/* Tarkov Tracker — night-ops HUD. Tokens first, then layout, then components. */

@font-face { font-family: 'Tektur'; src: url('/fonts/Tektur-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Tektur'; src: url('/fonts/Tektur-Medium.woff') format('woff'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/fonts/InstrumentSans-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/fonts/InstrumentSans-Bold.woff') format('woff'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/fonts/InstrumentSans-Italic.woff') format('woff'); font-style: italic; font-display: swap; }

:root {
  --night: #0b1324;
  --night-deep: #070d1a;
  --hull: #111c32;
  --hull-2: #17243f;
  --seam: #24365a;
  --seam-bright: #34507f;
  --frost: #e8f0ff;
  --haze: #8ea3c7;
  --haze-dim: #5d7194;
  --signal: #5ad1ff;
  --signal-ink: #04202d;
  --pulse: #ff6fb5;
  --done: #7be8b0;
  --warn: #ffc94d;
  --danger: #ff6b7f;

  --font-display: 'Tektur', 'Instrument Sans', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.4rem;
  --step-3: 1.9rem;
  --step-4: 2.8rem;

  --cut: 10px;           /* chamfer size of HUD plates */
  --radius: 6px;
  --gutter: 16px;
  --topbar: 64px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 8% -10%, rgba(90, 209, 255, .10), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(255, 111, 181, .06), transparent 60%),
    var(--night);
  color: var(--frost);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
}
body::before {
  /* faint tactical grid */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(142, 163, 199, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 163, 199, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
  z-index: 0;
}
#app { position: relative; z-index: 1; }

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--frost); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: .01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
::selection { background: rgba(90, 209, 255, .35); }
.muted { color: var(--haze); }
.small { font-size: var(--step--1); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- HUD plate (chamfered panel) ---------- */
.plate {
  position: relative;
  background: linear-gradient(180deg, var(--hull-2), var(--hull));
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  padding: 20px;
}
.plate::after {
  /* hairline border that follows the chamfer */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--seam);
  clip-path: polygon(
    0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 0,
    1px 1px, 1px calc(100% - var(--cut) - .4px), calc(var(--cut) + .4px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px),
    calc(100% - 1px) calc(var(--cut) + .4px), calc(100% - var(--cut) - .4px) 1px, 1px 1px
  );
}

/* ---------- buttons ---------- */
.btn {
  --bg: var(--hull-2);
  --fg: var(--frost);
  --bd: var(--seam-bright);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--bd); border-radius: var(--radius);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { --bd: var(--signal); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --bg: var(--signal); --fg: var(--signal-ink); --bd: var(--signal); font-weight: 600; }
.btn-primary:hover { --bg: #8be1ff; --bd: #8be1ff; }
.btn-ghost { --bg: transparent; --bd: transparent; color: var(--haze); }
.btn-ghost:hover { --bd: var(--seam-bright); color: var(--frost); }
.btn-danger { --bd: rgba(255, 107, 127, .5); color: var(--danger); background: transparent; }
.btn-danger:hover { --bd: var(--danger); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: var(--step--1); }
.icon-btn { min-height: 36px; width: 36px; padding: 0; }

/* ---------- inputs ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--step--1); color: var(--haze); }
.input, .select {
  width: 100%; min-height: 42px; padding: 8px 12px;
  background: var(--night-deep); border: 1px solid var(--seam); border-radius: var(--radius);
  color: var(--frost);
}
.input:focus, .select:focus { border-color: var(--signal); outline: none; box-shadow: 0 0 0 3px rgba(90, 209, 255, .18); }
.input::placeholder { color: var(--haze-dim); }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--night-deep); border: 1px solid var(--seam); border-radius: calc(var(--radius) + 3px); }
.seg button {
  border: 0; background: transparent; color: var(--haze);
  padding: 6px 12px; border-radius: var(--radius); cursor: pointer; min-height: 32px;
}
.seg button[aria-pressed='true'] { background: var(--hull-2); color: var(--frost); box-shadow: inset 0 0 0 1px var(--seam-bright); }
.seg button:hover { color: var(--frost); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; min-height: 30px;
  border: 1px solid var(--seam); border-radius: 999px;
  background: transparent; color: var(--haze); cursor: pointer; font-size: var(--step--1);
}
.chip[aria-pressed='true'] { border-color: var(--signal); color: var(--frost); background: rgba(90, 209, 255, .1); }
.chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--seam); border-radius: var(--radius); background: var(--night-deep); }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--haze); }
.stepper button:hover:not(:disabled) { color: var(--signal); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 44px; text-align: center; font-family: var(--font-display); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  height: var(--topbar); padding: 0 24px;
  background: rgba(7, 13, 26, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--seam);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--frost); text-decoration: none; font-family: var(--font-display); font-size: var(--step-1); }
.brand svg { width: 26px; height: 26px; color: var(--signal); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--haze); text-decoration: none; }
.nav a:hover { color: var(--frost); }
.nav a[aria-current='page'] { color: var(--frost); background: var(--hull-2); box-shadow: inset 0 -2px 0 var(--signal); }

/* squad strip: the memorable bit. Members link up on load. */
.squad-strip { display: flex; align-items: center; gap: 0; margin-left: auto; min-width: 0; }
.squad-name {
  margin-right: 12px; color: var(--haze); font-size: var(--step--1); white-space: nowrap;
  background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.squad-name:hover { color: var(--frost); }
.squad-name svg { width: 14px; height: 14px; }
.member-chip {
  --c: var(--signal);
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 6px; margin-left: 14px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 10%, transparent);
  font-size: var(--step--1); white-space: nowrap;
  animation: link-in .5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms + 150ms);
}
.member-chip::before {
  /* the link line between squad members */
  content: '';
  position: absolute; right: 100%; top: 50%;
  width: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 60%, transparent));
  transform-origin: right;
  animation: line-in .4s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms + 300ms);
}
.member-chip:first-of-type::before { display: none; }
.member-chip.off { opacity: .4; filter: saturate(.3); }
.member-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.member-chip.ping { animation: ping .9s var(--ease-out); }
@keyframes link-in { from { opacity: 0; transform: translateX(-10px) scale(.9); } }
@keyframes line-in { from { transform: scaleX(0); } }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

.burger { display: none; }

/* ---------- page layout ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 28px 24px 80px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--haze); max-width: 62ch; }

.quests-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.quests-layout > *, .filters > * { min-width: 0; }
.filters { position: sticky; top: calc(var(--topbar) + 20px); display: grid; gap: 20px; }
.filters h3 { font-family: var(--font-body); font-size: var(--step--1); color: var(--haze); font-weight: 600; margin-bottom: 8px; }
.filters .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--haze); }
.toggle input { accent-color: var(--signal); width: 18px; height: 18px; }
.toggle:hover { color: var(--frost); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--haze-dim); pointer-events: none; }
.search .input { padding-left: 36px; }

/* ---------- quest list ---------- */
.summary { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 18px; color: var(--haze); }
.summary b { display: block; font-family: var(--font-display); font-weight: 500; font-size: var(--step-2); color: var(--frost); }
.trader-group { margin-bottom: 26px; }
.trader-head { display: flex; align-items: center; gap: 12px; padding: 0 4px 10px; }
.trader-head img { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; border: 1px solid var(--seam); }
.trader-head h2 { font-size: var(--step-1); }
.trader-head .count { color: var(--haze); font-size: var(--step--1); }
.quest-list { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }

.quest-row {
  --accent: var(--signal);
  position: relative;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px;
  width: 100%; padding: 12px 16px 12px 0;
  background: var(--hull);
  border: 0; color: inherit; text-align: left; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background .15s;
}
.quest-row:hover { background: var(--hull-2); }
.quest-row .bar { align-self: stretch; background: var(--accent); opacity: .85; }
.quest-row[data-state='locked'] { --accent: var(--seam-bright); }
.quest-row[data-state='locked'] .q-name { color: var(--haze); }
.quest-row[data-state='done'] { --accent: var(--done); background: color-mix(in srgb, var(--hull) 70%, transparent); }
.quest-row[data-state='done'] .q-name { color: var(--haze); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--done) 60%, transparent); }
.quest-row[data-state='failed'] { --accent: var(--danger); }
.quest-row[data-state='other-faction'] { --accent: var(--seam); opacity: .6; }
.quest-row[aria-current='true'] { background: var(--hull-2); box-shadow: inset 0 0 0 1px var(--seam-bright); }
.quest-row.flash { animation: flash 1.2s var(--ease-out); }
@keyframes flash { 0% { background: color-mix(in srgb, var(--flash, var(--pulse)) 30%, var(--hull)); } }
.q-main { min-width: 0; display: grid; gap: 3px; }
.q-name { font-family: var(--font-display); font-size: var(--step-0); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--haze); font-size: var(--step--1); }
.q-meta span { display: inline-flex; align-items: center; gap: 4px; }
.q-meta svg { width: 13px; height: 13px; }
.q-progress { display: grid; gap: 4px; width: 74px; justify-items: end; font-size: var(--step--1); color: var(--haze); }
.meter { width: 100%; height: 4px; background: var(--seam); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); transition: width .3s var(--ease-out); }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px; font-size: 11px; line-height: 18px; border: 1px solid var(--seam-bright); color: var(--haze); }
.tag-kappa { border-color: rgba(255, 201, 77, .5); color: var(--warn); }
.tag-lk { border-color: rgba(90, 209, 255, .5); color: var(--signal); }
.tag-fir { border-color: rgba(255, 111, 181, .5); color: var(--pulse); }

.squad-dots { display: flex; gap: 4px; min-width: 20px; justify-content: flex-end; }
.squad-dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); }
.squad-dots i.open { background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 70%, transparent); }
.squad-dots i.done { border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.squad-dots i.locked { border-style: dotted; opacity: .5; }

.empty { padding: 40px 24px; text-align: center; color: var(--haze); display: grid; gap: 12px; justify-items: center; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 16, .55); z-index: 40; animation: fade .2s both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100vw);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--hull-2), var(--night) 40%);
  border-left: 1px solid var(--seam);
  box-shadow: -30px 0 60px rgba(0, 0, 0, .4);
  animation: slide-in .28s var(--ease-out) both;
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--seam); display: grid; gap: 10px; }
.drawer-head .row { justify-content: space-between; align-items: start; flex-wrap: nowrap; }
.drawer-body { overflow-y: auto; padding: 20px 24px 40px; display: grid; gap: 26px; align-content: start; }
.drawer-body section { display: grid; gap: 10px; }
.drawer-body h3 { font-family: var(--font-body); font-weight: 600; font-size: var(--step--1); color: var(--haze); }
.state-badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; }
.state-badge[data-state='available'] { color: var(--signal); }
.state-badge[data-state='locked'] { color: var(--haze); }
.state-badge[data-state='done'] { color: var(--done); }
.state-badge[data-state='failed'] { color: var(--danger); }
.state-badge[data-state='other-faction'] { color: var(--haze-dim); }

.reasons { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.reasons li { display: flex; gap: 8px; align-items: center; color: var(--haze); }
.reasons svg { width: 15px; height: 15px; flex: none; }
.linklike { background: none; border: 0; padding: 0; color: var(--signal); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.objectives { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.objective {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px 14px; background: var(--hull); border-radius: var(--radius); border: 1px solid transparent;
}
.objective.complete { border-color: color-mix(in srgb, var(--done) 25%, transparent); }
.objective.complete .obj-text { color: var(--haze); }
.obj-kind { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); background: var(--night-deep); color: var(--signal); border: 1px solid var(--seam); }
.obj-kind svg { width: 18px; height: 18px; }
.objective.complete .obj-kind { color: var(--done); }
.obj-main { display: grid; gap: 8px; }
.obj-text { line-height: 1.4; }
.obj-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.obj-items { display: flex; flex-wrap: wrap; gap: 6px; }
.item-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; background: var(--night-deep); border: 1px solid var(--seam); border-radius: 4px; font-size: var(--step--1); }
.item-pill img { width: 24px; height: 24px; object-fit: contain; background: #0d1729; border-radius: 3px; }
.check {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 4px 12px 4px 8px;
  border: 1px solid var(--seam-bright); border-radius: var(--radius);
  background: transparent; cursor: pointer; color: var(--haze);
}
.check .box { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--haze); display: grid; place-items: center; }
.check .box svg { width: 14px; height: 14px; opacity: 0; transform: scale(.4); transition: .2s var(--ease-out); }
.check[aria-pressed='true'] { color: var(--done); border-color: color-mix(in srgb, var(--done) 50%, transparent); }
.check[aria-pressed='true'] .box { background: var(--done); border-color: var(--done); color: var(--night); }
.check[aria-pressed='true'] .box svg { opacity: 1; transform: none; }
.check:hover { color: var(--frost); }
.burst { position: absolute; left: 17px; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; border: 2px solid var(--done); animation: burst .5s var(--ease-out) forwards; pointer-events: none; }
@keyframes burst { to { transform: scale(4); opacity: 0; } }

.squad-status { display: grid; gap: 6px; }
.squad-status .m { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--hull); border-radius: var(--radius); }
.squad-status .m .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.squad-status .m .s { margin-left: auto; color: var(--haze); font-size: var(--step--1); }

.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- onboarding ---------- */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.landing-card { width: min(520px, 100%); display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.landing-card > * { min-width: 0; }
.landing-title { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: .95; font-weight: 500; letter-spacing: -.01em; }
.landing-title span { display: block; color: var(--signal); text-shadow: 0 0 30px rgba(90, 209, 255, .45); }
.landing-lead { color: var(--haze); font-size: var(--step-1); max-width: 40ch; }
.radar {
  position: absolute; inset: auto; width: 520px; height: 520px; right: -160px; top: -160px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(90, 209, 255, .09) 0 1px, transparent 1px 64px),
    conic-gradient(from 0deg, rgba(90, 209, 255, .22), transparent 18%);
  mask-image: radial-gradient(circle, black 30%, transparent 70%);
  animation: sweep 6s linear infinite;
  pointer-events: none;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.return-link { display: flex; gap: 8px; align-items: center; }
.return-link code { flex: 1; min-width: 0; overflow-wrap: anywhere; word-break: break-all; padding: 10px 12px; background: var(--night-deep); border: 1px dashed var(--seam-bright); border-radius: var(--radius); font-size: var(--step--1); color: var(--signal); }
.callout { padding: 14px 16px; border-left: 3px solid var(--warn); background: rgba(255, 201, 77, .07); color: var(--frost); border-radius: 0 var(--radius) var(--radius) 0; }
.callout.info { border-left-color: var(--signal); background: rgba(90, 209, 255, .07); }

/* ---------- setup assistant ---------- */
.steps { display: flex; gap: 8px; list-style: none; margin: 0 0 22px; padding: 0; counter-reset: step; flex-wrap: wrap; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; color: var(--haze-dim); font-size: var(--step--1); }
.steps li::before { content: counter(step); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font-family: var(--font-display); }
.steps li + li { padding-left: 20px; position: relative; }
.steps li + li::after { content: ''; position: absolute; left: 4px; width: 10px; height: 1px; background: var(--seam); }
.steps li[aria-current='step'] { color: var(--signal); }
.steps li.done { color: var(--done); }
.trader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.trader-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--hull); border-radius: var(--radius); border: 1px solid var(--seam); }
.trader-card img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.trader-card .name { flex: 1; min-width: 0; }
.setup-quest { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; background: var(--hull); border-radius: var(--radius); }
.setup-quest .q-name { font-size: var(--step--1); }
.setup-quest .seg button { padding: 4px 10px; min-height: 28px; font-size: var(--step--1); }
.setup-quest .seg button[data-v='done'][aria-pressed='true'] { color: var(--done); }
.setup-quest .seg button[data-v='active'][aria-pressed='true'] { color: var(--signal); }
.setup-bar {
  position: sticky; bottom: 0; margin: 24px -24px -80px; padding: 16px 24px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: rgba(7, 13, 26, .92); backdrop-filter: blur(10px); border-top: 1px solid var(--seam);
}

/* ---------- squad page ---------- */
.member-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.member-row { --c: var(--signal); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--hull); border-radius: var(--radius); border-left: 3px solid var(--c); }
.member-row .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, var(--night)); color: var(--c); font-family: var(--font-display); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0; }
.swatch[aria-pressed='true'] { border-color: var(--frost); box-shadow: 0 0 0 3px var(--night), 0 0 14px var(--c); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; translate: -50% 0; display: grid; gap: 8px; z-index: 60; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; background: var(--hull-2); border: 1px solid var(--seam-bright); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: toast-in .25s var(--ease-out) both; }
.toast.error { border-color: rgba(255, 107, 127, .6); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

.loading { min-height: 60vh; display: grid; place-items: center; color: var(--haze); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--seam); border-top-color: var(--signal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { padding: 10px 24px; background: rgba(255, 201, 77, .1); border-bottom: 1px solid rgba(255, 201, 77, .3); color: var(--warn); font-size: var(--step--1); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .quests-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; }
  .filters .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 760px) {
  :root { --topbar: 56px; }
  .topbar { padding: 0 var(--gutter); gap: 10px; backdrop-filter: none; background: rgba(7, 13, 26, .97); }
  .brand span { display: none; }
  body { overflow-x: hidden; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; justify-content: space-around; background: rgba(7, 13, 26, .95); border-top: 1px solid var(--seam); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
  .nav a { flex: 1; text-align: center; }
  .squad-strip .member-chip span.n { display: none; }
  .squad-strip .member-chip { padding: 4px; margin-left: 8px; }
  .member-chip::before { width: 8px; }
  .squad-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  .page { padding: 20px var(--gutter) 110px; }
  .quest-row { grid-template-columns: 4px minmax(0, 1fr) auto; }
  .quest-row .q-progress { display: none; }
  .drawer { width: 100vw; }
  .setup-bar { margin: 24px calc(-1 * var(--gutter)) -110px; padding: 14px var(--gutter) calc(70px + env(safe-area-inset-bottom)); }
  .summary { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .radar { display: none; }
}
.field > .seg { justify-self: start; }

/* ---------- goals ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 34px; }
.goal-card {
  --g: var(--signal);
  position: relative; display: grid; gap: 14px; align-content: start;
  padding: 18px 18px 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--g) 7%, var(--hull-2)), var(--hull) 70%);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--seam);
  transition: box-shadow .2s;
}
.goal-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--g); opacity: .35; transition: opacity .2s; }
.goal-card.tracking::before { opacity: 1; box-shadow: 0 0 14px var(--g); }
.goal-card.selected { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g) 70%, transparent); }
.goal-open { display: grid; gap: 4px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
.goal-open:hover .goal-name { color: var(--g); }
.goal-name { font-family: var(--font-display); font-size: var(--step-2); font-weight: 500; line-height: 1.1; transition: color .15s; }
.goal-short { color: var(--haze); font-size: var(--step--1); }
.gauge { display: flex; gap: 3px; height: 10px; }
.gauge i {
  flex: 1; min-width: 3px; border-radius: 1px; background: var(--seam);
  transform-origin: bottom; animation: seg-in .35s var(--ease-out) both; animation-delay: calc(var(--i) * 28ms + 120ms);
}
.gauge i.done { background: var(--g); box-shadow: 0 0 8px color-mix(in srgb, var(--g) 55%, transparent); }
.gauge i.next { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--g) 70%, transparent); }
.gauge i.wait { background: var(--seam); opacity: .7; }
@keyframes seg-in { from { transform: scaleY(0); opacity: 0; } }
.goal-foot { display: flex; gap: 10px; align-items: baseline; min-width: 0; font-size: var(--step--1); }
.goal-foot .num { color: var(--frost); }
.goal-next { color: var(--haze); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-card.complete .goal-next { color: var(--done); }
.goal-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip.track svg { color: currentColor; }
.goal-card .chip.track[aria-pressed='true'] { border-color: var(--g); background: color-mix(in srgb, var(--g) 14%, transparent); }
.mates { display: flex; gap: 4px; }
.mates i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }

.section-head { display: grid; gap: 6px; justify-items: start; }
h3.sub { font-family: var(--font-body); font-weight: 600; font-size: var(--step--1); color: var(--haze); }
.goal-columns { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; margin-top: 22px; }
.goal-columns > * { min-width: 0; }
.goal-detail .section-head h2 { font-size: var(--step-3); color: var(--g); }
.story-list { list-style: none; counter-reset: story; margin: 0; padding: 0; display: grid; gap: 8px; }
.story-list li { counter-increment: story; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.story-list li::before { content: counter(story); font-family: var(--font-display); color: var(--haze-dim); padding-top: 12px; text-align: right; }
.story-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--hull); border-radius: var(--radius); }
.story-row .check { padding: 4px 6px; flex: none; }
.story-row.complete > .stack > span:first-child { color: var(--haze); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--done) 60%, transparent); }
.story-row > .stack { flex: 1; min-width: 0; }
.story-row .goal-tags { margin-left: auto; }
.goal-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.goal-tag { --g: var(--signal); font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 4px; color: var(--g); border: 1px solid color-mix(in srgb, var(--g) 50%, transparent); }
.fold { display: grid; gap: 8px; }
.fold summary { cursor: pointer; color: var(--haze); font-size: var(--step--1); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.fold summary::before { content: '›'; display: inline-block; transition: transform .15s; font-size: 1.1em; }
.fold[open] summary::before { transform: rotate(90deg); }
.fold summary::-webkit-details-marker { display: none; }
.fold summary:hover { color: var(--frost); }
.goal-squad { position: sticky; top: calc(var(--topbar) + 20px); gap: 16px; }
.squad-goal { display: grid; gap: 6px; }
.squad-goal .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px; }
.squad-goal .meter { height: 5px; }

@media (max-width: 980px) {
  .goal-columns { grid-template-columns: minmax(0, 1fr); }
  .goal-squad { position: static; }
}
@media (max-width: 760px) {
  .goal-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .goal-card { grid-template-columns: minmax(0, 1fr) auto; }
  .goal-card .gauge, .goal-card .goal-foot { grid-column: 1 / -1; }
  .goal-card .goal-actions { grid-row: 1; grid-column: 2; align-self: start; }
  .story-row { flex-wrap: wrap; }
  .story-row .goal-tags { flex-basis: 100%; margin-left: 46px; }
}

/* ---------- maps ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.map-card {
  display: grid; grid-template-rows: 150px auto; color: inherit; text-decoration: none;
  background: var(--hull); border: 1px solid var(--seam); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.map-card:hover { border-color: var(--signal); color: inherit; }
.map-card.quiet { opacity: .6; }
.map-thumb { position: relative; background: #0d1a2c; overflow: hidden; border-bottom: 1px solid var(--seam); }
.map-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .85; filter: saturate(.9); transition: transform .4s var(--ease-out); }
.map-card:hover .map-thumb img { transform: scale(1.06); }
.thumb-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(90, 209, 255, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(90, 209, 255, .12) 1px, transparent 1px); background-size: 22px 22px; }
.map-card-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.map-card-body h2 { font-size: var(--step-1); }
.map-counts { display: flex; gap: 16px; color: var(--haze); font-size: var(--step--1); }
.map-counts b { color: var(--frost); font-weight: 500; font-size: var(--step-1); }

.map-head { align-items: end; justify-content: space-between; }
.map-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.map-layout > * { min-width: 0; }
.prep { display: grid; gap: 22px; max-height: calc(100vh - var(--topbar) - 40px); overflow-y: auto; position: sticky; top: calc(var(--topbar) + 20px); padding-right: 4px; }
.prep-head { display: grid; gap: 4px; }
.prep-section { gap: 8px; }
.bring-list, .gear-list, .here-objs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bring-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: var(--hull); border-radius: var(--radius); }
.bring-list .squad-dots { margin-left: auto; }
.bring-count { color: var(--signal); }
.gear-list li { display: grid; gap: 6px; padding: 10px 12px; background: var(--hull); border-radius: var(--radius); }
.here-quest { display: grid; gap: 4px; }
.here-name { font-family: var(--font-display); font-size: var(--step-0); text-decoration: none; color: var(--frost); }
.here-name:hover { color: var(--signal); }
.here-obj {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--hull); border: 1px solid transparent; border-radius: var(--radius);
  color: inherit; text-align: left; cursor: pointer; font-size: var(--step--1);
}
.here-obj:hover, .here-obj.active { border-color: var(--seam-bright); background: var(--hull-2); }
.small-kind { width: 28px; height: 28px; }
.small-kind svg { width: 15px; height: 15px; }

.map-wrap { position: relative; }
.mapview {
  position: relative; overflow: hidden; touch-action: none; cursor: grab;
  height: max(420px, calc(100vh - var(--topbar) - 150px));
  background:
    radial-gradient(circle at 50% 40%, rgba(90, 209, 255, .06), transparent 60%),
    #08101e;
  border: 1px solid var(--seam); border-radius: var(--radius);
}
.mapview:active { cursor: grabbing; }
.mapview:focus-visible { outline-offset: -2px; }
.map-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; --inv: 1; }
.map-base { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 0 30px rgba(0, 0, 0, .4)); }
.map-tiles img { position: absolute; user-select: none; -webkit-user-drag: none; }
.mapview [hidden] { display: none !important; }
.map-schem { filter: none; }
/* compare slider: detailed map on the left, schematic on the right */
.map-split {
  position: absolute; top: 0; bottom: 0; left: 50%; z-index: 3; width: 32px; margin-left: -16px;
  cursor: ew-resize; touch-action: none; display: flex; justify-content: center;
}
.map-split::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  background: linear-gradient(var(--signal), var(--pulse));
  box-shadow: 0 0 12px color-mix(in srgb, var(--signal) 70%, transparent);
}
.map-split-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; gap: 0;
  width: 40px; height: 40px; border-radius: 50%;
  background: #0b1324; color: var(--frost);
  box-shadow: 0 0 0 2px var(--signal), 0 0 22px color-mix(in srgb, var(--signal) 55%, transparent), 0 6px 18px rgba(0, 0, 0, .6);
  transition: transform .15s var(--ease-out), box-shadow .15s;
}
.map-split-knob svg:first-child { transform: rotate(90deg); margin-right: -3px; }
.map-split-knob svg:last-child { transform: rotate(-90deg); margin-left: -3px; }
.map-split:hover .map-split-knob, .map-split.dragging .map-split-knob, .map-split:focus-visible .map-split-knob {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 0 0 2px var(--pulse), 0 0 28px color-mix(in srgb, var(--pulse) 60%, transparent), 0 6px 18px rgba(0, 0, 0, .6);
}
.map-split:focus-visible { outline: none; }
.map-split-tag {
  position: absolute; top: 12px; white-space: nowrap; pointer-events: none;
  font-family: 'Tektur', sans-serif; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: rgba(7, 13, 26, .82); border: 1px solid var(--seam);
}
.map-split-tag.left { right: 26px; color: var(--haze); }
.map-split-tag.right { left: 26px; color: var(--signal); }
.map-style { display: inline-flex; align-items: center; gap: 8px; }
.map-style .label { font-size: var(--step--1); color: var(--haze-dim); }
.map-markers { position: absolute; inset: 0; }
.map-marker {
  --ring: var(--signal);
  position: absolute; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: var(--ring); cursor: pointer;
  transform: translate(-50%, -50%) scale(var(--inv)) translateX(var(--nudge, 0px));
  box-shadow: 0 0 0 2px rgba(7, 13, 26, .9), 0 4px 14px rgba(0, 0, 0, .55);
  animation: marker-in .35s var(--ease-out) both;
}
.map-marker .pin { position: absolute; inset: 3px; border-radius: 50%; background: #0b1324; display: grid; place-items: center; color: var(--frost); }
.map-marker .pin svg { width: 14px; height: 14px; }
.map-marker:hover .pin, .map-marker.active .pin { background: #17243f; }
.map-marker.active { z-index: 2; box-shadow: 0 0 0 2px rgba(7, 13, 26, .9), 0 0 0 7px color-mix(in srgb, var(--signal) 35%, transparent), 0 0 24px var(--signal); }
.map-marker.dim { opacity: .45; }
@keyframes marker-in { from { opacity: 0; transform: translate(-50%, -50%) scale(calc(var(--inv) * .3)); } }
.map-controls { position: absolute; right: 12px; top: 12px; display: grid; gap: 6px; }
.map-controls .btn { background: rgba(17, 28, 50, .92); }
.map-credit { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--haze-dim); background: rgba(7, 13, 26, .7); padding: 2px 8px; border-radius: 4px; }
.map-credit a { color: var(--haze); }
.map-popover {
  position: absolute; left: 14px; bottom: 34px; z-index: 5; width: min(360px, calc(100% - 28px));
  display: grid; gap: 10px; padding: 14px 16px;
  background: rgba(17, 28, 50, .97); border: 1px solid var(--seam-bright); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.map-popover.pop-in { animation: toast-in .2s var(--ease-out) both; }
.pop-title { font-family: var(--font-display); font-size: var(--step-1); text-decoration: none; color: var(--frost); }
.pop-who { display: flex; align-items: center; gap: 8px; }
.pop-who .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pop-who .btn { margin-left: auto; }

/* ---------- raid view (second screen) ---------- */
.raid-page { height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #050a14; }
.raid-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--seam); }
.raid-head h1 { font-size: var(--step-2); }
.raid-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.raid-body .map-wrap { min-height: 0; }
.raid-body .mapview { height: 100%; border: 0; border-radius: 0; }
.raid-side { overflow-y: auto; padding: 16px; border-left: 1px solid var(--seam); display: grid; gap: 16px; align-content: start; font-size: var(--step-1); }
.raid-side .here-name { font-size: var(--step-1); }
.raid-side .here-obj { font-size: var(--step-0); padding: 10px 12px; }
.raid-page .map-marker { width: 40px; height: 40px; }
.raid-page .map-marker .pin svg { width: 19px; height: 19px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); }
.live-dot.on { background: var(--done); box-shadow: 0 0 10px var(--done); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

@media (max-width: 980px) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .prep { position: static; max-height: none; overflow: visible; }
  .mapview { height: 70vh; }
  .raid-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 38vh; }
  .raid-side { border-left: 0; border-top: 1px solid var(--seam); }
}
.map-popover[hidden] { display: none; }

/* ---------- AI recognition ---------- */
.ai-toggle {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 5px 12px; min-height: 32px; border-radius: 999px;
  border: 1px solid var(--seam-bright); background: transparent; color: var(--haze);
  font-family: var(--font-display); font-size: var(--step--1); cursor: pointer;
}
.ai-toggle:hover { color: var(--frost); border-color: var(--signal); }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--haze-dim); }
.ai-toggle[data-state='watching'], .ai-toggle[data-state='sending'] { color: var(--frost); border-color: color-mix(in srgb, var(--pulse) 60%, transparent); background: color-mix(in srgb, var(--pulse) 10%, transparent); }
.ai-toggle[data-state='watching'] .ai-dot { background: var(--pulse); box-shadow: 0 0 10px var(--pulse); animation: breathe 2.4s ease-in-out infinite; }
.ai-toggle[data-state='sending'] .ai-dot { background: var(--signal); box-shadow: 0 0 12px var(--signal); }
.ai-toggle[data-state='paused'] .ai-dot, .ai-toggle[data-state='error'] .ai-dot { background: var(--warn); }
.ai-panel {
  position: fixed; top: calc(var(--topbar) + 10px); right: 16px; z-index: 45;
  width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - var(--topbar) - 30px); overflow-y: auto;
  display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  animation: toast-in .2s var(--ease-out) both;
}
.ai-panel h2 { font-size: var(--step-1); }
.ai-switch { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; cursor: pointer; padding: 12px; background: var(--night-deep); border: 1px solid var(--seam); border-radius: var(--radius); }
.ai-switch.disabled { opacity: .5; cursor: not-allowed; }
.ai-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ai-switch .track { width: 44px; height: 24px; border-radius: 999px; background: var(--seam); position: relative; transition: background .2s; }
.ai-switch .thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--frost); transition: transform .2s var(--ease-out); }
.ai-switch input:checked + .track { background: var(--pulse); box-shadow: 0 0 14px color-mix(in srgb, var(--pulse) 50%, transparent); }
.ai-switch input:checked + .track .thumb { transform: translateX(20px); }
.ai-switch input:focus-visible + .track { outline: 2px solid var(--signal); outline-offset: 2px; }
.ai-switch > span:last-child { display: grid; gap: 2px; }
.ai-tips { margin: 0; padding-left: 18px; color: var(--haze); display: grid; gap: 4px; }
.ai-stats { display: flex; gap: 16px; color: var(--haze); font-size: var(--step--1); }
.ai-stats b { color: var(--frost); font-weight: 500; }
.ai-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ai-log li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--hull); border-radius: var(--radius); font-size: var(--step--1); }
.ai-log li.undone { opacity: .55; }
@media (max-width: 760px) {
  .ai-toggle { padding: 4px 9px; }
}
.ai-card { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px; background: var(--hull); border: 1px solid var(--seam); border-radius: var(--radius); }
.ai-card.stack { display: grid; align-items: stretch; }
.ai-card.active { border-color: color-mix(in srgb, var(--pulse) 55%, transparent); }
.ai-card .input { min-height: 34px; }

/* subscription */
.consent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; color: var(--haze); cursor: pointer; }
.consent input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--signal); }
.tag-sub { color: var(--done); border-color: color-mix(in srgb, var(--done) 50%, transparent); }
.legal-links a { color: var(--haze-dim); }
.legal-links a:hover { color: var(--frost); }
.code-details summary { cursor: pointer; color: var(--haze); padding: 2px 0; }
.code-details[open] summary { margin-bottom: 8px; }
.site-legal { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; padding: 28px 16px 36px; font-size: var(--step--1); color: var(--haze-dim); }
.site-legal a { color: var(--haze-dim); }
.site-legal a:hover { color: var(--frost); }
.plan { gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--signal) 6%, var(--night-deep)); border: 1px solid color-mix(in srgb, var(--signal) 25%, var(--seam)); }
.plan-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.plan-big { font-family: var(--font-display); font-size: var(--step-2, 1.6rem); color: var(--signal); line-height: 1; text-shadow: 0 0 18px color-mix(in srgb, var(--signal) 45%, transparent); }
.plan-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--haze); }
.meter { height: 6px; border-radius: 999px; background: var(--seam); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--signal), var(--pulse)); transition: width .4s var(--ease-out); }

/* ---------- story ---------- */
.section-title { margin: 8px 0 -4px; }
.chapter-line { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.chapter-line li { animation: rise .4s var(--ease-out) both; animation-delay: calc(var(--i) * 35ms); }
.chapter-card {
  width: 100%; height: 100%; text-align: left; cursor: pointer; display: grid; gap: 4px; align-content: start;
  padding: 12px 14px 12px; border-radius: var(--radius); border: 1px solid var(--seam); background: var(--hull); color: var(--frost);
  position: relative; overflow: hidden; transition: border-color .2s, transform .2s var(--ease-out), background .2s;
}
.chapter-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c); opacity: .35; transition: opacity .2s; }
.chapter-card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--seam)); transform: translateY(-2px); }
.chapter-card.started::before { opacity: .8; }
.chapter-card.selected { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--hull)); box-shadow: 0 0 0 1px var(--c), 0 10px 30px -12px color-mix(in srgb, var(--c) 60%, transparent); }
.chapter-card.complete { background: color-mix(in srgb, var(--done) 6%, var(--hull)); }
.chapter-card.complete .ch-no { color: var(--done); }
.ch-no { font-family: var(--font-display); font-size: 12px; color: var(--c); letter-spacing: .12em; }
.ch-name { font-family: var(--font-display); font-size: 16px; line-height: 1.15; }
.ch-sub { font-size: 12px; color: var(--haze-dim); line-height: 1.3; min-height: 2.6em; }
.ch-bar { display: block; height: 3px; border-radius: 3px; background: var(--seam); overflow: hidden; margin-top: 4px; }
.ch-bar i { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width .4s var(--ease-out); }
.chapter-card.complete .ch-bar i { background: var(--done); }
.ch-foot { display: flex; justify-content: space-between; align-items: center; min-height: 18px; }

.guide-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.guide-card {
  display: grid; gap: 6px; align-content: start; text-align: left; cursor: pointer; text-decoration: none; color: var(--frost);
  padding: 14px 16px; border-radius: var(--radius); background: var(--hull); border: 1px solid var(--seam);
  border-top: 2px solid var(--c); transition: border-color .2s, transform .2s var(--ease-out);
}
.guide-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 50%, var(--seam)); border-top-color: var(--c); }
.guide-card.selected { box-shadow: 0 0 0 1px var(--c); background: color-mix(in srgb, var(--c) 7%, var(--hull)); }
.gc-title { font-family: var(--font-display); font-size: 17px; }
.gc-dots { display: flex; gap: 4px; margin-top: 4px; }
.gc-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--seam); }
.gc-dots i.on { background: var(--c, var(--signal)); box-shadow: 0 0 8px color-mix(in srgb, var(--c, var(--signal)) 60%, transparent); }
.guide-card .gc-dots i.on { background: var(--c); }
.gc-link { color: var(--haze); display: inline-flex; gap: 4px; align-items: center; }

.story-detail { scroll-margin-top: calc(var(--topbar) + 12px); }
.story-card { display: grid; gap: 20px; border-top: 2px solid var(--c); animation: rise .35s var(--ease-out) both; }
.story-card-head { display: flex; gap: 16px; justify-content: space-between; align-items: start; flex-wrap: wrap; }
.story-card-head > .stack { max-width: 70ch; }
.story-card h2 { font-size: var(--step-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.story-subtitle { font-family: inherit; font-size: 14px; color: var(--c); letter-spacing: .04em; }
.eyebrow { font-family: var(--font-display); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--c, var(--signal)); }
.story-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.story-start p { margin: 0; padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--c) 7%, var(--night-deep)); border-left: 3px solid var(--c); }
.story-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 6px; }
.story-step {
  counter-increment: step; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 10px 12px; border-radius: var(--radius); background: var(--hull); border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.story-step:hover { border-color: var(--seam); }
.story-step .check { padding: 2px 4px; }
.story-step .step-text::before { content: counter(step) '. '; color: var(--haze-dim); font-family: var(--font-display); }
.story-step.complete { background: color-mix(in srgb, var(--done) 5%, var(--hull)); }
.story-step.complete .step-text { color: var(--haze); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--done) 60%, transparent); }
.story-step.optional .step-text { color: var(--haze); }
.step-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.step-tags:empty { display: none; }
.step-tags .tag { gap: 4px; }
.choice { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--night-deep); border: 1px dashed color-mix(in srgb, var(--c) 45%, var(--seam)); }
.choice ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.choice li { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 12px; }
.choice .pick { color: var(--c); font-weight: 600; }
.story-aside section { display: grid; gap: 8px; }
.need-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--haze); }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ach { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); background: var(--hull); }
.ach-pic { position: relative; width: 40px; height: 40px; border-radius: 8px; background: var(--night-deep); display: grid; place-items: center; color: var(--haze-dim); overflow: hidden; }
.ach-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ach-pct { font-size: 12px; color: var(--c, var(--signal)); }
.squad-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.squad-mini li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.squad-mini .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.warn-box { display: flex; gap: 10px; align-items: start; margin: 0; padding: 10px 12px; border-radius: var(--radius); background: rgba(255, 200, 87, .07); border: 1px solid rgba(255, 200, 87, .35); color: #ffe3a3; }
.warn-box svg { flex: none; margin-top: 2px; }
.ending-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ending { display: grid; gap: 10px; align-content: start; padding: 14px 16px; border-radius: var(--radius); background: var(--hull); border: 1px solid var(--seam); border-left: 3px solid var(--c); }
.ending.got { box-shadow: 0 0 0 1px var(--c), 0 10px 30px -14px var(--c); }
.ending-head { display: flex; gap: 12px; align-items: center; }
.ending-head img { border-radius: 8px; }
.ending h3 { font-family: var(--font-display); font-size: 20px; color: var(--c); }
.ending p { margin: 0; }
.next-chapter { display: grid; gap: 8px; justify-items: start; border-left: 3px solid var(--c); }
.next-chapter h2 { font-size: var(--step-2); }
.story-sources { line-height: 1.8; padding: 12px 0 0; }
.story-sources a { color: var(--haze); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .chapter-line li, .story-card { animation: none; } }
@media (max-width: 1100px) { .chapter-line { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .story-body { grid-template-columns: minmax(0, 1fr); }
  .chapter-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nav a { padding: 8px 2px; font-size: 13px; }
  .chapter-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-row, .ending-grid { grid-template-columns: minmax(0, 1fr); }
  .choice li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .story-step { grid-template-columns: auto minmax(0, 1fr); }
  .story-step > .mates { grid-column: 2; }
}
.ending .chip.track[aria-pressed='true'] { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }

/* AI: collected pictures */
.collect { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--night-deep); border: 1px dashed var(--seam); }
.collect.has { border-style: solid; border-color: color-mix(in srgb, var(--signal) 40%, var(--seam)); }
.collect-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.collect-count { font-size: var(--step--1); color: var(--haze); }
.collect-count b { font-family: var(--font-display); font-size: 20px; color: var(--signal); margin-right: 2px; text-shadow: 0 0 12px color-mix(in srgb, var(--signal) 50%, transparent); }
.chip.sound[aria-pressed='true'] { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 50%, var(--seam)); }
.shots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.shots li { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: var(--hull); border: 1px solid var(--seam); animation: shot-in .3s var(--ease-out) both; }
.shots img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shots .more { display: grid; place-items: center; color: var(--haze); font-size: 13px; }
.shot-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: rgba(7, 13, 26, .85); color: var(--frost); cursor: pointer; opacity: 0; transition: opacity .15s; }
.shots li:hover .shot-x, .shot-x:focus-visible { opacity: 1; }
.collect-actions { gap: 6px; }
.collect-actions .spacer { flex: 1; }
.collect.busy .shots li { animation: shot-scan 1.2s linear infinite; }
@keyframes shot-in { from { opacity: 0; transform: scale(.85); } }
@keyframes shot-scan { 50% { border-color: var(--signal); box-shadow: 0 0 10px color-mix(in srgb, var(--signal) 40%, transparent); } }
.own-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.own-grid .field { display: grid; gap: 4px; color: var(--haze); }
.own-grid select.input { padding-right: 8px; }
@media (max-width: 520px) { .own-grid { grid-template-columns: minmax(0, 1fr); } }

/* Story: road to your ending (flowchart you can tick off) */
.etree { display: grid; gap: 16px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--seam); }
.etree-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; align-items: start; }
.etree-head h3 { font-family: var(--font-display); font-size: var(--step-2); margin: 0; }
.etree-head p { margin: 0; }
.etree-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg .seg-ending[aria-pressed='true'] { color: var(--c); box-shadow: inset 0 0 0 1px var(--c); background: color-mix(in srgb, var(--c) 12%, var(--hull-2)); }
.tlegend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--haze); }
.tlegend li { display: inline-flex; align-items: center; gap: 6px; }
.tlegend i { width: 12px; height: 12px; border-radius: 3px; background: var(--kc); }
.k-decision { --kc: var(--danger); }
.k-mandatory { --kc: #ffb15c; }
.k-achievement { --kc: var(--done); }
.k-optional { --kc: #d39bff; }
.k-escape { --kc: var(--warn); }
.k-warn { --kc: var(--danger); }
.k-step { --kc: var(--seam-bright); }

.tshared { display: grid; gap: 10px; max-width: 640px; margin: 0 auto; width: 100%; }
.tsection { display: grid; gap: 6px; min-width: 0; }
.tsec-title { margin: 0; font-family: var(--font-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--haze-dim); }
.tlist { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 6px; position: relative; }
.tlist::before { content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: color-mix(in srgb, var(--c, var(--sel)) 35%, var(--seam)); border-radius: 2px; }
.tnode {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: start;
  padding: 8px 10px; border-radius: var(--radius); background: var(--hull);
  border: 1px solid var(--seam); border-left: 3px solid var(--kc);
}
.tnode::before { content: ''; position: absolute; left: -15px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--kc); box-shadow: 0 0 0 3px var(--night); }
.tnode.k-decision { background: color-mix(in srgb, var(--danger) 9%, var(--hull)); }
.tnode.k-achievement { background: color-mix(in srgb, var(--done) 8%, var(--hull)); }
.tnode.k-escape { background: color-mix(in srgb, var(--warn) 8%, var(--hull)); }
.tnode.k-warn .ttext { color: #ffb3bd; }
.tnode.info { border-style: dashed; }
.tnode .check { padding: 2px 4px; }
.tinfo { display: grid; place-items: center; width: 26px; height: 26px; color: var(--haze-dim); }
.tbody { display: grid; gap: 3px; min-width: 0; }
.ttext { overflow-wrap: anywhere; }
.tnode.done { opacity: .72; }
.tnode.done .ttext { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--done) 60%, transparent); color: var(--haze); }
.tnode.next { box-shadow: 0 0 0 1px var(--sel), 0 8px 26px -12px var(--sel); }
.tach { border-radius: 6px; }
.tag-decision { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.tag-mandatory { color: #ffb15c; border-color: rgba(255, 177, 92, .5); }
.tag-achievement { color: var(--done); border-color: color-mix(in srgb, var(--done) 50%, transparent); }
.tag-optional { color: #d39bff; border-color: rgba(211, 155, 255, .5); }
.tag-escape, .tag-warn { color: var(--warn); border-color: rgba(255, 201, 77, .5); }
.tag-next { color: var(--sel); border-color: var(--sel); }

.tsplit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 14px; align-items: start; }
.tkerman { display: grid; gap: 12px; min-width: 0; }
.tkerman-lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.tlane { display: grid; gap: 10px; min-width: 0; padding: 10px; border-radius: calc(var(--radius) + 2px); border: 1px solid var(--seam); background: color-mix(in srgb, var(--c) 3%, transparent); transition: opacity .2s, box-shadow .2s, border-color .2s; }
.tlane.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 14px 40px -24px var(--c); background: color-mix(in srgb, var(--c) 7%, transparent); }
.tlane.off, .tkerman.off > .tshared { opacity: .42; }
.tlane.off:hover, .tlane.off:focus-within, .tkerman.off > .tshared:hover { opacity: .85; }
.tlane-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--seam)); background: var(--night-deep); color: var(--c); font-family: var(--font-display); font-size: var(--step-1); cursor: pointer; text-align: left; }
.tlane-head[aria-pressed='true'] { background: color-mix(in srgb, var(--c) 16%, var(--night-deep)); }
.tlane .tnode { grid-template-columns: auto minmax(0, 1fr) auto; }
.tlane .tnode > .mates { grid-column: 2; }
.tlane .tlist::before { background: color-mix(in srgb, var(--c) 45%, var(--seam)); }
.tshared-kerman { max-width: none; }
@media (max-width: 1180px) {
  .tsplit { grid-template-columns: minmax(0, 1fr); }
  .tkerman-lanes { grid-template-columns: minmax(0, 1fr); }
  .tsplit .tlane.off { display: none; }
  .tsplit[data-sel='survivor'] .tkerman { display: none; }
  .tshared { max-width: none; }
}

/* Support bar */
.support-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; margin: 28px auto 0; padding: 14px var(--gutter); border-top: 1px solid var(--seam); background: color-mix(in srgb, var(--night-deep) 70%, transparent); color: var(--haze); font-size: var(--step--1); text-align: center; }
.support-bar a { color: var(--signal); font-weight: 600; overflow-wrap: anywhere; }
.support-bar .sep { color: var(--haze-dim); }

/* Setup: AI or by hand */
.choose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.choose-card { align-content: start; gap: 12px; }
.choose-card h3 { font-family: var(--font-display); font-size: var(--step-1); margin: 0; }
.choose-card .btn { justify-self: start; margin-top: 4px; }
@media (max-width: 640px) { .choose-grid { grid-template-columns: minmax(0, 1fr); } }

/* Buttons never squeeze their label (it got clipped by the chamfer) */
.btn { flex-shrink: 0; white-space: nowrap; }
.ai-card > .btn { flex: none; }
/* wide screens: the AI panel sits next to the page instead of over it */
@media (min-width: 1240px) {
  body.ai-open #main, body.ai-open .support-bar { padding-right: 432px; transition: padding-right .2s var(--ease-out); }
}
