:root {
  --maroon: #7f403b;
  --maroon-dark: #512826;
  --maroon-soft: #a56d64;
  --sage: #c9c9b5;
  --sage-light: #eeeee5;
  --cream: #f7f4e9;
  --paper: #fffdf7;
  --ink: #211f1b;
  --muted: #69665d;
  --line: #d7d2c2;
  --gold: #b48a4b;
  --success: #32644c;
  --danger: #9a3e38;
  --shadow: 0 18px 50px rgba(55, 40, 28, .12);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--sage-light);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 75% 0, rgba(127,64,59,.10), transparent 34rem), var(--sage-light); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.masthead { min-height: 76px; padding: 0 4vw; display: flex; align-items: center; gap: 2rem; position: sticky; top: 0; z-index: 20; background: rgba(127,64,59,.97); border-bottom: 2px solid #2e6580; color: white; }
.brand { display: flex; align-items: center; gap: .7rem; color: white; text-decoration: none; margin-right: auto; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--cream); color: var(--maroon); border: 3px solid rgba(255,255,255,.45); transform: rotate(45deg); }
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand strong { font-family: Georgia, 'Times New Roman', serif; font-size: 1.55rem; display: block; line-height: 1; }
.brand small { display: block; text-transform: uppercase; letter-spacing: .13em; font-size: .68rem; margin-top: .25rem; }
nav { display: flex; align-items: center; gap: .25rem; }
nav a { color: rgba(255,255,255,.78); text-decoration: none; padding: .75rem .8rem; border-radius: .35rem; font-weight: 700; font-size: .92rem; }
nav a:hover, nav a.active { color: white; background: rgba(255,255,255,.13); }
.quiet-btn, .primary-btn, .answer, .topic-link { min-height: 44px; border-radius: .35rem; border: 1px solid var(--line); cursor: pointer; }
.quiet-btn { background: transparent; color: inherit; padding: .65rem 1rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.masthead .quiet-btn { color: white; border-color: rgba(255,255,255,.42); }
.primary-btn { background: var(--maroon); color: white; border-color: var(--maroon); padding: .75rem 1.15rem; font-weight: 700; box-shadow: 0 6px 16px rgba(81,40,38,.18); }
.primary-btn:hover { background: var(--maroon-dark); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
main { min-height: calc(100vh - 150px); }
.page { width: min(1180px, 92vw); margin: 0 auto; padding: 3rem 0 4rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.eyebrow { margin: 0 0 .45rem; text-transform: uppercase; letter-spacing: .14em; color: var(--maroon); font-weight: 800; font-size: .78rem; }
h1, h2, h3 { margin-top: 0; }
h1, .display { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.25rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.035em; margin-bottom: .8rem; }
h2 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.55rem, 3vw, 2.4rem); }
h3 { font-size: 1.08rem; }
p { line-height: 1.62; }
.lede { max-width: 720px; color: var(--muted); font-size: 1.06rem; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 1.2rem; margin-bottom: 2rem; }
.hero-card { min-height: 310px; padding: clamp(1.6rem, 4vw, 3.4rem); background: linear-gradient(135deg, rgba(247,244,233,.96), rgba(201,201,181,.90)); border: 1px solid rgba(127,64,59,.18); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero-card::after { content: ''; position: absolute; width: 280px; height: 280px; border: 38px solid rgba(127,64,59,.055); border-radius: 50%; right: -70px; bottom: -110px; }
.hero-card .primary-btn { position: relative; z-index: 1; }
.snapshot { background: var(--maroon-dark); color: white; padding: 1.6rem; display: grid; align-content: space-between; box-shadow: var(--shadow); }
.snapshot .metric strong { display: block; font-family: Georgia, serif; font-size: 2.5rem; }
.snapshot .metric span { color: rgba(255,255,255,.7); font-size: .9rem; }
.ready-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .75rem; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); width: fit-content; }
.ready-badge i { width: 9px; height: 9px; border-radius: 50%; background: #d2ad68; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2.4rem 0 1rem; }
.section-bar h2 { margin: 0; font-size: 1.65rem; }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.module-card { background: var(--paper); border: 1px solid var(--line); padding: 1.25rem; display: flex; flex-direction: column; min-height: 240px; box-shadow: 0 10px 25px rgba(55,40,28,.05); }
.module-card:hover { border-color: var(--maroon-soft); transform: translateY(-2px); transition: .18s ease; }
.module-number { color: var(--maroon); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; }
.module-card h3 { font-family: Georgia, serif; font-size: 1.35rem; margin: .7rem 0; }
.module-card p { color: var(--muted); font-size: .92rem; margin: 0 0 1rem; }
.module-card .card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.pill { border-radius: 100px; padding: .35rem .6rem; font-size: .75rem; font-weight: 700; background: var(--sage-light); color: var(--muted); }
.pill.done { background: #dce9df; color: var(--success); }
.text-link { border: 0; background: transparent; color: var(--maroon); font-weight: 800; cursor: pointer; padding: .4rem 0; }
.learn-layout { display: grid; grid-template-columns: 270px minmax(0,1fr); gap: 1.4rem; align-items: start; }
.topic-nav { position: sticky; top: 94px; background: var(--paper); border: 1px solid var(--line); padding: .65rem; max-height: calc(100vh - 120px); overflow: auto; }
.topic-link { display: block; width: 100%; text-align: left; background: transparent; border-color: transparent; padding: .7rem; color: var(--ink); }
.topic-link.active { background: var(--maroon); color: white; }
.topic-content { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.topic-title { padding: 2rem 2.2rem; background: linear-gradient(90deg, var(--sage), var(--cream)); border-bottom: 3px solid var(--maroon); }
.topic-title h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.topic-body { padding: 2rem 2.2rem; }
.lesson { padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
.lesson:last-of-type { border: 0; }
.lesson h3 { color: var(--maroon-dark); font-size: 1.2rem; }
.lesson ul { padding-left: 1.3rem; line-height: 1.65; }
.lesson li + li { margin-top: .45rem; }
.source-note { color: var(--muted); font-size: .82rem; }
.action-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.setup-grid, .progress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.setup-card, .stat-card { background: var(--paper); border: 1px solid var(--line); padding: 1.35rem; }
.setup-card h3 { font-family: Georgia, serif; font-size: 1.35rem; }
.setup-card.selected { border: 2px solid var(--maroon); }
.choice-row { display: flex; flex-wrap: wrap; gap: .65rem; }
.choice-chip { border: 1px solid var(--line); background: var(--paper); padding: .65rem .8rem; cursor: pointer; min-height: 44px; }
.choice-chip.selected { background: var(--maroon); color: white; border-color: var(--maroon); }
select, input { width: 100%; min-height: 46px; border: 1px solid var(--line); background: white; padding: .7rem .8rem; border-radius: .3rem; color: var(--ink); }
label { display: block; font-weight: 700; margin: 1rem 0 .4rem; }
.quiz-shell { width: min(880px, 92vw); margin: 0 auto; padding: 2.5rem 0 4rem; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.progress-track { height: 8px; background: #ddd9ca; overflow: hidden; flex: 1; }
.progress-track span { display: block; height: 100%; background: var(--maroon); transition: width .25s ease; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--maroon-dark); }
.question-card { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); padding: clamp(1.3rem, 4vw, 2.5rem); }
.question-card h2 { font-family: Arial, sans-serif; font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.35; }
.answers { display: grid; gap: .7rem; margin: 1.4rem 0; }
.answer { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: .75rem; text-align: left; padding: .85rem 1rem; background: white; border-color: var(--line); color: var(--ink); }
.answer:hover { border-color: var(--maroon); }
.answer.selected { border: 2px solid var(--maroon); background: #f7efea; }
.answer.correct { border-color: var(--success); background: #e6f0e8; }
.answer.wrong { border-color: var(--danger); background: #f8e7e5; }
.answer-letter { width: 30px; height: 30px; display: grid; place-items: center; background: var(--sage-light); border-radius: 50%; font-weight: 800; }
.flag-control { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; cursor: pointer; }
.flag-control input { width: 20px; min-height: 20px; accent-color: var(--maroon); }
.explanation { margin-top: 1.2rem; border-left: 4px solid var(--gold); background: #f6f0df; padding: 1rem 1.1rem; }
.results-hero { background: var(--maroon-dark); color: white; padding: 2rem; display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center; }
.score-ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; border: 12px solid var(--gold); font-family: Georgia, serif; font-size: 2.4rem; }
.review-list { display: grid; gap: .8rem; margin-top: 1.2rem; }
.review-item { background: var(--paper); border: 1px solid var(--line); padding: 1rem 1.1rem; }
.review-item h3 { margin-bottom: .4rem; }
.review-item p { margin: .25rem 0; }
.references-page { width: min(1280px, 92vw); }
.references-hero { display: grid; grid-template-columns: 1.2fr .8fr; min-height: 420px; background: linear-gradient(135deg, #fffdf7 0%, #eee9dc 100%); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.references-intro { padding: clamp(2rem, 5vw, 4.5rem); position: relative; z-index: 1; }
.references-intro h1 { color: var(--maroon-dark); }
.reference-compass { position: relative; min-height: 420px; display: grid; place-items: center; background: radial-gradient(circle at center, rgba(180,138,75,.18), transparent 48%), var(--maroon-dark); overflow: hidden; color: white; }
.compass-ring { position: absolute; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; }
.ring-one { width: 310px; height: 310px; }
.ring-two { width: 220px; height: 220px; border-style: dashed; animation: compass-turn 32s linear infinite; }
.compass-core { width: 148px; height: 148px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--cream); color: var(--maroon-dark); box-shadow: 0 0 0 12px rgba(255,255,255,.08), 0 15px 40px rgba(0,0,0,.24); }
.compass-core strong { font-family: Georgia, serif; font-size: 3.4rem; line-height: .9; }
.compass-core span { margin-top: .45rem; text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 800; line-height: 1.25; }
.orbit-label { position: absolute; padding: .5rem .7rem; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.orbit-one { top: 20%; left: 8%; }
.orbit-two { right: 7%; top: 34%; }
.orbit-three { bottom: 14%; left: 16%; }
.reference-tools { margin: 1.5rem 0 2.5rem; padding: 1.25rem; background: var(--paper); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr minmax(260px,.38fr); gap: 1.5rem; align-items: end; }
.reference-filters { display: flex; flex-wrap: wrap; gap: .55rem; }
.reference-filter { min-height: 42px; border: 1px solid var(--line); border-left: 4px solid var(--filter-color,var(--gold)); background: white; color: var(--ink); padding: .55rem .7rem; font-weight: 700; cursor: pointer; }
.reference-filter span { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: .3rem; padding: 0 .35rem; border-radius: 100px; background: var(--sage-light); font-size: .72rem; }
.reference-filter:hover, .reference-filter.active { border-color: var(--filter-color,var(--maroon)); background: var(--maroon-dark); color: white; }
.reference-filter.active span { color: var(--ink); }
.reference-search { margin: 0; }
.reference-search span { display: block; margin-bottom: .45rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--maroon); }
.reference-search input { border-radius: 0; }
.reference-library { display: grid; gap: 3rem; }
.reference-group { scroll-margin-top: 100px; }
.reference-group-head { display: grid; grid-template-columns: 84px 1fr; gap: 1.2rem; align-items: center; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 3px solid var(--reference-accent); }
.reference-group-head h2 { margin-bottom: .25rem; color: var(--maroon-dark); }
.reference-group-head p:last-child { margin: 0; color: var(--muted); max-width: 820px; }
.reference-symbol { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--reference-soft); color: var(--reference-accent); border: 1px solid color-mix(in srgb, var(--reference-accent) 35%, white); font-family: Georgia, serif; font-weight: 800; font-size: 1.8rem; }
.resource-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.resource-card { min-height: 270px; display: flex; flex-direction: column; color: var(--ink); background: var(--paper); border: 1px solid var(--line); text-decoration: none; box-shadow: 0 8px 20px rgba(55,40,28,.05); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; overflow: hidden; }
.resource-card:hover { transform: translateY(-4px); border-color: var(--reference-accent); box-shadow: 0 16px 32px rgba(55,40,28,.12); }
.resource-visual { min-height: 94px; padding: 1rem; display: flex; justify-content: space-between; align-items: start; background: linear-gradient(135deg, var(--reference-soft), white); border-bottom: 1px solid color-mix(in srgb, var(--reference-accent) 28%, white); position: relative; overflow: hidden; }
.resource-visual::after { content: ''; position: absolute; width: 110px; height: 110px; right: -35px; bottom: -65px; border: 18px solid color-mix(in srgb, var(--reference-accent) 16%, transparent); border-radius: 50%; }
.source-mark { min-width: 54px; height: 54px; padding: 0 .45rem; display: grid; place-items: center; border-radius: 50%; background: var(--reference-accent); color: white; font-family: Georgia, serif; font-weight: 800; font-size: .95rem; box-shadow: 0 5px 12px rgba(55,40,28,.15); }
.source-kind { max-width: 125px; text-align: right; color: var(--reference-accent); text-transform: uppercase; letter-spacing: .08em; font-size: .65rem; font-weight: 800; }
.resource-copy { padding: 1rem 1rem .5rem; }
.resource-source { margin: 0 0 .35rem; color: var(--reference-accent); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.resource-copy h3 { margin: 0; font-family: Georgia, serif; font-size: 1.2rem; line-height: 1.25; }
.resource-domain { margin: .45rem 0 0; color: var(--muted); font-size: .78rem; }
.resource-foot { margin-top: auto; padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .6rem; color: var(--muted); font-size: .75rem; }
.resource-foot strong { color: var(--maroon); }
.reference-empty { margin: 2rem 0; background: var(--paper); border: 1px solid var(--line); }
.reference-disclaimer { margin: 3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.stat-card strong { display: block; font-family: Georgia, serif; font-size: 2.25rem; color: var(--maroon-dark); }
.mastery-row { display: grid; grid-template-columns: minmax(170px, 1fr) 2fr 55px; gap: 1rem; align-items: center; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.bar { height: 10px; background: #dedacb; }
.bar span { display: block; height: 100%; background: var(--maroon); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
footer { min-height: 74px; padding: 1.2rem 4vw; display: flex; justify-content: space-between; gap: 1rem; background: #dedacb; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
dialog { width: min(480px, 90vw); border: 1px solid var(--line); padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(30,22,19,.6); }
dialog form { padding: 2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1.5rem; }
dialog .quiet-btn { color: var(--ink); }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; background: var(--maroon-dark); color: white; padding: .85rem 1rem; box-shadow: var(--shadow); transform: translateY(140%); transition: transform .2s ease; }
.toast.show { transform: translateY(0); }
@media (max-width: 850px) {
  .masthead { padding: .75rem 4vw; flex-wrap: wrap; gap: .5rem; }
  .brand { width: calc(100% - 80px); }
  nav { width: 100%; overflow-x: auto; order: 3; }
  nav a { white-space: nowrap; }
  .hero-grid, .learn-layout { grid-template-columns: 1fr; }
  .module-grid, .setup-grid { grid-template-columns: repeat(2, 1fr); }
  .references-hero { grid-template-columns: 1fr; }
  .reference-compass { min-height: 340px; }
  .reference-tools { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topic-nav { position: static; display: flex; overflow-x: auto; max-height: none; }
  .topic-link { min-width: 180px; }
}
@media (max-width: 580px) {
  .page { width: min(94vw, 1180px); padding-top: 1.6rem; }
  .module-grid, .setup-grid, .progress-grid { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: 1fr; }
  .reference-group-head { grid-template-columns: 58px 1fr; }
  .reference-symbol { width: 52px; height: 52px; font-size: 1.2rem; }
  .reference-compass { min-height: 300px; }
  .ring-one { width: 260px; height: 260px; }
  .ring-two { width: 185px; height: 185px; }
  .compass-core { width: 125px; height: 125px; }
  .hero-card { min-height: 280px; }
  .topic-title, .topic-body { padding: 1.35rem; }
  .results-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .score-ring { width: 125px; height: 125px; }
  .mastery-row { grid-template-columns: 1fr 55px; }
  .mastery-row .bar { grid-row: 2; grid-column: 1 / 3; }
  footer { flex-direction: column; }
}
@keyframes compass-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
