/* Extractore — design system.
 *
 * Neutral charcoal surfaces, one warm gold accent, hairline borders, and a
 * strict elevation scale. Every color on this page is a token; nothing is
 * hardcoded downstream. Contrast targets: primary text ≥ 12:1, secondary
 * ≥ 7:1, labels ≥ 4.5:1 on their actual surfaces.
 *
 * Mobile is a first-class layout: the header wraps to two rows, the metrics
 * bar collapses to one scrollable line, panels fold, and nothing — at any
 * width — is allowed to overflow the viewport horizontally.
 */

:root {
  color-scheme: dark;

  /* surfaces, darkest to lightest */
  --bg:        #0a0a0c;
  --panel:     #161619;
  --panel-2:   #1d1d21;
  --panel-3:   #2a2a30;

  /* hairlines */
  --line:      #303036;
  --line-soft: #242429;

  /* text */
  --ink:       #f5f4f1;
  --ink-2:     #d2d0ca;
  --muted:     #a09e97;
  --faint:     #7b7972;

  /* the accent */
  --gold:      #e3c06d;
  --gold-hi:   #f4dfa3;
  --gold-dim:  #6d5a2c;      /* borders on gold surfaces */
  --gold-bg:   #292214;      /* gold-tinted fill */
  --gold-soft: #39301b;      /* quiet gold fill (minimap solo tiles) */
  --on-gold:   #201907;      /* text on a gold button */

  --good:      #4ed48d;
  --good-dim:  #14301f;
  --good-line: #2b5940;
  --warn:      #eebd5a;
  --bad:       #f57f6b;
  --bad-dim:   #38201b;
  --solo:      #e3c06d;
  --split:     #6fa7da;

  --r:    10px;
  --r-lg: 14px;

  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px -14px rgba(0,0,0,.55);
  --header-h: 54px;
}

* { box-sizing: border-box; }
html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(1100px 460px at 50% -12%, #17151157 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", ui-sans-serif,
        system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad  { color: var(--bad); }
h1, h2, h3 { letter-spacing: -0.02em; }

/* ═════════════════════════════════════════════════ login */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 120px), var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 40px 34px;
  width: min(370px, 100%); text-align: center; box-shadow: var(--shadow);
}
.login h1 { margin: 0; font-size: 27px; }
.login .sub { margin: 5px 0 26px; color: var(--muted); font-size: 13px; }
.login input, .login button {
  width: 100%; padding: 12px 14px; border-radius: 10px; font-size: 16px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
.login input:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; }
.login button {
  margin-top: 12px; background: var(--gold); color: var(--on-gold);
  font-weight: 650; border: 0; cursor: pointer;
}
.login button:hover { background: var(--gold-hi); }
.login .err { color: var(--bad); font-size: 13px; margin: 14px 0 0; }

/* ═════════════════════════════════════════════════ header */

body > header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px; height: var(--header-h);
  background: rgba(18,18,21,.86);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.logo { width: 22px; height: 22px; color: var(--gold); }
.name { font-size: 15px; font-weight: 660; letter-spacing: -0.015em; }
.tag {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 3px 7px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel-2);
}
.tag.armed { color: var(--good); border-color: var(--good-line); background: var(--good-dim); }
.tag.dry   { color: var(--gold); border-color: var(--gold-dim); background: var(--gold-bg); }

.head-verdict {
  min-width: 0; display: flex; align-items: center; gap: 9px;
  padding-left: 16px; position: relative;
}
.head-verdict::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 22px; background: var(--line);
}
.head-spacer { flex: 1; min-width: 10px; }
.hv-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none;
  position: relative;
}
.hv-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0; animation: ping 2.6s ease-out infinite;
}
.hv-dot.go   { color: var(--good); background: var(--good); box-shadow: 0 0 9px var(--good); }
.hv-dot.idle { color: var(--gold); background: var(--gold); box-shadow: 0 0 9px var(--gold); }
.hv-dot.pass { color: var(--bad);  background: var(--bad);  box-shadow: 0 0 9px rgba(245,127,107,.5); }
@keyframes ping {
  0%   { opacity: .5; transform: scale(.7); }
  70%  { opacity: 0;  transform: scale(1.5); }
  100% { opacity: 0;  transform: scale(1.5); }
}
.hv-text {
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em;
}
.hv-text b { color: var(--ink); font-weight: 620; }

.head-right { display: flex; align-items: center; gap: 16px; flex: none; }
.clock {
  display: flex; align-items: baseline; gap: 1px; padding: 3px 10px;
  border-radius: 8px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent), var(--panel-2);
  min-width: 52px; justify-content: center;
}
.clock b { font-size: 16px; font-variant-numeric: tabular-nums; }
.clock span { font-size: 10px; color: var(--muted); }
.clock.settling, .clock.hot { border-color: var(--gold-dim); background: var(--gold-bg); }
.clock.settling b, .clock.settling span, .clock.hot b { color: var(--gold); }
.clock.settling b { letter-spacing: .06em; }

.wallet {
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.3; cursor: pointer; font-variant-numeric: tabular-nums;
}
.w-sol { font-size: 13.5px; font-weight: 620; }
.w-ore { font-size: 11px; color: var(--gold); }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; flex: none;
  background: var(--panel-3); border: 1px solid var(--line);
  position: relative; transition: background .18s, border-color .18s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--muted);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: transform .18s cubic-bezier(.4,1.4,.6,1), background .18s;
}
.switch input:checked + .track { background: var(--good-dim); border-color: var(--good-line); }
.switch input:checked + .track .knob { transform: translateX(18px); background: var(--good); }
.switch-label { font-size: 13px; color: var(--ink-2); }
.switch.small .track { width: 34px; height: 20px; }
.switch.small .knob { width: 14px; height: 14px; }
.switch.small input:checked + .track .knob { transform: translateX(14px); }

/* ═════════════════════════════════════════════════ metrics bar */

.metrics-wrap {
  position: sticky; top: var(--header-h); z-index: 15;
  display: grid; grid-template-columns: minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 1px; background: var(--line-soft);
}
.metrics:empty { display: none; }
.metrics-toggle { display: none; }
.s-cell {
  display: flex; flex-direction: column; gap: 2px; padding: 7px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 85%), var(--panel);
  min-width: 0;
}
.s-cell:first-child { padding-left: 18px; }
.s-k {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s-v {
  font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s-v.good { color: var(--good); }
.s-v.warn { color: var(--warn); }
.s-v.bad  { color: var(--bad); }

/* ═════════════════════════════════════════════════ layout */

main {
  max-width: 1760px; margin: 0 auto; padding: 14px 18px 96px;
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.92fr) minmax(0, 0.92fr);
  gap: 12px;
  align-items: start;
}
.col, .sidebar {
  display: grid; gap: 12px; align-content: start; min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}
.workspace > * { min-width: 0; }

/* ═════════════════════════════════════════════════ panels */

.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0) 120px),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 13px 15px; box-shadow: var(--shadow);
  position: relative;
}
.panel::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08) 22%, rgba(255,255,255,.08) 78%, transparent);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 650; color: var(--ink); }
.panel-head .rnd { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.panel-sub { margin: 5px 0 11px; font-size: 12px; color: var(--muted); max-width: 62ch; line-height: 1.45; }
.panel-sub b.warn { color: var(--warn); }
.panel-sub.tight { margin-bottom: 10px; }

/* folding: the whole heading is the control; the chevron just says so */
.panel[data-sec] .panel-head { cursor: pointer; -webkit-user-select: none; user-select: none; }
.fold {
  flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; margin: -2px -4px -2px 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--faint);
  cursor: pointer;
}
.fold:hover { color: var(--ink-2); background: var(--panel-3); }
.fold svg { transition: transform .2s ease; }
.panel.collapsed .fold svg { transform: rotate(-90deg); }
.panel.collapsed > *:not(.panel-head) { display: none; }
.panel.collapsed .panel-head { margin-bottom: 0; }
.panel.collapsed { padding-bottom: 11px; }

/* ═════════════════════════════════════════════════ board */

.board-key { display: flex; gap: 12px; flex-wrap: wrap; }
.board-key .k { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.chip { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chip.solo  { background: var(--solo); }
.chip.split { background: var(--split); }
.chip.mine  { background: transparent; border: 2px solid var(--gold); }
.chip.hit   { background: var(--good); }
.chip.miss  { background: var(--bad); }
.chip.pass  { background: var(--faint); }

.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }

.tile {
  position: relative; aspect-ratio: 1 / .66; border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0) 60%),
    var(--panel-2);
  padding: 6px 8px 7px;
  display: grid;
  grid-template-areas: 'idx solo' 'mine mine' 'total miners';
  grid-template-rows: auto 1fr auto;
  align-items: center;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer; overflow: hidden;
  transition: transform .12s ease, border-color .2s, box-shadow .25s, background .3s;
}
.tile:hover { transform: translateY(-1px); border-color: var(--faint); }

.t-idx {
  grid-area: idx; font-size: 10.5px; color: var(--faint);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.t-solo { grid-area: solo; justify-self: end; font-size: 10px; color: transparent; }
.tile.is-solo .t-solo { color: var(--solo); }
.t-mine {
  grid-area: mine; align-self: center; font-size: 11.5px; font-weight: 640;
  color: var(--good); font-variant-numeric: tabular-nums; min-height: 1em;
}
.t-total {
  grid-area: total; font-size: 14px; font-weight: 640; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.t-miners {
  grid-area: miners; justify-self: end; font-size: 10px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.tile.in-pool {
  border-color: var(--gold-dim);
  box-shadow: inset 0 0 0 1px rgba(227,192,109,.28), 0 0 18px -8px rgba(227,192,109,.5);
  background:
    linear-gradient(180deg, rgba(227,192,109,.09), rgba(227,192,109,.02) 60%),
    var(--panel-2);
}
.tile.in-pool .t-total { color: var(--ink); }
.tile.ours { border-color: var(--good-line); box-shadow: inset 0 0 0 1px rgba(78,212,141,.35); }
.tile.off { opacity: .34; }
.tile.off .t-total { text-decoration: line-through; }

.tile.winner {
  border-color: var(--gold);
  background:
    linear-gradient(180deg, rgba(227,192,109,.26), rgba(227,192,109,.06) 70%),
    var(--panel-2);
  box-shadow: 0 0 0 1px var(--gold), 0 0 34px -6px rgba(227,192,109,.55);
  animation: winner-in .45s ease-out;
  z-index: 1;
}
.tile.winner .t-total { color: var(--gold-hi); }
@keyframes winner-in {
  0%   { transform: scale(.94); }
  60%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.t-flag {
  grid-area: mine; justify-self: start; align-self: center;
  font-size: 8px; font-weight: 800; letter-spacing: .12em;
  color: var(--on-gold); background: var(--gold);
  padding: 1px 5px; border-radius: 3px;
  opacity: 0; transform: scale(.9); transition: opacity .2s, transform .2s;
}
.tile.winner .t-flag { opacity: 1; transform: scale(1); }
.tile.winner.ours .t-flag { grid-area: idx; justify-self: end; align-self: center; }
.tile.winner.ours .t-idx { font-size: 0; }

.tile.frozen { filter: saturate(.92); }
.board:has(.tile.frozen) { outline: 1px dashed var(--gold-dim); outline-offset: 4px; border-radius: 10px; }

.board-hint { margin: 9px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.board-hint b { color: var(--ink-2); }
.board-hint b.gold { color: var(--gold); }

/* ── rotation minimaps ── */
.rotate { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); display: grid; gap: 5px; }
.maps { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.map { margin: 0; display: grid; gap: 5px; justify-items: center; }
.mini {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  padding: 4px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.mini i { width: 9px; height: 9px; border-radius: 2px; background: var(--panel-3); transition: background .3s; }
.mini i.solo { background: var(--solo); box-shadow: 0 0 4px rgba(227,192,109,.4); }
.map figcaption {
  font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.map figcaption b { color: var(--ink-2); font-weight: 600; }
.map.next .mini { opacity: .62; }
.map.next .mini i.solo { box-shadow: none; }
.rotate-fact { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.5; flex: 1; min-width: 150px; align-self: center; }
.rotate-fact em { color: var(--ink-2); font-style: normal; font-weight: 600; }
.rotate-fact b { color: var(--gold); }

/* ═════════════════════════════════════════════════ economics */

.pools { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 9px 0 4px; }
.pools .pool:nth-child(3) { grid-column: 1 / -1; }
.pool {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 70%), var(--panel-2);
  position: relative; min-width: 0;
}
.pool.chosen { border-color: var(--gold-dim); background: linear-gradient(180deg, var(--gold-bg), var(--panel-2)); }
.pool.chosen::after {
  content: 'chosen'; position: absolute; top: 9px; right: 10px;
  font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
}
.pool-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 9px; }
.pool-name { font-size: 12.5px; font-weight: 650; text-transform: capitalize; }
.pool-tiles { font-size: 10.5px; color: var(--muted); }
.pool-cost {
  font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em; line-height: 1.1;
}
.pool-cost span { font-size: 10px; color: var(--muted); font-weight: 500; margin-left: 5px; letter-spacing: 0; }
.pool-margin { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.pool-margin.good { color: var(--good); }
.pool-margin.bad  { color: var(--bad); }
.pool-crowd { font-size: 10.5px; color: var(--muted); margin-top: 7px; font-variant-numeric: tabular-nums; }

.sub-head {
  margin: 14px 0 0; font-size: 10px; color: var(--faint);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}

.why-rows { display: grid; gap: 1px; background: var(--line-soft); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.why-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 6px 11px; font-size: 12.5px;
  background: var(--panel-2);
  min-width: 0;
}
.why-row .k { color: var(--muted); }
.why-row .v { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.why-row .v.good { color: var(--good); }
.why-row .v.bad  { color: var(--bad); }
.why-row .v.warn { color: var(--warn); }

.why-note {
  margin-top: 9px; font-size: 11.5px; color: var(--muted); line-height: 1.5;
  border-left: 2px solid var(--line); padding-left: 11px;
}
.why-note b { color: var(--ink-2); font-weight: 600; }
.excl-note { margin-top: 10px; color: var(--warn); }

/* ═════════════════════════════════════════════════ params */

.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.param { min-width: 0; }
.param.span2 { grid-column: span 2; }
.param label { display: block; font-size: 12px; font-weight: 550; margin-bottom: 5px; color: var(--ink-2); }
.param .hint { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.param .hint.warn { color: var(--warn); }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.hint .warn, .warn { color: var(--warn); }
.live-hint { color: var(--ink-2); }

input, select {
  width: 100%; padding: 8px 11px; border-radius: 9px; font-size: 14px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-variant-numeric: tabular-nums;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a09e97' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 28px;
}
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus { border-color: var(--gold-dim); outline: none; }
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold-dim);
}
button { transition: background .15s, border-color .15s, opacity .15s; }
.with-unit { position: relative; display: flex; align-items: center; }
.with-unit input { padding-right: 44px; }
.with-unit span { position: absolute; right: 11px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
#fixed-wrap.off { opacity: .35; pointer-events: none; }

.actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions button {
  padding: 8px 14px; font-size: 13px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
.actions button:hover { background: var(--panel-3); }
.actions .primary { background: var(--gold); color: var(--on-gold); border: 0; font-weight: 650; padding: 9px 18px; }
.actions .primary:hover { background: var(--gold-hi); }
.saved { color: var(--good); font-size: 12px; }

/* ── the save bar: appears only when the form differs from the bot ── */
.savebar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  z-index: 40;
  display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: min(600px, calc(100vw - 20px));
  padding: 9px 10px 9px 16px; border-radius: 14px;
  background: rgba(32,32,37,.94);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: 0 14px 40px -10px rgba(0,0,0,.75);
  transition: transform .22s ease, opacity .22s ease;
}
.savebar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.sb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.sb-text {
  font-size: 12.5px; color: var(--ink-2); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.savebar button {
  padding: 7px 14px; font-size: 13px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  flex: none;
}
.savebar button:hover { background: var(--panel-3); }
.savebar .primary { background: var(--gold); color: var(--on-gold); border: 0; font-weight: 650; }
.savebar .primary:hover { background: var(--gold-hi); }
.sb-actions { display: flex; gap: 8px; flex: none; }

/* ═════════════════════════════════════════════════ log */

.log { max-height: 300px; overflow-y: auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; margin-top: 10px; scrollbar-width: thin; }
.log .line { padding: 4px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); overflow-wrap: anywhere; }
.log .ts { color: var(--faint); margin-right: 10px; }
.log .warn { color: var(--warn); }
.log .error { color: var(--bad); }

/* ═════════════════════════════════════════════════ round cards */

.round-cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: start;
  margin-top: 6px; max-height: 470px; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.rcard {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 5px 5px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 70%), var(--panel-2);
  min-width: 0;
}
.rcard header {
  display: flex; justify-content: space-between; align-items: center;
  margin: -4px -5px 4px; padding: 3px 6px;
  line-height: 1.3;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent), var(--panel-3);
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
}
.r-id { font-size: 10.5px; font-weight: 640; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.r-badge { font-size: 8px; font-weight: 800; letter-spacing: .09em; padding: 1.5px 5px; border-radius: 3px; }
.r-badge.hit  { background: var(--good-dim); color: var(--good); }
.r-badge.miss { background: var(--bad-dim); color: var(--bad); }
.r-badge.pass { background: var(--panel-3); color: var(--muted); }
.r-badge.pending { background: var(--panel-3); color: var(--gold); }

.rmap {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.5px;
  padding: 3px; border-radius: 4px; background: var(--panel); border: 1px solid var(--line-soft);
}
.rmap i { aspect-ratio: 1; border-radius: 1.5px; background: var(--panel-3); }
.rmap i.solo { background: var(--gold-soft); }
.rmap i.dep { background: var(--gold-dim); box-shadow: inset 0 0 0 1px var(--gold); }
.rmap i.w-hit  { background: var(--good); box-shadow: 0 0 6px rgba(78,212,141,.5); }
.rmap i.w-miss { background: var(--bad);  box-shadow: 0 0 6px rgba(245,127,107,.5); }
.rmap i.w-pass { background: var(--faint); }

.r-sep {
  display: flex; align-items: center; gap: 6px; margin: 3px 0 0;
  font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint);
}
.r-sep::before, .r-sep::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.r-sep.solo span { color: var(--solo); }

.rcard dl { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin: 3px 0 0; }
.rcard dl div { min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.rcard dt { font-size: 8px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.rcard dd {
  margin: 0; font-size: 10.5px; font-weight: 620; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═════════════════════════════════════════════════ responsive */

@media (max-width: 1500px) { .round-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 1400px) {
  .workspace { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .sidebar { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

@media (max-width: 900px) {
  .workspace, .sidebar { grid-template-columns: minmax(0, 1fr); }
  /* parameters right after the board — no expedition to the bottom */
  .col:first-child { order: 0; }
  .sidebar { order: 1; }
  .col:nth-child(2) { order: 2; }
}

/* ── the phone layout ── */
@media (max-width: 760px) {
  body > header {
    flex-wrap: wrap; height: auto; padding: 8px 12px;
    gap: 10px; row-gap: 7px;
  }
  .head-verdict { order: 9; flex-basis: 100%; padding-left: 1px; }
  .head-verdict::before { display: none; }
  .head-spacer { display: none; }
  .brand { margin-right: auto; }
  .head-right { gap: 12px; }
  .hv-text { white-space: normal; font-size: 12px; line-height: 1.35; }

  /* metrics: one scrollable line, expandable to a grid */
  .metrics-wrap { position: static; grid-template-columns: minmax(0, 1fr) 34px; }
  .metrics {
    display: flex; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .metrics::-webkit-scrollbar { display: none; }
  .s-cell { flex: none; min-width: 92px; padding: 6px 10px; }
  .s-cell:first-child { padding-left: 12px; }
  .s-v { font-size: 13.5px; }
  .metrics-toggle {
    display: grid; place-items: center;
    border: 0; border-left: 1px solid var(--line-soft);
    background: var(--panel); color: var(--muted); cursor: pointer;
  }
  .metrics-toggle svg { transition: transform .2s ease; }
  .metrics-wrap.open .metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics-wrap.open .metrics-toggle svg { transform: rotate(180deg); }

  main { padding: 10px 10px 96px; }
  .panel-head { flex-wrap: wrap; }
  .workspace, .col, .sidebar { gap: 10px; }
  .panel { padding: 11px 12px; }

  /* iOS zooms any focused input under 16px — so never go under 16px */
  input, select { font-size: 16px; padding: 9px 12px; }
  .param-grid { gap: 8px; }

  .board { gap: 4px; }
  .t-total { font-size: 12.5px; }
  .round-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pools { grid-template-columns: 1fr 1fr; }
  .savebar { width: auto; left: 10px; right: 10px; transform: translateY(16px); max-width: none; }
  .savebar.show { transform: translateY(0); }
}

@media (max-width: 400px) {
  .tag { display: none; }
  .switch-label { display: none; }
  .pools { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
