/* phage — the shelf's shell (dice's, mahjong's, solitaire's and minesweeper's
 * before it: the glass, the bar, the menu sheet, the rows, the foot of
 * settings) around a galaxy drawn on a canvas.
 *
 * THE ROOM IS SPACE (mahjong-v4's rule, "match the theme of the game"): every
 * screen sits on deep space — black at the edges, a dark blue wash — whatever
 * the Appearance setting says, because space is dark. The setting chooses the
 * PANELS: light is pale paper with dark ink, dark is navy glass with light
 * ink. Two token scopes do it: the ground takes space's ink; the panels put
 * their own back.
 *
 * THE SIDES' COLOURS are the original's: you are GREEN, the computer is RED,
 * nobody is GREY. They are tokens (--you, --them, --none) because the canvas
 * (art.js) reads them off the root, so the HUD and the planets agree.
 *
 * GOLD MEANS YOU (wizard's rule): your row on a leaderboard, your best on a
 * card, the one button that is the next thing to do.
 */

:root {
  --bg:       #070b16;
  --panel:    #ffffff;
  --glass:    rgba(255, 255, 255, .78);
  --glass-2:  rgba(255, 255, 255, .55);
  --line:     rgba(60, 60, 67, .16);
  --line-2:   rgba(60, 60, 67, .08);
  --ink:      #000000;
  --ink-2:    #3c3c43;
  --dim:      #8a8a8e;
  --dim-2:    #b0b0b6;
  --pill:     #efeff0;
  --good:     #1a9e4b;
  --warn:     #b8730a;
  --bad:      #e5322b;
  --link:     #007aff;
  --heart:    #e0596e;
  --gold:     #d9a520;
  --gold-lit: #ffd45c;
  --gold-ink: #1a1200;
  --shadow:   0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);

  /* Space: the ground of every screen, and what is written straight on it. */
  --space-1:  #141b33;
  --space-2:  #04070f;
  --space-ink: #eef1ff;
  --space-dim: rgba(238, 241, 255, .62);
  --space-line: rgba(255, 255, 255, .18);
  --space-glass:   rgba(255, 255, 255, .10);
  --space-glass-2: rgba(255, 255, 255, .06);
  --space-link:    #9ec5ff;

  /* The sides, from the viewer: you, the next seat round, the third, the fourth (art.js setSides; a supporter may wear another). */
  --you:   #3ddc5a;
  --them:  #ff4b3e;
  --third: #4aa3ff;
  --fourth: #ffc93c;
  --none:  #9aa3ad;

  /* The panels: paper by day. */
  --paper-1:  #f6f7fb;
  --paper-2:  #e6e9f2;
  --paper-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 0 0 .5px rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.35);
  --paper-ink: #10131f; --paper-ink-2: #3a3f55; --paper-dim: #7a8097; --paper-dim-2: #a9aec0;
  --paper-line: rgba(20, 30, 60, .18); --paper-line-2: rgba(20, 30, 60, .1);
  --paper-pill: rgba(20, 30, 60, .09); --paper-glass: rgba(255, 255, 255, .6); --paper-glass-2: rgba(20, 30, 60, .06);
  --paper-link: #2457c5;

  --r-card: 18px;
  --r-mid:  14px;
  --r-sm:   10px;

  --font: -apple-system, BlinkMacSystemFont, system-ui, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-num: ui-rounded, -apple-system, "SF Pro Rounded", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* THE PANELS BY NIGHT: navy glass, light ink. The ground does not change. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper-1: #1b2240; --paper-2: #11172c;
    --paper-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 .5px rgba(120, 140, 200, .25), 0 10px 24px rgba(0,0,0,.5);
    --paper-ink: #f2f4ff; --paper-ink-2: #d6dbf0; --paper-dim: #8f97b5; --paper-dim-2: #5d6482;
    --paper-line: rgba(180, 190, 230, .22); --paper-line-2: rgba(180, 190, 230, .12);
    --paper-pill: rgba(180, 190, 230, .12); --paper-glass: rgba(255, 255, 255, .08); --paper-glass-2: rgba(180, 190, 230, .08);
    --paper-link: #9ec5ff;
    --good: #30d158; --warn: #ffd60a; --bad: #ff453a; --gold: #e8c05a; --gold-lit: #ffd77a;
  }
}
:root[data-theme="dark"] {
  --paper-1: #1b2240; --paper-2: #11172c;
  --paper-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 .5px rgba(120, 140, 200, .25), 0 10px 24px rgba(0,0,0,.5);
  --paper-ink: #f2f4ff; --paper-ink-2: #d6dbf0; --paper-dim: #8f97b5; --paper-dim-2: #5d6482;
  --paper-line: rgba(180, 190, 230, .22); --paper-line-2: rgba(180, 190, 230, .12);
  --paper-pill: rgba(180, 190, 230, .12); --paper-glass: rgba(255, 255, 255, .08); --paper-glass-2: rgba(180, 190, 230, .08);
  --paper-link: #9ec5ff;
  --good: #30d158; --warn: #ffd60a; --bad: #ff453a; --gold: #e8c05a; --gold-lit: #ffd77a;
}

/* THE GAME'S FACE: Orbitron for every count and the HUD's numbers — a planet's
   number is the whole game (SIL OFL 1.1, from Google Fonts' repository, served
   from here, registered in ~/claude/dependencies.json as phage-fonts). */
@font-face { font-family: "Orbitron"; src: url("fonts/Orbitron.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
:root { --font-game: "Orbitron", var(--font-num); }

* { box-sizing: border-box; }
/* `[hidden]` MUST WIN (solitaire's lesson: any author `display` beats the UA's). */
[hidden] { display: none !important; }

/* NATIVE CONTROLS FOLLOW THE IN-APP CHOICE (IOS.md §11). */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

html, body {
  margin: 0;
  min-height: 100%;              /* the page scrolls; the galaxy locks it (see "the shell") */
  font-family: var(--font);
  color: var(--space-ink);
  -webkit-font-smoothing: antialiased;
}
/* On the ROOT, not the body: a short screen's body ends mid-screen, and a
   gradient painted on it stopped there in a seam (mahjong-v4). */
html { background: radial-gradient(140% 90vh at 50% 0, var(--space-1), var(--space-2)) no-repeat, var(--space-2); }
body { background: transparent; }

/* No text selection, no long-press callout, no double-tap zoom — on EVERY
   element (IOS.md §27: touch-action is not inherited). */
*, *::before, *::after { touch-action: manipulation; }
body {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
input, textarea { -webkit-user-select: text; user-select: text; }

/* THE GLASS AT THE TOP (IOS.md §1): iOS 26 blurs a band under the status bar. */
:root { --glass-t: 20px; }

/* ── the shell ─────────────────────────────────────────────────────────────

   THE PAGE SCROLLS; THE GALAXY LOCKS IT (IOS.md §15, gems' shape). The home
   and the menu are in-flow content and the document is their one scroller.
   While a game shows (and the menu is closed) app.js sets html.locked: the
   root is the viewport and nothing moves under a drag. */
html.locked, html.locked body { height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none; }
html.locked main { height: 100%; }

.view {
  padding: calc(8px + var(--glass-t) + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin: 0 auto;
}
.view[hidden] { display: none !important; }
/* WHILE THE MENU IS OPEN the screen under it is hidden and pinned, not unmounted. */
body:has(#sheet-menu:not([hidden])) main { visibility: hidden; position: fixed; inset: 0; height: auto; }

/* THE GROUND: every screen takes space's ink. */
.view, .sheet-body, .gate {
  --ink: var(--space-ink); --ink-2: var(--space-ink); --dim: var(--space-dim); --dim-2: var(--space-dim);
  --line: var(--space-line); --line-2: var(--space-line);
  --glass: var(--space-glass); --glass-2: var(--space-glass-2); --pill: var(--space-glass); --link: var(--space-link);
  color: var(--ink);
}

.view-head { padding: 12px 4px 18px; }
.view-head.bar { display: flex; align-items: center; gap: 10px; }
.bar-title { flex: 1; min-width: 0; }
.view-head h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.6px; }
.view-sub { margin: 4px 0 0; color: var(--dim); font-size: 15px; }

/* THE PANELS: the paper's (or the glass's) tokens, then the panel. */
.card, .mode-card, .board-list, .signin-card, .overlay-card {
  --ink: var(--paper-ink); --ink-2: var(--paper-ink-2); --dim: var(--paper-dim); --dim-2: var(--paper-dim-2);
  --line: var(--paper-line); --line-2: var(--paper-line-2);
  --pill: var(--paper-pill); --glass: var(--paper-glass); --glass-2: var(--paper-glass-2); --panel: var(--paper-1);
  --link: var(--paper-link); --heart: #d4475d; --games-gold: #c48a12;
  color: var(--ink);
  background: linear-gradient(170deg, var(--paper-1), var(--paper-2));
  box-shadow: var(--paper-shadow);
}

.card { border-radius: var(--r-card); padding: 16px; margin: 0 0 18px; }
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.card.rows { padding: 0 16px; }

.fine { margin: 12px 6px 0; color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.fine strong { color: var(--ink-2); font-weight: 600; }
.fine a { color: var(--link); }
.fine.in-card { margin-left: 0; margin-right: 0; }
.fine.version { font-family: var(--font-num); }

/* ── buttons ───────────────────────────────────────────────────────────── */

.btn {
  font: inherit; font-size: 16px; font-weight: 600;
  padding: 12px 18px; border-radius: var(--r-mid);
  color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--glass); border: .5px solid var(--line); box-shadow: var(--shadow);
}
.btn:active { opacity: .7; }
.btn-primary { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.btn-quiet   { background: transparent; color: var(--link); box-shadow: none; border-color: transparent; }
.btn-wide    { display: flex; width: 100%; margin-top: 18px; }
.btn-small   { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }
.view .btn:not(.btn-primary):not(.btn-quiet) { box-shadow: none; }

.icon {
  font: inherit; font-size: 20px; line-height: 0;
  width: 40px; height: 40px; border-radius: 20px;
  display: grid; place-items: center; flex: none; padding: 0;
  color: var(--ink); cursor: pointer;
  background: var(--glass); border: .5px solid var(--line);
}
.icon:active { opacity: .7; }

.pill {
  display: block; width: 100%; margin: 0 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 10px 14px; border-radius: 999px; cursor: pointer;
  background: var(--space-glass); color: var(--space-ink); border: .5px solid var(--space-line);
}

/* ── the gate ──────────────────────────────────────────────────────────── */

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.signin-card { max-width: 340px; width: 100%; text-align: center; padding: 26px 22px 22px; border-radius: var(--r-card); }
.signin-card h1 { margin: 14px 0 6px; font-size: 30px; letter-spacing: -.03em; }
.signin-card .lede { margin: 0 0 22px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.signin-card .btn-wide { margin-top: 0; }
.brand { display: block; width: 88px; height: 88px; margin: 0 auto; border-radius: 22.5%; box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0,0,0,.14); }
.gate-msg { margin: 0 0 18px; padding: 11px 13px; border-radius: var(--r-mid); background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-size: 13px; line-height: 1.45; text-align: left; }

/* ── the home ──────────────────────────────────────────────────────────── */

.mode-cards { display: grid; gap: 18px; }
.mode-card {
  display: flex; gap: 14px; align-items: stretch; width: 100%; text-align: left;
  font: inherit; cursor: pointer; padding: 16px; border-radius: var(--r-card); border: 0;
}
.mode-card:active { translate: 0 2px; }
.mode-card:disabled { opacity: .6; cursor: default; }
.mode-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.mode-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mode-card h3 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.mode-card .shape { color: var(--dim); font-size: 12.5px; font-family: var(--font-num); white-space: nowrap; }
.mode-card .blurb { margin: 5px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.mode-art { flex: none; width: 64px; display: flex; align-items: center; justify-content: center; position: relative; }
.mode-art canvas { width: 64px; height: 64px; display: block; }
.mode-card-stats { display: flex; gap: 18px; margin-top: 12px; padding-top: 11px; border-top: .5px solid var(--line-2); }
.mode-card-stats div { display: flex; flex-direction: column; gap: 1px; }
.mode-card-stats .v { font-family: var(--font-num); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mode-card-stats .k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.mode-card-stats .v.none { color: var(--dim-2); }
.mode-card-stats .v.you { color: var(--gold); }
/* A game in play stays SPACE (it is the galaxy you left), raised on the dark. */
.mode-card.resume {
  --ink: var(--space-ink); --ink-2: var(--space-ink); --dim: var(--space-dim); --line-2: var(--space-line);
  background: var(--space-glass); color: var(--space-ink); box-shadow: inset 0 0 0 1px var(--space-line), 0 8px 18px rgba(0,0,0,.22);
}

/* ── a game in play ────────────────────────────────────────────────────── */

#view-game {
  height: 100%; max-width: none;
  display: flex; flex-direction: column; overflow: hidden; gap: 0;
  padding: calc(4px + var(--glass-t) + env(safe-area-inset-top, 0px)) 0 0;
}
.game-head { display: flex; align-items: center; gap: 8px; padding: 2px 10px 8px calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); flex: none; max-width: 760px; width: 100%; margin: 0 auto; }
/* THE TALLY: every side's ships in its colour, yours first on the left; a bar split by ships under them.
   Two sides read left against right (the original's); three are three columns. */
.tally { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tally-sides { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.tally-side { display: flex; flex-direction: column; line-height: 1.05; min-width: 44px; }
.tally-side:last-child { align-items: flex-end; text-align: right; }
.tally-sides.three .tally-side:nth-child(2), .tally-sides.four .tally-side:nth-child(2), .tally-sides.four .tally-side:nth-child(3) { align-items: center; text-align: center; }
/* Three or four (phage-v11, v20): equal columns, no names (they ran into each other), so nothing reaches the next. */
.tally-sides.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tally-sides.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tally-sides.three .tally-side, .tally-sides.four .tally-side { min-width: 0; }
/* A planet's count wears a small ring in the side's colour, for the word "planets". */
.tally-k.pl::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 4px; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: 0; opacity: .9; }
.tally-side .tally-k.pl { color: currentColor; opacity: .75; }
.tally-sides.four .tally-v { font-size: 16px; }
.tally-sides.four .tally-k { max-width: 100%; font-size: 9.5px; letter-spacing: .3px; }
.tally-v { font-family: var(--font-game); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: currentColor; }
.tally-k { font-size: 10.5px; color: var(--space-dim); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.tally-bar { display: flex; height: 5px; border-radius: 3px; background: var(--space-line); overflow: hidden; }
.tally-bar i { display: block; height: 100%; transition: width .4s ease; }
/* At a table there is no pause: the galaxy runs on the server's clock. */
#view-game[data-table] #pause-btn { display: none; }
#view-game[data-table] .game-note { left: 16px; }

/* THE SPEAKER (CLAUDE.md 5e, letters' .snd-g). */
.snd-g { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.snd-g .ol { fill: none; }
.sound-btn[aria-pressed="true"] .snd-off, .sound-btn[aria-pressed="false"] .snd-on { display: none; }
.sound-btn[aria-pressed="false"] { opacity: .62; }
#view-game .icon { background: var(--space-glass); color: var(--space-ink); border-color: var(--space-line); box-shadow: none; }

/* THE BOX THE GALAXY FILLS (field.js measures it): the canvas and the touch
   layer are laid in it at the size the galaxy fits, centred. It owns every
   gesture inside it: `none` on the box and on everything in it, so nothing a
   finger does here scrolls, zooms or selects. */
.field-wrap { position: relative; flex: 1; min-height: 0; touch-action: none; overflow: hidden; }
.field-wrap * { touch-action: none; }
.field-canvas, .field-touch { position: absolute; display: block; }
.field-back { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.field-touch { -webkit-tap-highlight-color: transparent; cursor: crosshair; }
.paused .field-touch { pointer-events: none; }
/* THE TICK (field.js): one invisible native switch over the galaxy, widened under a finger while it is down. */
.field-touch .field-haptic { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: crosshair; -webkit-tap-highlight-color: transparent; }
/* Nothing to see: field.js reads its padding as what the galaxy must keep clear — the safe-area insets at the
   sides, and the corner buttons' band at the foot (THE EDGES). */
.field-inset { position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none;
  padding: 0 env(safe-area-inset-right, 0px) calc(48px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); }

/* THE TWO CORNERS: pause bottom-left, the share bottom-right — the original's "<50%>". */
.hud-btn {
  position: absolute; z-index: 6; height: 44px; padding: 0 14px; min-width: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; border: 0; cursor: pointer;
  background: rgba(10, 16, 34, .72); color: #cfe9ff;
  box-shadow: 0 0 0 1px rgba(160, 200, 255, .22);
  font-family: var(--font-game); font-size: 15px; font-weight: 700; letter-spacing: .04em;
}
.hud-bl { left: env(safe-area-inset-left, 0px); bottom: env(safe-area-inset-bottom, 0px); border-top-right-radius: 16px; }
.hud-br { right: env(safe-area-inset-right, 0px); bottom: env(safe-area-inset-bottom, 0px); border-top-left-radius: 16px; }
.hud-btn:active { background: rgba(30, 40, 70, .85); }
.pct { color: #6fe3ff; }
.pct .pct-lt, .pct .pct-gt { opacity: .6; font-weight: 400; }
#pct-v { min-width: 3.6em; text-align: center; }
.game-note {
  position: absolute; left: 64px; right: 110px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  margin: 0; padding: 0 4px; text-align: center; pointer-events: none;
  color: var(--space-dim); font-size: 13px; line-height: 1.4; min-height: 2.8em; display: grid; align-content: end;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .2s;
}
.game-note.show { opacity: 1; }
.game-note.warn { color: var(--gold-lit); }

/* ── the end of a game ─────────────────────────────────────────────────── */

.overlay {
  position: absolute; inset: 0; z-index: 1000; display: grid; place-items: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(4, 7, 15, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.overlay-card { width: min(340px, 92%); padding: 24px 20px; text-align: center; border-radius: var(--r-card); max-height: 92%; overflow: auto; }
.overlay-mark { line-height: 0; display: flex; justify-content: center; min-height: 40px; }
.overlay-mark canvas { width: 72px; height: 72px; }
.overlay-card h2 { margin: 14px 0 4px; font-size: 26px; letter-spacing: -.4px; font-family: var(--font-game); font-weight: 800; }
.overlay-card h2.won { color: var(--good); }
.overlay-card h2.lost { color: var(--bad); }
.overlay-line { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.5; }
.overlay-stats { display: flex; justify-content: center; gap: 20px; margin: 18px 0 0; padding: 14px 0 0; border-top: .5px solid var(--line-2); }
.overlay-stats div { display: flex; flex-direction: column; gap: 2px; }
.overlay-stats dt { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; order: 2; }
.overlay-stats dd { margin: 0; font-family: var(--font-num); font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; order: 1; }
.overlay-submit { margin: 14px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--dim); min-height: 17px; }
.overlay-submit.bad { color: var(--warn); }
.overlay-submit.good { color: var(--good); }
.overlay-btns { display: flex; gap: 10px; margin-top: 18px; }
.overlay-btns .btn { flex: 1; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.overlay-card .btn-quiet.btn-wide { margin-top: 8px; }
.pause-card h2 { margin-top: 0; }
.pause-card .btn-wide { margin-top: 12px; }
.pause-card .overlay-btns { margin-top: 10px; }
.pause-card #paused-giveup { margin-top: 4px; }
.btn.armed { color: var(--gold-lit); }

/* ── the standings (a table's end) ─────────────────────────────────────── */

.standings { margin: 16px 0 0; padding-top: 10px; border-top: .5px solid var(--line-2); text-align: left; }
.standings .st-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: .5px solid var(--line-2); }
.standings .st-row:last-child { border-bottom: 0; }
.standings .st-p { width: 22px; font-family: var(--font-num); font-weight: 700; color: var(--dim); text-align: right; }
.standings .st-n { flex: 1; font-weight: 600; font-size: 15px; }
.standings .st-l { font-size: 11.5px; color: var(--dim); font-weight: 500; margin-left: 5px; }
.standings .st-v { font-family: var(--font-num); font-size: 13.5px; color: var(--dim); }
.standings .st-row.win .st-p, .standings .st-row.win .st-v, .standings .st-row.you .st-n { color: var(--gold); }

/* ── multiplayer: the lobby and a room (Dice's) ────────────────────────── */

.name-input {
  font: inherit; font-size: 16px; width: 100%; padding: 11px 13px; border-radius: var(--r-mid);
  border: .5px solid var(--line); background: var(--glass); color: var(--ink);
}
.name-input:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.code-row { display: flex; gap: 10px; }
.code-input { flex: 1; font-family: var(--font-game); font-size: 22px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.lobby-list .lobby-row { gap: 12px; }
.lb-body { flex: 1; min-width: 0; }
.lb-title { font-size: 15.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-note { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.lb-code { font-family: var(--font-game); font-weight: 700; letter-spacing: .12em; }
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.code-k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.code-v { font-family: var(--font-game); font-size: 34px; font-weight: 800; letter-spacing: .18em; }
.seat-row .seat-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.seat-row .seat-n { flex: 1; font-weight: 600; font-size: 15.5px; }
.seat-row .seat-t { font-size: 12px; color: var(--dim); margin-left: 6px; font-weight: 500; }
.seat-row .btn { padding: 6px 12px; font-size: 13px; box-shadow: none; }
.bot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bot-chip { font: inherit; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 13px; border-radius: 12px; cursor: pointer;
  background: var(--glass); border: .5px solid var(--line); color: var(--ink); }
.bot-chip b { font-size: 15px; }
.bot-chip span { font-size: 11.5px; color: var(--dim); }
.bot-chip:disabled { opacity: .4; }
.fine.center { text-align: center; }

/* ── segmented control ─────────────────────────────────────────────────── */

.segmented { display: flex; gap: 3px; padding: 3px; background: var(--glass-2); border-radius: var(--r-sm); border: .5px solid var(--line-2); }
.segmented button {
  flex: 1; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); cursor: pointer;
}
.segmented button[aria-selected="true"], .segmented button.is-on { background: var(--gold); color: var(--gold-ink); box-shadow: var(--shadow); }
.segmented.seg-sm { flex: none; }
.segmented.seg-sm button { flex: none; font-size: 13px; padding: 6px 10px; }

/* ── the leaderboards ──────────────────────────────────────────────────── */

.board-list { margin-top: 10px; padding: 0; overflow: hidden; border-radius: var(--r-card); }
.board-sub { margin: 18px 4px 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.board-sub + .board-list { margin-top: 8px; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: .5px solid var(--line-2); }
.board-row:last-child { border-bottom: 0; }
.board-row.you { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.board-rank { width: 26px; flex: none; text-align: right; font-family: var(--font-num); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--dim); }
.board-row.you .board-rank { color: var(--gold); }
.board-who { flex: 1; min-width: 0; }
.board-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row.you .board-name { font-weight: 700; }
.board-meta { font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.board-time { font-family: var(--font-num); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-empty { padding: 26px 20px; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.5; }

/* ── settings rows ─────────────────────────────────────────────────────── */

.rows > .row, .rows > div > .row { padding: 13px 0; border-bottom: .5px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rows > .row:last-child, .rows > div > .row:last-child { border-bottom: 0; }
.rows > .row.row-stack { flex-direction: column; align-items: stretch; gap: 8px; }
.row-head { display: flex; align-items: center; justify-content: space-between; }
.row-k { font-size: 15px; font-weight: 500; }
.row-v { font-family: var(--font-num); font-weight: 600; font-variant-numeric: tabular-nums; }
.row-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--dim); }
.rows > button.row-tap {
  appearance: none; -webkit-appearance: none; width: 100%; background: none; border: 0;
  border-bottom: 1px solid var(--line-2); font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.rows > button.row-tap:active { background: var(--pill); }
.row-tap .chev { color: var(--dim); font-size: 22px; line-height: 1; margin-top: -2px; }

.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--pill); transition: background .2s ease; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .4; }

.prose p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.prose p:last-child { margin-bottom: 0; }
.prose-meta { font-size: 12px !important; color: var(--dim) !important; font-family: var(--font-mono); }
.update-note { color: var(--warn) !important; }

/* ── the menu sheet ────────────────────────────────────────────────────── */

/* IN FLOW, NOT FIXED (IOS.md §15): the page is the menu's scroller. */
.sheet { position: relative; z-index: 1100; }
.sheet-body {
  padding: calc(8px + var(--glass-t) + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
  max-width: 560px; width: 100%; margin: 0 auto;
}
.sheet-body > .view-head { padding-bottom: 4px; }
h2.sec { margin: 26px 4px 10px; font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.sheet-body section:first-of-type h2.sec { margin-top: 14px; }

/* ── the foot of settings (CLAUDE.md 5) ───────────────────────────────── */

#tipjar-card { margin-top: 14px; }
#tipjar .tip-glyph { color: var(--heart); font-size: 18px; line-height: 1; margin-right: 2px; }
#tipjar .row-k { flex: 1; }
:root { --games-gold: #c48a12; }
#games-card { margin-top: 14px; }
#games-row { padding: 12px 0; }
.games-lockup { display: inline-flex; flex: none; flex-direction: column; align-items: flex-end; line-height: 1; font-family: "SF Pro Rounded", ui-rounded, var(--font); font-weight: 700; }
.games-lockup .gl-mark { font-size: 22px; letter-spacing: -0.01em; color: var(--ink); }
.games-lockup .gl-ca { color: var(--dim); }
.games-lockup .gl-sub { font-size: 10px; letter-spacing: .02em; color: var(--games-gold); margin-top: -1px; margin-right: 1px; }
#games-row .games-more { flex: 1; text-align: right; color: var(--dim); font-weight: 400; }
#account-card { padding: 16px 16px 0; }
#account-card #account-who { margin: 0 0 12px; }
#account-card .rows { margin: 0 -16px; }
#account-card .rows > button.row-tap { padding: 13px 16px; border-bottom: 0; border-top: .5px solid var(--line-2); }
.rows > button.row-tap.danger { color: var(--bad); }
details.technical { padding: 0; overflow: hidden; }
details.technical > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; }
details.technical > summary::-webkit-details-marker { display: none; }
details.technical > summary .chev { color: var(--dim); font-size: 22px; line-height: 1; margin-top: -2px; transition: transform .15s; }
details.technical[open] > summary .chev { transform: rotate(90deg); }
details.technical > summary:active { background: var(--pill); }
details.technical .kv { margin: 0; padding: 4px 16px 12px; border-top: .5px solid var(--line-2); }
details.technical .kv > div { display: flex; gap: 12px; padding: 8px 0; border-bottom: .5px solid var(--line-2); }
details.technical .kv > div:last-child { border-bottom: 0; }
details.technical .kv dt { flex: 0 0 76px; font-size: 13px; color: var(--dim); }
details.technical .kv dd { margin: 0; flex: 1; min-width: 0; font-size: 12px; font-family: var(--font-mono); color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
details.technical > .row-note { padding: 0 16px 14px; }
#credits .row-note { padding: 0 16px 12px; }
#credits .row-note:first-of-type { padding-top: 12px; border-top: .5px solid var(--line-2); }
#credits a { color: var(--link); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 1300;
  max-width: min(92vw, 420px); padding: 10px 14px; border-radius: 14px;
  background: rgba(246, 247, 251, .96); color: #10131f; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  font-size: 14px; line-height: 1.4; text-align: center;
}

.banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-mid);
  font-size: 13.5px; line-height: 1.45; z-index: 1200;
  background: rgba(246, 247, 251, .97); color: #10131f; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.banner .banner-retry { margin-left: auto; padding: 6px 13px; font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.2; border: 0; border-radius: 999px; background: #d9a520; color: #1a1200; cursor: pointer; }
.banner .banner-retry:disabled { opacity: .45; }
.banner .banner-retry + button { margin-left: 4px; }
.banner button { margin-left: auto; flex: none; font: inherit; font-size: 20px; line-height: 1; border: 0; background: transparent; color: inherit; cursor: pointer; }

/* ── single player, the fleet, the supporter (phage-v11) ───────────────── */
.foe-row { gap: 10px; }
.foe-row .foe-k { flex: 1; min-width: 0; font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foe-row .foe-x { flex: none; font: inherit; font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--glass-2); color: var(--dim); cursor: pointer; }
.foe-row .foe-x[hidden] { display: none; }
.solo-add { background: var(--glass); }
.solo-add[hidden] { display: none; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0 0; }
.fleet-k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; margin: 2px 0 8px; }
.fleet-k + .swatches, .fleet-k + .ship-chips { margin-bottom: 14px; }
.ship-chips:last-child { margin-bottom: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--card, #fff), 0 0 0 4px var(--ink); }
.swatch.locked, .ship-chip.locked { opacity: .35; }
.ship-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ship-chip { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; border-radius: 12px; cursor: pointer;
  background: #0b1020; border: .5px solid var(--line); color: #eef1ff; }
.ship-chip canvas { width: 54px; height: 54px; }
.ship-chip span { font-size: 12px; }
.ship-chip.is-on { outline: 2px solid var(--gold); outline-offset: 0; }
#support-card .support-thanks, #support-card .support-perks { margin: 0 0 12px; }
.mark { display: inline-block; margin-left: 5px; vertical-align: -1px; cursor: pointer; line-height: 0; }
.mark svg { width: .8em; height: .8em; display: inline-block; }

/* ── maps and modes (phage-v12) ─────────────────────────────────────────── */
.map-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.map-chip { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 9px; border-radius: 14px; cursor: pointer;
  background: #0b1020; border: .5px solid var(--space-line); color: #eef1ff; }
.map-chip canvas { display: block; border-radius: 6px; }
.map-chip span { font-size: 12.5px; font-weight: 600; }
.map-chip.is-on { outline: 2px solid var(--gold); outline-offset: 0; }
#solo-rules button { flex: 1; }
.rule-note { margin: 10px 0 0; }
.setup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.setup-row label { font-weight: 600; }
.setup-row select { font: inherit; padding: 6px 10px; border-radius: 10px; border: .5px solid var(--line); background: var(--glass); color: var(--ink); min-width: 0; max-width: 60%; }
.setup-row select:disabled { opacity: 1; -webkit-appearance: none; appearance: none; border-color: transparent; background: none; text-align: right; }

/* ── the campaign (phage-v14) ──────────────────────────────────────────── */
.camp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.camp-head h3 { margin: 0; font-size: 21px; }
.camp-stars { color: var(--gold); letter-spacing: 2px; font-size: 18px; }
.camp-stars .off { color: var(--dim); opacity: .45; }
.camp-recipe { margin: 6px 0 0; font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.camp-detail .btn-wide { margin-top: 14px; }
.camp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.camp-tile { font: inherit; aspect-ratio: 1; border-radius: 14px; border: .5px solid var(--space-line); background: #0b1020; color: #eef1ff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; }
.camp-tile b { font-family: var(--font-game); font-size: 20px; }
.camp-tile span { font-size: 11px; color: var(--gold); letter-spacing: 1px; min-height: 13px; }
.camp-tile.locked { opacity: .35; }
.camp-tile.is-on { outline: 2px solid var(--gold); outline-offset: 0; }
.camp-tile.won { background: #13203d; }
