/* VocaBowl — warm "bowl of words" theme. System fonts only: zero network requests. */
:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f4ece0;
  --ink: #2a2320;
  --muted: #8a7f72;
  --line: #ece2d4;
  --brand: #e0762f;
  --brand-dark: #c2611f;
  --select: #5b6cc4;
  --select-bg: #eceffb;
  --correct: #3f9b6b;
  --correct-bg: #e6f3ec;
  --correct-ink: #246b47;
  --wrong: #d4574e;
  --wrong-bg: #fbe9e7;
  --wrong-ink: #9c352e;
  --gold: #b9923b;
  --shadow: 0 8px 28px rgba(60, 40, 20, .10);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16120d;
    --surface: #221c15;
    --surface-2: #2c2419;
    --ink: #f1e9dd;
    --muted: #a99c89;
    --line: #382e22;
    --select-bg: #1e2336;
    --correct-bg: #16291f;
    --correct-ink: #7fd3a4;
    --wrong-bg: #2e1916;
    --wrong-ink: #f0a59d;
    --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* generic layout */
.screen {
  width: 100%; max-width: 32rem; margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  flex: 1; display: flex; flex-direction: column;
}
.center { justify-content: center; align-items: center; text-align: center; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 1rem; }

/* buttons */
.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%;
  font: inherit; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--brand);
  padding: .95rem 1rem; border-radius: 14px;
  box-shadow: 0 4px 0 var(--brand-dark);
  transition: transform .06s ease, box-shadow .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn:focus-visible { outline: 3px solid var(--select); outline-offset: 2px; }
.btn.green { background: var(--correct); box-shadow: 0 4px 0 #2f7e54; }
.btn.ghost {
  background: transparent; color: var(--brand-dark); box-shadow: none;
  text-transform: none; letter-spacing: 0; font-weight: 700; padding: .5rem;
}
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:active[disabled] { transform: none; }

/* chips */
.chips { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .5rem .8rem; min-width: 6.5rem; box-shadow: var(--shadow);
}
.chip .k { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.chip .v { font-size: 1.25rem; font-weight: 800; }

/* ===== start ===== */
.logo { width: 112px; height: 112px; }
.title { font-size: 2.6rem; font-weight: 900; letter-spacing: -.02em; margin: .4rem 0 .1rem; }
.title .bowl { color: var(--brand); }
.tagline {
  display: inline-block; background: var(--surface-2); color: var(--gold);
  font-weight: 800; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  padding: .35rem .8rem; border-radius: 999px;
}
.lede { max-width: 24rem; color: var(--muted); font-weight: 500; }
.feats { display: flex; gap: 1.25rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.credit { font-size: .68rem; color: var(--muted); opacity: .8; }

.lengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; width: 100%; }
.length {
  display: flex; flex-direction: column; align-items: center; gap: .12rem;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: .85rem .4rem; cursor: pointer; font: inherit; color: var(--ink);
  box-shadow: 0 3px 0 var(--line); transition: transform .06s, border-color .12s, box-shadow .06s;
}
.length:hover { border-color: var(--brand); }
.length:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.length:focus-visible { outline: 3px solid var(--select); outline-offset: 2px; }
.length .n { font-size: 1.7rem; font-weight: 900; line-height: 1; color: var(--brand-dark); }
.length .lab { font-weight: 800; font-size: .8rem; }
.length .sub { font-size: .58rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.length.feature { border-color: var(--brand); box-shadow: 0 3px 0 var(--brand-dark); }
.length.feature .n { color: var(--brand); }

/* ===== quiz ===== */
.qhead { display: flex; flex-direction: column; gap: .55rem; }
.qrow { display: flex; justify-content: space-between; align-items: center; }
.level-tag {
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  font-size: .64rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
  padding: .3rem .65rem; border-radius: 999px;
}
.count { font-weight: 800; color: var(--brand-dark); font-size: .85rem; }
.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }

.qbody { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1rem; padding: 1.25rem 0; }
.prompt { font-weight: 800; color: var(--muted); font-size: .95rem; margin: 0; }
.word-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem 1rem; text-align: center;
}
.word-card .word { font-size: clamp(1.8rem, 7vw, 2.5rem); font-weight: 900; letter-spacing: -.01em; word-break: break-word; }

.options { display: grid; gap: .65rem; }
.opt {
  display: flex; align-items: center; gap: .7rem; text-align: left; width: 100%;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: .85rem .9rem; font: inherit; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: border-color .12s, background .12s, transform .06s;
  -webkit-user-select: none; user-select: none;
}
.opt:hover:not(.locked) { background: var(--surface-2); }
.opt:active:not(.locked) { transform: translateY(1px); }
.opt:focus-visible { outline: 3px solid var(--select); outline-offset: 2px; }
.opt .badge {
  flex: none; width: 1.6rem; height: 1.6rem; border-radius: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: .8rem;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.opt.selected { border-color: var(--select); background: var(--select-bg); }
.opt.selected .badge { background: var(--select); color: #fff; border-color: var(--select); }
.opt.correct { border-color: var(--correct); background: var(--correct-bg); color: var(--correct-ink); }
.opt.correct .badge { background: var(--correct); color: #fff; border-color: var(--correct); }
.opt.wrong { border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong-ink); }
.opt.wrong .badge { background: var(--wrong); color: #fff; border-color: var(--wrong); }
.opt.dim { opacity: .5; }
.opt.locked { cursor: default; }

.hint { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.hint kbd {
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: .05rem .35rem; font: inherit; font-size: .7rem; font-weight: 700;
}

/* feedback banner (reveal) */
.qfoot { padding-top: 1rem; min-height: 7.5rem; display: flex; flex-direction: column; gap: .6rem; }
.btn.next { letter-spacing: .03em; }
.feedback {
  border-radius: 14px; padding: .85rem 1rem; display: flex; align-items: center; gap: .7rem;
  font-weight: 800; animation: rise .25s ease;
}
.feedback.ok  { background: var(--correct-bg); color: var(--correct-ink); }
.feedback.no  { background: var(--wrong-bg);  color: var(--wrong-ink); }
.feedback .mark {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 900;
}
.feedback.ok .mark { background: var(--correct); }
.feedback.no .mark { background: var(--wrong); }
.feedback .meaning { font-weight: 600; font-size: .82rem; opacity: .9; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ===== result ===== */
.result-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); overflow: hidden; animation: rise .5s ease;
}
.result-hero { background: var(--brand); color: #fff; padding: 1.6rem 1rem; text-align: center; position: relative; }
.result-hero .k { text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 800; opacity: .9; }
.result-hero .big { font-size: 3.2rem; font-weight: 900; line-height: 1.05; }
.result-hero .of { font-size: .8rem; opacity: .85; font-weight: 600; }
.result-hero .best-flag {
  position: absolute; top: .8rem; right: .8rem; background: var(--gold); color: #3a2c08;
  font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  padding: .25rem .5rem; border-radius: 8px; transform: rotate(6deg);
}
.result-body { padding: 1.25rem; }
.verdict-line { text-align: center; font-weight: 800; font-style: italic; font-size: 1.05rem; }
.note { background: var(--correct-bg); color: var(--correct-ink); border: 1px solid var(--line);
  border-radius: 12px; padding: .6rem .8rem; text-align: center; font-weight: 700; font-size: .85rem; }
.card-tint { border-radius: 14px; padding: .8rem .9rem; }
.card-tint h4 { margin: 0 0 .3rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); }
.card-tint p { margin: 0; font-size: .88rem; font-weight: 500; }
.card-tint.a { background: var(--surface-2); }
.card-tint.b { background: var(--select-bg); }
.card-tint.b h4 { color: var(--select); }

.breakdown h4, .review h4 { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .6rem; }
.brow { display: flex; align-items: center; gap: .7rem; font-size: .85rem; margin-bottom: .5rem; }
.brow .nm { width: 6.5rem; font-weight: 700; }
.brow .track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.brow .track > i { display: block; height: 100%; background: var(--correct); }
.brow .sc { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: .78rem; }
.review { margin-top: 1.1rem; }
.review details { border-top: 1px solid var(--line); }
.review summary { cursor: pointer; font-weight: 800; padding: .6rem 0; }
.miss { padding: .5rem .2rem; border-top: 1px dashed var(--line); }
.miss .w { font-weight: 800; }
.miss a.w { color: var(--brand-dark); text-decoration: none; border-bottom: 1px dotted currentColor; }
.miss a.w:hover { border-bottom-style: solid; }
.miss a.w:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }
.miss .d { font-size: .85rem; color: var(--muted); }
.lifetime { text-align: center; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin-top: .8rem; }

/* ===== modal ===== */
.modal-bg { position: fixed; inset: 0; background: rgba(20,12,4,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 1rem; z-index: 50; animation: rise .15s ease; }
.modal { background: var(--surface); color: var(--ink); border-radius: 20px; max-width: 32rem; width: 100%;
  max-height: 90dvh; overflow: auto; box-shadow: var(--shadow); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal header h3 { margin: 0; font-size: 1.1rem; }
.modal .x { background: var(--surface-2); border: 0; width: 2rem; height: 2rem; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.modal .content { padding: 1.25rem; }
.modal h4 { margin: 1.1rem 0 .4rem; }
.modal h4:first-child { margin-top: 0; }
.modal p, .modal li { font-size: .9rem; }
.modal ul { padding-left: 1.1rem; }
.bands { list-style: none; padding: 0; }
.bands li { display: flex; justify-content: space-between; background: var(--surface-2);
  border-radius: 10px; padding: .45rem .7rem; margin-bottom: .4rem; font-weight: 600; }
.bands b { color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.formula { background: var(--select-bg); border-radius: 12px; padding: .8rem; font-weight: 700; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
