/* ===========================================================================
   FISH INC. — design system (design doc, section 12)
   Navy and brass, nautical chart. Oswald for labels and numbers, Work Sans for
   prose. Mobile-first; on a wide screen the UI stays a phone-width column over
   the chart, which is the shape the game is designed for.
   =========================================================================== */

:root {
  /* surfaces */
  --navy: #0B2436;
  --navy-deep: #071A28;
  --card: #123A52;
  --card-alt: #0F2E43;
  --chip: #17435E;
  --line: rgba(147, 174, 182, 0.16);
  --line-strong: rgba(147, 174, 182, 0.3);

  /* ink */
  --ink: #E7EFEE;
  --dim: #93AEB6;
  --faint: #6C858D;

  /* accents */
  --brass: #C08A46;
  --brass-hi: #D9A253;
  --gold: #CBA135;
  --teal: #4FA3A0;
  --rust: #A85338;
  --rust-ink: #C4735A;
  --green: #7FBF9A;
  --parchment: #C7B187;

  /* type */
  --label: 600 10px/1.2 'Oswald', system-ui, sans-serif;
  --micro: 500 11px/1.35 'Work Sans', system-ui, sans-serif;

  /* shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--navy-deep); color: var(--ink);
  font: 400 14px/1.5 'Work Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

h1, h2, h3, .brand, .cash, .buy, .cta, .tab, .tag, .chip, .nav em, label, .rule span, .lvl-badge {
  font-family: 'Oswald', 'Work Sans', system-ui, sans-serif;
  letter-spacing: 0.04em;
}
h2 { font-size: 20px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
b, strong { font-weight: 600; }
.muted { color: var(--dim); font-size: 12px; }
.note { color: var(--dim); font-size: 12.5px; margin: 8px 0; line-height: 1.5; }
.note.locked { opacity: 0.7; }
.warn { color: var(--brass-hi); font-style: normal; }
.bad { color: var(--rust-ink); }
.gold { color: var(--gold); }
.good { color: var(--green); }
.spacer { flex: 1; }

#chart { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; z-index: 0; }

#app {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  max-width: 520px; margin: 0 auto;
  pointer-events: none;
}
#app > * { pointer-events: auto; }

/* --- HUD ------------------------------------------------------------------ */
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 12px;
  background: linear-gradient(180deg, rgba(7, 26, 40, 0.97) 60%, rgba(7, 26, 40, 0));
}
.hud-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hud-brand .mark {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--brass); border-radius: 50%; color: var(--brass-hi); font-size: 14px;
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
.brand em {
  font-style: normal; font-size: 9px; color: var(--faint); margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 5px;
}
.co { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.co-lvl { font: var(--label); color: var(--brass-hi); letter-spacing: 0.12em; }
.co .bar { width: 70px; }

.hud-wallet { text-align: right; }
.cash { font-size: 23px; font-weight: 700; color: var(--gold); line-height: 1.05; font-variant-numeric: tabular-nums; }
.hud-meta { display: flex; gap: 9px; justify-content: flex-end; font: var(--micro); color: var(--dim); margin-top: 2px; }
.hud-meta .mkt::before { content: '\2192 '; }
.hud-meta .mkt.up { color: var(--green); }
.hud-meta .mkt.up::before { content: '\2197 '; }
.hud-meta .mkt.down { color: var(--rust-ink); }
.hud-meta .mkt.down::before { content: '\2198 '; }
.hud-meta .speed { color: var(--gold); font-weight: 600; }

.collect-wrap { display: flex; justify-content: center; margin-top: -6px; }
.collect {
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: #14212B; border: 0; border-radius: 999px; padding: 8px 18px;
  font-family: 'Oswald'; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm);
  animation: pop 0.25s ease-out;
}
.collect b { font-variant-numeric: tabular-nums; }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

.effects { display: flex; gap: 6px; padding: 0 14px 8px; flex-wrap: wrap; }
.effects .chip em { font-style: normal; opacity: 0.75; margin-left: 5px; }

/* --- primitives ----------------------------------------------------------- */
.bar { height: 5px; width: 100%; border-radius: 999px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brass), var(--brass-hi));
  transition: width 0.35s ease-out;
}
.bar.xp i { background: linear-gradient(90deg, #8A6A33, var(--brass)); }
.bar.teal i { background: linear-gradient(90deg, #3C8079, var(--teal)); }
.bar.amber i { background: linear-gradient(90deg, var(--brass), var(--gold)); }
.bar.over i { background: linear-gradient(90deg, #7E3E2A, var(--rust)); }

.pips { display: inline-flex; gap: 3px; margin-top: 5px; }
.pips i { width: 9px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.13); }
.pips i.on { background: var(--brass-hi); }
.lvl-num { font-style: normal; font-size: 11px; color: var(--dim); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip); color: var(--dim);
  border-radius: 999px; padding: 4px 10px; font-size: 10.5px; white-space: nowrap;
}
.chip.good { background: rgba(79, 163, 160, 0.2); color: #8FD1CB; }
.chip.bad { background: rgba(168, 83, 56, 0.22); color: var(--rust-ink); }
.chip.tier0 { background: rgba(79, 163, 160, 0.2); color: #8FD1CB; }
.chip.tier1 { background: rgba(217, 162, 83, 0.2); color: var(--brass-hi); }
.chip.tier2 { background: rgba(203, 161, 53, 0.24); color: var(--gold); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.tag {
  font-family: 'Oswald'; font-size: 10px; letter-spacing: 0.08em; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; white-space: nowrap;
}
.tag.max { background: var(--gold); border-color: var(--gold); color: #1A1405; font-weight: 700; }

.rule {
  display: flex; align-items: center; gap: 10px; margin: 16px 0 8px;
  font: var(--label); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
}
.rule::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.rule b { color: var(--dim); font-size: 10px; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.idle { background: var(--green); }
.dot.sail { background: var(--brass-hi); animation: blink 1.6s infinite; }
.dot.fish { background: var(--teal); animation: blink 1.6s infinite; }
.dot.port, .dot.refit { background: var(--gold); }
.dot.down { background: var(--rust); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.empty {
  color: var(--faint); font-size: 12.5px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-md); padding: 22px 16px; margin: 0;
}

/* --- buttons -------------------------------------------------------------- */
.cta {
  width: 100%; border: 0; border-radius: var(--r-md); padding: 14px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: #14212B;
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, filter 0.15s ease;
}
.cta:active { transform: translateY(1px); filter: brightness(0.95); }
.cta:disabled { background: var(--chip); color: var(--faint); box-shadow: none; }
.cta.ghost-cta { background: transparent; border: 1px solid var(--brass); color: var(--brass-hi); box-shadow: none; margin-top: 12px; }
.cta.ghost-cta:disabled { border-color: var(--line); color: var(--faint); }

.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); padding: 10px 12px; font-family: 'Oswald'; font-size: 12.5px;
}
.ghost:disabled { color: var(--faint); }
.ghost.wide { width: 100%; margin-top: 8px; }
.duo { display: flex; gap: 8px; }
.duo .ghost { flex: 1; }

.buy {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: #14212B;
  border: 0; border-radius: var(--r-sm); padding: 9px 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; min-width: 62px;
}
.buy:disabled { background: transparent; border: 1px solid var(--line); color: var(--faint); }

.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tab {
  flex: 1; background: var(--card-alt); border: 1px solid var(--line); color: var(--dim);
  border-radius: var(--r-sm); padding: 9px 6px; font-size: 12.5px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tab.on { background: var(--card); color: var(--ink); border-color: var(--brass); }
.tab span { font-size: 15px; }

/* --- main / screens -------------------------------------------------------- */
main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 14px 110px; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }
main:not(.as-map) { background: linear-gradient(180deg, var(--navy) 0 60%, var(--navy-deep)); }
#app > main.as-map { pointer-events: none; overflow: hidden; padding-bottom: 88px; display: flex; flex-direction: column; }
main.as-map .map-tools, main.as-map .panel, main.as-map .strip { pointer-events: auto; }

.screen { display: flex; flex-direction: column; gap: 10px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.head.sub { margin-top: 4px; }

/* --- chart overlay --------------------------------------------------------- */
.map-layer { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 0; }
.map-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(18, 58, 82, 0.92); border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-family: 'Oswald'; font-size: 12px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-sm);
}
.tool.on { background: var(--brass); border-color: var(--brass); color: #14212B; }
.tool.ghost { color: var(--dim); }
.spin { display: inline-block; animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel {
  background: rgba(11, 36, 54, 0.96); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.panel-head .muted { text-align: right; font-size: 11px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input { flex: 1; accent-color: var(--brass-hi); }
.slider-row b { min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.quote { display: flex; gap: 8px; margin-top: 12px; }
.quote > div { flex: 1; background: var(--card-alt); border-radius: var(--r-sm); padding: 8px 10px; }
.quote label, .facts label, .totals label, .meters label, .prize label {
  display: block; font: var(--label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px;
}
.quote b { font-size: 13.5px; }
.panel .cta { margin-top: 12px; }

/* fleet strip on the chart */
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip-card {
  flex: 0 0 auto; width: 156px; text-align: left;
  background: rgba(11, 36, 54, 0.94); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: 9px 11px; backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 5px;
}
.strip-card.idle { border-color: rgba(127, 191, 154, 0.35); }
.strip-top { display: flex; align-items: center; gap: 6px; }
.strip-top b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-top em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; }
.strip-sub { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-eta { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* --- rows ------------------------------------------------------------------ */
.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: var(--card-alt); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 12px; color: var(--ink); font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.row.off { opacity: 0.45; }
.row .ico { font-size: 17px; width: 22px; text-align: center; flex: none; color: var(--dim); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main b { font-size: 13.5px; }
.row-main small { color: var(--dim); font-size: 11.5px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; }
.row-side small { color: var(--dim); font-size: 11px; }
.row-side em { font-style: normal; font-size: 11px; }
.row-side.swap { flex-direction: row; }
.working { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 92px; }
.working small { color: var(--brass-hi); font-size: 11px; font-variant-numeric: tabular-nums; }

.row.tech.owned { border-color: rgba(203, 161, 53, 0.45); background: rgba(203, 161, 53, 0.06); }
.row.tech.owned .ico { color: var(--gold); }
.row.tech.ready { border-color: var(--line-strong); }
.list.track { position: relative; }

.pick .check {
  width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 11px; color: #14212B;
}
.pick.on { border-color: var(--brass); background: rgba(192, 138, 70, 0.12); }
.pick.on .check { background: var(--brass-hi); border-color: var(--brass-hi); }

.send { align-items: flex-start; }
.modes { display: flex; gap: 4px; }
.mode {
  background: var(--chip); border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 6px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px;
}
.mode span { font-size: 13px; }
.mode em { font-style: normal; font-size: 8.5px; color: var(--faint); font-family: 'Oswald'; letter-spacing: 0.06em; }
.mode.on { border-color: var(--brass); background: rgba(192, 138, 70, 0.2); }
.mode.on em { color: var(--brass-hi); }

/* --- cards ------------------------------------------------------------------ */
.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  width: 100%; text-align: left; color: var(--ink); font-size: 14px;
  background: linear-gradient(180deg, var(--card), var(--card-alt));
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.card-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--chip); font-size: 16px; border: 1px solid var(--line);
}
.avatar.big { width: 42px; height: 42px; font-size: 20px; }
.avatar.autonomous { border-color: rgba(147, 174, 182, 0.4); }
.avatar.expert { border-color: rgba(217, 162, 83, 0.5); }
.avatar.diver { border-color: rgba(203, 161, 53, 0.55); }
.card-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-id b { font-size: 14px; }
.card-id small { color: var(--dim); font-size: 11.5px; }
.lvl-badge {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--brass); color: var(--brass-hi); font-size: 11px; flex: none;
}
.lvl-badge.big { width: 30px; height: 30px; font-size: 13px; }
.price { font-family: 'Oswald'; color: var(--gold); font-size: 13px; }
.card-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim); }
.card-status em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--brass-hi); }
.landed {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim);
  border-top: 1px dashed var(--line); padding-top: 8px;
}
.landed b { color: var(--gold); margin-left: auto; }
.landed em { font-style: normal; font-size: 10.5px; }

.hull .class-row { display: flex; gap: 6px; }
.class-pick {
  flex: 1; background: var(--card-alt); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 8px; display: flex; flex-direction: column; gap: 2px; text-align: left;
}
.class-pick span { font-size: 15px; }
.class-pick b { font-size: 12px; }
.class-pick small { font-size: 10px; color: var(--faint); line-height: 1.3; }
.class-pick:disabled { opacity: 0.45; }

/* --- fact grids -------------------------------------------------------------- */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.facts.six { grid-template-columns: repeat(3, 1fr); }
.facts > div, .totals > div {
  background: var(--card-alt); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 10px;
}
.facts b { font-size: 13.5px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.totals b { font-size: 14px; }
.meters { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.meters > div { display: grid; grid-template-columns: 76px 1fr 52px; align-items: center; gap: 10px; }
.meters label { margin: 0; }
.meters b { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.gauge { margin: 12px 0; }
.gauge-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.gauge-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.gauge.over .gauge-head b { color: var(--rust-ink); }
.gauge small { display: block; margin-top: 6px; font-size: 11px; }

.contract-tag {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  background: rgba(192, 138, 70, 0.14); border: 1px solid rgba(192, 138, 70, 0.5);
  border-radius: var(--r-md); padding: 9px 11px; font-size: 12px; color: var(--brass-hi);
}
.contract-tag b { color: var(--ink); }
.contract-tag em { margin-left: auto; font-style: normal; color: var(--dim); }

.prize {
  background: linear-gradient(180deg, rgba(203, 161, 53, 0.16), rgba(203, 161, 53, 0.04));
  border: 1px solid rgba(203, 161, 53, 0.4); border-radius: var(--r-md);
  padding: 12px; text-align: center; margin-bottom: 4px;
}
.prize b { display: block; font-family: 'Oswald'; font-size: 26px; color: var(--gold); }

.locked-panel {
  border: 1px dashed var(--line); border-radius: var(--r-md); padding: 20px 16px;
  text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.locked-panel span { font-size: 22px; }
.locked-panel small { color: var(--faint); font-size: 11.5px; }
.locked-panel .bar { max-width: 180px; margin-top: 4px; }

/* --- boat sheet -------------------------------------------------------------- */
.boat-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.boat-id { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.boat-id b { font-size: 15px; }
.boat-id small { display: block; color: var(--dim); font-size: 11.5px; }
.nudge {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-sm);
  background: var(--card-alt); border: 1px solid var(--line); font-size: 16px;
}
.nudge:disabled { color: var(--faint); opacity: 0.5; }
.xp-row { margin: 10px 0 2px; display: flex; flex-direction: column; gap: 4px; }
.xp-row small { color: var(--faint); font-size: 11px; }

/* --- HQ pager ----------------------------------------------------------------- */
.pager { display: flex; gap: 6px; justify-content: center; }
.page-dot {
  flex: 1; max-width: 62px; height: 38px; border-radius: var(--r-sm);
  background: var(--card-alt); border: 1px solid var(--line); font-size: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.page-dot.on { border-color: var(--brass); background: var(--card); }

/* --- log ---------------------------------------------------------------------- */
.log { display: flex; flex-direction: column; gap: 5px; }
.log-line {
  font-size: 12px; color: var(--dim); border-left: 2px solid var(--line);
  padding: 2px 0 2px 9px; line-height: 1.45;
}
.log-line.good { border-color: var(--teal); color: var(--ink); }
.log-line.bad { border-color: var(--rust); color: var(--rust-ink); }

/* --- nav ------------------------------------------------------------------------ */
.nav {
  display: flex; gap: 4px; padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: linear-gradient(0deg, rgba(7, 26, 40, 0.98) 72%, rgba(7, 26, 40, 0));
}
/* Over the chart the bar fades out; on a solid screen it must not show water. */
.nav.solid { background: var(--navy-deep); border-top: 1px solid var(--line); }
.nav button {
  flex: 1; background: transparent; border: 0; color: var(--faint); position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
}
.nav .nav-ico { font-size: 18px; filter: grayscale(0.6) opacity(0.75); transition: filter 0.2s ease, transform 0.2s ease; }
.nav em { font-style: normal; font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.nav button.on { color: var(--brass-hi); }
.nav button.on .nav-ico { filter: none; transform: translateY(-1px); }
.badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(16px);
  background: var(--rust); color: var(--ink); font-style: normal; font-size: 9px;
  border-radius: 999px; padding: 0 5px; line-height: 14px;
}

/* --- sheets and modals ------------------------------------------------------------ */
.scrim {
  position: fixed; inset: 0; z-index: 9; background: rgba(4, 14, 22, 0.66);
  display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px);
  animation: fade 0.16s ease-out;
}
.scrim.event { align-items: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 86vh;
  background: linear-gradient(180deg, var(--navy) 0 120px, var(--navy-deep));
  border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: rise 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet.tall { max-height: 92vh; }
@keyframes rise { from { transform: translateY(28px); } to { transform: none; } }
.grip { width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 9px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 16px 4px; }
.sheet-head small { color: var(--dim); font-size: 12px; }
.close { background: transparent; border: 0; color: var(--dim); font-size: 16px; padding: 4px 6px; }
.close.floating { position: absolute; top: 10px; right: 10px; z-index: 2; }
.sheet-body { padding: 8px 16px 18px; overflow-y: auto; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-foot {
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 14px);
  border-top: 1px solid var(--line); background: rgba(7, 26, 40, 0.92); flex: none;
}
.sheet-foot .cta { margin: 0; }

.modal {
  width: min(92%, 400px); background: linear-gradient(180deg, var(--card), var(--card-alt));
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 24px 20px;
  text-align: center; box-shadow: var(--shadow); animation: rise 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal.bad { border-color: rgba(168, 83, 56, 0.6); }
.modal.good { border-color: rgba(203, 161, 53, 0.6); }
.modal-icon { font-size: 40px; line-height: 1; }
.modal h2 { margin: 10px 0 6px; }
.modal p { color: var(--dim); font-size: 13px; margin: 0 0 14px; }
.impact {
  border-radius: var(--r-md); padding: 11px; font-size: 13px; font-weight: 600; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.impact em { font-style: normal; font-size: 11px; opacity: 0.7; }
.impact.bad { background: rgba(168, 83, 56, 0.18); color: var(--rust-ink); }
.impact.good { background: rgba(203, 161, 53, 0.16); color: var(--gold); }

/* --- toast and floaters ------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px; z-index: 12;
  background: rgba(18, 58, 82, 0.97); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 10px 18px; font-size: 13px; box-shadow: var(--shadow); animation: pop 0.16s ease-out;
}
.toast.good { border-color: var(--gold); color: var(--gold); }
.toast.bad { border-color: var(--rust); color: var(--rust-ink); }
.dev-panel ~ .toast { bottom: auto; top: 92px; }

.floaters { position: fixed; top: 64px; right: 18px; z-index: 12; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; }
.floater {
  font-family: 'Oswald'; font-size: 17px; font-weight: 600; color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); animation: lift 1.5s ease-out forwards;
}
.floater.bad { color: var(--rust-ink); }
@keyframes lift {
  0% { opacity: 0; transform: translateY(8px) scale(0.9); }
  18% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-34px); }
}

/* --- developer console ---------------------------------------------------------------- */
.dev-tab {
  position: fixed; right: 0; top: 40%; z-index: 6;
  background: rgba(23, 67, 94, 0.9); color: var(--dim); border: 1px solid var(--line);
  border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); padding: 10px 5px;
  font-family: 'Oswald'; font-size: 9px; letter-spacing: 0.16em; writing-mode: vertical-rl;
}
.dev-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; max-width: 520px; margin: 0 auto;
  background: #061219; border-top: 2px solid var(--gold);
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; gap: 8px; max-height: 72vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.dev-head { display: flex; align-items: center; gap: 8px; }
.dev-head b { font-family: 'Oswald'; color: var(--gold); font-size: 12px; letter-spacing: 0.16em; }
.dev-head .dim { flex: 1; font-size: 10.5px; color: var(--faint); }
.dev-head .x { background: transparent; border: 0; color: var(--dim); font-size: 15px; padding: 2px 4px; }
.dev-row { display: flex; align-items: center; gap: 10px; }
.dev-row > label {
  width: 92px; flex: none; font: var(--label); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); line-height: 1.35;
}
.dev-row > label em { display: block; font-style: normal; color: var(--dim); text-transform: none; }
.dev-btns { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.dev-btn {
  background: var(--card-alt); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-sm); padding: 7px 10px; font-family: 'Oswald'; font-size: 11.5px;
}
.dev-btn.on { background: var(--gold); border-color: var(--gold); color: #1A1405; font-weight: 700; }
.dev-btn.warn-btn { border-color: var(--rust); color: var(--rust-ink); }

@media (min-width: 560px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
