/* Layout: one centered column, a sky-blue masthead with the book's paw-print band, then the game board.
   Colors and type come from the cover: storm navy, sky-blue outlines, chunky rounded titles. */

:root {
  --bg: #edf1f2;
  --surface: #ffffff;
  --surface-2: #f5f8f8;
  --ink: #142229;
  --muted: #536770;
  --line: #d2dcdf;
  --storm: #1d4c5c;
  --storm-soft: #dde9ed;
  --sun: #f0b12a;
  --sun-soft: #fdf1d3;
  --sun-ink: #4f3500;
  --good: #2b7a4c;
  --good-soft: #def0e4;
  --warn: #a95c14;
  --crit: #b0291f;
  --crit-soft: #fae3e0;
  --focus: #1f6fd1;
  --night-band: #233a5c;
  --on-storm: #ffffff;
  --on-storm-chip: rgba(255,255,255,0.16);

  --f-display: "Young Serif", Georgia, "Times New Roman", serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 10px;
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e181d; --surface: #15232a; --surface-2: #1a2b33; --ink: #e4ecee; --muted: #9bb0b8;
    --line: #2b3f48; --storm: #86c6d8; --storm-soft: #1d3540; --sun: #f4c24c; --sun-soft: #3a2f12;
    --sun-ink: #fbe3a4; --good: #6fcf97; --good-soft: #17352a; --warn: #e9a35a; --crit: #ff8a7f;
    --crit-soft: #3d1d1a; --focus: #7db4ff; --on-storm: #0e181d; --on-storm-chip: rgba(14,24,29,0.14); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e181d; --surface: #15232a; --surface-2: #1a2b33; --ink: #e4ecee; --muted: #9bb0b8;
  --line: #2b3f48; --storm: #86c6d8; --storm-soft: #1d3540; --sun: #f4c24c; --sun-soft: #3a2f12;
  --sun-ink: #fbe3a4; --good: #6fcf97; --good-soft: #17352a; --warn: #e9a35a; --crit: #ff8a7f;
  --crit-soft: #3d1d1a; --focus: #7db4ff; --on-storm: #0e181d; --on-storm-chip: rgba(14,24,29,0.14); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.55;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
a { color: var(--storm); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.eyebrow { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }


.masthead {
  background: var(--night-band);
  padding-block: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 10px solid transparent;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Crect width='28' height='28' fill='%2374c2e8'/%3E%3Cg fill='white' transform='translate(7 7) scale(.58)'%3E%3Cellipse cx='12' cy='16' rx='5' ry='4.2'/%3E%3Cellipse cx='5.5' cy='10' rx='2.1' ry='2.7'/%3E%3Cellipse cx='9.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='14.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='18.5' cy='10' rx='2.1' ry='2.7'/%3E%3C/g%3E%3C/svg%3E") 0 0 100% 0 / 0 0 10px 0 round;
}
.masthead-in { max-width: 980px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.masthead a { text-decoration: none; }
.wordmark { font-family: var(--f-cover); font-weight: 700; font-size: clamp(1.25rem, 4vw, 1.6rem); line-height: 1; color: #111; text-shadow: 2px 2px 0 #74c2e8, -1px -1px 0 #74c2e8, 1px -1px 0 #74c2e8, -1px 1px 0 #74c2e8, 0 0 6px rgba(255,255,255,.4); }
.wordmark small { display: block; font-size: 0.6em; margin-top: 2px; }
.masthead .tag { font-family: var(--f-kid); font-weight: 700; color: #fff; font-size: 0.875rem; }
.main {
  min-width: 0;
  padding-block: 24px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page { max-width: 980px; margin-inline: auto; display: flex; flex-direction: column; gap: 24px; }
.foot { font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; max-width: 980px; margin: 0 auto; }
@media (max-width: 560px) { .masthead .tag { display: none; } }


/* Surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }


/* Pills and tags */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.pill.life { background: var(--crit-soft); border-color: transparent; color: var(--crit); font-weight: 700; }
.pill.done { background: var(--good-soft); border-color: transparent; color: var(--good); font-weight: 700; }
.pill.due { background: var(--sun-soft); border-color: transparent; color: var(--sun-ink); font-weight: 700; }
.pill.el { background: var(--storm-soft); border-color: transparent; color: var(--storm); }


/* ---------- Games: the book's own look ----------
   Chunky rounded titles with a sky-blue outline and the paw-print border from the back cover. */
:root {
  --sky: #74c2e8;
  --sky-soft: #e3f3fb;
  --night: #233a5c;
  --f-cover: "Fredoka", "Comfortaa", "Atkinson Hyperlegible", system-ui, sans-serif;
  --f-kid: "Comfortaa", "Atkinson Hyperlegible", system-ui, sans-serif;
  --paw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cellipse cx='12' cy='16' rx='5' ry='4.2'/%3E%3Cellipse cx='5.5' cy='10' rx='2.1' ry='2.7'/%3E%3Cellipse cx='9.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='14.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='18.5' cy='10' rx='2.1' ry='2.7'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sky: #6cbbe2; --sky-soft: #15303f; --night: #c9e6f6; } }
:root[data-theme="dark"] { --sky: #6cbbe2; --sky-soft: #15303f; --night: #c9e6f6; }

.g-title {
  font-family: var(--f-cover); font-weight: 700; font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.1;
  color: var(--ink); -webkit-text-stroke: 0; paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--sky), -1px -1px 0 var(--sky), 1px -1px 0 var(--sky), -1px 1px 0 var(--sky);
}
.g-line { font-family: var(--f-kid); font-size: 1.0625rem; line-height: 1.55; max-width: 56ch; }
.g-quote { font-family: var(--f-kid); font-size: 1.125rem; line-height: 1.5; color: var(--night); max-width: 52ch; }
.g-hero { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 640px) { .g-hero { grid-template-columns: minmax(0, 1fr); } .g-cover { max-width: 240px; } }
.g-cover { width: 100%; max-width: 100%; border-radius: 6px; box-shadow: 0 10px 24px rgba(20, 34, 41, 0.22); display: block; }

.g-list { display: flex; flex-direction: column; gap: 12px; }
.g-tile { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px 18px; text-decoration: none; color: inherit; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; }
.g-tile:hover { border-color: var(--sky); }
.g-tile-no { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--sky-soft); color: var(--night); font-family: var(--f-cover); font-weight: 700; font-size: 1.5rem; }
.g-tile-title { font-family: var(--f-cover); font-weight: 600; font-size: 1.375rem; line-height: 1.2; }

.g-stage {
  position: relative; display: flex; flex-direction: column; gap: 18px; padding: 22px;
  background: var(--surface); border-radius: 18px; font-family: var(--f-kid);
  border: 14px solid transparent;
  background-image: linear-gradient(var(--surface), var(--surface)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Crect width='28' height='28' fill='%2374c2e8'/%3E%3Cg fill='white' transform='translate(7 7) scale(.58)'%3E%3Cellipse cx='12' cy='16' rx='5' ry='4.2'/%3E%3Cellipse cx='5.5' cy='10' rx='2.1' ry='2.7'/%3E%3Cellipse cx='9.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='14.5' cy='6' rx='2.1' ry='2.7'/%3E%3Cellipse cx='18.5' cy='10' rx='2.1' ry='2.7'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, 22px 22px; background-repeat: no-repeat, repeat;
  background-origin: padding-box, border-box; background-clip: padding-box, border-box;
}
@media (max-width: 560px) { .g-stage { padding: 14px; border-width: 8px; } }
.g-guide { display: flex; gap: 12px; align-items: flex-end; }
.g-guide img { width: 72px; height: 64px; object-fit: cover; border-radius: 50%; border: 3px solid var(--sky); flex: none; background: var(--sky-soft); }
.g-bubble { position: relative; background: var(--sky-soft); color: var(--ink); border-radius: 18px 18px 18px 4px; padding: 12px 16px; font-size: 1.125rem; line-height: 1.45; font-weight: 700; min-width: 0; }
.g-paws { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.g-paw { width: 22px; height: 22px; background: var(--line); -webkit-mask: var(--paw) center / contain no-repeat; mask: var(--paw) center / contain no-repeat; }
.g-paw.on { background: var(--sky); }

.g-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.g-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 112px; padding: 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface-2); cursor: pointer; font-family: var(--f-kid); font-weight: 700; font-size: 0.9375rem; text-align: center; line-height: 1.25; }
.g-item:hover { border-color: var(--sky); }
.g-item.in { background: var(--good-soft); border-color: var(--good); }
.g-item.nope { border-color: var(--warn); animation: g-wiggle .4s; }
.g-item:disabled { cursor: default; }
.g-emoji { font-size: 2.5rem; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.g-emoji.big { font-size: 4.5rem; }
.g-bag { border: 2px dashed var(--sky); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.g-bag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.g-chip { background: var(--sky-soft); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 0.875rem; }

.g-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px; border-radius: 18px; background: var(--sky-soft); text-align: center; }
.g-card-text { font-size: 1.375rem; font-weight: 700; line-height: 1.35; max-width: 30ch; }
.g-worn { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 2.5rem; }
.g-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-choices { display: flex; flex-direction: column; gap: 10px; }
.g-choice { text-align: left; padding: 16px 18px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface-2); font-family: var(--f-kid); font-weight: 700; font-size: 1.125rem; cursor: pointer; }
.g-choice:hover:not(:disabled) { border-color: var(--sky); }
.g-choice.right { background: var(--good-soft); border-color: var(--good); }
.g-choice.wrong { background: var(--sun-soft); border-color: var(--warn); }
.g-choice:disabled { cursor: default; }
.g-feedback { border-radius: 16px; padding: 14px 16px; font-size: 1.0625rem; line-height: 1.45; }
.g-feedback.good { background: var(--good-soft); }
.g-feedback.try { background: var(--sun-soft); color: var(--sun-ink); }

.g-btn { font-family: var(--f-cover); font-weight: 600; font-size: 1.0625rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; border-radius: 999px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; box-shadow: 0 3px 0 var(--ink); }
.g-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.g-btn.sun { background: var(--sun); color: #2a1c00; }
.g-btn.big { font-size: 1.5rem; padding: 18px 12px; border-radius: 18px; }
.g-btn.good { background: var(--good-soft); color: var(--ink); }
.g-btn.crit { background: var(--crit-soft); color: var(--ink); }
.g-btn.small { font-size: 0.875rem; padding: 6px 14px; box-shadow: 0 2px 0 var(--ink); }
.g-btn.ghost { border-color: var(--line); box-shadow: none; }
.g-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.g-win { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 8px 0; }
.g-win-art { width: 100%; max-width: 420px; border-radius: 14px; border: 3px solid var(--sky); }

.g-setup { align-items: stretch; text-align: left; gap: 14px; }
.g-setup input { font-size: 1.25rem; }
.g-display { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; font-family: var(--f-mono); font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 600; }
.g-digit { width: 1.2em; text-align: center; border-bottom: 3px solid var(--line); color: var(--muted); }
.g-digit.on { color: var(--ink); border-color: var(--good); }
.g-digit.hint { color: var(--warn); border-color: var(--warn); }
.g-sep { color: var(--muted); }
.g-display.shake { animation: g-wiggle .4s; }
.g-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 88px)); gap: 10px; justify-content: center; }
.g-key { aspect-ratio: 1; max-width: 100%; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface-2); font-family: var(--f-cover); font-weight: 600; font-size: 1.75rem; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.g-key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
@keyframes g-wiggle { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .g-item.nope, .g-display.shake { animation: none; } }

