:root {
  color-scheme: light;
  --blue: #2563eb;
  --link: #1749b8;
  --ink: #172033;
  --navy: #102a43;
  --muted: #4a5c72;
  --bg: #f6f8fb;
  --line: #d7e0ed;
  --teal: #0f766e;
  --gold: #f4c430;
  --correct: #16803b;
  --wrong: #c62828;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 100%;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[id] { scroll-margin-top: 1.25rem; }
h1, h2, h3, p { margin: 0 0 .65em; }
h1, h2, h3 { line-height: 1.16; color: var(--navy); text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 6vw, 4.55rem); letter-spacing: -.045em; margin-bottom: .35em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); letter-spacing: -.035em; }
h3 { font-size: 1.22rem; letter-spacing: -.018em; }
h1 em { color: var(--link); font-style: normal; }
button, select, input { font: inherit; }
button { cursor: pointer; }
.wrap, .reading { width: min(calc(100% - 2rem), 74rem); margin-inline: auto; }
.reading { max-width: 54rem; }
.skip { position: absolute; top: .75rem; left: .75rem; z-index: 5; padding: .75rem; background: white; transform: translateY(-170%); }
.skip:focus { transform: translateY(0); }
.header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .6rem; padding-block: .6rem; }
.brand { display: inline-flex; align-items: center; min-height: 48px; gap: .65rem; color: var(--navy); text-decoration: none; font-size: clamp(1.06rem, 2vw, 1.21rem); font-weight: 780; letter-spacing: -.026em; }
.logo { width: 43px; height: 43px; flex: none; }
.logo svg { display: block; width: 100%; height: 100%; }
.header nav { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0 .6rem; }
.header nav a, .foot nav a, .text-link { display: inline-flex; align-items: center; gap: .35em; min-height: 44px; }
.header nav a { padding-inline: .4rem; color: var(--navy); text-decoration: none; font-weight: 650; }
.header nav a:hover { text-decoration: underline; }
.menu { width: 48px; height: 48px; display: grid; align-content: center; justify-content: center; gap: 5px; color: var(--navy); background: var(--bg); border: 1px solid var(--line); border-radius: 11px; }
.menu span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }
.menu[aria-expanded="true"] span:first-child { transform: translateY(7px) rotate(45deg); }
.menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu[aria-expanded="true"] span:last-child { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 55.999rem) {
  .header nav { display: grid; padding-top: .4rem; border-top: 1px solid var(--line); }
}
.hero, .subhero { background: radial-gradient(ellipse at 90% 0%, #dbeafe 0%, transparent 61%), linear-gradient(115deg, #f1f6ff, #f4f9ff 60%, #eaf6f8); border-bottom: 1px solid var(--line); }
.hero { padding: clamp(2.4rem, 7vw, 5.6rem) 0; }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.eyebrow { font-weight: 780; font-size: 1rem; letter-spacing: .045em; color: var(--teal); }
.lede, .section-intro { max-width: 65ch; color: var(--muted); }
.lede { font-size: clamp(1.125rem, 2vw, 1.28rem); }
.hero-panel { padding: clamp(1.25rem, 4vw, 2rem); color: #e4effc; background: linear-gradient(145deg, #102a43 15%, #173e67); border-radius: 24px; box-shadow: 0 18px 32px #102a4322; }
.hero-panel h2 { color: white; font-size: clamp(1.65rem, 3vw, 2.35rem); }
.hero-panel .eyebrow { color: #a2e7de; }
.hero-panel a { display: inline-flex; align-items: center; min-height: 44px; color: white; font-weight: 700; }
.hero-panel a:focus-visible { outline-color: white; }
.panel-stats { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; padding: .9rem 0; margin: .9rem 0 .25rem; border-block: 1px solid #ffffff38; }
.panel-stats strong { color: white; font-size: 1.4rem; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: 1.05rem; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; max-width: 100%; padding: .55rem .95rem; border: 1px solid #afc4e4; border-radius: 11px; color: var(--navy); background: white; text-align: center; text-decoration: none; font-weight: 720; }
.button:hover { background: #ecf4ff; }
.button.primary { color: white; border-color: var(--link); background: var(--link); }
.button.primary:hover { background: #123b99; }
.section { padding-block: clamp(1.6rem, 4vw, 3rem); }
.section + .section { border-top: 1px solid var(--line); }
.subject-grid, .variant-grid, .theory-list { display: grid; gap: .75rem; }
.subject-grid + h3 { margin-top: 1.6rem; }
.subject-card, .card, .question { border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.subject-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .7rem; align-items: center; padding: .85rem; min-height: 74px; color: var(--navy); text-decoration: none; }
.subject-card:hover { border-color: #8aaddf; background: #fcfdff; }
.subject-card small { display: block; color: var(--muted); font-size: 1rem; }
.subject-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: #eaf0ff; color: var(--link); font-weight: 800; }
.tone-1 .subject-icon { background: #e4f5f1; color: #126255; }
.tone-2 .subject-icon { background: #fff4d7; color: #744900; }
.arrow { color: var(--link); }
.feature { background: #eaf2ff; border: 1px solid #ccddfa; border-radius: var(--radius); padding: clamp(1rem, 4vw, 2rem); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.feature p, .card p:last-child, .note p:last-child, .example p:last-child { margin-bottom: 0; }
.note { background: #fff9e9; border: 1px solid #ead8a5; border-inline-start: 4px solid var(--gold); border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1rem; }
details { margin-top: .55rem; border: 1px solid var(--line); border-radius: 10px; background: white; padding-inline: .9rem; }
summary { min-height: 48px; padding-block: .65rem; cursor: pointer; font-weight: 700; }
.footer { background: #eaf0f8; border-top: 1px solid var(--line); }
.foot { padding-block: 1.35rem; display: flex; gap: .5rem 1.4rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.subhero { padding-bottom: clamp(1.5rem, 5vw, 3rem); }
.subhero h1 { font-size: clamp(2.15rem, 5.4vw, 3.85rem); }
.test h1 em { display: block; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .55rem; padding-block: .85rem 1.15rem; }
.crumbs a, .crumb-current { display: inline-flex; align-items: center; min-height: 44px; padding: .38rem .8rem; border-radius: 999px; line-height: 1.25; }
.crumbs a { gap: .5rem; background: #fff; border: 1px solid #c5d6f0; font-weight: 620; text-decoration: none; }
.crumbs a::after { content: ""; width: .43em; height: .43em; border-block-start: 2px solid currentColor; border-inline-end: 2px solid currentColor; transform: rotate(45deg); }
.crumbs a:hover { background: #eaf2ff; }
.crumb-current { background: #e0f2ef; color: #12554f; font-weight: 700; overflow-wrap: anywhere; }
.card { padding: 1.05rem; }
.theory-card { display: flex; flex-direction: column; align-items: flex-start; }
.theory-card a { margin-top: auto; }
.lesson-nav { margin-block: 1.4rem 0; padding: 1rem 1.2rem; background: #eaf2ff; border: 1px solid #ccddfa; border-radius: var(--radius); }
.lesson-nav h2 { font-size: 1.25rem; margin-bottom: .25em; }
.lesson-nav ol { padding-inline-start: 1.4rem; margin-block: 0; }
.lesson-section > p, .example p { font-size: 1.08rem; line-height: 1.7; max-width: 68ch; }
.example { margin-top: .9rem; padding: .95rem 1.05rem; background: white; border: 1px solid var(--line); border-inline-start: 4px solid var(--teal); border-radius: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.facts li { background: white; border: 1px solid #bed1ef; padding: .2rem .6rem; border-radius: 8px; font-weight: 650; }
.ad { min-height: 100px; max-width: 100%; overflow: hidden; margin-block: 1.25rem; }
.ad-top, .ad-middle { min-height: 120px; }
.ad-after { min-height: 190px; }
.ad ins { min-height: inherit; }
.test-intro { padding-bottom: .8rem; }
.test-bar { padding: .9rem 1rem; border: 1px solid #ccddfa; background: #eaf2ff; border-radius: 12px; margin-bottom: .75rem; }
.test-bar p { margin: 0; font-weight: 750; }
progress { width: 100%; height: .75rem; accent-color: var(--blue); }
.question-nav { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.question-nav a { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 9px; border: 1px solid var(--line); background: white; font-weight: 700; text-decoration: none; }
.question-nav a[data-answered="true"] { background: #dceaff; border-color: #9cb9e5; }
.question { padding: clamp(.85rem, 3vw, 1.55rem); margin-bottom: .8rem; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { width: 100%; padding: 0; margin-bottom: .7rem; font-size: 1.2rem; font-weight: 750; line-height: 1.35; }
.question-number { display: block; margin-bottom: .35rem; font-size: 1rem; font-weight: 750; color: var(--teal); }
.answer { min-height: 48px; padding: .55rem .65rem; margin-bottom: .45rem; display: flex; align-items: center; gap: .65rem; border-radius: 9px; border: 1px solid var(--line); cursor: pointer; overflow-wrap: anywhere; }
.answer:has(input:checked) { border-color: #82a7e6; background: #edf4ff; }
.answer input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--blue); }
.answer.correct { border-color: var(--correct); background: #ecf8ee; }
.answer.incorrect { border-color: var(--wrong); background: #fff0ef; }
.answer-mark { font-weight: 750; }
select, input[type="text"] { color: var(--ink); background: white; border: 1px solid #8598b0; border-radius: 8px; min-height: 48px; width: 100%; padding: .4rem .6rem; }
select:disabled, input:disabled { opacity: 1; }
.control-row { display: grid; gap: .35rem; margin: 0 0 .75rem; }
.feedback { margin: .85rem 0 0; padding: .65rem; border-radius: 8px; font-weight: 730; }
.correct-text { color: #12632f; background: #ecf8ee; }
.incorrect-text { color: #9b2020; background: #fff0ef; }
.result { background: #eaf2ff; padding: 1rem; border: 1px solid #bbd0f2; border-radius: var(--radius); margin-bottom: 1rem; }
.result h2 { margin-bottom: .3em; }
.score { font-size: 1.35rem; font-weight: 800; }
.check-area { padding-bottom: 2rem; }
.storage-message { color: var(--muted); }
.shared-text { margin: 1.4rem 0 .85rem; border-inline-start: 4px solid var(--teal); }
.shared-text h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); }
.test-resources { margin-top: 2rem; border-top: 1px solid var(--line); }
.lesson-section ol { padding-inline-start: 1.45rem; }
.lesson-section li + li { margin-top: .55rem; }
.subject-intro { padding-bottom: .25rem; }
.subject-actions { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.subject-actions h3 { margin: .2rem 0 0; }
.card-links { display: flex; flex-wrap: wrap; gap: 0 .95rem; }
.card-links a { min-height: 44px; font-weight: 650; }
.section-emoji { font-size: .8em; vertical-align: .06em; }
.study-status { margin-block: .35rem; color: var(--teal); font-weight: 700; }
.exercise-list { padding-inline-start: 1.4rem; }
.exercise-list > li { padding-block: .45rem; }
.button[data-mark-lesson][aria-pressed="true"] { background: #e0f2ef; color: #12554f; }
@media (min-width: 44rem) {
  .subject-grid, .variant-grid, .theory-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 56rem) { .header nav { flex: 0 1 auto; } }
@media (min-width: 58rem) {
  .wrap, .reading { width: min(calc(100% - 4rem), 74rem); }
  .hero-grid { grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 3rem; }
  .subject-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media print {
  .header, .footer, .skip, .ad, .actions, .question-nav, .check-area, .test-bar, .crumbs, .storage-message { display: none !important; }
  body, .hero, .subhero, .hero-panel, .result, .note { background: white; color: black; box-shadow: none; }
  .hero-panel h2, .hero-panel a, .hero-panel .eyebrow, .panel-stats strong { color: black; }
  .wrap, .reading { width: 100%; max-width: none; }
  .section, .hero { padding-block: .5rem; }
  .question, .card, .example { break-inside: avoid; }
}
.visual-exercises > li { margin-block: 1.5rem; }
.visual-figure { margin: 0.75rem 0; padding: 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.visual-figure img, .visual-figure svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.visual-figure img { max-width: 34rem; max-height: 25rem; object-fit: contain; }
.visual-figure svg { max-width: 25rem; }
.visual-credit { font-size: 0.95rem; }
.visual-number { display: inline-block; min-width: 2rem; padding: 0.1rem 0.4rem; border-radius: 0.35rem; text-align: center; background: var(--bg); color: var(--navy); font-weight: 700; }
.official-album { margin-block: 1.25rem; }
.official-album-frame { display: block; width: 100%; height: clamp(26rem, 68vh, 50rem); margin-block: 0.75rem; border: 1px solid var(--line); border-radius: 0.5rem; background: #fff; }
@media print { .official-album-frame { display: none; } }


.back-top { position:fixed; z-index:3; right:max(.75rem,env(safe-area-inset-right)); bottom:max(1rem,calc(env(safe-area-inset-bottom) + .75rem)); min-height:46px; display:inline-flex; align-items:center; padding:.4rem .8rem; border:1px solid #adc3e7; border-radius:12px; background:#fff; color:var(--link); font-weight:750; text-decoration:none; box-shadow:0 5px 18px #102a4322; }
.back-top:hover { background:#eaf2ff; }
body { padding-bottom:4rem; }
.theory-card h4 { margin:0 0 .35rem; font-size:1.1rem; }
@media print { .back-top { display:none !important; } body { padding-bottom:0; } }
