/* Farplane portal: same palette as farplane.org */
:root {
  --night: #0b1020;
  --night-2: #121a33;
  --night-3: #1b2547;
  --ember: #ff7a1a;
  --flame: #d9431e;
  --gold: #ffc56b;
  --ivory: #f6ead2;
  --teal: #7fd6d0;
  --text: #e9e1d2;
  --muted: #a9a3b4;
  --line: rgba(255, 197, 107, 0.18);
  --ok: #7fd69a;
  --bad: #ff8d79;
  --display: "Cinzel", Georgia, serif;
  color-scheme: dark;   /* native controls (date pickers, selects) in dark mode */
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -10%, #1a2140 0%, var(--night) 55%) fixed, var(--night);
  color: var(--text);
  font: 400 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--display); color: var(--ivory); line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; letter-spacing: .03em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .7rem clamp(16px, 3vw, 32px);
  background: rgba(11, 16, 32, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ivory);
  font: 700 1rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.brand img { border-radius: 50%; }
.tabs { display: flex; gap: .1rem; flex-wrap: wrap; flex: 1; }
.tabs a {
  padding: .4rem .65rem; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: var(--muted); font-weight: 500; font-size: .86rem;
}
.tabs a:hover { color: var(--ivory); }
.tabs a[aria-current="page"] { color: #1a0d04; background: linear-gradient(135deg, var(--gold), var(--ember)); }
.who { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.who img { width: 28px; height: 28px; border-radius: 50%; }

.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.25rem) clamp(16px, 3vw, 32px) 4rem; }
.loading { color: var(--muted); }

/* Panels */
.panel {
  background: linear-gradient(180deg, var(--night-3), var(--night-2));
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.panel-head h2, .panel-head h3 { margin: 0; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Buttons and inputs */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 .88rem/1 var(--body); text-decoration: none;
  color: #1a0d04; background: linear-gradient(135deg, var(--gold), var(--ember) 60%, var(--flame));
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { color: var(--ivory); background: transparent; box-shadow: inset 0 0 0 1px rgba(246, 234, 210, .35); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--gold); }
.btn.danger { color: var(--bad); background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 141, 121, .45); }
.btn.big { padding: .85rem 1.6rem; font-size: 1rem; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

input, select, textarea {
  font: inherit; color: var(--ivory);
  background: rgba(11, 16, 32, .6);
  border: 1px solid rgba(246, 234, 210, .2);
  border-radius: 8px; padding: .5rem .65rem;
  min-width: 0;
}
textarea { width: 100%; min-height: 80px; resize: vertical; }
/* calendar / clock icons: white via color-scheme: dark above */
input::-webkit-calendar-picker-indicator { opacity: .85; cursor: pointer; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
label.field { display: grid; gap: .3rem; font-size: .82rem; color: var(--muted); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.row > label.field { flex: 1 1 120px; }

/* Character cards */
.char-title { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font: 600 .7rem/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold); box-shadow: inset 0 0 0 1px rgba(255, 197, 107, .45);
}
.badge.ok { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(127, 214, 154, .45); }
.badge.bad { color: var(--bad); box-shadow: inset 0 0 0 1px rgba(255, 141, 121, .45); }
.badge.teal { color: var(--teal); box-shadow: inset 0 0 0 1px rgba(127, 214, 208, .45); }

.checklist { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 1rem; }
.checklist h3 { color: var(--ember); font: 600 .75rem/1 var(--body); letter-spacing: .18em; text-transform: uppercase; margin-bottom: .55rem; }
.check {
  display: flex; align-items: center; gap: .55rem;
  padding: .4rem .5rem; border-radius: 8px; cursor: pointer;
}
.check:hover { background: rgba(255, 197, 107, .06); }
.check input { width: 18px; height: 18px; accent-color: var(--ember); flex: none; }
.check .src { margin-left: auto; font-size: .72rem; color: var(--muted); }
.progress-bar { height: 6px; border-radius: 3px; background: rgba(246, 234, 210, .1); overflow: hidden; margin: .4rem 0 0; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--ember)); }

/* Character panels (Phoenix-style): jobs, professions, missions, milestones */
.char-summary { color: var(--gold); font-weight: 600; margin: .15rem 0 .2rem; }
.char-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.char-grid .span-all { grid-column: 1 / -1; }
.sub {
  background: rgba(11, 16, 32, .45);
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.sub-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; }
.sub-foot { margin: .7rem 0 0; }
.tiles { display: grid; gap: .45rem; }
.tiles.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  display: grid; gap: .1rem; padding: .5rem .6rem; border-radius: 6px;
  background: rgba(5, 8, 18, .7); box-shadow: inset 0 0 0 1px rgba(246, 234, 210, .06);
}
.tile span { font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile strong { font-size: 1.05rem; color: var(--ivory); font-variant-numeric: tabular-nums; }
.tile.zero strong { color: rgba(246, 234, 210, .35); }
.tile.main { box-shadow: inset 0 0 0 1px var(--ember); }
.tile.main span, .tile.main strong { color: var(--ember); }
.mission-list { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.mission-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid rgba(255, 197, 107, .08); }
.mission-list li:last-child { border-bottom: 0; }
.m-right { display: flex; gap: .7rem; align-items: baseline; text-align: right; }
.m-status { color: var(--ember); }
.m-status.done { color: var(--ok); }
.m-count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.milestones-sub { margin-top: 1rem; }
.milestones-sub .checklist { margin-top: 0; }
details.manual { margin-top: .6rem; }
details.manual summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-bottom: .6rem; }
@media (max-width: 860px) {
  .char-grid { grid-template-columns: 1fr; }
  .tiles.six { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .tiles.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Roster */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type="search"] { flex: 1 1 200px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid rgba(255, 197, 107, .08); white-space: nowrap; }
thead th { position: sticky; top: 0; background: var(--night-2); color: var(--muted); font-weight: 500; font-size: .78rem; }
th.ms { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; height: 210px; max-height: 210px; padding: .5rem .25rem; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; }
th.cat { color: var(--ember); text-align: center; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; border-left: 1px solid var(--line); }
td.cell { text-align: center; padding: .35rem .2rem; }
td.cell.first, th.ms.first { border-left: 1px solid var(--line); }
td.cell .yes { color: var(--ok); }
td.cell .no { color: rgba(246, 234, 210, .15); }
tbody tr:hover { background: rgba(255, 197, 107, .05); cursor: pointer; }
td .name { color: var(--ivory); font-weight: 600; }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(5, 8, 18, .6); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 21;
  overflow-y: auto; padding: 1.5rem;
  background: var(--night-2); box-shadow: -1px 0 0 var(--line), -20px 0 60px rgba(0, 0, 0, .5);
}

/* Events */
.event { border-left: 3px solid var(--ember); }
.event.help { border-left-color: var(--teal); }
.event .when { color: var(--gold); font-weight: 600; }
.names { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.names span { padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; background: rgba(246, 234, 210, .07); }
.names.ok span { color: var(--ok); }
.names.bad span { color: var(--muted); }
.pick { display: grid; gap: .2rem .8rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 260px; overflow-y: auto; padding: .4rem; border-radius: 8px; background: rgba(11, 16, 32, .4); }

/* Milestone editor */
.ms-row { display: grid; grid-template-columns: 140px 1fr 70px 70px auto auto; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.ms-row.inactive { opacity: .5; }

/* Sign-in */
.hero-card { max-width: 520px; margin: 8vh auto; text-align: center; }
.hero-card img { width: 120px; height: 120px; border-radius: 50%; box-shadow: 0 0 60px -10px rgba(255, 122, 26, .6); margin-bottom: 1.2rem; }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: rgba(255, 141, 121, .1); box-shadow: inset 0 0 0 1px rgba(255, 141, 121, .35); color: var(--bad); }
.alert.ok { background: rgba(127, 214, 154, .1); box-shadow: inset 0 0 0 1px rgba(127, 214, 154, .35); color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%);
  padding: .7rem 1.1rem; border-radius: 10px; z-index: 30;
  background: var(--night-3); box-shadow: inset 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, .5);
  transition: transform .25s ease, opacity .25s ease;
  opacity: 0; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { color: var(--bad); }

.activity li { padding: .3rem 0; border-bottom: 1px solid rgba(255, 197, 107, .06); font-size: .85rem; list-style: none; }
.activity { padding: 0; margin: 0; max-height: 420px; overflow-y: auto; }

@media (max-width: 700px) {
  .top { gap: .6rem; }
  .tabs { order: 3; flex-basis: 100%; }
  .ms-row { grid-template-columns: 1fr 1fr; }
}

/* Herald drafting / voice tools */
.herald-tools { margin: .2rem 0 .8rem; padding: .8rem 1rem; border-radius: 10px; background: rgba(255, 122, 26, .06); box-shadow: inset 0 0 0 1px rgba(255, 197, 107, .2); }
.herald-draft summary { cursor: pointer; color: var(--gold); font-weight: 600; }
.herald-draft[open] summary { margin-bottom: .6rem; }
.herald-draft textarea { min-height: 70px; margin: .3rem 0 .5rem; }
.herald-tools audio { height: 32px; max-width: 280px; }
.herald-art { margin-top: .6rem; }
.art-stage > img { display: block; width: auto; max-width: min(640px, 100%); max-height: 560px; object-fit: contain; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); margin: .4rem 0 .6rem; }
.art-versions { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.art-thumb { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; opacity: .65; }
.art-thumb img { display: block; width: 84px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; }
.art-thumb.on { opacity: 1; box-shadow: 0 0 0 2px var(--ember); }
.art-thumb:hover { opacity: 1; }
.art-refs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.art-ref { position: relative; }
.art-ref img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.art-ref button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; cursor: pointer; background: var(--flame); color: #fff; line-height: 20px; padding: 0; }
.post-art { display: block; width: auto; max-width: min(560px, 100%); max-height: 480px; object-fit: contain; border-radius: 10px; margin: .2rem 0 .8rem; box-shadow: 0 0 0 1px var(--line); }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.ref { margin: 0; display: grid; gap: .35rem; }
.ref img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.ref figcaption { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref.add { display: grid; place-items: center; aspect-ratio: 3 / 2; border-radius: 8px; border: 1px dashed rgba(255, 197, 107, .4); color: var(--gold); cursor: pointer; font-size: .85rem; }
.ref.add:hover { background: rgba(255, 197, 107, .05); }
