:root {
  --bg: #1b2a4a;
  --bg-2: #24375f;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --brand: #ffb627;
  --brand-ink: #3b2600;
  --good: #22c55e;
  --good-soft: #dcfce7;
  --bad: #ef4444;
  --bad-soft: #fee2e2;
  --accent: #6366f1;
  --line: #e5e7eb;
  --radius: 18px;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 20% 0%, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border: 0; border-radius: 14px;
  background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 1.1rem;
  box-shadow: var(--shadow); transition: transform 0.08s; text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18); }
.btn:disabled { opacity: 0.5; }
.btn.big { width: 100%; min-height: 68px; font-size: 1.4rem; }
.btn.alt { background: #fff; color: var(--ink); }
.btn.ghost { background: transparent; color: #fff; box-shadow: none; min-height: 44px; padding: 8px 12px; }
.btn.good { background: var(--good); color: #fff; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 18px; }
.topbar .spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; font-size: 1.05rem;
}

/* Cards */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.hero-title { color: #fff; font-size: 2rem; margin: 6px 0 4px; }
.sub { color: #c7d2fe; margin: 0 0 18px; }

/* Home */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 12px; text-align: center; color: #fff; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { font-size: 0.85rem; color: #c7d2fe; }
.bar { height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--good); border-radius: inherit; transition: width 0.4s; }
.card .bar { background: var(--line); }
.stack { display: grid; gap: 12px; margin-top: 16px; }

/* Quest */
.q-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.q-head .bar { flex: 1; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: #eef2ff; color: var(--accent);
}
.prompt { font-size: 1.15rem; color: var(--muted); margin: 10px 0 6px; }
.word-big { font-size: 2.4rem; font-weight: 700; margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; word-break: break-word; }
.speak { border: 0; background: #eef2ff; border-radius: 12px; width: 48px; height: 48px; font-size: 1.4rem; flex: none; }
.meaning { font-size: 1.25rem; margin: 6px 0 14px; }

/* The meaning, styled as a chunky game block so it's the first thing the eye lands on. */
.meaning-block {
  --block: #ffe27a;
  --block-edge: #2b2112;
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  margin: 10px 0 16px; padding: 16px 16px 16px 18px;
  background: var(--block); color: var(--block-edge);
  border: 3px solid var(--block-edge); border-radius: 12px;
  box-shadow: 0 6px 0 var(--block-edge);
}
.meaning-block p { margin: 0; flex: 1; font-size: 1.4rem; line-height: 1.35; }
.meaning-block .mb-word { font-weight: 600; }
.meaning-block .mb-verb { opacity: 0.7; }
.meaning-block strong { font-weight: 700; }
.mb-speak {
  flex: none; width: 44px; height: 44px; border-radius: 10px; font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.65); border: 2px solid var(--block-edge);
}
.meaning-block.small { margin: 10px 0; padding: 12px 12px 12px 14px; box-shadow: 0 4px 0 var(--block-edge); }
.meaning-block.small p { font-size: 1.1rem; }
.meaning-block.small .mb-speak { width: 38px; height: 38px; font-size: 1rem; }
.pop-in { animation: block-pop 0.45s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes block-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .pop-in, .pop, .shake { animation: none; } }

.syn-chip {
  display: inline-block; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px;
  background: var(--good-soft); color: #14532d; font-size: 1.05rem;
}
.learn .example { font-size: 1.1rem; color: #334155; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.example { font-size: 1.15rem; background: #f8fafc; border-radius: 12px; padding: 14px; line-height: 1.5; }
.example mark { background: #fde68a; border-radius: 4px; padding: 0 3px; }
.options { display: grid; gap: 10px; margin-top: 16px; }
.option {
  text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; font-size: 1.1rem; line-height: 1.35;
}
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.spell-input {
  width: 100%; font-size: 1.6rem; padding: 14px; border-radius: 14px; border: 3px solid var(--line);
  text-align: center; letter-spacing: 0.04em; margin-top: 14px;
}
.spell-input:focus { outline: none; border-color: var(--accent); }
.feedback { margin-top: 16px; padding: 14px; border-radius: 14px; font-size: 1.1rem; }
.feedback.good { background: var(--good-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .btn { margin-top: 12px; width: 100%; }
.hint { color: var(--muted); font-size: 1rem; margin-top: 8px; }

.pop {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); pointer-events: none;
  font-size: 2.4rem; font-weight: 700; color: var(--brand); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  animation: pop 0.9s ease-out forwards; z-index: 10;
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Results */
.result-emoji { font-size: 4rem; text-align: center; }
.result-list { list-style: none; padding: 0; margin: 12px 0 0; }
.result-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }

/* Word list */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }
.chip.on { background: var(--brand); color: var(--brand-ink); }
.wordrow { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.wordrow:last-child { border-bottom: 0; }
.wordrow .w { font-weight: 600; font-size: 1.1rem; flex: 1; }
.dots { display: flex; gap: 3px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--good); }

/* Login */
.login { max-width: 400px; margin: 10vh auto 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font-size: 1.05rem; background: #fff; width: 100%;
}
.error { color: var(--bad); margin: 8px 0 0; }
