/* Layout: one phone column; the board (a flat disc ringed by the ice wall)
   sits in the thumb zone. On wide screens the found list moves to a side panel.
   Palette from the Flat Earth canvas: polar paper, navy ink, sea-blue disc. */
:root {
  --bg: #EEF3F7;
  --ink: #0E2A47;
  --muted: #4A6378;
  --line: #B9CCDB;
  --surface: #FFFFFF;
  --sea: #CFE1EE;
  --wall: #C9DCEA;
  --rim: #8FB0C8;
  --route: #A7C3D8;
  --accent: #1E5A86;
  --accent-ink: #FFFFFF;
  --accent-text: #1E5A86;
  --off: #5E7387;
  --sun: #E0A12F;
  /* the ice wall: lit top, shaded face, crack lines */
  --ice-top: #F4F9FC;
  --ice-face: #A9C6DC;
  --ice-line: #6A90B0;
  --toast-bg: #0E2A47;
  --toast-fg: #FFFFFF;
  --scrim: rgba(14, 42, 71, 0.38);
  /* the edge screen is the same night sky in both themes */
  --edge-bg: #0E2A47;
  --edge-ink: #FFFFFF;
  --edge-muted: #CFE1EE;
  --edge-line: #3E6A90;
  --edge-sea: #2C5D85;
  --edge-route: #5B87AB;
  --edge-sun: #F2B544;

  --font-display: 'Frank Ruhl Libre', 'David Libre', 'Times New Roman', serif;
  --font-body: 'Heebo', -apple-system, 'Segoe UI', 'Noto Sans Hebrew', Arial, sans-serif;

  --tap: 44px;
  --radius-pill: 999px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1D31; --ink: #E6EEF5; --muted: #A3BACD; --line: #2E4E6E; --surface: #12304F;
    --sea: #1A4064; --wall: #3D6489; --rim: #4F7DA3; --route: #4A719A;
    --accent: #2C6DA3; --accent-ink: #FFFFFF; --accent-text: #8EC3EE; --off: #8AA2B8;
    --sun: #F2B544; --toast-bg: #E6EEF5; --toast-fg: #0B1D31; --scrim: rgba(0, 0, 0, 0.5);
    --ice-top: #D6E6F2; --ice-face: #86A9C7; --ice-line: #4F7DA3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1D31; --ink: #E6EEF5; --muted: #A3BACD; --line: #2E4E6E; --surface: #12304F;
  --sea: #1A4064; --wall: #3D6489; --rim: #4F7DA3; --route: #4A719A;
  --accent: #2C6DA3; --accent-ink: #FFFFFF; --accent-text: #8EC3EE; --off: #8AA2B8;
  --sun: #F2B544; --toast-bg: #E6EEF5; --toast-fg: #0B1D31; --scrim: rgba(0, 0, 0, 0.5);
  --ice-top: #D6E6F2; --ice-face: #86A9C7; --ice-line: #4F7DA3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 440px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

/* playtest bar: owner-only, plain utility look */
.playtest {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px; border: 1px dashed var(--rim); border-radius: 12px; font-size: 14px;
}
.seg { display: flex; border: 1px solid var(--rim); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { min-height: 36px; padding: 0 12px; border: 0; background: transparent; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pt-nav { display: flex; align-items: center; gap: 4px; }
.pt-nav button { width: 36px; height: 36px; border: 1px solid var(--rim); border-radius: 18px; background: var(--surface); font-size: 18px; line-height: 1; }
.pt-nav button:disabled { opacity: 0.35; cursor: default; }
.pt-label { min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.pt-compare { min-height: 36px; padding: 0 12px; border: 1px solid var(--rim); border-radius: var(--radius-pill); background: var(--surface); }

.top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.wordmark { margin: 0; font: 900 27px/1 var(--font-display); white-space: nowrap; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav button { min-height: var(--tap); padding: 0 6px; border: 0; background: transparent; font-weight: 500; font-size: 15px; border-radius: 8px; white-space: nowrap; }
.nav button.round { width: 40px; min-height: 40px; height: 40px; padding: 0; border: 1.5px solid var(--ink); border-radius: 22px; font-weight: 700; font-size: 17px; }
.nav button.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; border-width: 1.5px; }
.nav button.avatar .initial:empty { display: none; }
.nav button.avatar.signed svg { display: none; }
.nav button.avatar.signed { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font: 700 18px/1 var(--font-display); }
/* a suggestion waits in המסע שלי */
.nav button.avatar.dot::after { content: ""; position: absolute; top: -2px; inset-inline-end: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--sun); border: 2px solid var(--bg); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.banner button { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--radius-pill); background: var(--ink); color: var(--bg); font-weight: 500; }
.banner #banner-text { flex: 1; }
.banner .banner-x { min-width: 36px; padding: 0; background: transparent; color: var(--muted); font-size: 20px; }

.play { display: flex; flex-direction: column; gap: 12px; }

.rank { display: flex; flex-direction: column; }
.rank-btn { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 0; border: 0; background: transparent; text-align: start; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; width: 100%; min-height: 32px; }
.rank-name { font: 700 20px/1.2 var(--font-display); }
.score { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.voyage { display: block; width: 100%; height: auto; overflow: visible; }
.voyage-next { font-size: 13px; line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-sea { fill: var(--sea); stroke: var(--rim); stroke-width: 1; }
.v-wall { fill: url(#ice-g); }
.v-wall-edge { fill: none; stroke: var(--ice-line); stroke-width: 1.4; stroke-linejoin: round; }
.v-face { fill: var(--ice-face); opacity: 0.75; }
.v-brick { fill: none; stroke: var(--ice-line); stroke-width: 0.9; }
.stop-top { stop-color: var(--ice-top); }
.stop-face { stop-color: var(--ice-face); }
.v-equator { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.v-route { stroke: var(--rim); stroke-width: 1.5; stroke-dasharray: 4 4; }
.v-done { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.v-stop { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.v-stop.on { fill: var(--ink); }
.v-pole { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.v-ship path { fill: var(--accent-text); }
.v-flag path { fill: var(--sun); }
.v-ship .mast, .v-flag .mast { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.v-ship, .v-flag { transition: transform 0.5s ease; }
.v-label { font: 400 11px var(--font-body); fill: var(--muted); text-anchor: middle; }

.found-wrap { position: relative; z-index: 5; }
.found-toggle {
  width: 100%; min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; text-align: start; font-size: 15px;
}
.found-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
.found-count { font-weight: 700; white-space: nowrap; }
.found-toggle[aria-expanded="true"] .caret { display: inline-block; transform: rotate(180deg); }
.found-panel {
  display: none; position: absolute; inset-inline: 0; top: calc(100% + 6px);
  max-height: 58vh; overflow: auto; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(14, 42, 71, 0.14);
}
.found-panel.open { display: flex; flex-direction: column; gap: 12px; }
.found-panel h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0.3px; }
.found-panel h3 + .words { margin-bottom: 12px; }
/* the found list opens on the map: the familiar words inside the ice wall,
   rare finds and secrets as lands beyond it */
.lands { position: relative; flex-shrink: 0; display: grid; grid-template-columns: minmax(118px, 40%) 1fr; min-height: 150px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.lands-map { position: absolute; inset-block: 0; inset-inline-start: 0; width: 40%; min-width: 118px; height: 100%; }
.lands-count { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding-inline-start: 16px; }
.lands-count span { font-size: 12px; color: var(--muted); }
.lands-count b { font: 700 34px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.lands-count span:last-child { font-size: 13px; }
.lands-beyond { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 12px; min-width: 0; }
.lands-title { font-size: 12px; color: var(--muted); }
.isles { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; }
.isle { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1.5px solid var(--rim); background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1.4; }
.isle.secret { border-color: var(--sun); color: var(--accent-text); font-weight: 700; }
.isle.hidden { border-style: dashed; background: transparent; font-weight: 700; }
.isle .diamond, .log .diamond { display: inline-block; box-sizing: content-box; width: 7px; height: 7px; border: 1.5px solid currentColor; transform: rotate(45deg); }
.lands-empty { font-size: 13px; color: var(--muted); }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px 12px; margin: 0; padding: 0; list-style: none; }
.words li { font-size: 16px; padding-block: 3px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.words li.all { font-weight: 700; }
.words li.all::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--sun); vertical-align: middle; }
.words li.off { color: var(--off); }
.words li.beyond { color: var(--muted); }
.words li.secret { font-weight: 700; color: var(--accent-text); }
.words li.secret::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border: 1.5px solid currentColor; transform: rotate(45deg); vertical-align: middle; }
.words li.miss { color: var(--muted); }
.bonus { margin-inline-start: 6px; font-size: 13px; color: var(--accent-text); white-space: nowrap; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.picks button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); font-size: 15px; }
.picks button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.picks button .tag { margin-inline-start: 6px; font-size: 11px; font-weight: 700; }
.picks button .tag:empty { display: none; }
.picks button[data-label="plural"], .picks button[data-label="prefix"], .picks button[data-label="notword"],
.picks button[data-label="name"], .picks button[data-label="spelling"], .picks button[data-label="intj"], .picks button[data-label="notgame"] { text-decoration: line-through; color: var(--muted); border-style: dashed; }
.picks button[data-label="map"], .picks button[data-label="beyond"], .picks button[data-label="ok"] { border-color: var(--ink); }
.picks.review button[aria-pressed="true"] { border-color: var(--accent); background: transparent; color: var(--accent-text); font-weight: 700; }
.brushes { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.brush-title { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.brushes button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.picks.plain span { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: 15px; }
.empty { margin: 0; color: var(--muted); font-size: 15px; }

.entry { min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.typed { display: flex; align-items: center; gap: 1px; min-height: 46px; font: 700 34px/1 var(--font-display); }
.typed .ch.pole { color: var(--accent-text); }
.typed .ch.bad { color: var(--off); }
.typed .caret-line { width: 2px; height: 34px; background: var(--accent-text); margin-inline-start: 2px; animation: blink 1.1s steps(1) infinite; }
.typed .ph { font: 400 17px/1 var(--font-body); color: var(--muted); }
.typed.shake { animation: shake 0.32s ease; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.toast { min-height: 26px; font-size: 14px; text-align: center; }
.toast span { display: inline-block; max-width: 100%; background: var(--toast-bg); color: var(--toast-fg); padding: 3px 12px; border-radius: 14px; }
.toast span.tip { padding: 6px 14px; border-radius: 12px; font-size: 15px; line-height: 1.45; cursor: pointer; }

.board { position: relative; width: min(330px, 100%); aspect-ratio: 1; align-self: center; max-width: 100%; }
.disc { position: absolute; inset: 0; width: 100%; height: 100%; }
.disc-rim { fill: var(--surface); stroke: var(--rim); stroke-width: 1.25; }
.disc-ticks { fill: none; stroke: var(--rim); stroke-width: 1; }
.disc-sea { fill: var(--sea); }
.disc-meridian { fill: none; stroke: var(--route); stroke-width: 0.75; opacity: 0.7; }
.disc-route { fill: none; stroke: var(--route); stroke-width: 1; stroke-dasharray: 4 4; }
.disc-route.faint { opacity: 0.6; }
.ice-shadow { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linejoin: round; opacity: 0.14; }
.ice-top { fill: var(--ice-top); stroke: var(--ice-line); stroke-width: 1; stroke-linejoin: round; }
.ice-face { fill: var(--ice-face); }
.ice-joint { fill: none; stroke: var(--ice-line); stroke-width: 0.8; stroke-linecap: round; }
.berg { fill: var(--ice-top); stroke: var(--ice-line); stroke-width: 0.8; stroke-linejoin: round; }
.disc-glow { fill: none; stroke: var(--accent-text); stroke-width: 9; opacity: 0; }
.board.wall-hit .disc-glow { animation: wallglow 1.6s ease; }
.board.secret-hit .disc-rim { animation: secretglow 1.4s ease; }
@keyframes secretglow { 0% { stroke: var(--rim); stroke-width: 1.25; } 35% { stroke: var(--sun); stroke-width: 5; } 100% { stroke: var(--rim); stroke-width: 1.25; } }
@keyframes wallglow { 0% { opacity: 0; } 30% { opacity: 0.55; } 100% { opacity: 0; } }

.tile {
  position: absolute; width: 24.8%; height: 24.8%; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; padding: 0;
  border: 1.5px solid var(--rim); border-radius: 50%; background: var(--surface); color: var(--ink);
  font: 700 min(38px, 10vw)/1 var(--font-display);
  transition: left 0.35s ease, top 0.35s ease, background 0.12s ease;
}
.tile:active, .tile.press { background: var(--sea); }
.tile.pole { width: 26.7%; height: 26.7%; border: 3px solid var(--surface); background: var(--accent); color: var(--accent-ink); font-size: min(40px, 10.5vw); }
.tile.pole:active, .tile.pole.press { background: var(--ink); }
.tile .badge {
  position: absolute; top: -4px; inset-inline-end: -4px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 11px; background: var(--ink); color: var(--bg); font: 700 12px/22px var(--font-body); text-align: center;
}
.tile .badge.done { background: var(--surface); color: var(--muted); border: 1px solid var(--line); line-height: 20px; }

.controls { display: flex; justify-content: center; gap: 14px; }
.btn { min-width: 96px; min-height: 48px; padding: 0 18px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: 24px; font-weight: 500; font-size: 16px; }
.btn.icon { min-width: 48px; width: 48px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.icon.spin svg { animation: spin 0.35s ease; }
@keyframes spin { to { transform: rotate(-180deg); } }

/* sheets */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.sheet {
  position: fixed; z-index: 21; inset-inline: 0; bottom: 0; margin: 0 auto; max-width: 480px; max-height: 86vh;
  display: flex; flex-direction: column; background: var(--bg); border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
}
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 4px; }
.sheet-head h2 { margin: 0; font: 700 22px/1.2 var(--font-display); text-wrap: balance; }
.sheet-head h2:focus { outline: none; }
.sheet-body .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.sheet-body .more.share { align-self: flex-start; }
.suggest { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-inline-start: 3px solid var(--sun); border-radius: 10px; background: var(--surface); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.field input, .field textarea { font: 400 17px/1.4 var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.note.err { color: var(--ink); font-weight: 500; }
.note.err:empty { display: none; }
.credits-box summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted); min-height: var(--tap); display: flex; align-items: center; }
.credits-box .credits { display: flex; flex-direction: column; gap: 8px; }
.close { width: var(--tap); height: var(--tap); border: 0; background: transparent; font-size: 28px; line-height: 1; }
.sheet-body { padding: 4px 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-body h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.3px; color: var(--muted); }
.summary { margin: 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.summary strong { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li { display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); font-variant-numeric: tabular-nums; }
.chips li b { font-family: var(--font-display); font-size: 18px; }
.chips li.done { color: var(--muted); }
.more { align-self: flex-start; min-height: var(--tap); padding: 0 18px; border: 1.5px solid var(--ink); border-radius: var(--radius-pill); background: transparent; font-weight: 500; }
.note { margin: 0; font-size: 14px; color: var(--muted); }
.prose p, .prose li { max-width: 60ch; }
.prose ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose p { margin: 0; }
.mini-board { display: inline-flex; gap: 4px; vertical-align: middle; }
.mini-board span { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rim); display: inline-flex; align-items: center; justify-content: center; font: 700 15px/1 var(--font-display); background: var(--surface); }
.mini-board span.pole { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.kbd { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.kbd-row { display: flex; gap: 4px; justify-content: center; width: 100%; }
.kbd-row:nth-child(2) { padding-inline-start: 12px; }
.kbd-row:nth-child(3) { padding-inline-start: 30px; }
.key { flex: 1 1 0; max-width: 34px; min-width: 0; height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 10px; line-height: 1; }
.key b { font: 700 16px/1 var(--font-display); color: var(--ink); }
.key.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.key.on b { color: var(--accent-ink); }
.key.blank { visibility: hidden; }
.ladder-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.ladder-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ladder-list li.on { font-weight: 700; }
.ladder-list li.now { color: var(--accent-text); }

.table-wrap { overflow-x: auto; }
table.cmp { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.cmp th, table.cmp td { padding: 6px 8px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cmp th { color: var(--muted); font-weight: 500; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools button { min-height: 40px; padding: 0 14px; border: 1px solid var(--rim); border-radius: var(--radius-pill); background: var(--surface); }
textarea.dump { width: 100%; min-height: 120px; font: 12px/1.4 ui-monospace, Menlo, monospace; direction: ltr; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

/* the edge: top-rank screen */
.edge {
  position: fixed; inset: 0; z-index: 30; overflow: auto;
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
  padding: calc(40px + env(safe-area-inset-top, 0px)) 28px calc(32px + env(safe-area-inset-bottom, 0px));
  background: var(--edge-bg); color: var(--edge-ink);
}
.edge-eyebrow { font-size: 15px; color: var(--edge-muted); letter-spacing: 0.5px; }
.edge-disc { flex-shrink: 0; width: 150px; height: 150px; overflow: visible; }
.e-rim { fill: #FFFFFF; }
.e-sea { fill: var(--edge-sea); }
.e-route { fill: none; stroke: var(--edge-route); stroke-width: 1; stroke-dasharray: 4 4; }
.ice-top.night { fill: #FFFFFF; stroke: #9DBBD3; }
.ice-face.night { fill: #C9DCEA; }
.ice-joint.night { stroke: #9DBBD3; }
.ice-shadow.night { stroke: #000000; opacity: 0.25; }
.e-path { fill: none; stroke: var(--edge-sun); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.e-stop { fill: var(--edge-sun); }
.e-pole { fill: #FFFFFF; }
.e-sun { fill: var(--edge-sun); stroke: var(--edge-bg); stroke-width: 2; }
.edge-copy h2 { margin: 0; font: 900 44px/1.1 var(--font-display); }
.edge-copy p { margin: 10px 0 0; font-size: 17px; line-height: 1.6; color: var(--edge-muted); }
.log { width: 100%; max-width: 360px; display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--edge-line); border-radius: 12px; text-align: start; }
.log h3 { margin: 0 0 6px; font: 700 18px/1.5 var(--font-display); }
.log dl { margin: 0; display: flex; flex-direction: column; }
.log dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--edge-line); }
.log dt { font-size: 15px; color: var(--edge-muted); }
.log dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.log h4 { margin: 12px 0 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.3px; color: var(--edge-muted); }
.log ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.log li { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.log .diamond { margin-inline: 2px; border-color: var(--edge-muted); }
.log li.got .diamond { background: var(--edge-sun); border-color: var(--edge-sun); }
.log li b { font-size: 16px; }
.log .pts { margin-inline-start: auto; color: var(--edge-sun); font-weight: 700; font-variant-numeric: tabular-nums; }
.log .bar { display: inline-block; width: 72px; max-width: 60%; height: 14px; border-radius: 2px; background: var(--edge-line); }
.log .stamp { margin-inline-start: auto; padding: 0 6px; border: 1px solid var(--edge-route); border-radius: 4px; font-size: 12px; letter-spacing: 1px; color: var(--edge-muted); }
.edge-actions { margin-top: auto; display: flex; gap: 12px; width: 100%; max-width: 360px; }
.edge-actions .btn { flex: 1; min-width: 0; }
.btn.light { background: #FFFFFF; color: var(--edge-bg); border-color: #FFFFFF; font-weight: 700; min-height: 52px; }
.btn.ghost { min-height: 52px; }
.btn.ghost { background: transparent; color: var(--edge-ink); border-color: var(--edge-muted); }
.edge.enter .edge-disc { animation: drift 1.2s ease both; }
@keyframes drift { from { transform: rotate(-40deg) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 960px) {
  .app { max-width: 900px; display: grid; grid-template-columns: 440px 1fr; column-gap: 40px; align-items: start; }
  .playtest, .top, .banner { grid-column: 1 / -1; }
  .play { display: contents; }
  .rank, .entry, .board, .controls { grid-column: 1; }
  .board { justify-self: center; }
  .found-wrap { grid-column: 2; grid-row: span 4; align-self: stretch; }
  .found-toggle { display: none; }
  .found-panel { display: flex; flex-direction: column; gap: 12px; position: static; max-height: 640px; box-shadow: none; }
}
@media (max-height: 700px) {
  .entry { min-height: 60px; }
  .board { width: min(300px, 100%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* account and history */
.acct { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.more.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.history button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: start; }
.history .mini-board span { width: 22px; height: 22px; font-size: 13px; }
.history .h-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history .h-what b { font-weight: 500; font-size: 15px; }
.history .h-what span { font-size: 13px; color: var(--muted); }
.history .h-nums { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); white-space: nowrap; }
.history li.unplayed { opacity: 0.6; }

/* the owner's quick review: a row per word, one tap per verdict */
.rv-top { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rv-list { margin: 0; padding: 0; list-style: none; }
.rv { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "w d" "acts acts" "why why"; column-gap: 8px; row-gap: 6px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rv-w { grid-area: w; font: 700 19px/1.3 var(--font-display); overflow-wrap: anywhere; }
.rv[data-kind="notgame"] .rv-w { color: var(--muted); text-decoration: line-through; }
.rv[data-kind="notword"] .rv-w { color: var(--muted); text-decoration: line-through double; }
.rv[data-kind="missing"] .rv-w { color: var(--accent-text); }
.rv-dict { grid-area: d; display: flex; gap: 12px; font-size: 13px; }
.rv-dict a { color: var(--accent-text); text-underline-offset: 2px; }
.rv-acts { grid-area: acts; display: flex; flex-wrap: wrap; gap: 6px; }
.rv-b { min-height: 40px; padding: 0 10px; border: 1px solid var(--rim); border-radius: var(--radius-pill); background: var(--surface); font-size: 14px; white-space: nowrap; }
.rv-b[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 700; }
.rv-secret[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: #0E2A47; }
.rv-why { grid-area: why; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
.rv-r { min-height: 32px; padding: 0 10px; border: 1px dashed var(--rim); border-radius: var(--radius-pill); background: transparent; font-size: 13px; color: var(--muted); }
.rv-r[aria-pressed="true"] { border-style: solid; border-color: var(--ink); color: var(--ink); font-weight: 700; }
.toast-act { margin-inline-start: 10px; padding: 0 10px; min-height: 26px; border: 1px solid currentColor; border-radius: 13px; background: transparent; color: inherit; font: inherit; font-weight: 700; }
.rv-update { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.rv-update .note { flex: 1 1 200px; }
.more:disabled { opacity: 0.45; cursor: default; }
.text-btn { align-self: flex-start; min-height: var(--tap); padding: 0; border: 0; background: transparent; color: var(--accent-text); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.privacy-row { display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.erase { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.erase .row { display: flex; gap: 8px; }
.rv-done { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Before the launch: the game's frame, no board (players; the owner signs in from here) */
section.soon { margin: 48px auto; max-width: 320px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
section.soon h2 { font-family: var(--font-display, inherit); font-size: 28px; margin: 0; }
section.soon p { color: var(--muted); margin: 0; }
body.prelaunch main.play, body.prelaunch #open-prev, body.prelaunch #open-hints { display: none; }

/* Narrow phones (320–374 px): the header fits on one line */
@media (max-width: 374px) {
  .app { padding-inline: 12px; }
  .wordmark { font-size: clamp(20px, 6.4vw, 27px); }
  .nav { gap: 2px; }
  .nav button { padding: 0 4px; font-size: 14px; }
  .nav button.round { width: 36px; height: 36px; min-height: 36px; }
}
