/* Shrimply's page (SPEC 8.1, 7.2). The scene is a canvas scaled up with
   pixelated rendering; everything else is plain DOM in the UI palette, in
   the system monospace stack with smoothing off, as Wormillion's is. */
:root {
  color-scheme: dark;
  --sea-900: #0d1b2a;
  --sea-800: #13283d;
  --sea-700: #1a3552;
  --line: #2c4a66;
  --cream: #f6ead6;
  --cream-dim: #b9c3cc;
  --shrimp: #ff8a6b;
  --coral: #ff6f59;
  --amber: #ffb648;
  --good: #6fd08c;
  --bad: #ff6b6b;
  --font: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--sea-900);
  color: var(--cream);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button {
  background: var(--sea-800);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--cream-dim); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--coral); border-color: var(--coral); color: var(--sea-900); font-weight: bold; }
button.primary:hover:not(:disabled) { background: var(--shrimp); border-color: var(--shrimp); }
button.big { font-size: 1.25em; padding: 10px 18px; width: 100%; }
[hidden] { display: none !important; }
.dim { color: var(--cream-dim); }
.warn { color: var(--amber); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---- the shell (8.1) ---- */
.app { height: 100dvh; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
/* With the phone keyboard up the shell is the visible part (ui.js). */
body.keyboard .app { position: fixed; left: 0; right: 0; top: var(--app-top, 0); height: var(--app-h, 100dvh); }
.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.wordmark { margin: 0; font-size: 18px; letter-spacing: 0.3em; color: var(--shrimp); }
button.icon { width: 36px; height: 32px; padding: 0; font-weight: bold; }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.bars i { display: block; width: 4px; background: var(--cream); }
.bars i:nth-child(1) { height: 7px; }
.bars i:nth-child(2) { height: 14px; }
.bars i:nth-child(3) { height: 10px; }

.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); grid-template-rows: minmax(0, 1fr); }
.scene { position: relative; overflow: hidden; background: #0a1522; min-height: 160px; }
#map { display: block; image-rendering: pixelated; touch-action: none; }
.panel { overflow: auto; padding: 12px 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; scroll-padding-bottom: 100px; }
@media (max-width: 860px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 50dvh) minmax(0, 1fr); }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  /* While typing on a phone the map gives way to the newest clue and the
     box, which is all that fits above the keyboard (ui.js). */
  body.keyboard .stage { grid-template-rows: 0 minmax(0, 1fr); }
  body.keyboard .scene { min-height: 0; }
}
.view { display: flex; flex-direction: column; gap: 10px; }
.view h2 { margin: 0; font-size: 16px; }
.official-home { margin: auto 0 0; font-size: 12px; color: var(--cream-dim); }

/* ---- hop and recenter (3.13) ---- */
.hops { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; }
.hops button { width: 36px; height: 34px; padding: 0; background: rgba(13, 27, 42, 0.82); }
.zoom-reset { position: absolute; right: 8px; top: 8px; width: 36px; height: 34px; padding: 0; background: rgba(13, 27, 42, 0.82); font-size: 18px; }

/* ---- the title (8.2, minimal until M9) ---- */
.howto { margin: 0; padding-left: 1.4em; }
.howto li { margin: 2px 0; }
.countdown { margin: 0; color: var(--cream-dim); }

/* ---- playing (8.3) ---- */
.play-head { display: flex; align-items: center; gap: 10px; }
.pips { display: inline-flex; gap: 4px; }
.pips canvas { width: 24px; height: 18px; image-rendering: pixelated; }
.clue-count { font-weight: bold; }
.clue-count.last { color: var(--amber); }
.clues { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.clues li { background: var(--sea-800); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.clues li .n { color: var(--cream-dim); margin-right: 6px; }
.clues li.fresh { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--sea-700); border-color: var(--amber); } }
.clues .flag { display: block; margin-top: 6px; }
.clues li.last-flag { border-color: var(--amber); color: var(--amber); font-weight: bold; }
.flag { image-rendering: pixelated; border: 1px solid var(--line); height: 32px; }
.guess { position: relative; display: flex; gap: 8px; }
.guess input { flex: 1; min-width: 0; background: #0a1522; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 16px; }
.guess input:focus { outline: 2px solid var(--shrimp); outline-offset: 0; }
.dropdown { position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 4px; padding: 4px; list-style: none; background: var(--sea-800); border: 1px solid var(--line); border-radius: 6px; z-index: 5; overflow-y: auto; overscroll-behavior: contain; }
.dropdown li { padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.dropdown li[aria-selected="true"], .dropdown li:hover { background: var(--line); }
.message { margin: 0; min-height: 1.45em; color: var(--amber); }
.dock { position: sticky; bottom: -12px; margin: 0 -14px -12px; padding: 8px 14px 10px; background: var(--sea-900); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; z-index: 4; }

/* ---- results (8.4) and stats (8.5) ---- */
.headline { margin: 0; font-size: 20px; }
.answer { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: bold; }
.clues.all li a { color: #7ec8ff; margin-left: 6px; white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stat-grid b { display: block; font-size: 20px; }
.stat-grid span { font-size: 12px; color: var(--cream-dim); }
.dist { display: grid; grid-template-columns: 1.6em 1fr; gap: 3px 6px; align-items: center; margin-top: 8px; }
.dist .dist-bar { display: block; background: var(--line); color: var(--cream); text-align: right; padding: 0 6px; border-radius: 3px; min-width: 1.6em; }
.dist .dist-bar.you { background: var(--coral); color: var(--sea-900); }
.manual-copy { width: 100%; background: #0a1522; color: var(--cream); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; resize: none; }
.back { align-self: flex-start; }
.compare-hist { margin-top: 4px; }

/* ---- the legend (8.2), credits and the footer (9.6) ---- */
.legend h3 { margin: 14px 0 6px; font-size: 14px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.3; }
.legend-icon { width: 60px; height: auto; image-rendering: pixelated; flex: none; }
.legend-note { font-size: 12px; margin: 6px 0 0; }
.footer { font-size: 12px; color: var(--cream-dim); margin-top: 10px; }
.linkish { background: none; border: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.licence { white-space: pre-wrap; font-size: 11px; color: var(--cream-dim); }
.compare-rank { margin: 2px 0 0; font-weight: bold; }

/* The owner's other games, on the title (2026-09-29). */
.more-games { margin: 10px 0 0; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 4px; font-size: 13px; color: var(--cream-dim); }
.more-games a { color: var(--amber); font-weight: bold; }
