/* Buzzy Spelling Bee */

:root {
  --ink: #25304f;
  --ink-soft: #5b6585;
  --honey: #ffc93c;
  --honey-deep: #e2a516;
  --honey-pale: #fff3c4;
  --lady: #e5383b;
  --lady-pale: #ffe9e6;
  --leaf: #3da35d;
  --leaf-pale: #e1f5e5;
  --sky: #cfeffb;
  --cream: #fff8e7;
  --paper: #fffdf6;
  --teal: #1b6b8f;
  --coral: #ff8a5b;
  --pink: #ff9aa2;
  --radius: 24px;
  --nav-h: 72px;
  --font: Fredoka, ui-rounded, "Nunito", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cg fill='none' stroke='%23ffc93c' stroke-opacity='.3' stroke-width='2'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34zM28 66v34M28 0v-34M28 100v34'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#d6f0fc 0, #eefaff 50%, #fff8e7 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: 4px solid var(--teal); outline-offset: 3px; border-radius: 12px; }

.meadow {
  position: fixed; left: 0; right: 0; bottom: 0; height: 150px; z-index: -1; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 150' preserveAspectRatio='none'%3E%3Cpath d='M0 70Q100 25 210 68T400 55V150H0z' fill='%23c4eaad'/%3E%3Cpath d='M0 100Q120 62 250 98T400 90V150H0z' fill='%2397d77e'/%3E%3Ccircle cx='60' cy='112' r='5' fill='%23fff'/%3E%3Ccircle cx='60' cy='112' r='2' fill='%23ffc93c'/%3E%3Ccircle cx='170' cy='124' r='5' fill='%23ff9aa2'/%3E%3Ccircle cx='170' cy='124' r='2' fill='%23ffc93c'/%3E%3Ccircle cx='310' cy='116' r='5' fill='%23fff'/%3E%3Ccircle cx='310' cy='116' r='2' fill='%23ffc93c'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}

/* ---------- top bar and tabs ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px;
  /* no backdrop-filter here: it would make this bar the containing block of the fixed tab bar */
  background: rgba(255, 248, 231, 0.97);
  border-bottom: 3px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-bee { width: 46px; height: 40px; flex: none; }
.brand-bee svg { width: 100%; height: 100%; }
.brand-name { font-weight: 700; font-size: 21px; letter-spacing: 0.01em; white-space: nowrap; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 3px solid var(--ink);
}
.tab-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: 6px 4px;
  background: transparent; border: 0; border-radius: 18px;
  font-weight: 600; font-size: 14px; color: var(--ink-soft);
}
.tab-ico { width: 26px; height: 26px; display: block; }
.tab-ico svg { width: 100%; height: 100%; display: block; }
.tab-btn[aria-selected="true"] { background: var(--honey); color: var(--ink); box-shadow: inset 0 0 0 3px var(--ink); }

@media (min-width: 760px) {
  .tabs {
    position: static; display: flex; gap: 8px; padding: 0; background: none; border: 0;
  }
  .tab-btn { flex-direction: row; gap: 8px; min-height: 44px; padding: 6px 16px; font-size: 16px; }
  .tab-ico { width: 22px; height: 22px; }
  main { padding-bottom: 170px !important; }
}

main {
  width: 100%; max-width: 560px; margin: 0 auto;
  padding: 14px 16px calc(var(--nav-h) + 90px + env(safe-area-inset-bottom));
}

h2 { margin: 0 0 8px; font-size: 21px; line-height: 1.2; }
h3 { margin: 14px 0 8px; font-size: 18px; line-height: 1.2; }
p { margin: 0 0 8px; }
.muted { color: var(--ink-soft); font-size: 15px; }
.label { margin: 6px 0; font-weight: 600; font-size: 15px; }

/* ---------- mascots ---------- */

.mascot { display: block; width: 100%; height: auto; overflow: visible; }
.wing-g { transform-box: view-box; }
@keyframes flap { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-16deg); } }
@keyframes flap2 { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(12deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes ear { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.mood-listening .wing-back, .bee-btn:hover .wing-back, .mini-btn.on .wing-back { animation: flap 0.16s linear infinite; }
.mood-listening .wing-front, .bee-btn:hover .wing-front, .mini-btn.on .wing-front { animation: flap2 0.16s linear infinite; }
.mood-listening .e1 { animation: ear 0.9s ease-in-out infinite; }
.mood-listening .e2 { animation: ear 0.9s ease-in-out 0.25s infinite; }
.bee-btn .bee-all { animation: bob 2.4s ease-in-out infinite; }
.hero-lady .lady-all { animation: bob 3.2s ease-in-out infinite; }

/* ---------- speech bubbles ---------- */

.bubble {
  position: relative; background: var(--teal); color: #fff;
  border: 3px solid var(--ink); border-radius: 22px; padding: 10px 16px;
  font-weight: 500; line-height: 1.3;
}
.bubble::after {
  content: ""; position: absolute; width: 18px; height: 18px; background: var(--teal);
  border: 3px solid var(--ink); border-top: 0; border-right: 0;
}
.bubble-left::after { left: -11px; bottom: 22px; transform: rotate(45deg); border-radius: 0 0 0 6px; }

/* ---------- HOME: progress, card ---------- */

.progress-pill {
  width: fit-content; margin: 0 auto 14px; padding: 4px 16px;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px;
  font-weight: 600; font-size: 15px;
}

.card-scene { position: relative; width: min(100%, 360px); margin: 0 auto; perspective: 1400px; }
.card {
  display: grid; min-height: 470px;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.15, 0.2, 1);
}
.card.flipped { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1;
  position: relative; display: flex; flex-direction: column;
  padding: 18px 16px 16px;
  background: var(--paper);
  border: 4px solid var(--ink); border-radius: 36px;
  box-shadow: 0 10px 0 var(--honey-deep), 0 18px 28px rgba(37, 48, 79, 0.16);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.back { transform: rotateY(180deg); cursor: pointer; user-select: none; }
.card.is-right .back { background: #f1fbf2; }
.card.is-wrong .back { background: #fff5f2; }

.front-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 6px; }
.slot { width: 100%; display: flex; flex-direction: column; align-items: center; }
.cap { margin-top: 6px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }

.tile {
  width: 88px; height: 88px; padding: 14px;
  border: 3px solid var(--ink); border-radius: 28px;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.tile svg { width: 100%; height: 100%; display: block; }
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.tile-sky { background: var(--sky); }
.tile-leaf { background: var(--leaf-pale); }
.tile.speaking { animation: bob 0.5s ease-in-out 3; }

.bee-slot { display: flex; flex-direction: column; align-items: center; }
.bee-btn {
  width: 132px; padding: 0; background: transparent; border: 0;
}
.bee-btn:active { transform: scale(0.95); }

.spell-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.hint-bubble {
  position: relative; display: flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 14px 6px 8px;
  background: var(--teal); color: #fff;
  border: 3px solid var(--ink); border-radius: 20px;
  font-weight: 500; font-size: 15px; line-height: 1.25;
}
.hint-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -11px; width: 16px; height: 16px; margin-left: -8px;
  background: var(--teal); border: 3px solid var(--ink); border-top: 0; border-left: 0;
  transform: rotate(45deg); border-radius: 0 0 6px 0;
}
.hint-bee { width: 40px; flex: none; }
.hint-bubble.nudge { animation: nudge 0.5s ease; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.spell-box {
  position: relative; width: 100%; min-height: 66px; padding: 8px 12px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 20px;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.spell-text { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 1px; font-size: clamp(20px, 6vw, 30px); font-weight: 600; letter-spacing: 0.04em; line-height: 1.25; }
.spell-text .ph { font-size: 16px; font-weight: 400; color: var(--ink-soft); letter-spacing: 0; }
.dash { color: #aeb6cf; font-weight: 400; }
.spell-input {
  width: 100%; padding: 0; border: 0; background: transparent; outline: none; text-align: center;
  font-size: clamp(22px, 6.5vw, 32px); font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  caret-color: var(--lady);
}
.spell-input::placeholder { font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--ink-soft); text-transform: none; }
.spell-box:has(.spell-input:not([hidden])) { cursor: text; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(27, 107, 143, 0.2); }
.spell-box.listening { border-color: var(--lady); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 56, 59, 0.35); } 50% { box-shadow: 0 0 0 9px rgba(229, 56, 59, 0); } }

.spell-tools { display: flex; align-items: center; justify-content: center; gap: 12px; }
.mini-btn {
  width: 50px; height: 50px; padding: 7px; display: grid; place-items: center;
  background: #fff; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
}
.mini-btn svg { width: 100%; height: 100%; display: block; }
.mini-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.mini-btn:disabled { opacity: 0.35; box-shadow: none; }
.mini-btn.on { background: var(--lady-pale); border-color: var(--lady); }

/* back of the card */
.verdict { display: flex; align-items: center; gap: 4px; }
.verdict-bee { width: 92px; flex: none; }
.verdict .bubble { flex: 1; display: flex; flex-direction: column; padding: 8px 14px; }
.verdict .bubble::after { left: -11px; top: 50%; margin-top: -9px; transform: rotate(45deg); border-radius: 0 0 0 6px; }
.v-main { font-size: 20px; font-weight: 600; line-height: 1.15; }
.v-sub { font-size: 14px; opacity: 0.9; }

.given {
  margin-top: 10px; min-height: 58px; padding: 8px 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px;
  font-size: clamp(22px, 6.4vw, 30px); font-weight: 600; letter-spacing: 0.04em;
}
.given .L.ok { color: #1f8a46; }
.given .L.bad { color: var(--lady); text-decoration: underline wavy; text-underline-offset: 5px; }

.answer { margin-top: 12px; text-align: center; }
.answer-word { display: block; font-size: clamp(32px, 10vw, 44px); font-weight: 700; line-height: 1.1; word-break: break-word; }
.answer-letters { display: block; margin-top: 4px; font-size: 16px; font-weight: 500; letter-spacing: 0.12em; color: var(--ink-soft); }

.meaning { flex: 1; margin-top: 12px; overflow-y: auto; font-size: 16px; line-height: 1.4; }
.def { margin: 0 0 8px; }
.pos { display: inline-block; padding: 0 9px; margin-right: 4px; background: var(--honey-pale); border: 2px solid var(--ink); border-radius: 999px; font-size: 13px; font-weight: 600; }
.ex { margin: 0 0 8px; color: var(--ink-soft); font-style: italic; }
.src { margin: 4px 0 0; font-size: 12px; color: var(--ink-soft); }
.def-loading, .def-none { color: var(--ink-soft); }
.next-hint { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--ink-soft); }

.under-card { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink); font-weight: 600; font-size: 15px;
}
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip-ico { width: 24px; height: 24px; display: inline-block; }
.chip-ico:empty { display: none; }
.chip-ico svg { width: 100%; height: 100%; display: block; }
.note { margin: 0; max-width: 340px; font-size: 14px; color: var(--ink-soft); }
.note:empty { display: none; }

/* finished */
.finish-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.finish-bee { width: 150px; }
.finish-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* confetti */
.conf {
  position: absolute; left: 50%; top: 32%; z-index: 6; width: 13px; height: 15px; pointer-events: none;
  background: var(--c); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: confetti 1.2s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

/* ---------- buttons, panels and shared bits ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  background: var(--honey); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 600; font-size: 17px; line-height: 1.2; text-align: center;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.45; box-shadow: none; transform: translateY(2px); }
.btn.alt { background: var(--sky); }
.btn.ghost { background: #fff; }
.btn.armed { background: var(--lady); color: #fff; }
.btn.small { padding: 8px 16px; font-size: 16px; }
.btn-ico { width: 22px; height: 22px; display: inline-block; flex: none; }
.btn-ico svg { width: 100%; height: 100%; display: block; }

.actions { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.actions.wrap { flex-direction: row; flex-wrap: wrap; }

.panel {
  margin: 16px 0; padding: 16px;
  background: #fff; border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(37, 48, 79, 0.18);
}

.hero { display: flex; align-items: flex-end; gap: 14px; margin: 2px 0 6px; }
.hero-lady { width: 118px; flex: none; }
.hero .bubble { flex: 1; margin-bottom: 14px; }

/* results */
.level-card { display: flex; align-items: center; gap: 14px; }
.level-badge { width: 68px; height: 68px; flex: none; padding: 14px; display: grid; background: var(--honey); border: 3px solid var(--ink); border-radius: 50%; }
.level-badge svg { width: 100%; height: 100%; }
.level-info { flex: 1; min-width: 0; }
.level-info h2 { margin-bottom: 6px; }
.level-info p { margin: 6px 0 0; font-size: 15px; }
.bar { height: 16px; background: var(--honey-pale); border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--honey); border-radius: 999px; transition: width 0.6s ease; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.tile-stat {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 8px 10px;
  border: 3px solid var(--ink); border-radius: 22px;
}
.tile-stat:nth-child(1) { background: var(--honey-pale); }
.tile-stat:nth-child(2) { background: #ffe8ef; }
.tile-stat:nth-child(3) { background: var(--lady-pale); }
.tile-stat:nth-child(4) { background: #ffe9d6; }
.ts-ico { width: 40px; height: 40px; }
.ts-ico svg { width: 100%; height: 100%; display: block; }
.ts-num { font-size: 36px; font-weight: 700; line-height: 1.1; }
.ts-label { font-weight: 600; font-size: 16px; line-height: 1.2; }
.ts-sub { font-size: 13px; color: var(--ink-soft); }

.comb { position: relative; width: 100%; margin: 8px 0 12px; }
.hex {
  position: absolute; width: 24px; height: 28px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.hex.ok { background: linear-gradient(160deg, #ffe27a, var(--honey) 55%, var(--honey-deep)); }
.hex.miss { background: var(--lady); }
.hex.left { background: #bfcae4; }
.hex.left::after {
  content: ""; position: absolute; inset: 3px; background: var(--paper);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .hex { position: relative; display: inline-block; width: 18px; height: 21px; }
.legend .hex.left::after { inset: 2.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip { display: inline-flex; flex-direction: column; padding: 4px 12px; border: 2.5px solid var(--ink); border-radius: 16px; line-height: 1.2; }
.word-chip.ok { background: var(--leaf-pale); }
.word-chip.miss { background: var(--lady-pale); }
.word-chip small { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; }

/* settings */
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.seg-btn { padding: 9px 20px; background: #fff; border: 0; font-weight: 600; }
.seg-btn + .seg-btn { border-left: 3px solid var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--honey); }

.switch { display: flex; align-items: center; gap: 12px; margin-top: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; flex: none; width: 54px; height: 32px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; transition: background 0.15s; }
.switch .track i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: var(--ink); border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + .track { background: var(--leaf); }
.switch input:checked + .track i { transform: translateX(22px); background: #fff; border: 3px solid var(--ink); width: 20px; height: 20px; box-sizing: border-box; top: 3px; }
.switch input:focus-visible + .track { outline: 4px solid var(--teal); outline-offset: 3px; }

.radio-row { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; font-size: 16px; }
.radio-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.radio-row input { width: 20px; height: 20px; accent-color: var(--ink); }

.help { margin-top: 14px; font-size: 15px; }
.help summary { cursor: pointer; font-weight: 600; }
.help pre { margin: 8px 0; padding: 10px 12px; background: #f6f2e4; border-radius: 12px; font-size: 12.5px; line-height: 1.45; overflow-x: auto; }

.add-row { display: flex; gap: 8px; margin-top: 16px; }
.add-row input, .search {
  flex: 1; min-width: 0; padding: 9px 14px;
  background: #fff; border: 2.5px solid #b8c1da; border-radius: 14px; font-size: 16px;
}
.add-row input:focus, .search:focus, .wl-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.6); }
.search { display: block; width: 100%; margin-top: 12px; }

.word-list { list-style: none; margin: 10px 0 0; padding: 4px 4px 4px 0; max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.word-list li { display: flex; align-items: center; gap: 8px; }
.word-list li.empty { color: var(--ink-soft); }
.wl-input { flex: 1; min-width: 0; padding: 7px 12px; background: #fff; border: 2px solid #d3d9ea; border-radius: 12px; font-size: 16px; }
.wl-del { flex: none; width: 38px; height: 38px; padding: 9px; display: grid; background: var(--lady-pale); color: var(--lady); border: 2px solid var(--lady); border-radius: 50%; }
.wl-del svg { width: 100%; height: 100%; display: block; }
.wl-del:active { transform: scale(0.92); }

/* meaning pop-up */
dialog {
  width: min(92vw, 420px); max-height: 80vh; padding: 0; overflow: auto;
  color: var(--ink); background: var(--paper);
  border: 4px solid var(--ink); border-radius: 30px;
  box-shadow: 0 10px 0 var(--honey-deep);
}
dialog::backdrop { background: rgba(37, 48, 79, 0.55); }
.dict-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 4px 16px; }
.dict-bee { width: 64px; flex: none; }
.dict-head h2 { flex: 1; margin: 0; font-size: 22px; }
.close-btn { width: 42px; height: 42px; padding: 10px; display: grid; background: #fff; border: 3px solid var(--ink); border-radius: 50%; }
.close-btn svg { width: 100%; height: 100%; display: block; }
.dict-body { padding: 6px 20px 22px; font-size: 18px; line-height: 1.45; }
.dict-body .pos { font-size: 14px; }
.dict-body .ex { font-size: 17px; }

/* toasts */
.toast-layer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
@media (min-width: 760px) { .toast-layer { bottom: 24px; } }
.toast {
  max-width: min(92vw, 460px); padding: 11px 18px;
  background: var(--ink); color: #fff; border-radius: 18px;
  font-size: 16px; font-weight: 500; line-height: 1.3; text-align: center;
  box-shadow: 0 6px 18px rgba(37, 48, 79, 0.35);
  animation: toast-in 0.25s ease-out;
}
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 380px) {
  .brand-name { font-size: 18px; }
  .hero-lady { width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ?debug panel for the speech recogniser */
#debug-log {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--nav-h) + 8px); z-index: 70; max-height: 28vh; overflow: auto;
  margin: 0; padding: 8px 10px; background: rgba(37, 48, 79, 0.92); color: #cfeffb;
  font: 11px/1.35 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; border-radius: 10px; pointer-events: none;
}

/* invitation to press the bee after the word was played */
.bee-prompt { margin-bottom: 12px; animation: prompt-in 0.3s ease-out; }
@keyframes prompt-in { from { opacity: 0; transform: translateY(6px); } }

/* "speak now / wait" light while listening */
.listen-status {
  padding: 2px 14px; background: var(--leaf-pale); border: 2.5px solid var(--leaf); border-radius: 999px;
  font-weight: 600; font-size: 14px; color: #1f6b39;
}
.listen-status.busy { background: var(--honey-pale); border-color: var(--honey-deep); color: #8a5d00; }
.spell-box.listening.busy { border-color: var(--honey-deep); border-style: dashed; animation: none; }
