@charset "UTF-8";
/* 梦战研习室 · paper, ink green and warm gold. System fonts only. */

:root {
  --paper: #efede3;
  --sheet: #f8f7f1;
  --white: #fdfcf8;
  --ink: #1f2b26;
  --ink-2: #3f4b45;
  --muted: #5e675f;
  --line: #d9d6c8;
  --line-strong: #bdb9a7;
  --tile: #dcd9cb;

  --green: #1f4a3c;
  --green-deep: #163a2f;
  --green-mid: #2f6b4f;
  --green-soft: #dde8e0;
  --green-wash: #ebf1ec;

  --gold: #b48a45;
  --gold-light: #d6b878;
  --gold-ink: #7e5e27;
  --gold-soft: #f1e6cb;
  --focus: #9a7535;

  --rust: #a3432e;
  --rust-light: #e39c85;
  --miss: #c96f55; /* lighter than the greens so tiles stay distinct for red-green colour blindness */
  --rust-soft: #f5e4db;

  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;

  --page: 1120px;
  --gutter: 16px;
  --header: 58px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.65 var(--sans);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
button, a, input, select, label { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip-link { position: fixed; z-index: 40; top: -60px; left: 16px; padding: 10px 16px; border-radius: 8px; background: var(--green); color: #fff; }
.skip-link:focus { top: 12px; }

#main { flex: 1; outline: none; }
.page-pad { width: 100%; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.loading, .noscript { padding: 96px 20px; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  border-radius: 10px; border: 1px solid transparent;
  background: var(--green); color: #fbf8ee;
  font-size: 15px; font-weight: 600; line-height: 1.4;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.button:hover:not(:disabled) { background: var(--green-deep); }
.button:disabled { opacity: .4; }
.button .icon { width: 18px; height: 18px; }
.button.secondary { background: transparent; border-color: var(--line-strong); color: var(--green); }
.button.secondary:hover:not(:disabled) { background: var(--sheet); border-color: var(--green-mid); }
.button.ghost { background: transparent; color: var(--green); padding-left: 8px; padding-right: 12px; font-weight: 500; }
.button.ghost:hover:not(:disabled) { background: var(--green-wash); }
.button.light { background: #f6f1e2; color: var(--green); }
.button.light:hover:not(:disabled) { background: #fffaea; }
.button.block { width: 100%; }
.danger-button { background: var(--rust); }
.button.danger-button:hover:not(:disabled) { background: #86341f; }

.icon-button {
  display: grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 10px;
  color: var(--ink-2);
  transition: background-color .15s, color .15s;
}
.icon-button:hover { background: rgba(31, 74, 60, .08); color: var(--green); }
.icon-button .icon, .icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.text-link { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.text-button { padding: 8px 0; font-size: 14px; }
.danger { color: var(--rust); }

/* ---------- header & footer ---------- */

.site-header { position: sticky; top: 0; z-index: 10; background: rgba(239, 237, 227, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.header-inner { max-width: var(--page); height: var(--header); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; color: var(--ink); font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .06em; }
.brand img { display: block; width: 24px; height: auto; }
.brand-name small { display: none; margin-right: 8px; padding-right: 8px; border-right: 1px solid var(--line-strong); font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: .1em; }
.site-nav { display: flex; align-items: stretch; height: 100%; margin-left: auto; }
.site-nav a { position: relative; display: flex; align-items: center; gap: 5px; padding: 0 9px; font-size: 15px; color: var(--muted); white-space: nowrap; }
.site-nav a:hover { color: var(--green); }
.site-nav a.active { color: var(--green); font-weight: 600; }
.site-nav a.active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--green); }
.nav-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--rust); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.about-button { margin-right: -8px; }

.site-footer { width: 100%; max-width: var(--page); margin: 56px auto 0; padding: 18px var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
.site-footer p { padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
body[data-route="quiz"] .site-footer { display: none; }

/* ---------- shared meters & tiles ---------- */

.meter { display: flex; height: 4px; overflow: hidden; border-radius: 2px; background: var(--tile); }
.meter i { display: block; height: 100%; background: var(--green-mid); }
.meter i.no { background: var(--miss); }

.tiles, .legend i { --tile-gap: 2px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--tile-gap); }
.tiles i, .legend i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--tile); }
.tiles i.ok, .legend i.ok { background: var(--green-mid); }
.tiles i.no, .legend i.no { background: var(--miss); }
.tiles i.here, .legend i.here { position: relative; outline: 2px solid var(--gold); outline-offset: 1px; z-index: 1; }
.legend i.here { background: var(--tile); }

/* ---------- home ---------- */

.home { max-width: var(--page); padding-top: 24px; }
.home-side { display: grid; gap: 16px; }
.home-intro h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.35; letter-spacing: .04em; }
.home-intro p { margin-top: 8px; font-size: 14px; color: var(--muted); max-width: 30em; }

.progress-panel { padding: 18px 18px 18px; border-radius: 16px; background: var(--green); color: #f4efe0; }
.panel-count { display: flex; align-items: baseline; gap: 8px; }
.panel-count strong { font-size: 40px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.panel-count span { font-size: 14px; color: #b9c7bd; }
.progress-panel .meter { height: 6px; margin: 12px 0 14px; background: rgba(255, 255, 255, .14); border-radius: 3px; }
.progress-panel .meter i.ok { background: var(--gold-light); }
.progress-panel .meter i.no { background: var(--rust-light); }
.panel-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.panel-stats div { display: flex; flex-direction: column-reverse; }
.panel-stats dt { font-size: 12px; color: #b9c7bd; }
.panel-stats dd { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.primary-start { justify-content: space-between; min-height: 60px; padding: 10px 14px 10px 18px; text-align: left; }
.button-stack { display: flex; flex-direction: column; min-width: 0; }
.button-stack > span { font-size: 16px; }
.button-stack small { font-size: 12px; font-weight: 400; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions .button { padding-left: 10px; padding-right: 10px; }
.quick-actions .count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--rust); color: #fff; font-size: 12px; line-height: 20px; font-variant-numeric: tabular-nums; }

.home-section { margin-top: 12px; }
.home-section h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .04em; }
.home-section > h2 { margin-bottom: 10px; }

.categories { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.category {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 8px;
  padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--sheet);
  text-align: left; transition: border-color .15s, background-color .15s;
}
.category:hover { border-color: var(--green-mid); background: var(--white); }
.category-name { font-size: 15px; font-weight: 600; }
.category-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.category .meter { grid-column: 1 / -1; height: 3px; }

.map { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; }
.section-note { margin: 4px 0 14px; font-size: 13px; color: var(--muted); }

.group-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.group-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 10px; text-align: left; transition: background-color .15s; }
.group-card:hover { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); }
.group-label { display: flex; flex-direction: column; line-height: 1.35; }
.group-label b { font-size: 13px; font-weight: 600; color: var(--ink); }
.group-label span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.group-card.done .group-label b { color: var(--green-mid); }

/* ---------- quiz ---------- */

.quiz { max-width: 720px; padding-top: 12px; }
.quiz-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 44px; }
.back-button { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -6px; padding: 0 8px 0 2px; border-radius: 8px; color: var(--green); font-size: 15px; }
.back-button:hover { background: var(--green-wash); }
.quiz-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 14px; color: var(--muted); }
.quiz-counter { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quiz-counter b { margin-right: 3px; font-size: 19px; font-weight: 600; color: var(--ink); }

.quiz-progress { display: flex; align-items: center; gap: 3px; height: 12px; margin-top: 4px; }
.quiz-progress i { flex: 1; min-width: 0; height: 6px; border-radius: 2px; background: var(--tile); }
.quiz-progress i.ok { background: var(--green-mid); }
.quiz-progress i.no { background: var(--miss); }
.quiz-progress i.now { height: 12px; }
.quiz-progress i.now:not(.ok):not(.no) { background: var(--gold); }
.quiz-progress i.now.ok, .quiz-progress i.now.no { outline: 2px solid var(--gold); outline-offset: 1px; }
.quiz-progress.bar { gap: 0; height: 6px; overflow: hidden; border-radius: 3px; background: var(--tile); }
.quiz-progress.bar i { flex: none; border-radius: 0; }
.quiz-progress.dense { gap: 2px; }
.progress-status { margin: 8px 0 14px; font-size: 13px; color: var(--muted); }
.progress-status b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.question-card { padding: 16px 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--sheet); }
.question-meta { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: -4px -6px 6px 0; }
.question-id { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.tag { padding: 1px 8px; border-radius: 4px; background: var(--green-soft); color: var(--green); font-size: 12px; white-space: nowrap; }
.favorite { margin-left: auto; }
.favorite.saved { color: var(--gold-ink); }
.favorite.saved .icon { fill: var(--gold); stroke: var(--gold-ink); }
.question-card h1 { margin-bottom: 18px; font-size: 19px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }

.option-set { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.option {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--white);
  font-size: 16px; line-height: 1.6; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.option:not(.locked):hover { border-color: #9db3a5; background: #f6f8f3; }
.letter {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
  border: 1.5px solid var(--line-strong); color: var(--ink-2);
  font-size: 14px; font-weight: 600; line-height: 1;
}
.option-text { overflow-wrap: anywhere; }
.option.selected { border-color: var(--green); background: var(--green-wash); }
.option.selected .letter { border-color: var(--green); background: var(--green); color: #fff; }
.option.locked { cursor: default; }
.option.locked:not(.correct):not(.incorrect) { color: var(--muted); }
.option.correct { border-color: var(--green-mid); background: var(--green-soft); color: #173a2d; }
.option.correct .letter { border-color: var(--green-mid); background: var(--green-mid); color: #fff; }
.option.incorrect { border-color: var(--rust); background: var(--rust-soft); color: #6e2a1c; }
.option.incorrect .letter { border-color: var(--rust); background: var(--rust); color: #fff; }
.option-note { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.option-note .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.option-note .note-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.feedback {
  margin-top: 12px; padding: 14px 16px 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--green-mid); border-radius: 12px; background: var(--sheet);
  outline: none; animation: reveal .2s ease-out;
}
.feedback.wrong { border-left-color: var(--rust); }
.feedback-title { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--green-mid); }
.feedback.wrong .feedback-title { color: var(--rust); }
.feedback-title strong { font-size: 16px; }
.feedback-title .icon { stroke-width: 2.2; }
.correct-answer { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.feedback p { font-size: 15px; line-height: 1.85; color: var(--ink); }
.source-details { margin-top: 8px; font-size: 13px; color: var(--muted); }
.source-details summary { display: inline-block; padding: 6px 0; cursor: pointer; list-style: none; color: var(--green); }
.source-details summary::-webkit-details-marker { display: none; }
.source-details summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.source-details[open] summary::after { transform: rotate(-135deg); margin-bottom: -1px; }
.source-details a { display: flex; align-items: flex-start; gap: 4px; margin: 2px 0 4px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; overflow-wrap: anywhere; }
.source-details a:hover { color: var(--green); }
.source-details a .icon { width: 15px; height: 15px; margin-top: 3px; }

.quiz-actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 78%, rgba(239, 237, 227, 0));
}
.quiz-actionbar .button:not(.ghost) { margin-left: auto; min-width: 136px; }
.session-note { min-width: 0; font-size: 12px; color: var(--muted); }
.session-note.warn { color: var(--rust); }
.quiz-actionbar .ghost + .session-note { margin-left: 4px; }

/* ---------- wrong answers & favorites ---------- */

.library { max-width: 760px; padding-top: 24px; }
.library-heading h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .04em; }
.library-heading p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.library-tools { display: flex; gap: 8px; margin-top: 18px; }
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-wrap .icon { position: absolute; left: 12px; top: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-wrap input, .library-tools select {
  width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--white);
  font-size: 16px; color: var(--ink);
}
.search-wrap input { padding: 8px 12px 8px 38px; }
.search-wrap input::placeholder { color: #858c84; }
.library-tools select { width: auto; max-width: 132px; padding: 0 10px; font-size: 15px; }
.library-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; }
.result-count { font-size: 13px; color: var(--muted); }
.library-bar .button { min-height: 40px; padding: 8px 16px; font-size: 14px; flex-shrink: 0; }
.library-list { display: grid; gap: 8px; }
.library-item {
  display: block; width: 100%; padding: 12px 14px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--sheet); text-align: left;
  transition: border-color .15s, background-color .15s;
}
.library-item:hover { border-color: var(--green-mid); background: var(--white); }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 3px; font-size: 12px; color: var(--muted); }
.item-meta .question-id { font-size: 12px; }
.item-stem { display: block; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.no-results { padding: 28px 16px; text-align: center; font-size: 14px; color: var(--muted); }

.empty-state { margin-top: 20px; padding: 40px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--sheet); text-align: center; }
.empty-emblem { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; background: var(--green-soft); color: var(--green-mid); }
.empty-emblem .icon { width: 24px; height: 24px; }
.empty-state h1, .empty-state h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.empty-state p { max-width: 22em; margin: 6px auto 20px; font-size: 14px; color: var(--muted); }

/* ---------- summary ---------- */

.summary { max-width: 560px; padding-top: 28px; }
.summary-card { padding: 28px 20px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--sheet); text-align: center; }
.summary-card h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .06em; }
.summary-sub { margin-top: 2px; font-size: 14px; color: var(--muted); }
.score { margin: 18px 0 14px; font-size: 64px; font-weight: 600; line-height: 1.1; color: var(--green); font-variant-numeric: tabular-nums; }
.score small { margin-left: 8px; font-size: 16px; font-weight: 400; color: var(--muted); }
.summary .quiz-progress { max-width: 360px; height: 8px; margin: 0 auto; }
.summary-numbers { display: grid; grid-template-columns: repeat(3, 1fr); margin: 20px 0 24px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.summary-numbers > div + div { border-left: 1px solid var(--line); }
.summary-numbers b { display: block; font-size: 21px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.summary-actions { display: grid; gap: 10px; }
.summary-footnote { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* ---------- dialogs & toast ---------- */

.modal {
  width: calc(100% - 32px); max-width: 480px; max-height: calc(100dvh - 48px); overflow: auto;
  padding: 20px 20px 18px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--sheet); color: var(--ink); box-shadow: 0 24px 80px rgba(16, 38, 31, .25);
}
.modal::backdrop { background: rgba(22, 46, 38, .55); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-heading .icon-button { margin-right: -8px; }
.modal h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: .04em; }
.modal p { font-size: 14px; line-height: 1.8; }
.modal .muted { font-size: 13px; color: var(--muted); }
.about-facts { margin: 14px 0; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
.about-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; }
.about-facts dt { flex-shrink: 0; color: var(--muted); }
.about-facts dd { text-align: right; }
.notice { margin-top: 12px; padding: 10px 12px; border: 1px solid #e0c3b6; border-radius: 8px; background: var(--rust-soft); color: #6e2a1c; font-size: 13px; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: calc(100% - 32px); padding: 9px 18px; border-radius: 999px;
  background: var(--green-deep); color: #f6f1e2; font-size: 14px; text-align: center;
  box-shadow: 0 6px 24px rgba(16, 38, 31, .25);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
body[data-route="quiz"] .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }

@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- touch devices: keyboard hint is noise ---------- */

@media (hover: none), (max-width: 719px) {
  .session-note.keys { display: none; }
}

/* ---------- small phones ---------- */

@media (max-width: 374px) {
  :root { --gutter: 14px; }
  .brand { font-size: 16px; gap: 7px; }
  .brand img { width: 22px; }
  .site-nav a { padding: 0 7px; font-size: 14px; }
  .site-nav a.active::after { left: 7px; right: 7px; }
  .home-intro h1 { font-size: 23px; }
  .panel-count strong { font-size: 36px; }
  .group-grid { gap: 4px; }
  .group-card { padding: 6px; }
  .question-card { padding: 14px 13px 16px; }
  .option { gap: 10px; padding: 11px 12px; }
}

/* ---------- tablet and up ---------- */

@media (min-width: 560px) {
  .option-note .note-text { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .group-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .summary-actions { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 720px) {
  :root { --gutter: 32px; --header: 64px; }
  .brand-name small { display: inline; }
  .site-nav { gap: 8px; }
  .site-nav a { padding: 0 12px; }
  .site-nav a.active::after { left: 12px; right: 12px; }
  .about-button { margin-left: 8px; }
  .home { padding-top: 40px; }
  .home-intro h1 { font-size: 30px; }
  .quiz { padding-top: 24px; }
  .question-card { padding: 24px 28px 28px; border-radius: 18px; }
  .question-card h1 { font-size: 21px; margin-bottom: 22px; }
  .option { padding: 14px 18px; gap: 14px; }
  .feedback { padding: 18px 24px 14px; }
  .feedback p { font-size: 16px; }
  .library { padding-top: 40px; }
  .library-heading h1 { font-size: 30px; }
  .summary { padding-top: 56px; }
  .summary-card { padding: 40px 40px 32px; }
  .tiles { --tile-gap: 3px; }
  .modal { padding: 24px 28px 22px; }
}

@media (min-width: 720px) and (max-width: 959px) {
  .home-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 20px; align-items: start; }
  .home-intro { grid-column: 1 / -1; }
  .progress-panel { grid-row: span 2; }
  .home-side > .home-section { margin-top: 0; }
}

@media (min-width: 960px) {
  .home { display: grid; grid-template-columns: 344px minmax(0, 1fr); gap: 56px; align-items: start; }
  .map { margin-top: 0; }
  .map .section-head h2 { font-size: 21px; }
  .group-grid { gap: 10px 12px; }
  .group-card { padding: 10px; }
}

@media (min-width: 960px) and (min-height: 760px) {
  .home-side { position: sticky; top: calc(var(--header) + 24px); }
}

/* ---------- preferences ---------- */

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

@media print {
  .site-header, .site-footer, .quiz-actionbar, .toast, .skip-link { display: none !important; }
  body { background: #fff; }
  .question-card, .feedback { border: 0; }
}
