:root {
  color-scheme: dark;
  --ink: #10251c;
  --ink-2: #17372a;
  --panel: #183a2c;
  --panel-soft: #1d4633;
  --gold: #e4bb67;
  --gold-soft: #f2d89a;
  --cream: #f5f0e4;
  --muted: #b9c8bd;
  --red: #b3473c;
  --green: #72c28d;
  --line: rgba(228, 187, 103, .28);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--cream);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse at 55% 5%, #244d38 0, var(--ink) 52rem); }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 960px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 20px max(14px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font-size: .79rem; font-weight: 800; letter-spacing: .18em; }
.wordmark-mark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--ink); background: var(--gold); border-radius: 50%; font-size: 1rem; letter-spacing: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; padding: 7px 10px; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(228,187,103,.55); }
.status-pill.is-ready .status-dot { background: var(--green); box-shadow: 0 0 10px rgba(114,194,141,.45); }
.status-pill.is-offline .status-dot { background: var(--gold); }
.install-button { border: 1px solid var(--gold); border-radius: 999px; padding: 7px 12px; background: transparent; color: var(--gold-soft); font-size: .72rem; font-weight: 700; }
.install-button[hidden] { display: none; }
main { flex: 1; width: 100%; padding: clamp(24px, 5vh, 54px) 0 38px; }
.footer { display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 2px 2px; color: rgba(245,240,228,.55); font-size: .67rem; letter-spacing: .08em; }
.footer span:first-child { font-weight: 800; }
.hero { position: relative; overflow: hidden; min-height: 280px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(150px, .7fr); align-items: center; gap: 22px; padding: clamp(24px, 5vw, 44px); border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(118deg, rgba(23,55,42,.97), rgba(16,37,28,.91)); box-shadow: 0 20px 55px rgba(0,0,0,.18); }
.hero::before { content: ""; position: absolute; width: 240px; height: 240px; right: 18%; top: -156px; border: 1px solid rgba(228,187,103,.2); border-radius: 50%; box-shadow: 0 0 0 22px rgba(228,187,103,.04), 0 0 0 46px rgba(228,187,103,.025); pointer-events: none; }
.hero-copy, .hero-art { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 13px; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin-bottom: 12px; max-width: 540px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 7vw, 4.1rem); line-height: .98; font-weight: 500; letter-spacing: -.04em; }
.hero h1 span { color: var(--gold-soft); }
.hero-description { max-width: 470px; color: var(--muted); font-size: .98rem; line-height: 1.6; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0 22px; }
.meta-chip { border: 1px solid rgba(228,187,103,.25); border-radius: 999px; padding: 7px 10px; color: #e3e7df; font-size: .72rem; }
.hero-art { display: grid; place-items: center; min-height: 190px; }
.hero-art::before { content: ""; position: absolute; width: min(100%, 220px); aspect-ratio: 1; border: 1px solid rgba(228,187,103,.23); border-radius: 50%; box-shadow: 0 0 0 16px rgba(228,187,103,.04), 0 0 0 33px rgba(228,187,103,.025); }
.emblem { position: relative; width: clamp(136px, 20vw, 190px); aspect-ratio: 1; border: 1px solid rgba(228,187,103,.36); border-radius: 27%; overflow: hidden; background: #164b37; box-shadow: 0 18px 35px rgba(0,0,0,.28); }
.emblem img { display: block; width: 100%; height: 100%; object-fit: cover; }
.logo-caption { display: grid; gap: 3px; margin-top: 10px; color: var(--gold-soft); font-size: .74rem; line-height: 1.3; letter-spacing: .025em; text-align: center; }
.logo-caption span:first-child { font-weight: 750; }
.primary-button, .secondary-button, .text-button { cursor: pointer; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border: 0; border-radius: 999px; padding: 0 21px; background: var(--gold); color: #18291f; font-weight: 800; box-shadow: 0 8px 20px rgba(228,187,103,.15); transition: transform .18s ease, background .18s ease; }
.primary-button:hover { transform: translateY(-1px); background: var(--gold-soft); }
.secondary-button { min-height: 44px; border: 1px solid rgba(228,187,103,.45); border-radius: 999px; padding: 0 17px; background: transparent; color: var(--gold-soft); font-weight: 700; }
.text-button { border: 0; padding: 9px 3px; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 35px 2px 15px; }
.section-heading h2 { margin-bottom: 3px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.55rem, 4vw, 2rem); font-weight: 500; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: .82rem; }
.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.subject-card { display: flex; min-height: 238px; flex-direction: column; align-items: flex-start; gap: 14px; border: 1px solid var(--line); border-radius: 20px; padding: 20px; background: linear-gradient(145deg, rgba(29,70,51,.86), rgba(24,58,44,.58)); color: var(--cream); text-align: left; cursor: pointer; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.subject-card:hover { transform: translateY(-2px); border-color: var(--gold); background: linear-gradient(145deg, rgba(37,83,59,.96), rgba(24,58,44,.78)); }
.subject-card-top { display: flex; align-items: center; gap: 10px; }
.subject-badge { display: grid; min-width: 38px; height: 38px; place-items: center; border: 1px solid rgba(228,187,103,.5); border-radius: 50%; color: var(--gold-soft); font-size: .7rem; font-weight: 850; }
.subject-category { color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.subject-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 500; }
.subject-description { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.subject-count { margin-top: auto; color: var(--cream); font-size: .76rem; }
.subject-arrow { color: var(--gold-soft); font-size: .83rem; font-weight: 800; }
.subject-back { margin-bottom: 20px; }
.subject-intro { border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 5vw, 35px); background: linear-gradient(120deg, rgba(23,55,42,.97), rgba(16,37,28,.9)); }
.subject-intro h1 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 6vw, 3.1rem); font-weight: 500; line-height: 1.1; }
.subject-intro .hero-meta { margin-bottom: 20px; }
.series-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.series-card { text-align: left; display: flex; align-items: center; gap: 12px; min-height: 64px; border: 1px solid rgba(255,255,255,.11); border-radius: 16px; padding: 11px 13px; background: rgba(24,58,44,.66); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.series-card:hover { transform: translateY(-1px); border-color: var(--line); background: rgba(29,70,51,.82); }
.series-number { flex: 0 0 34px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(228,187,103,.35); border-radius: 50%; color: var(--gold); font-family: Georgia, serif; font-size: .88rem; }
.series-name { flex: 1; color: var(--cream); font-size: .82rem; line-height: 1.3; font-weight: 650; }
.series-arrow { color: var(--gold); font-size: 1.2rem; }
.quiz-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: .8rem; }
.progress-track { height: 5px; margin-bottom: 24px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.12); }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: var(--gold); transition: width .25s ease; }
.question-card { border: 1px solid var(--line); border-radius: 24px; padding: clamp(20px, 5vw, 34px); background: rgba(24,58,44,.88); box-shadow: 0 20px 50px rgba(0,0,0,.14); }
.question-label { color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.question-text { margin: 12px 0 23px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.45rem, 4.7vw, 2.2rem); font-weight: 500; line-height: 1.25; }
.options { display: grid; gap: 10px; }
.option { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; width: 100%; min-height: 55px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; padding: 10px 13px; background: rgba(16,37,28,.45); text-align: left; cursor: pointer; transition: border .16s ease, background .16s ease; }
.option:hover:not(:disabled) { border-color: rgba(228,187,103,.65); }
.option-letter { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: var(--gold-soft); font-size: .78rem; font-weight: 800; }
.option-text { color: #edf1ea; font-size: .91rem; line-height: 1.4; }
.option.is-selected { border-color: var(--gold); background: rgba(228,187,103,.12); }
.option.is-selected .option-letter { border-color: var(--gold); background: var(--gold); color: var(--ink); }
.option.is-correct { border-color: var(--green); background: rgba(114,194,141,.12); }
.option.is-correct .option-letter { border-color: var(--green); color: var(--green); }
.option.is-wrong { border-color: #df8176; background: rgba(179,71,60,.16); }
.option.is-wrong .option-letter { border-color: #df8176; color: #ffb7ad; }
.option:disabled { cursor: default; }
.feedback { margin: 16px 0 0; border-radius: 12px; padding: 12px 14px; font-size: .9rem; line-height: 1.5; }
.feedback.good { border: 1px solid rgba(114,194,141,.4); background: rgba(114,194,141,.1); color: #d6f4de; }
.feedback.bad { border: 1px solid rgba(223,129,118,.4); background: rgba(179,71,60,.12); color: #ffe0dc; }
.question-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.selection-hint { margin: 0; color: var(--muted); font-size: .76rem; }
.result-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 5vw, 35px); background: linear-gradient(120deg, rgba(23,55,42,.97), rgba(16,37,28,.9)); }
.result-hero h1 { margin: 0 0 8px; font-family: Georgia, serif; font-size: clamp(2rem, 6vw, 3rem); font-weight: 500; }
.result-hero p { margin: 0; color: var(--muted); }
.score-ring { display: grid; place-items: center; width: clamp(86px, 22vw, 126px); aspect-ratio: 1; border: 2px solid var(--gold); border-radius: 50%; color: var(--gold-soft); font-family: Georgia, serif; font-size: clamp(1.5rem, 5vw, 2.25rem); }
.score-ring small { display: block; color: var(--muted); font-family: inherit; font-size: .65rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 28px; }
.review-list { display: grid; gap: 9px; }
.review-list details { border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(24,58,44,.55); }
.review-list summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px 15px; cursor: pointer; color: var(--cream); font-size: .84rem; font-weight: 700; }
.review-list summary span:last-child { color: var(--gold); white-space: nowrap; }
.review-questions { display: grid; gap: 8px; padding: 0 14px 14px; }
.review-question { border-top: 1px solid rgba(255,255,255,.09); padding-top: 10px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.review-question strong { color: var(--cream); }
.review-question .review-good { color: #9be0ac; }
.review-question .review-wrong { color: #ffb7ad; }
.install-help { max-width: 620px; margin-top: 18px; border-left: 3px solid var(--gold); padding: 12px 15px; color: var(--muted); font-size: .8rem; line-height: 1.55; }
@media (max-width: 640px) {
  .app-shell { padding-right: 15px; padding-left: 15px; }
  .status-pill { padding: 7px 8px; font-size: .62rem; }
  .install-button { padding: 7px 9px; font-size: .68rem; }
  .hero { grid-template-columns: 1fr; gap: 10px; padding: 25px 21px; }
  .hero-art { position: absolute; right: 4px; bottom: 8px; width: 148px; min-height: 132px; opacity: .92; }
  .hero-art::before { width: 120px; }
  .emblem { width: 82px; border-radius: 20px; }
  .logo-caption { max-width: 148px; font-size: .63rem; }
  .hero-copy { padding-right: 14px; }
  .hero h1 { max-width: 310px; font-size: clamp(2.45rem, 12vw, 3.55rem); }
  .hero-description { max-width: 320px; font-size: .9rem; }
  .hero-meta { max-width: 270px; }
  .primary-button { min-height: 46px; padding: 0 17px; font-size: .87rem; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 205px; padding: 18px; }
  .series-grid { grid-template-columns: 1fr; }
  .series-card { min-height: 58px; }
  .question-card { padding: 21px 17px; }
  .question-actions { align-items: flex-start; flex-direction: column; }
  .question-actions .primary-button { width: 100%; }
  .selection-hint { min-height: 1em; }
  .result-hero { grid-template-columns: 1fr auto; padding: 21px 17px; }
  .footer { font-size: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
