/* Division games shared kit. Layout: one centred column (max 640px): header, option chips, play area, message line, progress dots.
   Same visual family as the times-table games: jade + amber on a soft green-grey ground. */
:root {
  --bg: #EAF1ED;
  --surface: #FFFFFF;
  --ink: #17302A;
  --muted: #5A716A;
  --line: #C9D8D1;
  --soft: #DAE5DF;
  --good: #2B7763;
  --on-good: #FFFFFF;
  --gold: #E9A23B;
  --gold-soft: #F6DDAA;
  --on-gold: #2B1B04;
  --bad: #C0453A;
  --blue: #5B7FD6;
  --pink: #E07A6A;
  --violet: #8E6CC2;
  --display: "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1C19; --surface: #162824; --ink: #E4EEEA; --muted: #92AAA2; --line: #2A413B; --soft: #1F332E;
    --good: #5EBEA2; --on-good: #0A1915; --gold: #F2B552; --gold-soft: #5C4620; --on-gold: #2B1B04; --bad: #E7786C;
    --blue: #6D8FE0; --pink: #E8907F; --violet: #A385D6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1C19; --surface: #162824; --ink: #E4EEEA; --muted: #92AAA2; --line: #2A413B; --soft: #1F332E;
  --good: #5EBEA2; --on-good: #0A1915; --gold: #F2B552; --gold-soft: #5C4620; --on-gold: #2B1B04; --bad: #E7786C;
  --blue: #6D8FE0; --pink: #E8907F; --violet: #A385D6; color-scheme: dark;
}
html, body { background: var(--bg); color: var(--ink); }
body { font-family: var(--body); font-size: 16px; line-height: 1.5; padding-inline: 16px; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button:disabled { cursor: default; }

.wrap { max-width: 640px; margin: 0 auto; padding-block: 18px 36px; display: flex; flex-direction: column; gap: 14px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 8vw, 38px); line-height: 1.05; margin: 0; }
.top p { margin: 4px 0 0; color: var(--muted); }
.quiet { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 14px; color: var(--muted); min-height: 36px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips > span { font-size: 14px; color: var(--muted); margin-right: 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-width: 44px; height: 40px; padding: 0 10px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip:disabled { opacity: 0.45; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.q { font-family: var(--display); font-weight: 800; font-size: clamp(42px, 12vw, 66px); line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.q .x { color: var(--muted); font-weight: 600; }
.q .blank { display: inline-block; min-width: 1.1em; border-bottom: 5px solid var(--gold); color: var(--gold); text-align: center; }
.ask { font-family: var(--display); font-weight: 800; font-size: clamp(21px, 5.5vw, 27px); line-height: 1.2; text-align: center; text-wrap: balance; }

.opts { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.opt { min-width: 92px; height: 66px; border: 2px solid var(--line); background: var(--surface); border-radius: 18px; font-family: var(--display); font-weight: 800; font-size: 30px; font-variant-numeric: tabular-nums; transition: transform .1s; }
.opt:active { transform: scale(0.96); }
.opt.right { background: var(--good); border-color: var(--good); color: var(--on-good); }
.opt.wrong { opacity: 0.35; text-decoration: line-through; }

.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(100%, 330px); align-self: center; }
.pad button { height: 56px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; font-family: var(--display); font-weight: 700; font-size: 26px; -webkit-user-select: none; user-select: none; }
.pad .ok { background: var(--good); color: var(--on-good); border-color: var(--good); }
.pad .del { color: var(--muted); }

.say { min-height: 1.6em; text-align: center; font-weight: 700; font-size: 17px; color: var(--muted); }
.say.good { color: var(--good); }
.say.bad { color: var(--bad); }

.progress { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.progress i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.progress i.done { background: var(--good); }
.progress i.now { box-shadow: 0 0 0 3px var(--gold); }

.end { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; }
.end .stars { font-size: 56px; line-height: 1; letter-spacing: 0.08em; color: var(--gold); }
.end .stars .off { color: var(--line); }
.end h2 { font-family: var(--display); font-weight: 800; font-size: 30px; margin: 0; line-height: 1.1; text-wrap: balance; }
.end p { margin: 0; color: var(--muted); }
.primary { border: 0; background: var(--good); color: var(--on-good); font-weight: 700; padding: 12px 30px; border-radius: 999px; font-size: 19px; min-height: 48px; }
.secondary { border: 2px solid var(--good); background: transparent; color: var(--good); font-weight: 700; padding: 10px 24px; border-radius: 999px; font-size: 18px; min-height: 48px; }

/* A dot/item used in picture games (candies, cookies, sweets) */
.dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); box-shadow: inset -2px -3px 0 rgb(0 0 0 / 0.15); }

@keyframes kit-pop { 50% { transform: scale(1.12); } }
@keyframes kit-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.kit-pop { animation: kit-pop .35s ease-out; }
.kit-shake { animation: kit-shake .4s ease-in-out; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
