:root {
  --bg: #f3efe6;
  --panel: rgba(255, 252, 247, .95);
  --text: #1f2933;
  --muted: #65707c;
  --line: #d8c9b3;
  --primary: #315d74;
  --primary-dark: #163f57;
  --warm: #b08246;
  --gold: #d4a94e;
  --correct: #397957;
  --wrong: #a9483d;
  --shadow: 0 18px 36px rgba(48, 43, 34, .11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(255,255,255,.76), transparent 30%), linear-gradient(180deg, #f8f4ea 0%, var(--bg) 58%, #ece5d8 100%);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}
button { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(25, 78, 120, .42);
  outline-offset: 3px;
}
.container { width: min(1560px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.map-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(350px, .42fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.hero-copy, .map-controls { position: relative; overflow: hidden; border: 1px solid rgba(164,139,99,.18); border-radius: 26px; background: var(--panel); box-shadow: var(--shadow); }
.hero-copy { padding: clamp(24px, 2.6vw, 34px); }
.hero-copy::after { position: absolute; top: -48px; right: -62px; width: 230px; height: 230px; border-radius: 50%; content: ""; background: radial-gradient(circle, rgba(87,150,177,.2), rgba(87,150,177,0)); pointer-events: none; }
h1, h2, h3 { font-family: "EB Garamond", Georgia, "Times New Roman", serif; }
h1 { position: relative; z-index: 1; max-width: 23ch; margin: 0; color: #22313d; font-size: clamp(2rem, 3.5vw, 3.3rem); line-height: .98; text-wrap: balance; }
.hero-eyebrow, .panel-label { position: relative; z-index: 1; margin: 0 0 9px; color: var(--warm); font-size: .75rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.hero-text { position: relative; z-index: 1; max-width: 72ch; margin: 12px 0 0; color: var(--muted); font-size: clamp(1rem, 1rem + .14vw, 1.12rem); font-weight: 500; line-height: 1.55; }
.map-controls { display: flex; flex-direction: column; justify-content: center; padding: clamp(22px, 2.2vw, 30px); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; padding: 4px; border: 1px solid rgba(49,93,116,.18); border-radius: 999px; background: #f3eee5; }
.mode-button { min-height: 44px; padding: 8px 18px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.mode-button.is-active { color: white; background: var(--primary); }
.mode-hint { margin: 11px 3px 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.workspace { display: grid; grid-template-columns: minmax(0, 7fr) minmax(290px, 3fr); gap: 16px; align-items: stretch; }
.map-card, .info-panel { border: 1px solid rgba(164,139,99,.18); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.map-card { padding: 12px; }
.map-frame { position: relative; overflow: hidden; min-height: 500px; border: 1px solid #c7d4d9; border-radius: 14px; background: radial-gradient(circle at 45% 35%, rgba(255,255,255,.52), transparent 36%), #dbeaf0; box-shadow: inset 0 0 0 8px rgba(255,255,255,.22); }
.map-object { display: block; width: 100%; height: clamp(500px, 59vw, 720px); border: 0; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 800; pointer-events: none; }
.map-loading.is-hidden { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 4px 2px; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend b { color: #45505a; }
.swatch { width: 12px; height: 12px; border: 1px solid rgba(31,41,51,.25); border-radius: 3px; }
.swatch.cisleithania { background: #e7d7ad; }
.swatch.transleithania { background: #cbd6c6; }
.swatch.joint { background: #c5d0d6; }
.sources { margin: 7px 4px 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.sources summary { width: fit-content; cursor: pointer; font-weight: 800; }
.sources p { margin: 6px 0 0; }
.info-panel { display: flex; min-height: 100%; flex-direction: column; padding: clamp(20px, 2vw, 28px); }
.eyebrow { margin: 0 0 8px; color: var(--warm); font-size: .75rem; font-weight: 900; letter-spacing: .065em; text-transform: uppercase; }
.info-panel h2 { margin: 0 0 11px; color: var(--primary-dark); font-size: clamp(1.45rem, 2vw, 1.95rem); line-height: 1.08; }
.info-panel h3 { margin: 19px 0 6px; color: var(--primary-dark); font-size: 1.05rem; }
.lead, .history, .feedback, .instruction { line-height: 1.52; }
.lead { margin: 0; color: var(--muted); }
.history { margin: 10px 0 0; }
.facts { display: grid; gap: 8px; margin: 16px 0 0; }
.fact { padding: 9px 11px; border-left: 3px solid var(--warm); border-radius: 7px; background: #f8f2e7; }
.fact small { display: block; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.fact strong { display: block; margin-top: 2px; }
.practice-menu { display: grid; gap: 9px; margin-top: 17px; }
.practice-choice { display: grid; gap: 3px; width: 100%; min-height: 64px; padding: 11px 13px; border: 1px solid rgba(25,78,120,.24); border-radius: 12px; color: var(--primary-dark); background: white; cursor: pointer; text-align: left; }
.practice-choice:hover { border-color: var(--primary); background: #f2f7fa; }
.practice-choice strong { font-size: .96rem; }
.practice-choice span { color: var(--muted); font-size: .78rem; }
.practice-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--primary-dark); font-size: .8rem; }
.practice-meta span { padding: 4px 8px; border-radius: 999px; background: #e9f1f6; font-weight: 800; }
.prompt { margin: 7px 0 12px; padding: 12px 13px; border-left: 4px solid var(--warm); border-radius: 8px; background: #fff7e7; line-height: 1.42; }
.prompt strong { font-size: 1.08rem; }
.feedback { margin: 11px 0 0; padding: 11px 12px; border-radius: 9px; background: #f4f1eb; }
.feedback.correct { border-left: 4px solid var(--correct); background: #eaf5ee; }
.feedback.wrong { border-left: 4px solid var(--wrong); background: #faece9; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 20px; }
.primary-button, .secondary-button, .city-card { min-height: 44px; padding: 9px 13px; border-radius: 11px; cursor: pointer; font-weight: 800; }
.primary-button { border: 1px solid var(--primary); color: white; background: var(--primary); }
.secondary-button { border: 1px solid rgba(25,78,120,.25); color: var(--primary-dark); background: white; }
button:disabled { cursor: not-allowed; opacity: .42; }
.city-card { display: grid; place-items: center; width: 100%; min-height: 74px; margin: 8px 0; border: 2px dashed rgba(169,119,56,.5); color: #65451f; background: #fff7e7; font-family: Georgia, serif; font-size: 1.35rem; }
.city-card.is-armed { border-style: solid; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,78,120,.12); }
.match-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.match-column { display: grid; align-content: start; gap: 6px; }
.match-button { min-height: 42px; padding: 7px 8px; border: 1px solid rgba(25,78,120,.23); border-radius: 9px; color: var(--primary-dark); background: white; cursor: pointer; font-size: .8rem; font-weight: 750; }
.match-button.is-selected { color: white; background: var(--primary); }
.match-button.is-done { border-color: var(--correct); color: #276442; background: #eaf5ee; }
.sort-list { display: grid; gap: 7px; margin-top: 10px; }
.sort-card { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: white; font-weight: 800; text-align: center; }
.sort-actions { display: grid; grid-template-columns: 1fr; gap: 6px; }
.sort-actions button { min-height: 40px; padding: 7px; border: 1px solid rgba(25,78,120,.23); border-radius: 9px; color: var(--primary-dark); background: white; cursor: pointer; font-size: .78rem; font-weight: 800; }
.done-list { margin: 10px 0 0; padding: 0; list-style: none; font-size: .79rem; }
.done-list li { margin-top: 4px; padding: 6px 8px; border-radius: 7px; background: #eaf5ee; }

@media (max-width: 1000px) {
  .map-hero { grid-template-columns: minmax(0, 1fr) minmax(300px, .48fr); }
  .workspace { grid-template-columns: minmax(0, 2.25fr) minmax(260px, 1fr); }
  .map-frame { min-height: 440px; }
  .map-object { height: clamp(440px, 61vw, 620px); }
}
@media (max-width: 760px) {
  .container { width: min(100% - 20px, 720px); padding-top: 10px; }
  .map-hero { grid-template-columns: 1fr; }
  .hero-copy, .map-controls { border-radius: 18px; }
  .hero-copy { padding: 22px 20px; }
  .map-controls { padding: 18px 20px; }
  .workspace { grid-template-columns: 1fr; }
  .map-card, .info-panel { border-radius: 16px; }
  .map-object { height: clamp(390px, 91vw, 550px); }
  .map-frame { min-height: 390px; }
}
@media (max-width: 450px) {
  .map-card { padding: 8px; }
  .map-frame { min-height: 340px; }
  .map-object { height: 350px; }
  .legend { display: grid; }
  .info-panel { padding: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
