@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo2-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../fonts/andika-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../fonts/andika-700-latin.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f6f9ff;
  --card: #ffffff;
  --ink: #1f2547;
  --ink-soft: #4a5078;
  --line: #c9d3ea;
  --sun: #ffc83d;
  --sun-deep: #c98f00;
  --sky: #2f80ed;
  --sky-deep: #1a5bb5;
  --grass: #23a55a;
  --grass-deep: #167540;
  --tomato: #ef5a3c;
  --tomato-deep: #b83a20;
  --sky-wash: #e3eeff;
  --grass-wash: #dff5e8;
  --sun-wash: #fff3cf;
  --tomato-wash: #ffe5df;

  --display: "Baloo 2", "Trebuchet MS", sans-serif;
  --body: "Andika", "Verdana", sans-serif;

  --step-0: clamp(1.125rem, 1.08rem + 0.2vw, 1.25rem);
  --step-1: clamp(1.35rem, 1.25rem + 0.5vw, 1.6rem);
  --step-2: clamp(1.7rem, 1.45rem + 1.1vw, 2.3rem);
  --step-3: clamp(2.2rem, 1.7rem + 2.4vw, 3.6rem);
  --step-game: clamp(2rem, 1.4rem + 3vw, 3.4rem);

  --gap: clamp(1rem, 0.7rem + 1.4vw, 1.75rem);
  --radius: 14px;
  --measure: 38rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--body);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--sky-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.08; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; max-width: var(--measure); }

.wrap { width: min(100% - 32px, 62rem); margin-inline: auto; }
.narrow { width: min(100% - 32px, 42rem); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 12px 16px; z-index: 9; }
.skip:focus { left: 16px; }

/* Header and footer */
.top { padding: 18px 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 1.35rem/1 var(--display); color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-grid; grid-template-columns: repeat(2, 13px); gap: 3px; transform: rotate(-6deg); }
.brand-mark span { width: 13px; height: 13px; border-radius: 3px; }
.brand-mark span:nth-child(1) { background: var(--tomato); }
.brand-mark span:nth-child(2) { background: var(--sun); }
.brand-mark span:nth-child(3) { background: var(--sky); }
.brand-mark span:nth-child(4) { background: var(--grass); }
.top nav { display: flex; gap: 6px 20px; flex-wrap: wrap; }
.top nav a { font-weight: 700; color: var(--ink); text-decoration: none; padding: 8px 2px; }
.top nav a:hover, .top nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--sun); }

.foot { margin-top: 72px; padding: 32px 0 48px; border-top: 2px dashed var(--line); color: var(--ink-soft); font-size: 1rem; }
.foot p { max-width: none; }

/* Toy-key buttons: a solid lip underneath that presses in */
.btn {
  --face: var(--sky); --lip: var(--sky-deep); --text: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 26px;
  font: 800 var(--step-0)/1.1 var(--display);
  color: var(--text); background: var(--face);
  border: 0; border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--lip);
  text-decoration: none; cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.btn:hover { color: var(--text); filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--lip); }
.btn[disabled] { --face: #d9deea; --lip: #b4bbcd; --text: #5b6283; cursor: not-allowed; filter: none; transform: none; }
.btn-go { --face: var(--grass); --lip: var(--grass-deep); }
.btn-sun { --face: var(--sun); --lip: var(--sun-deep); --text: var(--ink); }
.btn-plain { --face: var(--card); --lip: var(--line); --text: var(--ink); border: 2px solid var(--line); }
.btn-big { min-height: 72px; padding: 14px 36px; font-size: var(--step-1); }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.link-btn { background: none; border: 0; padding: 8px 4px; font: 700 1rem/1.2 var(--body); color: var(--sky-deep); text-decoration: underline; cursor: pointer; min-height: 44px; }
.link-btn:hover { color: var(--ink); }

/* Home */
.hero { padding: clamp(24px, 6vw, 72px) 0 clamp(24px, 5vw, 56px); }
.hero h1 { max-width: 15ch; }
.hero .lead { font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); max-width: 30rem; }

.choices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr)); gap: var(--gap); }
.flash {
  --tint: var(--sky-wash); --tilt: -1.5deg; --edge: var(--sky);
  position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%;
  padding: 22px 22px 20px; min-height: 15rem;
  background: var(--card); color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: 6px 18px 8px 16px;
  box-shadow: 0 6px 0 var(--edge);
  transform: rotate(var(--tilt));
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.flash:hover, .flash:focus-visible { transform: rotate(0deg) translateY(-4px); box-shadow: 0 10px 0 var(--edge); color: var(--ink); }
.flash:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--edge); }
.flash-face { display: grid; place-items: center; min-height: 6.5rem; border-radius: 8px; background: var(--tint); font: 800 2.4rem/1 var(--display); gap: 6px; }
.flash h2 { font-size: var(--step-1); margin: 4px 0 0; }
.flash p { margin: 0; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.45; }
.choices li:nth-child(2) .flash { --tint: var(--sun-wash); --tilt: 1.2deg; --edge: var(--sun); }
.choices li:nth-child(3) .flash { --tint: var(--grass-wash); --tilt: -0.8deg; --edge: var(--grass); }
.choices li:nth-child(4) .flash { --tint: var(--tomato-wash); --tilt: 1.6deg; --edge: var(--tomato); }
.face-pair { display: flex; gap: 10px; align-items: center; }
.face-pair span { display: grid; place-items: center; min-width: 3.2rem; height: 3.2rem; padding: 0 8px; font-family: var(--body); background: var(--card); border: 2px solid var(--ink); border-radius: 8px; font-size: 1.6rem; }
.face-tiles { display: flex; gap: 6px; }
.face-tiles span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; background: var(--sun); border-radius: 6px; box-shadow: 0 3px 0 var(--sun-deep); font-size: 1.6rem; }

.band { padding: clamp(40px, 7vw, 80px) 0 0; }
.split { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.facts li { padding-left: 44px; position: relative; max-width: var(--measure); }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.2em; width: 26px; height: 26px; border-radius: 50%; background: var(--grass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/18px no-repeat; }
.facts strong { display: block; font-family: var(--display); font-size: var(--step-1); line-height: 1.2; }

.note-card { background: var(--sun-wash); border: 2px solid var(--ink); border-radius: 8px 16px 8px 16px; padding: 24px; }
.note-card p:last-child { margin-bottom: 0; }

/* Forms */
.page-head { padding: 24px 0 8px; }
.page-head p { color: var(--ink-soft); font-size: var(--step-1); line-height: 1.45; }
.panel { background: var(--card); border: 2px solid var(--ink); border-radius: 10px; padding: clamp(18px, 4vw, 32px); margin-top: 24px; }
.field { display: grid; gap: 6px; margin-bottom: 20px; }
.field > label, .field-label { font-weight: 700; }
.hint { color: var(--ink-soft); font-size: 1rem; margin: 0; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; min-height: 54px; padding: 10px 14px;
  font: 400 var(--step-0)/1.3 var(--body); color: var(--ink);
  background: #fff; border: 2px solid #8d96b8; border-radius: 10px;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--sky); outline: 3px solid var(--sky-wash); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--tomato); background: var(--tomato-wash); }

.rows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; counter-reset: row; }
.row { display: grid; gap: 10px; padding: 16px; border: 2px dashed var(--line); border-radius: 10px; background: var(--paper); counter-increment: row; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-head span { font: 800 1.1rem/1 var(--display); color: var(--ink-soft); }
.row-head span::before { content: counter(row) ". "; }
.row-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.row-fields label { font-size: 1rem; font-weight: 700; display: grid; gap: 4px; }

.check { display: flex; gap: 14px; align-items: flex-start; font-weight: 700; cursor: pointer; padding: 6px 0; }
.check input { width: 30px; height: 30px; margin: 0; flex: none; accent-color: var(--grass); }
.check small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 1rem; }

.things { display: flex; flex-wrap: wrap; gap: 10px; border: 0; padding: 0; margin: 0; }
.things legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.things label { position: relative; }
.things input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.things span { display: grid; place-items: center; width: 60px; height: 60px; font-size: 2rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.things input:checked + span { border-color: var(--ink); background: var(--sun-wash); box-shadow: 0 4px 0 var(--sun); }
.things input:focus-visible + span { outline: 4px solid var(--sky); outline-offset: 3px; }

.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 54px; height: 54px; font: 800 1.6rem/1 var(--display); border: 2px solid var(--ink); background: #fff; border-radius: 10px; cursor: pointer; color: var(--ink); }
.stepper output { min-width: 3ch; text-align: center; font: 800 var(--step-1)/1 var(--display); }

.status { font-weight: 700; color: var(--ink-soft); margin: 12px 0 0; }
.status.ok { color: var(--grass-deep); }

.ready { margin-top: 24px; background: var(--grass-wash); border: 2px solid var(--grass-deep); border-radius: 10px; padding: clamp(18px, 4vw, 32px); }
.ready h2 { color: var(--grass-deep); }
.share-link { display: block; width: 100%; padding: 12px; margin: 14px 0; font: 400 0.95rem/1.4 var(--body); background: #fff; border: 2px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; color: var(--ink-soft); }
.privacy-line { font-size: 1rem; color: var(--ink-soft); margin-top: 16px; }

/* Toast with undo */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; display: flex; gap: 14px; align-items: center; padding: 12px 14px 12px 20px; background: var(--ink); color: #fff; border-radius: 12px; font-weight: 700; max-width: calc(100% - 32px); box-shadow: 0 6px 0 rgba(31, 37, 71, 0.25); }
.toast button { background: var(--sun); color: var(--ink); border: 0; border-radius: 8px; min-height: 44px; padding: 6px 16px; font: 800 1rem/1 var(--display); cursor: pointer; }

/* Prompt kit */
.prompt-out { white-space: pre-wrap; font: 400 1.05rem/1.55 var(--body); background: var(--paper); border: 2px dashed var(--line); border-radius: 10px; padding: 18px; margin: 0 0 16px; max-width: none; }
.steps { padding-left: 1.4em; display: grid; gap: 10px; max-width: var(--measure); }
.steps li::marker { font: 800 1.2em var(--display); color: var(--sky-deep); }

/* Player */
.play-body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.play-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.play-bar .brand { font-size: 1.1rem; }
.sound-btn { display: inline-flex; gap: 8px; align-items: center; min-height: 48px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font: 700 1rem/1 var(--body); color: var(--ink); cursor: pointer; }
.sound-btn[aria-pressed="false"] { opacity: 0.7; }
.stage { flex: 1; display: grid; place-items: center; padding: 16px 16px 40px; }
.stage-inner { width: min(100%, 46rem); text-align: center; }
.stage h1 { font-size: var(--step-3); }
.stage p { margin-inline: auto; }
.stage .btn-row { justify-content: center; }
.progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.progress span { width: 16px; height: 16px; border-radius: 50%; background: var(--line); }
.progress span.done { background: var(--grass); }
.progress span.now { background: var(--sun); box-shadow: 0 0 0 3px var(--ink); }

.say-btn { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--ink); background: var(--sun); cursor: pointer; font-size: 1.5rem; vertical-align: middle; }
.prompt-card { display: inline-flex; align-items: center; gap: 16px; justify-content: center; flex-wrap: wrap; background: #fff; border: 3px solid var(--ink); border-radius: 10px 22px 10px 22px; padding: 22px 28px; margin-bottom: 28px; box-shadow: 0 7px 0 var(--sky); max-width: 100%; }
.prompt-card .big { font: 700 var(--step-game)/1.15 var(--body); overflow-wrap: anywhere; }
.prompt-card .pic { font-size: calc(var(--step-game) * 1.4); line-height: 1; }

.answers { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.answer {
  --face: #fff; --lip: var(--ink);
  min-height: 84px; padding: 14px 18px; font: 700 var(--step-1)/1.2 var(--body); color: var(--ink);
  background: var(--face); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--lip);
  cursor: pointer; overflow-wrap: anywhere; transition: transform 80ms ease, box-shadow 80ms ease;
}
.answers.nums { grid-template-columns: repeat(3, 1fr); }
.answers.nums .answer { font: 700 var(--step-game)/1 var(--body); }
.answer.emo { font-size: calc(var(--step-game) * 1.1); line-height: 1; }
.answer:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--lip); }
.answer.picked { --face: var(--sun-wash); --lip: var(--sun-deep); }
.answer.right { --face: var(--grass-wash); --lip: var(--grass); border-color: var(--grass-deep); }
.answer.nope { --face: #eef0f5; --lip: #c2c7d6; color: #6a7090; border-color: #a9afc4; cursor: default; text-decoration: line-through; }
.answer.matched { --face: var(--grass-wash); --lip: var(--grass); border-color: var(--grass-deep); cursor: default; }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 3vw, 28px); }
.board .col { display: grid; gap: 14px; align-content: start; }

.feedback { min-height: 2.2em; margin: 22px auto 0; font: 800 var(--step-1)/1.3 var(--display); max-width: none; }
.feedback.good { color: var(--grass-deep); }
.feedback.try { color: var(--tomato-deep); }

.slots { display: flex; gap: 14px 34px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.slot-word { display: flex; gap: 8px; }
.slot { display: grid; place-items: center; width: clamp(36px, 10vw, 68px); height: clamp(56px, 14vw, 84px); border-bottom: 5px solid var(--ink); font: 700 var(--step-game)/1 var(--body); }
.tiles { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.tile { width: clamp(60px, 14vw, 80px); height: clamp(60px, 14vw, 80px); font: 700 var(--step-game)/1 var(--body); background: var(--sun); color: var(--ink); border: 0; border-radius: 12px; box-shadow: 0 6px 0 var(--sun-deep); cursor: pointer; }
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sun-deep); }
.tile.used { visibility: hidden; }

.counters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 34rem; margin: 0 auto 28px; font-size: clamp(2.4rem, 1.6rem + 4vw, 4rem); line-height: 1; }
.counters span { display: inline-block; }

.wiggle { animation: wiggle 360ms ease; }
@keyframes wiggle { 20% { transform: translateX(-8px) rotate(-2deg); } 50% { transform: translateX(7px) rotate(2deg); } 80% { transform: translateX(-4px); } }
.pop { animation: pop 420ms ease; }
@keyframes pop { 40% { transform: scale(1.12); } }

.cheer { font-size: clamp(5rem, 3rem + 10vw, 9rem); line-height: 1; margin-bottom: 12px; display: inline-block; animation: cheer 900ms ease both; }
@keyframes cheer { 0% { transform: scale(0.3) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.15) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .flash { transform: none; }
}
@media (max-width: 30rem) {
  .btn-row .btn { width: 100%; }
  .board { gap: 10px; }
  .board .answer { font-size: 1.15rem; min-height: 72px; padding: 10px; }
}
