/* Word Ridge — own stylesheet. Blue + yellow (family rule: Word Turf blue+orange, Letter Flick blue+red). */
:root {
  --bg: #0b1d3a;
  --bg-2: #122b55;
  --tile: #1e4d8f;
  --tile-filled: #2a63b3;
  --tile-locked: #163a70;
  --tile-edge: rgba(0, 0, 0, .35);
  --accent: #facc15;
  --accent-ink: #1f1a00;
  --text: #f4f7fc;
  --muted: #9fb6d9;
  --cell: 40px;
  --gap: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px 24px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 8px 14px; cursor: pointer;
}
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.muted { color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; max-width: 560px; margin: 0 auto; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.topbar h1 span { color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; }
.topbar-actions button { padding: 6px 10px; font-size: 13px; }

main { max-width: 560px; margin: 0 auto; }

#home { text-align: center; padding-top: 28px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
#home h2 { margin: 0; font-size: 26px; line-height: 1.2; }
#home button { width: min(100%, 300px); padding: 12px 16px; font-size: 16px; }
#home p { margin: 0; }
#home-stats { font-size: 14px; }
.game-label { text-align: center; font-size: 13px; margin: 0 0 14px; }   /* the game's name between the play bar and the board (2026-09-15): also keeps Home away from the top tiles */
.card .stats { margin: 0; color: var(--accent); font-weight: 700; font-size: 15px; }
/* the victory card (2026-09-15): the climb bar big, the countdown, the sister games */
.card.victory { text-align: center; }
.climb-big { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 62px; margin: 2px 0; }
.climb-big .dot { width: 30px; }
.climb-big .dot.ridge { width: 38px; }
.climb-big .dot.ridge::after { width: 18px; height: 18px; }
.countdown { font-variant-numeric: tabular-nums; }

/* the free-play picker (2026-09-21): a row of Easy / Medium / Hard, the one on show lit, then the list's grid */
.pick { width: min(100%, 300px); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.cats { display: flex; gap: 6px; width: 100%; }
#home .cats button { flex: 1; width: auto; padding: 8px 4px; font-size: 14px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cats button small { font-weight: 500; font-size: 11px; color: var(--muted); }
.cats button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cats button.on small { color: var(--accent-ink); opacity: .75; }
.pick-count { font-size: 13px; }
.pick-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; width: 100%; }
#home .pick-grid button { width: auto; padding: 9px 0; font-weight: 700; font-size: 13px; position: relative; }
.pick-grid button.done { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pick-grid button.progress::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.pick-grid button.done.progress::after { background: var(--accent-ink); }   /* a replay in progress: dark dot on the solved yellow */

/* sister games (design call, 2026-09-15): mini tile marks + taglines, on Home and the victory card. Navigation
   links only — Ridge draws the marks with its own CSS and fetches nothing from the other sites. */
/* Quiet on purpose (Jeff, 2026-09-15: "too prominent — don't want people to leave before they play"):
   no boxes, small marks, muted text; a footnote under the play buttons, not a button. */
.sister-row { width: min(100%, 300px); display: flex; flex-direction: column; gap: 4px; align-items: center; margin-top: 10px; opacity: .8; }
.sister-row .small { font-size: 11px; text-align: center; margin: 0 0 2px; letter-spacing: .04em; }
.sister { display: flex; align-items: center; gap: 9px; padding: 3px 6px; color: var(--muted); text-decoration: none; }
.mini { display: grid; gap: 1px; flex: none; }
.mini.wt { grid-template-columns: repeat(4, 11px); }
.mini.lf { grid-template-columns: repeat(2, 14px); }
.mini i { font-style: normal; font-weight: 800; font-size: 7px; line-height: 1; display: grid; place-items: center; height: 11px; border-radius: 2px; color: #fff; }
.mini.lf i { height: 14px; font-size: 9px; border-radius: 3px; }
.mini.wt .b { background: #5b8cff; } .mini.wt .o { background: #ffa22d; }
.mini.lf .b { background: #2058e8; } .mini.lf .o { background: #e07b00; }
.sister-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 0; }
.sister-name { font-weight: 600; font-size: 13px; color: var(--text); }
.sister-tag { font-size: 11px; color: var(--muted); }
.sister-row.compact { margin-top: 2px; }

.playbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0 12px; }
/* the climb: blocks rise from the 3x3 to the ridge; heights are set inline per stage */
#stage-dots { display: flex; gap: 6px; align-items: flex-end; height: 38px; }
.dot { position: relative; width: 20px; border-radius: 5px 5px 3px 3px; background: var(--bg-2); border: 1px solid rgba(255, 255, 255, .1); box-sizing: border-box; }
.dot.lit { background: var(--accent); border-color: var(--accent); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the ridge itself: the same flat-top block, tallest and a little wider (a peaked silhouette was tried and read as
   noise), with a star cut out of its middle — a page-coloured star laid over the block reads as a hole */
.dot.ridge { width: 26px; }
.dot.ridge::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%); background: var(--bg);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

#board-wrap { display: flex; justify-content: center; position: relative; }
#board { display: grid; grid-template-columns: repeat(var(--n), var(--cell)); grid-auto-rows: var(--cell); gap: var(--gap); }
.cell {
  width: var(--cell); height: var(--cell); border-radius: 7px; background: var(--tile);
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--cell) * .55);
  text-transform: uppercase; user-select: none; cursor: pointer;
  box-shadow: inset 0 -3px 0 var(--tile-edge), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.cell { position: relative; }
.cell.filled { background: var(--tile-filled); }
/* while a word is held: an arrow marks the first box of each slot it could start in */
.cell[data-start]::after {
  content: '\2192'; position: absolute; top: 1px; right: 3px; line-height: 1;
  font-size: calc(var(--cell) * .32); font-weight: 800; color: var(--accent);
}
.cell[data-start="D"]::after { content: '\2193'; }
.cell[data-start="AD"]::after { content: '\2192\2193'; }
.cell.bad { box-shadow: inset 0 0 0 2px rgba(248, 113, 113, .9), inset 0 -3px 0 var(--tile-edge); }
.cell.ghost { box-shadow: inset 0 0 0 3px var(--accent), inset 0 -3px 0 var(--tile-edge); }
.cell.ghost:not(.filled) { color: rgba(250, 204, 21, .75); }
.cell.locked { background: var(--tile-locked); color: #d6e3f8; cursor: default; }
.cell.len-hint { box-shadow: inset 0 0 0 2px rgba(250, 204, 21, .5), inset 0 -3px 0 var(--tile-edge); }
.cell.sel { box-shadow: inset 0 0 0 3px var(--accent), inset 0 -3px 0 var(--tile-edge); }
.cell.new { animation: pop .35s cubic-bezier(.2, .9, .3, 1.3) both; }
.cell.shake { animation: shake .3s linear; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* victory: tiles ripple gold from the centre, sparkles burst from the board, the climb bar hops */
/* Compositor-friendly (Android Chrome, 2026-09-14): the tile animates TRANSFORM only (winPop) plus a two-step colour
   snap (winGold); the glow lives on ::after and animates OPACITY only. Mixing transform with box-shadow in one
   animation forced every tile onto the main thread for the whole ripple — 70 repaints per frame on a phone. */
.cell.win { animation: winPop var(--dur, 1.2s) cubic-bezier(.3, .8, .3, 1.2) both, winGold var(--dur, 1.2s) steps(1, end) both; animation-delay: var(--d, 0ms); will-change: transform; }
.cell.win::after { content: ''; position: absolute; inset: -2px; border-radius: 9px; box-shadow: 0 0 18px 2px rgba(250, 204, 21, .85); opacity: 0; pointer-events: none;
  animation: winGlow var(--dur, 1.2s) ease-out both; animation-delay: var(--d, 0ms); will-change: opacity; }
@keyframes winPop { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(var(--tilt, -4deg)); } 100% { transform: scale(1); } }
@keyframes winGlow { 0% { opacity: 0; } 30% { opacity: 1; } 75% { opacity: 0; } 100% { opacity: 0; } }
#board.flight .cell { will-change: transform, opacity; }
/* the gold snaps on and off (steps) — tweening blue→yellow passes through a muddy grey-green */
@keyframes winGold { 0% { background: var(--tile-filled); color: inherit; } 22% { background: var(--accent); color: var(--accent-ink); } 62% { background: var(--tile-filled); color: inherit; } 100% { background: var(--tile-filled); color: inherit; } }
#sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.spark { position: absolute; color: var(--accent); text-shadow: 0 0 8px rgba(250, 204, 21, .9); line-height: 1; animation: spark 1.8s ease-out both; will-change: transform, opacity; }
@keyframes spark { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(240deg); } }
/* floating cheers: rise from the board and drift off past the top */
#floaters { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
/* start at the board's bottom edge, rise the board's own height plus a margin (--rise, set per board); 3.2 s each
   (Jeff, 2026-09-15: slower again) on a half-alpha pill so the words read over the gold tiles */
.floater { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 0); font-weight: 900; font-size: 30px; letter-spacing: .5px; color: var(--accent); white-space: nowrap;
  padding: 6px 16px; border-radius: 14px; background: rgba(11, 29, 58, .55); text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  animation: floatUp 3.2s cubic-bezier(.2, .7, .3, 1) both; will-change: transform, opacity; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.7); } 10% { opacity: 1; transform: translate(-50%, -24px) scale(1.06); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, calc(-1 * var(--rise, 320px))) scale(1); } }
.dot.hop { animation: hop .5s ease-out both; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }

#words { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
#solved-bar { width: 100%; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding-bottom: 4px; }
.solved-tag { color: var(--accent); font-weight: 800; letter-spacing: .5px; }
.pill { font-size: 12px; color: var(--muted); border: 1px dashed rgba(255, 255, 255, .22); border-radius: 999px; padding: 4px 10px; }
#chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { text-transform: uppercase; letter-spacing: 1px; font-weight: 700; padding: 10px 14px; border-radius: 10px; background: var(--bg-2); }
.chip.held { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.placed { text-decoration: line-through; opacity: .45; }
.chip.dim { opacity: .3; }
.chip.enter { animation: slidein .3s ease-out both; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* copyright line: a tap target for About that reads as plain footer text */
.site-footer { text-align: center; padding: 28px 12px 8px; }
.site-footer button { background: none; border: none; color: var(--muted); font-size: 12px; letter-spacing: .3px; padding: 4px 10px; }
.site-footer button:hover { color: var(--text); }
/* the lift (design call, 2026-09-16): a small underlined line above the copyright that skips the rest of the climb —
   quiet on purpose, a footnote under the words, never a button beside the play controls */
.lift-row { text-align: center; margin: 26px 0 0; }
.lift-row button { background: none; border: none; color: var(--muted); font-size: 12px; letter-spacing: .3px; padding: 8px 12px;
  text-decoration: underline; text-decoration-color: rgba(159, 182, 217, .45); text-underline-offset: 3px; }
.lift-row button:hover { color: var(--text); text-decoration-color: currentColor; }
.lift-card { text-align: center; }
.lift-card p { font-size: 17px; }
.lift-actions { display: flex; gap: 10px; justify-content: center; }
.lift-actions button { min-width: 110px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px;
  padding: 10px 14px; border-radius: 10px; max-width: calc(100% - 32px); text-align: center; z-index: 5;
  cursor: pointer; user-select: none;   /* tap to dismiss (2026-09-19) */
}
.overlay { position: fixed; inset: 0; background: rgba(4, 12, 28, .78); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.card {
  background: var(--bg-2); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 20px;
  max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 12px;
}
.card h2 { margin: 0; }
/* About (2026-09-14): the Word Turf About, in Ridge's colours — centred, tagline, credits, Go to SCS / Close */
.about-card { text-align: center; }
.about-card a { color: var(--accent); }
.about-tagline { color: var(--muted); font-size: 15px; }
.about-credits { font-size: 14px; line-height: 1.5; }
.about-actions { display: flex; gap: 10px; justify-content: center; }
.about-actions button { min-width: 120px; }
button.subtle { align-self: center; font-size: 13px; padding: 8px 14px; color: var(--muted); background: transparent; border: 1px solid rgba(255, 255, 255, .15); }
#home button.subtle { padding: 9px 14px; font-size: 14px; }
.card ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.4; }
.card p { margin: 0; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .cell.new, .cell.shake, .chip.enter, .cell.win, .cell.win::after, .spark, .dot.hop, .floater { animation: none; }
  .floater { display: none; }
}
