/*
  Español 1: "Póster, but calmer".
  Bold display type only for titles and questions; calm body text.
  Hard shadows only on things you can click. Color has meaning:
  green = correct, red = wrong, yellow = main action / highlight, blue = info.
*/

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f4ef;
  --white: #ffffff;
  --ink: #141414;
  --text: #1c1c1c;
  --muted: #625e57;
  --line: #ddd7cc;
  --line-strong: #bdb6a8;
  --yellow: #ffc814;
  --yellow-soft: #fff4cc;
  --blue: #2f4bff;
  --blue-soft: #e6eaff;
  --green: #17864b;
  --green-soft: #e1f5e8;
  --red: #d42f22;
  --red-soft: #fde8e5;
  --radius: 8px;
  --tint: #f1eee7;
  --press: 3px 3px 0 var(--ink);
  --display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--body); }
a { color: var(--blue); text-underline-offset: 2px; }
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: inherit; font-size: 0.85em; font-weight: 700; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--white); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink); }

/* ---------- Header / footer ---------- */
.site-header { background: var(--ink); color: var(--white); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-family: var(--display); font-size: 1.2rem; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--red); color: var(--white); font-size: 1rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { color: #c9c9c9; text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 6px 12px; border-radius: 6px; }
.site-nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.08); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--yellow); font-weight: 700; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 20px 0 40px; }

/* ---------- Page ---------- */
main.container { padding-top: 36px; padding-bottom: 56px; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 5.5vw, 3rem); line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 10px; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 28px; max-width: 640px; }
.back { margin: 0 0 8px; font-size: 0.95rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--ink); text-decoration: underline; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.empty { margin: 0; font-weight: 500; }
.en { color: var(--muted); }

/* ---------- Buttons (the only things with the hard "poster" shadow) ---------- */
.btn {
  display: inline-block; padding: 10px 18px; border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--white); color: var(--ink); box-shadow: var(--press); cursor: pointer; white-space: nowrap;
  font: inherit; font-weight: 700; text-decoration: none; transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.primary { background: var(--yellow); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); transform: none; }
.btn.small { padding: 5px 12px; font-size: 0.88rem; box-shadow: 2px 2px 0 var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.link { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; vertical-align: middle;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--white); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--tint); border-color: var(--ink); }
.no-tts [data-say] { display: none; }

/* ---------- Home ---------- */

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; list-style: none; margin: 0; padding: 0; }
.topic {
  --c: var(--red);
  position: relative; display: flex; flex-direction: column; height: 100%; min-height: 138px; padding: 20px 18px 16px;
  background: var(--white); color: var(--text); text-decoration: none; overflow: hidden;
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--press);
  transition: transform 0.1s, box-shadow 0.1s;
}
a.topic:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
a.topic:active { transform: translate(3px, 3px); box-shadow: none; }
.topic .num { font-family: var(--display); font-size: 0.95rem; color: var(--muted); }
.topic h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.15; }
.topic p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Forms: chips, toggles, inputs ---------- */
.settings { display: grid; gap: 18px; margin-bottom: 20px; }
.settings h2, .field-label {
  display: block; margin: 0 0 10px; padding: 0; color: var(--muted);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 7px 14px; border: 1.5px solid var(--line-strong); border-radius: 999px;
  background: var(--white); font-weight: 500; font-size: 0.95rem; user-select: none;
}
.chip:hover span { border-color: var(--ink); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.chip input[type="radio"] + span { min-width: 3em; text-align: center; }
.toggles { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 4px; background: var(--white);
  display: grid; place-items: center;
}
.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { content: "✓"; color: var(--white); font-weight: 700; font-size: 14px; line-height: 1; }

input[type="text"] {
  width: 100%; padding: 10px 14px; border: 2px solid var(--line-strong); border-radius: var(--radius);
  background: var(--white); color: var(--text); font: inherit; font-size: 1.15rem;
}
input[type="text"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px #c9d2ff; }
input[type="text"]::placeholder { color: #9a958c; font-size: 0.95rem; }
input[type="text"][readonly] { background: #faf9f6; }
.is-good input[type="text"] { border-color: var(--green); background: var(--green-soft); }
.is-bad input[type="text"] { border-color: var(--red); background: var(--red-soft); }
select {
  font: inherit; font-weight: 500; font-size: 0.95rem; padding: 5px 8px; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--white); color: var(--text);
}

/* ---------- Tags ---------- */
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--blue-soft); color: #1d31b8; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.quiz-badge { display: inline-block; margin: 0 0 8px; padding: 2px 10px; border-radius: 999px; background: var(--ink); color: var(--white); font-weight: 700; font-size: 0.8rem; }
.quiz-badge[hidden] { display: none; }

/* ---------- Feedback (calm: colored side bar, dark text) ---------- */
.feedback { margin: 18px 0 0; padding: 12px 16px; border-radius: var(--radius); border-left: 6px solid var(--ink); background: var(--tint); font-weight: 500; }
.feedback:empty { display: none; }
.feedback > div:first-child { font-weight: 700; }
.feedback.good { background: var(--green-soft); border-left-color: var(--green); }
.feedback.good > div:first-child { color: var(--green); }
.feedback.bad { background: var(--red-soft); border-left-color: var(--red); }
.feedback.bad > div:first-child { color: #a8231a; }
.feedback .explain { margin-top: 6px; color: var(--text); }
.feedback .icon-btn, .note .icon-btn { width: 28px; height: 28px; margin-left: 6px; }

/* ---------- Mode tabs (conjugation) ---------- */
.tabs { display: inline-flex; margin-bottom: 16px; padding: 3px; gap: 3px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); }
.tabs button { border: 0; border-radius: 7px; padding: 8px 16px; background: transparent; cursor: pointer; font: inherit; font-weight: 700; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--white); }

/* ---------- Conjugation drill ---------- */
.verb-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.verb-head .inf { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: clamp(2.2rem, 7vw, 3rem); line-height: 1; color: var(--ink); }
.verb-head .en { margin-top: 6px; }
.verb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chart { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 28px; gap: 12px; align-items: start; }
.subj { padding-top: 12px; font-weight: 500; color: var(--muted); }
.mark { padding-top: 9px; text-align: center; font-weight: 700; font-size: 1.3rem; }
.row.is-good .mark { color: var(--green); }
.row.is-bad .mark { color: var(--red); }
.note { margin-top: 6px; padding: 6px 12px; border-radius: 6px; border-left: 4px solid var(--red); background: var(--red-soft); font-size: 0.92rem; color: var(--text); }
.note:empty { display: none; }
.row.is-good .note { border-left-color: var(--blue); background: var(--blue-soft); }
.quick-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.prompt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 20px; font-family: var(--display); font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; color: var(--ink); }
.subj-big, .subj-hl { background: var(--blue-soft); color: #1d31b8; padding: 0 0.15em; border-radius: 4px; }
.plus { color: var(--muted); font-family: var(--body); font-weight: 400; }
.answer-row { display: flex; gap: 10px; }
.answer-row input[type="text"] { font-size: 1.3rem; }
.accent-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.accent-bar button {
  min-width: 42px; height: 42px; border: 1.5px solid var(--line-strong); border-radius: 6px;
  background: var(--white); color: var(--ink); cursor: pointer; font: inherit; font-size: 1.15rem; font-weight: 700;
}
.accent-bar button:hover { border-color: var(--ink); background: var(--tint); }
.accent-bar button:active { background: var(--ink); color: var(--white); }
.score { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 16px 0 26px; color: var(--muted); }
.score b { color: var(--ink); font-size: 1.1rem; }
#streak-wrap:not([hidden]) { color: var(--ink); font-weight: 700; }
.help summary, .options summary { cursor: pointer; font-weight: 700; }
.help-body { margin-top: 16px; }
.help ul { padding-left: 20px; margin: 16px 0 0; }
.help li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; }
.endings { border-collapse: collapse; width: 100%; min-width: 440px; font-size: 0.95rem; }
.endings th, .endings td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.endings thead th { color: var(--ink); border-bottom: 2px solid var(--ink); }
.endings tbody th { color: var(--muted); font-weight: 500; }

/* ---------- Practice rounds ---------- */
.round-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.progress { flex: 1; height: 10px; border-radius: 999px; background: #e7e2d8; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--ink); transition: width 0.3s; }
.question-card { margin-bottom: 20px; padding: 28px; }
.q-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-sub { color: var(--muted); font-weight: 500; }
.q-visual { display: flex; justify-content: center; margin: 4px 0 18px; }
.q-visual .clock { width: min(210px, 60vw); }
.q-visual .scene { width: min(340px, 100%); border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.q-prompt { font-family: var(--display); font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.2; color: var(--ink); margin-bottom: 22px; overflow-wrap: anywhere; }
.blank { display: inline-block; min-width: 2.6em; padding: 0 0.2em; text-align: center; border-bottom: 4px solid var(--ink); }
.blank.ok { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.blank.no { color: #a8231a; border-color: var(--red); background: var(--red-soft); }
.cue {
  display: inline-block; vertical-align: middle; margin: 0 4px; padding: 2px 10px; border-radius: 999px;
  background: var(--blue-soft); color: #1d31b8; font-family: var(--body); font-size: 0.95rem; font-weight: 700;
}
.big-letter { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; font-size: 2em; border-radius: var(--radius); background: var(--white); border: 3px solid var(--ink); }
.digital { display: inline-block; padding: 2px 14px; border-radius: 6px; background: var(--ink); color: var(--white); font-variant-numeric: tabular-nums; }
.play-btn {
  font: inherit; font-weight: 700; font-size: 1.05rem; padding: 12px 24px; cursor: pointer; border-radius: var(--radius);
  background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); box-shadow: var(--press);
}
.play-btn:active { transform: translate(3px, 3px); box-shadow: none; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; cursor: pointer;
  font: inherit; font-size: 1.1rem; font-weight: 500; color: var(--text);
  background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--press);
  transition: transform 0.08s, box-shadow 0.08s;
}
.choice:hover:not(:disabled) { background: #f8f6f1; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.choice:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.choice:disabled { cursor: default; opacity: 0.5; box-shadow: none; border-color: var(--line-strong); }
.choice.is-right { opacity: 1; background: var(--green-soft); border-color: var(--green); }
.choice.is-wrong { opacity: 1; background: var(--red-soft); border-color: var(--red); }
.key { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; font-size: 0.8rem; font-weight: 700; background: #ece8df; color: var(--muted); }
.choice.is-right .key { background: var(--green); color: var(--white); }
.choice.is-wrong .key { background: var(--red); color: var(--white); }
.choices.visual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.visual .choice { position: relative; padding: 8px; justify-content: center; }
.choices.visual .key { position: absolute; top: 8px; left: 8px; }
.choices.visual .scene { display: block; width: 100%; max-width: 260px; margin: 0 auto; }
.choices.visual .choice-label { display: block; width: 100%; }

.pop { animation: pop 0.25s ease-out; }
.shake { animation: shake 0.35s ease-in-out; }
@keyframes pop { 50% { transform: scale(1.01); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .pop, .shake { animation: none; } }

.results { text-align: center; padding: 8px 0; }
.big-score { font-family: var(--display); font-size: clamp(4rem, 16vw, 6rem); line-height: 1; color: var(--ink); }
.big-score span { color: var(--muted); font-size: 0.45em; }
.result-msg { margin: 10px 0 22px; font-weight: 700; font-size: 1.2rem; }
.results h2 { margin: 8px 0 10px; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.misses { list-style: none; padding: 0; margin: 0 auto; max-width: 560px; text-align: left; display: grid; gap: 6px; }
.misses li { padding: 8px 12px; border-radius: 6px; border-left: 4px solid var(--red); background: #faf8f4; }
.results .actions { justify-content: center; }
.options .toggles { margin-top: 14px; }

/* ---------- Page head: breadcrumb, title, Options menu ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--muted); font-size: 0.95rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head .lede { margin-bottom: 22px; }
.menu { position: relative; flex: none; margin-top: 8px; }
.menu summary {
  list-style: none; cursor: pointer; padding: 7px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: var(--white); font-weight: 700; font-size: 0.95rem;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; color: var(--muted); }
.menu[open] summary, .menu summary:hover { border-color: var(--ink); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 270px; display: grid; gap: 14px; padding: 16px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}
.menu-item { display: grid; color: var(--ink); font-weight: 700; text-decoration: none; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.menu-item span { color: var(--muted); font-weight: 400; font-size: 0.88rem; }
.menu-item:hover { color: var(--blue); }

/* ---------- Home: sections and cards ---------- */
.home-section { margin-bottom: 34px; }
.section-title { margin: 0 0 14px; color: var(--muted); font-family: var(--body); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.card-action { margin-top: auto; padding-top: 14px; font-weight: 700; color: var(--ink); }
a.topic:hover .card-action { text-decoration: underline; }
.topic-feature { background: var(--ink); }
.topic-feature h3 { color: var(--white); }
.topic-feature p { color: #c9c9c9; }
.topic-feature .card-action { color: var(--yellow); }
.topic-feature .progress-badge { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.topic-feature .progress-badge.done { background: var(--green); color: var(--white); }

/* Quiz score card: meant to be screenshotted, so it gets the poster treatment */
.cert { max-width: 560px; margin: 0 auto 24px; text-align: left; }
.cert-label { display: block; font-weight: 700; margin-bottom: 8px; }
.cert-card { display: grid; gap: 4px; padding: 20px 22px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--white); box-shadow: 5px 5px 0 var(--ink); }
.cert-kicker { justify-self: start; padding: 1px 10px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 0.78rem; font-weight: 700; }
.cert-title { font-weight: 700; margin-top: 6px; }
.cert-name { font-family: var(--display); font-size: clamp(1.5rem, 5.5vw, 2.1rem); line-height: 1.15; overflow-wrap: anywhere; color: var(--ink); }
.cert-score { font-family: var(--display); font-size: 2.2rem; line-height: 1.1; color: var(--ink); }
.cert-score span { font-family: var(--body); font-size: 1.05rem; font-weight: 700; color: var(--muted); }
.cert-meta { color: var(--muted); font-size: 0.9rem; }
.cert-help { text-align: center; font-weight: 700; margin: 14px 0 0; }

/* ---------- Reference ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.toc a { padding: 5px 12px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--white); color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.92rem; }
.toc a:hover { border-color: var(--ink); background: var(--tint); }
.ref { margin-bottom: 24px; scroll-margin-top: 16px; }
.ref-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.ref-head h2 { flex: 1; margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.1; }
.ref-num { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 6px; font-family: var(--display); font-size: 1rem; background: var(--ink); color: var(--white); }
.ref-sub { margin: 18px 0 8px; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ref-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 6px; border-left: 4px solid var(--blue); background: var(--blue-soft); }
.ref-table { border-collapse: collapse; width: 100%; min-width: 440px; }
.ref-table.compact { min-width: 0; }
.ref-table th, .ref-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ref-table thead th { border-bottom: 2px solid var(--ink); color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ref-table tbody th { color: var(--muted); font-weight: 500; }
.ref-table .en { display: block; font-size: 0.88rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; margin-top: 8px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.rule { padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfbf8; }
.rule-grid .rule { margin: 0; }
.rule h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.15rem; }
.rule p { margin: 2px 0 0; }
.ex { font-size: 1.05rem; font-weight: 500; }
.ex b { background: var(--blue-soft); color: #1d31b8; padding: 0 2px; border-radius: 3px; }
.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.letter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fcfbf8; }
.letter b { font-family: var(--display); font-weight: 400; font-size: 1.4rem; line-height: 1; color: var(--ink); }
.letter span { font-size: 0.88rem; font-weight: 500; }
.letter .icon-btn { width: 28px; height: 28px; }
.boot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 320px; font-weight: 500; font-size: 1.05rem; }
.boot span { padding: 6px 10px; border: 1.5px dashed var(--line-strong); border-radius: 6px; }
.boot .in { border: 2px solid var(--ink); background: var(--blue-soft); font-weight: 700; }
.se-box { padding: 16px; border-radius: var(--radius); }
.se-box h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 1.4rem; }
.se-ser { background: var(--red-soft); }
.se-estar { background: var(--blue-soft); }
.acronym { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 2px; }
.acronym b { display: inline-block; width: 1.4em; font-family: var(--display); font-weight: 400; font-size: 1.15rem; }
.forms { margin: 0 0 6px; padding: 6px 10px; border-radius: 6px; background: var(--white); font-weight: 700; }
.se-box .ex { margin: 0; font-size: 1rem; }
.hay { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 18px; padding: 14px 18px; border-radius: var(--radius); background: var(--tint); font-weight: 500; font-size: 1.05rem; }
.hay > span:first-child { font-family: var(--display); font-size: 1.7rem; color: var(--ink); }
.qw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.qw-grid div { display: grid; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfbf8; }
.qw-grid b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; color: var(--ink); }
.qw-grid span { font-weight: 700; }
.qw-grid i { color: var(--muted); font-style: normal; font-size: 0.92rem; }
.prep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.prep-grid figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.prep-grid .scene { display: block; width: 100%; border-bottom: 1px solid var(--line); }
.prep-grid figcaption { display: grid; padding: 8px 10px; }
.prep-grid figcaption b { font-size: 1.05rem; }
.prep-grid figcaption span { color: var(--muted); font-size: 0.9rem; }
.prep-grid .prep-extra { display: grid; align-content: center; background: var(--tint); }
.time-rules { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.time-rules li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fcfbf8; }
.time-rules .en { display: block; font-size: 0.88rem; }
.periods { display: flex; flex-wrap: wrap; gap: 8px; }
.periods span { padding: 5px 12px; border-radius: 999px; background: var(--ink); color: var(--white); font-weight: 700; font-size: 0.92rem; }
.periods i { font-style: normal; color: #c9c9c9; font-weight: 500; margin-left: 4px; }
.clock-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.clock-examples figure { margin: 0; display: grid; justify-items: center; gap: 6px; text-align: center; font-weight: 500; }
.clock-examples .clock { width: 100%; max-width: 150px; }
.clock-examples .icon-btn { width: 28px; height: 28px; }

/* ---------- Quiz builder ---------- */
.builder { display: grid; gap: 22px; margin-bottom: 20px; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-help { margin: 10px 0 0; }
.toggles-col { display: grid; gap: 12px; }
.form-error { margin: 0; padding: 8px 12px; border-radius: 6px; border-left: 4px solid var(--red); background: var(--red-soft); font-weight: 700; }
.form-error[hidden] { display: none; }
.builder .actions { margin-top: 0; }
.result { margin-bottom: 20px; border: 2px solid var(--ink); background: var(--white); }
.result-title, .how h2 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 1.4rem; }
.result-meta { margin: 10px 0 0; font-weight: 500; }
#r-link { font-size: 0.95rem; }
.qr { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 20px; }
.qr svg { width: 180px; height: 180px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.qr p { margin: 0; max-width: 260px; font-weight: 500; }
.how ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

/* ---------- Printable worksheet ---------- */
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.ws-toolbar .back { margin-bottom: 4px; }
.ws-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sheet { max-width: 850px; margin: 0 auto; padding: 44px 48px; background: var(--white); color: #000; font-size: 15px; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); }
.ws-head { border-bottom: 3px solid #000; padding-bottom: 12px; margin-bottom: 18px; }
.ws-fields { display: flex; flex-wrap: wrap; gap: 8px 24px; font-weight: 700; margin-bottom: 18px; }
.ws-fields span { display: flex; align-items: flex-end; gap: 6px; flex: 1 1 auto; }
.ws-fields i { display: inline-block; flex: 1; min-width: 180px; height: 1.1em; border-bottom: 1.5px solid #000; }
.ws-fields i.short { min-width: 70px; }
.ws-title { margin: 0; font-size: 1.9rem; line-height: 1.1; }
.ws-meta { margin-top: 6px; font-size: 0.85rem; color: #444; }
.ws-list { margin: 0; padding-left: 28px; display: grid; gap: 16px; }
.ws-q { padding-left: 4px; break-inside: avoid; page-break-inside: avoid; }
.ws-q::marker { font-weight: 700; }
.ws-sub { font-size: 0.82rem; color: #444; margin-bottom: 2px; }
.ws-prompt { font-size: 1.1rem; font-weight: 500; }
.ws-visual .clock { width: 120px; }
.ws-visual .scene, .ws-choices .scene { width: 170px; border: 1px solid #000; }
.ws-line { height: 28px; max-width: 360px; border-bottom: 1.5px solid #000; }
.ws-choices { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 26px; }
.ws-choices li { display: flex; align-items: flex-start; gap: 6px; }
.ws-choices.visual { gap: 10px; }
.ws-letter { font-weight: 700; }
.sheet .blank { min-width: 7em; background: none; color: transparent; border-bottom: 1.5px solid #000; }
.sheet .cue { background: none; color: #000; border: 1.5px solid #000; border-radius: 4px; font-size: 0.8rem; padding: 1px 6px; }
.sheet .big-letter { width: auto; height: auto; font-size: 1.8rem; padding: 2px 14px; background: none; border: 2px solid #000; font-family: var(--display); }
.sheet .digital { background: none; color: #000; border: 2px solid #000; padding: 2px 10px; font-weight: 700; }
.sheet .subj-hl { background: none; font-weight: 700; text-decoration: underline; }
.sheet .plus { color: #000; }
.ws-key { margin-top: 36px; padding-top: 18px; border-top: 3px dashed #000; }
.ws-key h2 { margin: 0 0 12px; font-size: 1.3rem; }
.ws-key h2 span { font-size: 0.9rem; font-weight: 500; color: #444; }
.key-list { columns: 2; column-gap: 40px; margin: 0; padding-left: 28px; }
.key-list li { break-inside: avoid; margin-bottom: 4px; }


/* ---------- Levels: header link and landing page ---------- */
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.level-link { color: #c9c9c9; font-size: 0.85rem; font-weight: 500; text-decoration: none; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; white-space: nowrap; }
.level-link:hover { color: var(--white); border-color: var(--white); }
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 22px; list-style: none; margin: 0; padding: 0; }
.level-card {
  position: relative; display: grid; align-content: start; gap: 6px; height: 100%; padding: 26px 26px 22px; overflow: hidden;
  background: var(--white); color: var(--text); text-decoration: none;
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}
.level-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.level-card:active { transform: translate(4px, 4px); box-shadow: none; }
.level-num { position: absolute; top: -18px; right: 14px; font-family: var(--display); font-size: 7rem; line-height: 1; opacity: 0.9; }
.level-num { color: #e7e2d8; }
.level-name { font-family: var(--display); font-size: 2rem; line-height: 1.1; color: var(--ink); padding-right: 70px; }
.level-topics { color: var(--muted); max-width: 32ch; }
.level-go { margin-top: 10px; font-weight: 700; color: var(--ink); }

/* Bank questions that show the original sentence first */
.orig { display: block; margin-bottom: 8px; font-family: var(--body); font-size: 1.05rem; font-weight: 400; color: var(--muted); }
.orig b { color: var(--ink); }


/* ---------- Home: progress badges ---------- */
.progress-badge {
  align-self: flex-start; margin-top: 12px; padding: 2px 10px; border-radius: 999px;
  background: #ece8df; color: var(--muted); font-size: 0.82rem; font-weight: 700;
}
.progress-badge.done { background: var(--green-soft); color: var(--green); }
.reset-row { margin: 22px 0 0; font-size: 0.9rem; }

/* ---------- Flashcards ---------- */
.chip-count { font-size: 0.78em; opacity: 0.7; font-weight: 500; }
.fc-stage { max-width: 640px; margin: 0 auto; }
.fc-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.fc-progress .progress { max-width: none; }
.flashcard { display: block; width: 100%; height: clamp(230px, 40vw, 320px); padding: 0; border: 0; background: none; cursor: pointer; perspective: 1400px; font: inherit; color: inherit; }
.flashcard:focus-visible { outline: none; }
.flashcard:focus-visible .fc-face { outline: 3px solid var(--blue); outline-offset: 3px; }
.fc-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform 0.45s ease; transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 24px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--white); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 5px 5px 0 var(--ink);
}
.fc-back { transform: rotateY(180deg); background: var(--tint); }
.fc-word { font-family: var(--display); font-size: clamp(1.8rem, 6vw, 3rem); line-height: 1.15; text-align: center; color: var(--ink); overflow-wrap: anywhere; }
.fc-label { position: absolute; top: 14px; left: 18px; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.fc-deck { position: absolute; bottom: 14px; right: 18px; color: var(--muted); font-size: 0.85rem; }
.fc-known { position: absolute; top: 12px; right: 14px; padding: 1px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 0.8rem; font-weight: 700; }
.fc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.fc-done { text-align: center; }
.fc-done .actions { justify-content: center; }
.fc-help { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 22px 0 0; }
.fc-links { justify-content: center; }
.fc-links [hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .fc-inner { transition: none; } }

/* ---------- Projector mode (practice.html?mode=projector) ---------- */
.page-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: -12px 0 18px; }
.page-tools:empty { display: none; }
.projector-actions { display: flex; gap: 10px; }
body.projector .site-header, body.projector .site-footer, body.projector .back, body.projector .lede,
body.projector .options, body.projector #accent-bar, body.projector #round-score, body.projector .quiz-badge { display: none !important; }
body.projector main.container { max-width: 1280px; padding-top: 18px; }
body.projector h1 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); margin-bottom: 14px; }
body.projector .page-tools { margin: 0 0 14px; color: var(--muted); }
body.projector .question-card { padding: clamp(24px, 3vw, 44px); }
body.projector .q-sub { font-size: clamp(1.1rem, 1.8vw, 1.5rem); }
body.projector .q-prompt { font-size: clamp(2.2rem, min(4.6vw, 7vh), 4.2rem); margin-bottom: 18px; }
body.projector .choice { font-size: clamp(1.3rem, 2.4vw, 2.1rem); padding: 18px 22px; }
body.projector .key { width: 36px; height: 36px; font-size: 1.1rem; }
body.projector .choices.visual .scene { width: auto; height: min(24vh, 240px); max-width: 100%; }
body.projector .q-visual .clock { width: min(320px, 30vh); }
body.projector .q-visual .scene { width: auto; height: min(30vh, 300px); max-width: 100%; }
body.projector .q-visual { margin-bottom: 12px; }
body.projector .feedback { font-size: clamp(1.1rem, 2vw, 1.6rem); }
body.projector .btn { font-size: 1.15rem; }
body.projector .big-score { font-size: clamp(3rem, 10vw, 6rem); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .sheet { padding: 24px 18px; }
  .key-list { columns: 1; }
}
@media (max-width: 560px) {
  main.container { padding-top: 24px; }
  .card { padding: 18px; }
  .question-card { padding: 20px; }
  .row { grid-template-columns: minmax(0, 1fr) 28px; gap: 4px 10px; }
  .subj { grid-column: 1 / -1; padding-top: 0; }
  .answer-row { flex-direction: column; }
  .choices.visual { gap: 8px; }
  .round-bar { font-size: 0.82rem; gap: 10px; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 0.6in; }
  body { background: #fff; }
  .no-print, .site-header, .site-footer { display: none !important; }
  main.container { padding: 0; max-width: none; }
  .sheet { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 12pt; }
  .ws-key { break-before: page; page-break-before: always; border-top: 0; margin-top: 0; padding-top: 0; }
  .ws-key[hidden] { display: none; }
}
