/* ---- Tokens (spec §5) ---- */
:root {
  --page: #FAF8F4;
  --surface: #FFFFFF;
  --text: #1C1B19;
  --muted: #6B665D;
  --line: #E6E1D8;
  --tile-border: #CFCBC2;
  --tile-typed: #8F897E;
  --key: #E3DED4;
  --key-absent: #3F4A5A;
  --correct: #1E6FD9;
  --present: #D9620B;
  --absent: #3F4A5A;
  --danger: #C2362B;
  --backdrop: rgba(28, 27, 25, 0.45);
  --gap: 5px;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #121417; --surface: #1B1E22; --text: #ECEAE6; --muted: #9EA3AA; --line: #2B3036;
    --tile-border: #3A3F47; --tile-typed: #6B717B; --key: #3A3F47; --key-absent: #1F2328;
    --absent: #3A4250; --backdrop: rgba(0, 0, 0, 0.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #121417; --surface: #1B1E22; --text: #ECEAE6; --muted: #9EA3AA; --line: #2B3036;
  --tile-border: #3A3F47; --tile-typed: #6B717B; --key: #3A3F47; --key-absent: #1F2328;
  --absent: #3A4250; --backdrop: rgba(0, 0, 0, 0.6); color-scheme: dark;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.45 var(--sans);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--correct); outline-offset: 2px; }
.sr-only { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.unsupported { padding: 40px 20px; text-align: center; font-size: 18px; }

/* ---- Layout: fills the screen, nothing scrolls (spec §4.6) ---- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
}
/* The header is a floating, frosted pill: the page shows through it as it scrolls underneath. */
.top { flex: none; height: 54px; padding: 5px 0 3px; }
.top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 100%;
  padding: 0 4px 0 6px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.04), 0 6px 20px -8px rgba(28, 27, 25, 0.12);
}
.top .icon-btn { border-radius: 999px; }
.top-right { display: flex; }
.brand { display: flex; align-items: center; gap: 10px; }
.wordmark { margin: 0; font: 700 21px/1 var(--sans); letter-spacing: -0.02em; }
.wordmark span { color: var(--correct); }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: none;
}
.icon-btn svg, .kb-row svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.play { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 2px 0; }
.side { flex: none; }
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.premise {
  flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 12px;
}
.premise-top { display: flex; justify-content: space-between; gap: 12px; }
.premise-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.premise-label, .premise-meta { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.premise-meta { white-space: nowrap; }
.premise-text { margin: 4px 0 0; font: 16px/1.45 var(--sans); }
.retry { margin-top: 10px; }
[hidden] { display: none !important; }

/* ---- Shelf scene: the cat and six books (spec §5, public/js/cat.js) ---- */
/* Sized to the drawing (2:1), so there's no empty band above the cat; shrinks on short screens. */
.scene { position: relative; flex: 0 1 auto; width: 100%; aspect-ratio: 2 / 1; min-height: 96px; margin-top: 6px; }
.scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.books-left { position: absolute; top: 0; right: 2px; margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* transform-box lets each part pivot around its own bounding box */
.cs-book, .cs-head, .cs-body, .cs-tail, .cs-paw, .cs-ear, .cs-face, .cs-eyes, .cs-heart { transform-box: fill-box; }
.cs-book  { transform-origin: center; }
.cs-head  { transform-origin: 50% 92%; }   /* pivot at the neck */
.cs-body  { transform-origin: 50% 100%; animation: cs-breathe 3.2s ease-in-out infinite; }
.cs-tail  { transform-origin: 0% 100%;  animation: cs-tail 3s ease-in-out infinite; }
.cs-paw   { transform-origin: center; }
.cs-ear   { transform-origin: 50% 100%; }
.cs-face  { transform-origin: center; }
.cs-eyes  { transform-origin: center; }
.cs-heart { transform-origin: center; opacity: 0; }

@keyframes cs-breathe { 50% { transform: scale(1.02, 1.04); } }
@keyframes cs-tail    { 50% { transform: rotate(9deg); } }

@media (prefers-reduced-motion: reduce) {
  .cs-body, .cs-tail { animation: none; }
}

/* ---- Title tiles: closed red spines, open white pages (spec §5) ---- */
.title {
  flex: none;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
  column-gap: var(--word-gap, 22px); row-gap: 8px;
  padding: 12px 0 4px;
  --tile: 40px;
  perspective: 600px;
}
.word { display: flex; gap: 4px; }
.tile {
  width: var(--tile); height: calc(var(--tile) * 1.3);
  display: grid; place-items: center;
  border-radius: 4px;
  font: 700 calc(var(--tile) * 0.62)/1 var(--serif);
  text-transform: uppercase;
  user-select: none;
  position: relative;
}
.tile.spine {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 12%, transparent 12% 88%, rgba(0, 0, 0, 0.12) 88%), #B8382D;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 0 #7E241C;
}
.tile.spine::before, .tile.spine::after { content: ""; position: absolute; left: 14%; right: 14%; height: 6%; min-height: 2px; border-radius: 1px; background: #E3B04B; }
.tile.spine::before { top: 13%; }
.tile.spine::after { bottom: 13%; }
.tile.page, .tile.missed {
  background: linear-gradient(90deg, #F7F1E3, #FFFDF8 44%, #EAE2D0 50%, #FFFDF8 56%, #F7F1E3);
  border: 1px solid #DDD4C1;
  box-shadow: 0 2px 0 #DDD4C1;
  color: #1C1B19;
}
.tile.missed { color: #B8382D; }
.hc .tile.page { border: 2px solid #1C1B19; }
.hc .tile.missed { text-decoration: underline 2px; }
.title.shake { animation: shake 400ms ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---- Solve ---- */
.solve-input {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 16px;
  font: 600 16px/1 var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--tile-border); border-radius: 999px;
  background: var(--surface); color: var(--text);
}
.solve-input { width: 100%; margin-top: 4px; }
.solve-input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Keyboard ---- */
.keyboard {
  flex: none;
  margin-top: auto; /* phones: keyboard at the bottom, any spare space above it */
  padding: 6px 0 8px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.kb-row { display: flex; gap: 5px; margin-top: 6px; }
.kb-row.mid { padding: 0 4.5%; }
.kb-row button {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--key);
  font-size: 15px;
  font-weight: 600;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.kb-row button.wide, .kb-row .kb-spacer { flex: 1.55; font-size: 13px; }
.kb-row button.solve-key { background: var(--text); color: var(--page); font-size: 14px; letter-spacing: 0.02em; }
.kb-row button[data-state] { color: #fff; }
.kb-row button[data-state="correct"] { background: var(--correct); }
.kb-row button[data-state="absent"] { background: var(--key-absent); color: rgba(255, 255, 255, 0.7); }
.keyboard.disabled { opacity: 0.5; pointer-events: none; }

/* ---- Toasts ---- */
.toast {
  position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 10;
  width: max-content; max-width: 90vw; margin: 0 auto; pointer-events: none;
  background: var(--text); color: var(--page); padding: 10px 16px; border-radius: 8px;
  font-weight: 600; font-size: 15px; text-align: center; animation: fade 1.8s ease both;
}
@keyframes fade { 0% { opacity: 0; transform: translateY(-6px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---- Sheets (native <dialog>) ---- */
dialog.sheet {
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.18);
}
dialog.sheet[open] { animation: sheet-up 220ms ease-out; }
dialog.sheet:focus { outline: none; }
dialog.sheet::backdrop { background: var(--backdrop); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 600px), (min-height: 900px) {
  dialog.sheet { margin: auto; border-radius: 18px; padding-bottom: 22px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 8px; }
.sheet-head h2 { margin: 0; font: 700 20px/1.2 var(--serif); }
.close { width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; font-size: 18px; color: var(--muted); }
dialog h3, .card h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
dialog p { margin: 8px 0; }

.btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
  color: var(--text);
}
.btn.primary { background: var(--correct); border-color: var(--correct); color: #fff; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--text); color: var(--page); border-color: var(--text); }
.link-btn { border: 0; background: none; color: var(--correct); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 30px; padding: 0 8px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* Result sheet */
.outcome { margin: 0 0 12px; font-weight: 700; font-size: 18px; }
.book { border-left: 4px solid var(--correct); padding: 2px 0 2px 12px; }
.book-title { margin: 0; font: 700 22px/1.2 var(--serif); }
.book-sub { margin: 2px 0 0; font: italic 16px/1.3 var(--serif); color: var(--muted); }
.book-author { margin: 6px 0 0; font-size: 15px; }
.ideas { margin: 12px 0 0; padding-left: 22px; }
.ideas li { margin: 6px 0; }
/* Share / Reading list / Reminder: compact, one line; they wrap only on very narrow screens */
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.result-actions .btn { flex: 1 1 auto; min-height: 40px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
/* Accelerated summary link, under the key ideas */
.btn.summary { display: flex; width: 100%; margin-top: 14px; min-height: 48px; gap: 10px; padding: 0 14px; font-size: 15px; background: var(--text); border-color: var(--text); color: var(--page); }
.summary-icons { display: inline-flex; align-items: center; gap: 6px; }
.summary-icons svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.summary-sep { opacity: 0.5; font-weight: 400; }
.btn.summary.small { width: auto; flex: none; margin: 0; min-height: 36px; gap: 8px; padding: 0 12px; font-size: 13px; }
.btn.summary.small svg { width: 16px; height: 16px; }
/* In place of the keyboard once the game is over */
.done-actions { flex: none; width: 100%; max-width: 520px; margin: 0 auto; padding: 10px 0 12px; }
.done-actions .result-actions { margin: 0; }
/* Phones once the book is revealed: the page scrolls, with the book above the cat. */
.stage-book { margin-top: 10px; }
.stage-book .outcome { font-size: 16px; }
body.done .app { height: auto; min-height: 100vh; min-height: 100dvh; }
body.done .play, body.done .stage { flex: none; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stat-row b { display: block; font-size: 26px; line-height: 1.1; }
.stat-row span { font-size: 12px; color: var(--muted); }
.dist { display: grid; gap: 4px; margin-top: 8px; }
.dist-row { display: grid; grid-template-columns: 14px 1fr; gap: 6px; align-items: center; font-size: 14px; }
.dist-bar { min-width: 26px; padding: 2px 8px; border-radius: 4px; background: var(--absent); color: #fff; text-align: right; font-weight: 600; }
.dist-bar.today { background: var(--correct); }
.countdown { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.countdown b { font-variant-numeric: tabular-nums; font-size: 22px; }
.nudge { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--page); font-size: 15px; }

/* Help */
.help-list { padding-left: 20px; margin: 8px 0; }
.help-list li { margin: 6px 0; }
.examples { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.mini-row { display: flex; gap: 4px; --tile: 34px; margin-top: 10px; }
.help-end { font-weight: 700; margin-top: 16px; }

/* Menu */
.menu-item { display: block; width: 100%; min-height: 52px; text-align: left; padding: 0 6px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 17px; }
.menu-item:last-child { border-bottom: 0; }

/* Reading list */
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.saved-text { flex: 1 1 180px; min-width: 0; }
.saved .t { font: 700 17px/1.3 var(--serif); }
.saved .meta { font-size: 14px; color: var(--muted); }
.saved .remove { color: var(--muted); flex: none; }
.saved .remove svg { width: 20px; height: 20px; }
.empty { color: var(--muted); }

/* Settings */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setting small { display: block; font-size: 13px; color: var(--muted); }
.setting.account { flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--tile-border); border-radius: 999px; padding: 2px; }
.segmented button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font-size: 14px; font-weight: 600; }
.segmented button[aria-checked="true"] { background: var(--text); color: var(--page); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--tile-border); position: relative; cursor: pointer; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 150ms; }
.switch:checked { background: var(--correct); }
.switch:checked::after { transform: translateX(20px); }

/* Reminder, share box */
.reminder-time { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.reminder-time select { font: inherit; font-size: 17px; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--tile-border); background: var(--page); color: var(--text); }
.stack { display: grid; gap: 10px; }
.fine { font-size: 14px; color: var(--muted); }
#sharebox-text { width: 100%; font: 16px/1.4 ui-monospace, monospace; padding: 10px; border-radius: 10px; border: 1px solid var(--tile-border); background: var(--page); color: var(--text); resize: none; }

/* Short screens: tighten so the game still fits without scrolling */
@media (max-height: 640px) {
  .top { height: 48px; padding: 4px 0 2px; }
  .wordmark { font-size: 19px; }
  .play { padding-top: 6px; }
  .premise { padding: 8px 12px 10px; }
  .premise-text { font-size: 15.5px; line-height: 1.35; }
  .kb-row button { height: 44px; }
  .kb-row { margin-top: 5px; }
  .scene { min-height: 80px; }
  .title { padding-top: 8px; }
}

/* ---- Tablets: the phone layout, wider and roomier ---- */
@media (min-width: 700px) {
  .app { max-width: 720px; padding-left: 24px; padding-right: 24px; }
  .premise { padding: 14px 18px 16px; }
  .premise-text { font-size: 18px; }
  .kb-row button { height: 58px; font-size: 17px; }
}

/* ---- Desktop and large screens: a normal web app (breakpoint also in main.js) ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px 18px; }
.card > h3:first-child { margin-top: 0; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 12px; }
.legend .tile { --tile: 22px; flex: none; }
.legend-books { flex: none; width: 22px; text-align: center; font-size: 20px; line-height: 1; }
.side-foot { margin: 0; }
.card { scroll-margin-top: 104px; }
.card.appear { animation: appear 450ms ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(12px); } }

@media not all and (min-width: 900px) and (min-height: 600px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .mobile-only { display: none !important; }

  /* The page scrolls like a normal site; the board and keyboard stay in view. */
  .app { max-width: none; height: auto; min-height: 100vh; min-height: 100dvh; padding: 0; }
  .top { position: sticky; top: 0; z-index: 5; height: 84px; padding: 12px 32px 8px; }
  .top-inner { max-width: 1160px; margin: 0 auto; padding: 0 8px 0 22px; }
  .wordmark { font-size: 24px; }
  .desk-nav { display: flex; align-items: center; gap: 4px; }
  .desk-nav button {
    display: flex; align-items: center; gap: 8px;
    height: 42px; padding: 0 16px;
    border: 0; border-radius: 999px; background: none;
    font-size: 15px; font-weight: 500; color: var(--muted);
    transition: background-color 150ms, color 150ms;
  }
  .desk-nav button > svg { display: none; } /* text-only links; the icons stay for the phone menu */
  .desk-nav .nav-account { margin-left: 10px; padding: 0 22px; height: 46px; background: var(--text); color: var(--page); font-weight: 600; }
  .avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: -6px; border-radius: 50%; background: var(--correct); color: #fff; font-size: 13px; }
  .desk-nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .play {
    flex: none;
    flex-direction: row;
    align-items: flex-start;
    gap: 56px;
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 28px 32px 24px;
  }
  .side {
    flex: 0 0 380px;
    min-height: calc(100vh - 136px);
    min-height: calc(100dvh - 136px);
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .side-foot { margin-top: auto; }
  .premise { padding: 18px 22px 22px; border-radius: 14px; }
  .premise-text { margin-top: 10px; font-size: 20px; line-height: 1.45; }
  .stage {
    position: sticky;
    top: 112px;
    height: calc(100vh - 136px);
    height: calc(100dvh - 136px);
    padding-top: 8px;
  }
  .stage { justify-content: center; }
  .scene { flex: none; height: clamp(180px, 32vh, 280px); max-height: none; margin: 0 auto; width: 100%; max-width: 620px; }
  .title { padding: 18px 0 4px; }
  .keyboard { width: 100%; max-width: 520px; margin: 0 auto; padding-bottom: 0; }
  .kb-row button { height: 54px; }
  .result-actions { margin-bottom: 0; }
}
@media (min-width: 1400px) and (min-height: 600px) {
  .play, .top-inner { max-width: 1280px; }
  .side { flex-basis: 420px; }
}

/* ---- Hover, for mouse and trackpad ---- */
@media (hover: hover) {
  .icon-btn:hover, .desk-nav button:hover { background: color-mix(in srgb, var(--key) 70%, transparent); color: var(--text); }
  .desk-nav .nav-account:hover { background: var(--text); color: var(--page); opacity: 0.88; }
  .kb-row button:hover { opacity: 0.82; }
  .btn:hover { border-color: var(--text); }
  .btn.primary:hover { border-color: var(--correct); opacity: 0.9; }
  .menu-item:hover { background: var(--page); }
  .link-btn:hover { text-decoration-thickness: 2px; }
}

/* ---- Sign in / Register (spec §10) ---- */
.auth-switch { margin: -2px 0 18px; color: var(--muted); }
.auth-switch .link-btn { padding: 0 2px; min-height: 0; }
.google-btn {
  width: 100%; min-height: 48px; gap: 10px;
  border-radius: 10px; border: 1px solid #DADCE0;
  background: #fff; color: #1F1F1F; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.google-btn svg { width: 18px; height: 18px; flex: none; }
.auth-inapp { margin: 0; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 18px; color: var(--muted); font-size: 14px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--tile-border); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span:first-child { font-size: 15px; font-weight: 600; }
.field > span:first-child::before { content: "* "; color: var(--danger); }
.input-icon { position: relative; display: block; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; pointer-events: none; }
.input-icon input {
  width: 100%; min-height: 46px; padding: 0 12px 0 40px;
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  border: 1px solid var(--tile-border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.input-icon input:focus { outline: 2px solid var(--correct); outline-offset: -1px; border-color: transparent; }
.auth-msg { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.auth-msg.error { background: rgba(194, 54, 43, 0.1); color: var(--danger); }
.auth-msg.info { background: rgba(30, 111, 217, 0.1); color: var(--correct); }
.auth-submit { width: 100%; min-height: 48px; margin-top: 6px; border-radius: 10px; font-size: 16px; }
.auth-submit:disabled { opacity: 0.7; }
.auth-forgot { display: block; margin: 10px auto 0; font-size: 14px; }
.auth-note { margin: 16px 0 0; text-align: center; }
@media (min-width: 560px) {
  .field { grid-template-columns: 96px 1fr; align-items: center; column-gap: 12px; }
}

/* ---- Share card (spec §6) ---- */
.share-preview { display: grid; place-items: center; margin: 2px 0 14px; }
.share-preview img { display: block; width: 100%; max-width: min(100%, 52vh); height: auto; aspect-ratio: 1; border-radius: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14); }
.share-loading { min-height: 220px; width: 100%; display: grid; place-items: center; margin: 0; border-radius: 14px; background: var(--page); color: var(--muted); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-buttons .btn { flex: 1 1 40%; min-height: 44px; font-size: 15px; white-space: nowrap; }
.share-buttons .primary { flex-basis: 100%; }
.share-buttons [aria-disabled="true"], .share-buttons :disabled { opacity: 0.5; pointer-events: none; }
.share-note { margin: 12px 0 0; text-align: center; }
@media (min-width: 560px) {
  .share-buttons .btn, .share-buttons .primary { flex: 1 1 0; }
}

.share-social-label { margin: 16px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.share-social { display: flex; flex-wrap: wrap; gap: 8px; }
.social { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--tile-border); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; }
.social svg { width: 14px; height: 14px; }
@media (hover: hover) { .social:hover { border-color: var(--text); } }

/* ---- First load: the game area appears in one go (see index.html) ---- */
.booting .play { opacity: 0; }
.play { transition: opacity 180ms ease-out; }
