:root {
  color-scheme: light;
  --ink: #19233b;
  --muted: #647087;
  --paper: #fffdf8;
  --sun: #f4c542;
  --tomato: #d94b3d;
  --tomato-dark: #a92f27;
  --mint: #d9f0e5;
  --line: #d9d7cf;
  --shadow: 0 18px 50px rgb(25 35 59 / 12%);
  font-family: Inter, ui-rounded, "Avenir Next", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(25 35 59 / 4%) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(rgb(25 35 59 / 4%) 1px, transparent 1px) 0 0 / 32px 32px,
    #f7f3e8;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar { min-height: 92px; }

.brand {
  display: inline-block;
  padding: 8px 18px 10px;
  color: var(--ink);
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  text-decoration: none;
  transform: rotate(-2deg);
}

.streak { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.streak span:first-child { color: var(--tomato); font-size: 1.3rem; }
.streak strong { color: var(--ink); }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 760px) 280px;
  gap: 36px;
  align-items: start;
  width: min(1120px, calc(100% - 40px));
  margin: 34px auto 60px;
}

.session-head { display: flex; gap: 24px; align-items: end; justify-content: space-between; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--tomato-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.7rem); line-height: 0.98; letter-spacing: -0.055em; }
h2 { font-size: 1.55rem; line-height: 1.08; letter-spacing: -0.035em; }

.progress-copy { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-copy strong { color: var(--ink); font-size: 1.25rem; }
.progress-track { height: 9px; margin: 26px 0; overflow: hidden; background: #dedbd2; border-radius: 999px; }
.progress-track span { display: block; width: 10%; height: 100%; background: var(--tomato); border-radius: inherit; transition: width 220ms ease; }

.session-controls { display: flex; gap: 16px; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.difficulty { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; border: 0; }
.difficulty legend { float: none; width: 100%; margin-bottom: 8px; color: var(--muted); font-size: 0.86rem; font-weight: 750; }
.difficulty label { position: relative; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.9rem; font-weight: 750; }
.difficulty label:has(input:checked) { color: white; background: var(--ink); border-color: var(--ink); }
.difficulty input { position: absolute; opacity: 0; }
.difficulty label:has(input:focus-visible) { outline: 3px solid rgb(244 197 66 / 55%); outline-offset: 2px; }
.topic-picker { display: grid; flex: 0 0 auto; gap: 8px; color: var(--muted); font-size: 0.86rem; font-weight: 750; }
.topic-picker select { min-height: 38px; padding: 7px 34px 7px 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font-weight: 750; }
.topic-picker select:focus-visible { outline: 3px solid rgb(244 197 66 / 55%); outline-offset: 2px; }
.speaking-mode { display: flex; flex: 0 0 auto; gap: 9px; align-items: center; min-height: 58px; padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.speaking-mode input { width: 20px; height: 20px; accent-color: var(--tomato); }
.speaking-mode span { display: grid; gap: 1px; }
.speaking-mode strong { font-size: 0.88rem; }
.speaking-mode small { color: var(--muted); font-size: 0.72rem; }

.card,
.summary {
  position: relative;
  min-height: 430px;
  padding: clamp(26px, 5vw, 48px);
  overflow: hidden;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow), 8px 8px 0 var(--ink);
}

.card::after { position: absolute; right: -28px; bottom: -30px; width: 110px; height: 110px; background: var(--sun); border: 2px solid var(--ink); border-radius: 50%; content: ""; }
.card { clear: both; }
.card-meta { display: flex; min-height: 25px; gap: 10px; justify-content: space-between; color: var(--muted); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.verb { margin: 30px 0 6px; color: var(--tomato-dark); font-size: 1rem; font-weight: 850; }
.prompt { max-width: 650px; margin-bottom: 10px; font-size: clamp(1.55rem, 4vw, 2.45rem); font-weight: 800; line-height: 1.16; letter-spacing: -0.035em; }
.translation { margin-bottom: 8px; color: var(--muted); font-size: 1rem; }
.clue { min-height: 25px; margin-bottom: 24px; color: var(--tomato-dark); font-weight: 750; }

#answer-form label { display: block; margin-bottom: 8px; font-size: 0.88rem; font-weight: 800; }
.answer-row { display: flex; gap: 10px; }
.answer-row input { min-width: 0; flex: 1; padding: 14px 16px; color: var(--ink); background: white; border: 2px solid #9da3ad; border-radius: 9px; font-size: 1.08rem; }
.answer-row input:focus { border-color: var(--ink); outline: 3px solid rgb(244 197 66 / 50%); }

.primary { padding: 13px 19px; color: white; background: var(--tomato); border: 2px solid var(--ink); border-radius: 9px; box-shadow: 3px 3px 0 var(--ink); font-weight: 850; }
.primary:hover { background: var(--tomato-dark); }
.primary:active { box-shadow: 1px 1px 0 var(--ink); transform: translate(2px, 2px); }
.primary:focus-visible, .reveal:focus-visible, footer button:focus-visible { outline: 3px solid rgb(244 197 66 / 70%); outline-offset: 3px; }

.reveal { margin-top: 20px; padding: 4px 0; color: var(--muted); background: transparent; border: 0; border-bottom: 1px solid currentColor; font-size: 0.9rem; }
.feedback { margin-top: 24px; padding: 18px; background: var(--mint); border-left: 5px solid #16815b; border-radius: 8px; }
.feedback.wrong { background: #fde7e2; border-left-color: var(--tomato); }
.feedback-title { margin-bottom: 4px; font-weight: 900; }
.feedback p:not(.feedback-title) { margin-bottom: 15px; line-height: 1.5; }
.speaking-prompt { margin-top: 22px; }
.speaking-prompt p { color: var(--muted); }
.self-grade { display: flex; gap: 10px; }
.secondary { padding: 13px 19px; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 9px; font-weight: 850; }
.secondary:focus-visible { outline: 3px solid rgb(244 197 66 / 70%); outline-offset: 3px; }

.summary { display: grid; min-height: 430px; align-content: center; text-align: center; }
.summary .primary { justify-self: center; }
.score { display: flex; gap: 8px; align-items: baseline; justify-content: center; margin: 18px 0; }
.score strong { color: var(--tomato-dark); font-size: 4.5rem; line-height: 1; }
.score span { color: var(--muted); }

.side-note { margin-top: 170px; padding: 28px 24px; background: var(--sun); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(1deg); }
.side-note > p:not(.eyebrow) { line-height: 1.55; }
.side-note dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0; }
.side-note dl div { padding-top: 14px; border-top: 2px solid rgb(25 35 59 / 30%); }
.side-note dt { font-size: 1.8rem; font-weight: 900; }
.side-note dd { margin: 2px 0 0; font-size: 0.8rem; line-height: 1.2; }
.balance-note { margin-bottom: 0; padding-top: 18px; border-top: 2px solid rgb(25 35 59 / 30%); font-size: 0.86rem; }

footer { gap: 20px; padding: 25px 0 35px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.82rem; }
footer button { padding: 4px 0; color: inherit; background: transparent; border: 0; border-bottom: 1px solid currentColor; }
[hidden] { display: none !important; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; margin-top: 16px; }
  .side-note { margin-top: 10px; transform: none; }
}

@media (max-width: 560px) {
  .topbar, footer, .shell { width: min(100% - 24px, 1120px); }
  .topbar { min-height: 76px; }
  .streak span:last-child { display: none; }
  .shell { gap: 24px; }
  .session-head { align-items: start; }
  .session-controls { align-items: stretch; flex-direction: column; }
  .topic-picker select { width: 100%; }
  .speaking-mode { justify-content: center; }
  .answer-row { align-items: stretch; flex-direction: column; }
  .primary { min-height: 50px; }
  .card, .summary { min-height: 450px; padding: 24px 20px; box-shadow: 5px 5px 0 var(--ink); }
  .card-meta { align-items: start; flex-direction: column; }
  .verb { margin-top: 22px; }
  footer { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
