@font-face {
  font-family: "Andika";
  font-weight: 700;
  font-display: block;
  src: url(fonts/andika-bold.woff2) format("woff2");
  unicode-range: U+41-5A, U+61-7A;
}

:root {
  --ink: #4a3000;
  --muted: #8a6a2a;
  --card: #ffffff;
  --go: #f59e0b;
  --go-dark: #b45309;
  --purple: #8e5cf7;
  --purple-dark: #6a3ad1;
  --right: #22c55e;
  --wrong: #ef4444;
  --mark: #ffe066;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --letters: "Andika", ui-rounded, system-ui, sans-serif;
  --gap: clamp(8px, 1.8vmin, 18px);
  --safe-t: max(14px, env(safe-area-inset-top));
  --safe-r: max(14px, env(safe-area-inset-right));
  --safe-b: max(14px, env(safe-area-inset-bottom));
  --safe-l: max(14px, env(safe-area-inset-left));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.55) 0 7%, transparent 7.5%),
    radial-gradient(circle at 88% 78%, rgba(255, 255, 255, 0.45) 0 9%, transparent 9.5%),
    linear-gradient(#fff7d1, #ffe38a 65%, #ffd25c);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.5; cursor: default; }
[hidden] { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  overflow-y: auto;
}
.screen.on { display: flex; }

/* ---------- buttons ---------- */
.big-btn {
  font-size: clamp(22px, 4.6vmin, 42px);
  font-weight: 800;
  color: #fff;
  padding: 0.42em 1.2em;
  border-radius: 999px;
  background: var(--go);
  box-shadow: 0 0.16em 0 var(--go-dark);
  transition: transform 0.08s, box-shadow 0.08s;
}
.big-btn:active { transform: translateY(0.12em); box-shadow: 0 0.04em 0 var(--go-dark); }
.big-btn.purple { background: var(--purple); box-shadow: 0 0.16em 0 var(--purple-dark); }
.big-btn.purple:active { box-shadow: 0 0.04em 0 var(--purple-dark); }
.pill {
  font-size: clamp(16px, 2.6vmin, 22px);
  font-weight: 800;
  padding: 0.42em 0.9em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}
.pill.icon { padding: 0.42em 0.62em; }
.link { font-size: 17px; font-weight: 700; color: var(--muted); text-decoration: underline; padding: 10px; }
.small-btn { font-size: 16px; font-weight: 700; padding: 11px 14px; border-radius: 12px; background: #fff3c4; }
.small-btn.danger { color: #b91c1c; }

/* ---------- the bee ---------- */
.bee { position: relative; display: inline-block; line-height: 1; font-size: 64px; }
.bee .emo {
  display: inline-block;
  filter: hue-rotate(var(--hue)) saturate(1.2) drop-shadow(0 0 0.08em var(--glow));
}
.bee .emo.rainbow { animation: rainbow 3s linear infinite; }
.bee .emo.sparkle { filter: saturate(1.3) drop-shadow(0 0 0.06em #fff) drop-shadow(0 0 0.14em #ffe27a); animation: twinkle 1.6s ease-in-out infinite; }
.bee .hat { position: absolute; left: 16%; top: -26%; font-size: 0.5em; transform: rotate(-14deg); }
.bee.big { font-size: clamp(110px, 26vmin, 210px); animation: hover 2.4s ease-in-out infinite; }
.bee.small { font-size: clamp(44px, 9vmin, 76px); }
@keyframes rainbow { to { filter: hue-rotate(360deg) saturate(1.4) drop-shadow(0 0 0.08em #fff); } }
@keyframes twinkle { 50% { filter: saturate(1.5) brightness(1.15) drop-shadow(0 0 0.2em #fff); } }
@keyframes hover { 50% { transform: translateY(-0.06em) rotate(3deg); } }

/* ---------- who's spelling ---------- */
.title { display: flex; align-items: center; gap: 12px; margin-top: 2vh; }
.title h1 { font-size: clamp(38px, 8vmin, 72px); font-weight: 900; letter-spacing: -0.01em; }
.logo { font-size: clamp(44px, 9vmin, 80px); animation: hover 2.4s ease-in-out infinite; }
.ask { font-size: clamp(24px, 4.8vmin, 40px); font-weight: 800; text-align: center; }
.players { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); max-width: 1000px; }
.player-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: clamp(150px, 24vmin, 210px); padding: 18px 10px;
  border-radius: 28px; background: var(--card); box-shadow: 0 6px 0 rgba(180, 120, 0, 0.18);
}
.player-card .bee { font-size: clamp(60px, 11vmin, 92px); }
.player-name { font-size: clamp(22px, 3.8vmin, 30px); font-weight: 800; }
.player-honey { font-weight: 700; color: var(--muted); }
.player-card.add .plus { font-size: clamp(60px, 11vmin, 92px); line-height: 1; font-weight: 300; color: var(--go); }

/* ---------- new speller ---------- */
.back { align-self: flex-start; }
.step { display: none; flex-direction: column; align-items: center; gap: 24px; margin-top: 6vh; }
.step.on { display: flex; }
.name-input {
  font: inherit; font-size: clamp(32px, 7vmin, 56px); font-weight: 800; text-align: center; color: var(--ink);
  width: min(80vw, 520px); padding: 0.25em 0.4em; border-radius: 20px; border: 4px solid #ffd25c; background: #fff;
  -webkit-user-select: text; user-select: text;
}
.ages { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.ages button {
  width: clamp(80px, 14vmin, 120px); aspect-ratio: 1; border-radius: 50%;
  font-size: clamp(34px, 6vmin, 52px); font-weight: 900; background: #fff; box-shadow: 0 5px 0 rgba(180, 120, 0, 0.2);
}

/* ---------- home ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.topbar h2 { font-size: clamp(22px, 4vmin, 34px); }
.home-body { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: clamp(16px, 4vmin, 48px); flex: 1; width: 100%; }
.podium { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.podium h2 { font-size: clamp(30px, 6vmin, 54px); font-weight: 900; }
.level { font-size: clamp(17px, 3vmin, 24px); font-weight: 800; color: var(--muted); }
.pickers { display: flex; flex-direction: column; gap: 8px; max-width: min(560px, 100%); }
.pickers h3 { font-size: 18px; color: var(--muted); }
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  position: relative; width: clamp(54px, 9vmin, 72px); aspect-ratio: 1; border-radius: 18px;
  background: #fff; box-shadow: 0 4px 0 rgba(180, 120, 0, 0.16); display: grid; place-items: center;
}
.pick .pick-art { font-size: clamp(28px, 5vmin, 40px); }
.pick.on { outline: 4px solid var(--go); }
.pick.locked { opacity: 1; background: #f6efd9; }
.pick.locked .pick-art { filter: grayscale(1) opacity(0.45); }
.pick .price { position: absolute; bottom: 2px; font-size: 11px; font-weight: 800; color: var(--muted); }
.home-go { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); padding-bottom: 6px; }

/* ---------- playing ---------- */
.play { gap: clamp(6px, 1.4vmin, 14px); }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.flowers { display: flex; gap: clamp(2px, 1vmin, 10px); font-size: clamp(22px, 4.2vmin, 36px); }
.flower { filter: grayscale(1) opacity(0.4); transition: filter 0.3s, transform 0.3s; }
.flower.done { filter: none; }
.flower.now { filter: none; animation: hover 1.4s ease-in-out infinite; }
.prompt { display: flex; align-items: center; gap: clamp(8px, 2vmin, 18px); }
.hear {
  display: flex; align-items: center; gap: 8px;
  font-size: clamp(18px, 3.4vmin, 28px); font-weight: 800;
  padding: 0.45em 0.9em; border-radius: 999px; background: #fff; box-shadow: 0 4px 0 rgba(180, 120, 0, 0.2);
}
.hear .ico { font-size: 1.3em; }
.hear.slow { font-size: clamp(15px, 2.6vmin, 22px); }
.msg { min-height: 1.4em; font-size: clamp(18px, 3.4vmin, 30px); font-weight: 800; text-align: center; }

.tiles, .row {
  --size: min(92px, calc((100vw - 60px) / var(--n) - 8px), 12vh);
  display: flex; justify-content: center; gap: clamp(4px, 0.9vmin, 8px);
}
.tile {
  display: grid; place-items: center;
  width: var(--size); height: calc(var(--size) * 1.18);
  font-family: var(--letters); font-size: calc(var(--size) * 0.72); font-weight: 700;
  border-radius: 14px; background: #fff; border: 3px dashed #e6b84a; color: var(--ink);
}
.tiles .tile:not(:empty) { border-style: solid; border-color: #f0b429; background: #fffdf3; }
.tile.cur { border: 3px solid var(--go); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25); }
.tile.ghost { color: #d9c9a0; }
.tile.lit { background: var(--mark); transform: scale(1.12); transition: transform 0.15s; }
.tiles.right .tile { background: #dcfce7; border-color: var(--right); animation: bounce 0.5s ease-out; }
.tiles.right .tile:nth-child(2) { animation-delay: 0.05s; }
.tiles.right .tile:nth-child(3) { animation-delay: 0.1s; }
.tiles.right .tile:nth-child(4) { animation-delay: 0.15s; }
.tiles.right .tile:nth-child(n+5) { animation-delay: 0.2s; }
.shake { animation: shake 0.35s; }
@keyframes bounce { 40% { transform: translateY(-14px); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.compare {
  display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.4vmin, 12px);
  width: min(900px, 100%); padding: clamp(12px, 2.4vmin, 22px); border-radius: 26px; background: rgba(255, 255, 255, 0.9);
}
.rows { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 12px; }
.row-label { font-size: clamp(14px, 2.4vmin, 19px); font-weight: 800; color: var(--muted); text-align: right; }
.row { justify-content: flex-start; --size: min(56px, calc((100vw - 200px) / var(--n) - 8px), 8vh); }
.row .tile { border-style: solid; border-color: #eadbb5; }
.row .tile.ok { color: var(--right); border-color: #bbf7d0; }
.row .tile.bad { color: var(--wrong); border-color: #fecaca; background: #fff1f1; }
.row .tile.gap { border-style: dashed; border-color: var(--wrong); background: transparent; }
.row .tile.mark { background: var(--mark); border-color: #f0b429; }
.row .tile.none { visibility: hidden; }
.notes { list-style: none; text-align: center; font-size: clamp(18px, 3.2vmin, 28px); font-weight: 800; }
.tip { font-size: clamp(15px, 2.5vmin, 21px); font-weight: 700; color: var(--muted); text-align: center; max-width: 46em; }
.compare-go { display: flex; align-items: center; gap: 14px; }

.keys { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(5px, 1vmin, 9px); margin-top: auto; }
.key-row { display: flex; gap: clamp(4px, 0.9vmin, 9px); }
.key {
  --k: min(76px, calc((100vw - 64px) / 9.2), 8.6vh);
  width: var(--k); height: calc(var(--k) * 0.92);
  font-family: var(--letters); font-size: calc(var(--k) * 0.56); font-weight: 700;
  border-radius: 14px; background: #fff; box-shadow: 0 4px 0 rgba(180, 120, 0, 0.22);
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(180, 120, 0, 0.22); }
.key.vowel { background: #ffe3f1; }
.key-row.last { align-self: stretch; justify-content: space-between; margin-top: clamp(4px, 1vmin, 10px); }
.key.back { width: auto; padding: 0 1em; font-family: var(--font); font-size: calc(var(--k) * 0.4); font-weight: 900; color: #b91c1c; background: #ffe1e1; box-shadow: 0 4px 0 #f5a3a3; }
.key.check {
  width: auto; padding: 0 1.2em; font-family: var(--font); font-size: calc(var(--k) * 0.4); font-weight: 900;
  color: #fff; background: #d6c79c; box-shadow: 0 4px 0 #b8a676;
}
.keys.ready .key.check { background: var(--right); box-shadow: 0 4px 0 #15803d; }
.sure {
  position: absolute; inset: -6px -6px -12px; display: none; flex-direction: column; align-items: center; justify-content: center; gap: clamp(10px, 2.4vmin, 24px);
  border-radius: 24px; background: rgba(255, 247, 209, 0.97);
}
.keys.asking .sure { display: flex; }
.sure-q { font-size: clamp(26px, 5vmin, 46px); font-weight: 900; }
.sure-go { display: flex; gap: clamp(16px, 5vmin, 60px); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); background: rgba(74, 48, 0, 0.35); z-index: 10;
}
.overlay.open { display: flex; }
.card {
  display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 2vmin, 16px);
  max-width: min(640px, 100%); max-height: 100%; overflow-y: auto;
  padding: clamp(18px, 4vmin, 36px); border-radius: 30px; background: #fffdf4; text-align: center;
  box-shadow: 0 10px 0 rgba(180, 120, 0, 0.25);
}
.card h2 { font-size: clamp(28px, 5.6vmin, 46px); font-weight: 900; }
.eyebrow { font-size: clamp(15px, 2.6vmin, 20px); font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rule { font-size: clamp(18px, 3.2vmin, 26px); font-weight: 700; }
.finish-honey { font-size: clamp(30px, 6vmin, 52px); font-weight: 900; color: var(--go-dark); }
.finish-go { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sticker {
  display: grid; place-items: center; width: 1.5em; aspect-ratio: 1; font-size: clamp(34px, 6vmin, 50px);
  border-radius: 24%; background: #fff; box-shadow: 0 4px 0 rgba(180, 120, 0, 0.18);
}
.sticker.big { font-size: clamp(70px, 15vmin, 120px); }
.sticker.gold { background: radial-gradient(circle, #fff6b8, #ffc61a); box-shadow: 0 0 0 4px #e0a800, 0 0 18px #ffd84d; }
.sticker.empty { color: #e6d6a6; font-weight: 900; font-size: clamp(22px, 4vmin, 34px); width: calc(clamp(34px, 6vmin, 50px) * 1.5); background: #fbf3d9; box-shadow: none; }
.sticker.pop { animation: pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
.unlocks { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.unlocks .eyebrow { width: 100%; }
.unlock { font-size: clamp(36px, 7vmin, 56px); position: relative; }
.book-card { max-width: min(900px, 100%); }
.book-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.book-empty { width: 100%; font-weight: 700; color: var(--muted); }

.gate-card { gap: 10px; }
.gate-q { font-size: 40px; font-weight: 900; }
.gate-show { font-size: 34px; font-weight: 900; min-height: 1.2em; letter-spacing: 0.1em; }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; }
.pad button { height: 60px; border-radius: 14px; font-size: 26px; font-weight: 800; background: #fff3c4; }

.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none;
  font-size: clamp(22px, 4.4vmin, 38px); font-weight: 900; color: #fff; padding: 0.3em 0.9em;
  border-radius: 999px; background: var(--purple); opacity: 0;
}
.toast.show { animation: toast 2.2s ease-out; }
@keyframes toast { 10%, 75% { opacity: 1; transform: translate(-50%, -8px); } }

/* ---------- grown-ups ---------- */
.grownups { -webkit-user-select: text; user-select: text; }
.grown-body { width: min(900px, 100%); display: flex; flex-direction: column; gap: 14px; }
.toggles { display: flex; gap: 20px; font-weight: 700; }
.note { color: var(--muted); font-size: 15px; line-height: 1.4; }
.report { background: #fff; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.report dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.report dt { color: var(--muted); }
.report dd { font-weight: 700; }
.report h4 { margin-top: 8px; color: var(--muted); }
.edit { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 12px; }
.edit label { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); gap: 4px; }
.edit input, .edit select { font: inherit; font-size: 18px; padding: 8px 10px; border-radius: 10px; border: 2px solid #f0dfa8; background: #fff; color: var(--ink); }
.edit input[type=checkbox] { width: 28px; height: 28px; padding: 0; }

/* narrow screens (a phone held upright): labels above the rows so the letters keep their size */
@media (max-width: 560px) {
  .rows { grid-template-columns: 1fr; justify-items: center; }
  .row-label { text-align: center; }
  .row { justify-content: center; --size: min(48px, calc((100vw - 56px) / var(--n) - 6px)); }
}

/* short screens (a phone on its side): drop the bee art and tighten up */
@media (max-height: 500px) {
  .prompt .bee { display: none; }
  .play { gap: 4px; padding-top: 8px; padding-bottom: 8px; }
  .home-body .bee.big { font-size: 90px; }
}
