:root {
  --ink: #22313d;
  --muted: #66747d;
  --blue: #315d74;
  --blue-dark: #22495d;
  --paper: #fffdf9;
  --line: rgba(62, 83, 92, .18);
  --correct: #3c8062;
  --wrong: #b34f47;
  --shadow: 0 18px 42px rgba(35, 49, 61, .11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  padding-top: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, #edf4f4, #f6f0e6 34rem);
  font-family: Inter, "Segoe UI", sans-serif;
}
button { font: inherit; }
.page-shell { width: min(1480px, calc(100% - 32px)); margin: 0 auto 34px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 24px 5px 18px; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: .74rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.hero h1 { margin: 0; font: 700 clamp(2rem, 4vw, 3.7rem)/1.02 "EB Garamond", Georgia, serif; }
.chapter-title { margin: 9px 0 0; color: var(--muted); font-size: clamp(.98rem, 1.4vw, 1.16rem); }
.mode-switch, .practice-setup > div { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(35,49,61,.08); }
.mode-button, .order-button { min-height: 42px; padding: 9px 14px; border: 0; border-radius: 10px; color: #56676c; background: transparent; font-weight: 800; cursor: pointer; }
.mode-button.is-active, .order-button.is-active { color: #fff; background: var(--blue); }
.chapter-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.chapter-step { flex: 1; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 13px; color: #627078; background: rgba(255,255,255,.72); font-weight: 800; text-align: left; }
.chapter-step span { display: inline-grid; width: 25px; height: 25px; margin-right: 7px; place-items: center; border-radius: 50%; background: #e5eceb; }
.chapter-step.is-active { border-color: rgba(49,93,116,.45); color: var(--blue-dark); background: #fff; box-shadow: 0 8px 22px rgba(35,49,61,.08); }
.chapter-step.is-active span { color: #fff; background: var(--blue); }
.progress-arrow { color: #899496; font-size: 1.4rem; }
.practice-setup { display: grid; grid-template-columns: auto auto 1fr; gap: 18px; align-items: center; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.76); }
.practice-setup p { margin: 0; color: var(--muted); font-size: .86rem; }
.activity-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(310px, 1fr); gap: 16px; align-items: start; }
.map-card, .task-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,249,.96); box-shadow: var(--shadow); }
.map-toolbar { min-height: 56px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.map-toolbar p { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0; color: var(--muted); font-size: .86rem; }
.map-era { color: var(--blue-dark); font-weight: 900; }
.text-button { border: 0; color: var(--blue); background: transparent; font-weight: 800; cursor: pointer; }
.map-wrap { position: relative; min-height: 560px; aspect-ratio: 1.34; overflow: hidden; background: #cfe3e8; }
#history-map { display: block; width: 100%; height: 100%; }
.sea { fill: #cfe3e8; }
.region { fill: transparent; stroke: transparent; cursor: pointer; transition: opacity .18s, filter .18s; }
.region:hover, .region:focus-visible, .region.is-active-target { stroke: #173f52; stroke-width: 3; outline: none; filter: drop-shadow(0 0 5px #fff); }
.region.is-reich { fill: #7f3d37; }.region.is-occupied { fill: #bd7a58; }.region.is-ally { fill: #b49a62; }
.region.is-admin { fill: url(#admin-hatch); }.region.is-soviet { fill: url(#soviet-hatch); }
.region.is-correct { fill: var(--correct); }.region.is-wrong { fill: var(--wrong); }
.map-note { fill: #264653; font-size: 11px; font-weight: 800; }.noninteractive { pointer-events: none; }
.detail-inset { position: absolute; z-index: 4; right: 14px; bottom: 14px; width: min(290px, calc(100% - 28px)); padding: 12px; border: 1px solid rgba(35,49,61,.24); border-radius: 14px; background: rgba(255,253,249,.96); box-shadow: 0 16px 34px rgba(35,49,61,.2); }
.detail-inset h3 { margin: 0 0 5px; font: 700 1.14rem/1.1 Georgia, serif; }.detail-inset p { margin: 0 0 8px; color: var(--muted); font-size: .76rem; line-height: 1.4; }.detail-inset svg { display: block; width: 100%; height: auto; }.inset-target { fill: #e2bc78; stroke: #314c56; stroke-width: 3; cursor: pointer; }.inset-target.zone { fill: url(#zone-hatch); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; min-height: 48px; padding: 11px 16px; border-top: 1px solid var(--line); color: #59676d; font-size: .78rem; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }.swatch { width: 22px; height: 14px; border: 1px solid #52646b; border-radius: 3px; }.swatch.reich { background:#7f3d37 }.swatch.occupied { background:#bd7a58 }.swatch.ally { background:#b49a62 }.swatch.admin { background:#d8a178 }.swatch.soviet { background:#9d816f }
.task-card { position: sticky; top: 12px; min-height: 560px; padding: 23px; }
.task-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.task-card h2 { margin: 5px 0 12px; font: 700 clamp(1.55rem, 2.2vw, 2.1rem)/1.12 "EB Garamond", Georgia, serif; }
.task-prompt { color: #536269; line-height: 1.5; }
.choice-list { display: grid; gap: 9px; margin-top: 18px; }
.choice-button { min-height: 44px; padding: 10px 13px; border: 1px solid #b9c8c6; border-radius: 10px; color: var(--ink); background: #fff; font-weight: 750; text-align: left; cursor: pointer; }
.choice-button:hover, .choice-button:focus-visible, .choice-button.is-selected { border-color: var(--blue); background: #edf4f5; outline: none; }
.selection-status, .feedback { margin-top: 16px; padding: 13px 14px; border-radius: 11px; background: #e7f3eb; line-height: 1.48; }.feedback.is-wrong { background: #f7e8e5; }
.task-actions { display: flex; justify-content: space-between; gap: 9px; margin-top: 20px; }
.primary-button, .secondary-button { min-height: 44px; padding: 10px 15px; border-radius: 10px; font-weight: 850; cursor: pointer; }.primary-button { border: 0; color: #fff; background: var(--blue); }.secondary-button { border: 1px solid #b9c8c6; color: var(--blue); background: #fff; }button:disabled { opacity: .42; cursor: not-allowed; }
.timeline { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; padding: 4px 2px 8px; }.timeline-button { flex: 0 0 170px; min-height: 65px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: #5c6b70; background: rgba(255,255,255,.78); text-align: left; cursor: pointer; }.timeline-button strong { display: block; color: var(--blue-dark); }.timeline-button.is-active { border-color: var(--blue); background: #fff; box-shadow: 0 7px 18px rgba(35,49,61,.09); }
.source-note { margin: 12px 5px; color: var(--muted); font-size: .76rem; }.source-note a { color: var(--blue); }
.modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(24,34,40,.54); }.modal-card { width: min(530px, 100%); padding: 30px; border-radius: 22px; background: var(--paper); box-shadow: 0 28px 80px rgba(15,23,28,.3); }.modal-card h2 { margin: 4px 0 10px; font: 700 2rem/1.05 Georgia, serif; }.modal-card p { color: var(--muted); line-height: 1.55; }

@media (max-width: 900px) {
  .activity-grid { grid-template-columns: 1fr; }
  .task-card { position: static; min-height: auto; }
  .map-wrap { min-height: 480px; }
}
@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1480px); }
  .hero { display: grid; padding-top: 14px; }
  .mode-switch { width: 100%; }.mode-button { flex: 1; }
  .chapter-progress { display: grid; grid-template-columns: 1fr; }.progress-arrow { display: none; }
  .practice-setup { grid-template-columns: 1fr; gap: 9px; }
  .map-wrap { min-height: 0; aspect-ratio: 450 / 456; }
  .map-toolbar { align-items: flex-start; }.map-toolbar p { display: grid; }
  .task-card { padding: 18px; }
}
