:root {
  --ink: #0d1117;
  --panel: rgba(16, 20, 27, 0.82);
  --line: rgba(232, 197, 120, 0.22);
  --gold: #e8c578;
  --red: #de2d26;
  --text: #f1ece2;
  --muted: #a9a294;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, sans-serif; }
#map { position: absolute; inset: 0; }

.brand, .legend, .card, .timeline {
  position: absolute; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 14px;
}

.brand { top: 16px; left: 16px; display: flex; gap: 12px; align-items: center; padding: 10px 14px; }
.brand-mark { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--red); color: var(--gold); font: 700 24px "Noto Serif", serif; }
.brand h1 { margin: 0 0 4px; font: 700 18px "Noto Serif", serif; color: var(--gold); letter-spacing: .3px; }
.brand select, .controls select { background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 6px; font: 500 13px inherit; font-family: inherit; }
.brand select option, .controls select option { background: #1a1f28; }

.legend { top: 16px; right: 16px; padding: 10px 14px; font-size: 13px; max-width: 260px; }
#legend-arrows, #legend-regions { display: block !important; margin: 0 !important; }
.legend div { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend i { width: 22px; height: 6px; border-radius: 3px; display: inline-block; }
.legend b { width: 14px; height: 14px; border-radius: 3px; display: inline-block; opacity: .8; }
.legend-sub { color: var(--gold); font-weight: 600; font-size: 12px; margin-top: 10px; text-transform: uppercase; letter-spacing: .5px; }
.legend .hint { color: var(--muted); font-size: 11.5px; margin-top: 8px; line-height: 1.45; display: block; }

.card { left: 16px; top: 96px; width: 360px; max-height: calc(100% - 210px); overflow: auto; padding: 16px 18px; }
.card-date { color: var(--gold); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.card h2 { font: 700 21px/1.3 "Noto Serif", serif; margin: 6px 0 10px; }
.card p { margin: 0; font-size: 14.5px; line-height: 1.65; color: #ddd6c8; }
.card-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.card-nav button, .mode { background: rgba(232,197,120,.1); color: var(--gold); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font: 600 13px inherit; font-family: inherit; }
.card-nav button:hover, .mode:hover { background: rgba(232,197,120,.22); }
.sources { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.sources summary { cursor: pointer; color: var(--gold); }
.sources ul { padding-left: 18px; margin: 6px 0; }
.sources .beta { font-size: 12px; color: #c9a86a; font-style: italic; margin-top: 6px; }

.timeline { left: 16px; right: 16px; bottom: 30px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; }
.play { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font-size: 17px; box-shadow: 0 0 0 4px rgba(222,45,38,.25); }
.track-wrap { flex: 1; position: relative; padding-top: 30px; }
.ticks { position: absolute; top: 0; left: 0; right: 0; height: 28px; }
.tick { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap;
  cursor: pointer; text-align: center; line-height: 1.2; }
.tick::after { content: ""; display: block; width: 2px; height: 7px; background: var(--muted); margin: 3px auto 0; }
.tick.active { color: var(--gold); font-weight: 600; }
.tick.active::after { background: var(--gold); }
input[type=range] { width: 100%; accent-color: var(--red); margin: 0; }
.controls { display: flex; gap: 8px; flex: none; }

.deck-tooltip { max-width: 320px; }
.tip-side { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.tip-title { font: 700 15px/1.35 "Noto Serif", serif; margin: 3px 0 4px; }
.tip-meta { font-size: 12.5px; color: #cfc7b6; }
.tip-event { font-size: 12px; color: var(--gold); margin-top: 6px; }

#loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px;
  background: var(--panel); border-radius: 10px; border: 1px solid var(--line); font-size: 14px; transition: opacity .6s; }
.credit { position: absolute; right: 16px; bottom: 8px; font-size: 10.5px; color: rgba(241,236,226,.6); }

@media (max-width: 760px) {
  .legend { display: none; }
  .brand { right: 16px; }
  .brand select { max-width: 230px; }
  .card { top: auto; bottom: 104px; left: 10px; right: 10px; width: auto; max-height: 36%; padding: 12px 14px; }
  .card h2 { font-size: 17px; }
  .card p { font-size: 13.5px; }
  .tick span.long { display: none; }
  .timeline { left: 10px; right: 10px; gap: 8px; }
}
