/* Algorist, design direction C "Kaart" (D20; Design directions - 2026-11-27.md on Drive).
   Plum for what is yours, gold only for a right answer, no red anywhere. System fonts only (CSP). */
:root {
  --bg: #faf8f5; --card: #ffffff; --text: #1d1721; --muted: #5f5566;
  --plum: #5b2a6e; --on-plum: #ffffff; --learn: #a683b8; --none: #e6dfea;
  --gold: #e9a800; --gold-text: #7a5200; --on-gold: #1d1721;
  --line: #d8cfdd; --keyline: #8b7f92; --key: #ece6ef;
  --sans: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151017; --card: #1f1823; --text: #f1ebf3; --muted: #b5a9bb;
    --plum: #ddb6f0; --on-plum: #1e1024; --learn: #7a5a8b; --none: #2d2433;
    --gold: #f4c04e; --gold-text: #f4c04e; --on-gold: #1d1721;
    --line: #3a3040; --keyline: #7e7186; --key: #2a2130;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.45 var(--sans); font-variant-numeric: tabular-nums; }
p, h1, ol, ul { margin: 0; padding: 0; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

.app { max-width: 430px; margin: 0 auto; }
.screen {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
}
.top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-bottom: 8px; }
.wordmark { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { font-size: 17px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.note { font-size: 16px; color: var(--muted); margin-top: 12px; text-align: center; }
.link { background: none; border: 0; min-height: 44px; padding: 0 12px; font-size: 18px; color: var(--text); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.primary { min-height: 60px; width: 100%; border: 0; border-radius: 16px; background: var(--plum); color: var(--on-plum); font-size: 20px; font-weight: 700; cursor: pointer; }
.action { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.action:empty { display: none; }

/* the Som */
.work { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px 0; }
.question { font-size: clamp(56px, 19vw, 84px); line-height: 1; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; }
.answer {
  min-width: 220px; height: 88px; padding: 0 20px; display: flex; align-items: center; justify-content: center;
  border-bottom: 4px solid var(--text); font-size: 62px; font-weight: 700; color: var(--plum);
}
.caret { display: inline-block; width: 4px; height: 52px; margin-left: 4px; background: var(--plum); border-radius: 2px; }
.correct { font-size: 19px; font-weight: 600; text-align: center; min-height: 0; }
.correct:empty { display: none; }
.is-right .answer { background: var(--gold); color: var(--on-gold); border-color: transparent; border-radius: 18px; }
.is-right .caret { display: none; }
.is-right .correct { color: var(--gold-text); }
.is-right .work { flex: 1; }
.explained .work { flex: 0; padding-top: 0; }
.explained .question { font-size: 56px; }
.explained .answer { height: 72px; font-size: 52px; }
.explained .caret { height: 42px; }
.help .card { margin: 4px 0 12px; }
.explained .help { flex: 1; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  height: 60px; border: 1px solid var(--line); border-radius: 16px; background: var(--key);
  font-size: 28px; font-weight: 600; display: grid; place-items: center; cursor: pointer;
}
.key:active { background: var(--learn); }
.key-ok { background: var(--plum); color: var(--on-plum); border-color: var(--plum); font-size: 22px; font-weight: 700; }
.key-back { color: var(--muted); }

/* the worked solution */
.card { margin-top: 14px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.area { display: grid; gap: 3px; height: 104px; margin: 10px 0 12px; }
.area div { display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 6px; font-size: 17px; line-height: 1.3; min-width: 0; }
.area b { font-size: 26px; line-height: 1.1; }
.area .a1 { background: var(--plum); color: var(--on-plum); }
.area .a2 { background: var(--learn); color: var(--text); }
.total { font-size: 24px; font-weight: 600; }
.total b { font-weight: 700; }
.steps { list-style: none; font-size: 20px; line-height: 1.6; }

/* a wrong answer */
.feedback .right { font-size: 76px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 10px; }
.your { text-decoration: line-through; text-decoration-thickness: 2px; }

/* the end of the round */
.title { font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stats div { padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.stats b { display: block; font-size: 26px; line-height: 1.15; font-weight: 700; }
.stats span { display: block; font-size: 17px; color: var(--muted); }
.block { margin-top: 20px; }
.times { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--keyline);
}
.row.good { background: var(--gold); color: var(--on-gold); box-shadow: none; }
.row .sum-text { font-size: 19px; font-weight: 700; white-space: nowrap; }
.row .tags { font-size: 16px; color: var(--muted); }
.row.good .tags { color: var(--on-gold); }
.row .time { font-size: 18px; font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.device p + p { margin-top: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .is-right .answer { animation: land 0.4s ease-out; }
  @keyframes land { from { transform: scale(0.92); } 60% { transform: scale(1.04); } to { transform: none; } }
}
