:root {
  color-scheme: dark;
  --bg: #06111a;
  --panel: #0b1822;
  --panel-2: #10212d;
  --panel-3: #152a37;
  --text: #f4f6f0;
  --muted: #91a2ad;
  --line: rgba(255,255,255,.11);
  --accent: #d5f36a;
  --accent-dark: #172207;
  --land: #b9d96f;
  --land-edge: #e6f6a8;
  --ocean: #092436;
  --danger: #ffb783;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(38,92,109,.16), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  height: 72px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(6,17,26,.82);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; }
.brand strong { display: block; font-size: 15px; letter-spacing: .01em; white-space: nowrap; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; gap: 8px; }
.icon-button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); display: grid; place-items: center;
}
.icon-button:hover { background: rgba(255,255,255,.09); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px; }
.visual-section { position: relative; min-width: 0; overflow: hidden; background: #06131e; isolation: isolate; }
#earthCanvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#earthCanvas.is-grabbing { cursor: grabbing; }
.visual-section::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(3,10,16,.42), transparent 30%, transparent 68%, rgba(3,10,16,.62));
}
.visual-overlay { position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none; display: flex; justify-content: space-between; gap: 16px; }
.visual-overlay--top { top: 0; padding: 34px 36px; align-items: flex-start; }
.visual-overlay--bottom { bottom: 0; padding: 28px 36px; align-items: flex-end; }
.time-heading { max-width: 560px; text-shadow: 0 2px 18px rgba(0,0,0,.55); }
.heading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.eyebrow, .section-kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 700; }
.confidence-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 4px 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: rgba(255,255,255,.68); background: rgba(3,10,16,.35); font-size: 10px; letter-spacing: .02em; }
.confidence-badge.is-medium { color: #f4d88f; border-color: rgba(244,216,143,.3); }
.confidence-badge.is-low { color: var(--danger); border-color: rgba(255,183,131,.3); }
.time-heading h1 { margin: 6px 0 5px; font-size: clamp(42px, 6vw, 82px); line-height: .93; letter-spacing: -.055em; font-weight: 650; }
.time-heading h1 small { font-size: .29em; letter-spacing: -.02em; color: rgba(255,255,255,.75); font-weight: 500; }
.time-heading p { margin: 13px 0 0; max-width: 500px; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1.55; }
.view-switch { pointer-events: auto; display: flex; padding: 4px; background: rgba(4,13,20,.66); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(12px); }
.view-button { border: 0; border-radius: 999px; padding: 9px 14px; background: transparent; color: var(--muted); font-size: 12px; }
.view-button.is-active { color: var(--accent-dark); background: var(--accent); font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; max-width: min(420px, 55%); padding: 9px 12px; background: rgba(4,13,20,.72); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(12px); font-size: 12px; color: rgba(255,255,255,.82); }
.status-pill span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(213,243,106,.1); flex: 0 0 auto; }
.status-pill.is-loading .status-dot { animation: pulse 1s infinite; }
.status-pill.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,183,131,.1); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.75); } }
.map-tools { pointer-events: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 64%; }
.tool-button { border: 1px solid var(--line); background: rgba(4,13,20,.68); border-radius: 999px; padding: 9px 12px; font-size: 12px; color: var(--muted); backdrop-filter: blur(12px); }
.tool-button:hover, .tool-button.is-active { color: var(--text); background: rgba(255,255,255,.1); }
.tool-button.is-active { border-color: rgba(213,243,106,.28); }
.tool-icon { color: var(--accent); margin-right: 4px; }
.drag-hint { position: absolute; z-index: 3; left: 50%; bottom: 87px; transform: translateX(-50%); padding: 7px 11px; border-radius: 999px; background: rgba(4,13,20,.62); color: rgba(255,255,255,.57); font-size: 11px; pointer-events: none; transition: opacity .4s; white-space: nowrap; }
.drag-hint.is-hidden { opacity: 0; }

.map-message { position: absolute; z-index: 5; left: 50%; top: 54%; transform: translate(-50%, -50%); width: min(360px, calc(100% - 36px)); padding: 20px; border: 1px solid rgba(255,183,131,.25); border-radius: 18px; background: rgba(7,19,30,.9); backdrop-filter: blur(14px); text-align: center; box-shadow: var(--shadow); }
.map-message strong { display: block; font-size: 16px; }
.map-message p { margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-message button { border: 0; border-radius: 999px; padding: 9px 14px; background: var(--accent); color: var(--accent-dark); font-weight: 700; font-size: 12px; }
.toast { position: absolute; z-index: 8; left: 50%; bottom: 124px; transform: translateX(-50%); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(4,13,20,.9); box-shadow: var(--shadow); color: var(--text); font-size: 12px; white-space: nowrap; }

.control-panel { min-height: 0; overflow: auto; padding: 16px; background: var(--panel); border-left: 1px solid var(--line); scrollbar-color: rgba(255,255,255,.18) transparent; }
.timeline-card, .panel-section { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.timeline-card { padding: 17px; }
.timeline-toolbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.timeline-toolbar strong { display: block; font-size: 14px; }
.timeline-toolbar small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.play-button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-dark); display: grid; place-items: center; }
.play-button:hover { transform: scale(1.03); }
.play-button svg { width: 20px; fill: currentColor; }
.play-button .pause-icon { display: none; }
.play-button.is-playing .play-icon { display: none; }
.play-button.is-playing .pause-icon { display: block; }
.timeline-options { display: flex; align-items: center; gap: 6px; }
.direction-button, .compact-select { height: 36px; border: 1px solid var(--line); background: var(--panel-3); border-radius: 10px; font-size: 12px; }
.direction-button { width: 36px; padding: 0; color: var(--accent); font-size: 17px; }
.compact-select { padding: 0 8px; }
.range-wrap { margin-top: 20px; }
#timeSlider { width: 100%; accent-color: var(--accent); cursor: ew-resize; }
.range-labels { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 10px; }
.events-track-wrap { position: relative; margin: 14px 2px 0; height: 32px; }
.events-track { position: absolute; left: 0; right: 0; top: 8px; height: 3px; border-radius: 999px; background: rgba(255,255,255,.09); }
.event-marker { position: absolute; top: 50%; width: 11px; height: 11px; transform: translate(-50%, -50%); border: 2px solid var(--panel-2); border-radius: 50%; background: var(--muted); padding: 0; }
.event-marker:hover, .event-marker.is-active { width: 15px; height: 15px; background: var(--accent); box-shadow: 0 0 0 5px rgba(213,243,106,.09); }
.event-marker::after { content: attr(data-label); position: absolute; left: 50%; bottom: 17px; transform: translateX(-50%); width: max-content; max-width: 170px; padding: 6px 8px; border-radius: 8px; background: rgba(4,13,20,.94); border: 1px solid var(--line); color: var(--text); font-size: 10px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.event-marker:hover::after, .event-marker:focus-visible::after { opacity: 1; }
.milestones { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 3px; }
.milestones button { min-width: 0; padding: 8px 2px; border-radius: 9px; border: 1px solid transparent; background: rgba(255,255,255,.045); color: var(--muted); font-size: 10px; }
.milestones button:hover, .milestones button.is-active { color: var(--text); border-color: rgba(213,243,106,.35); background: rgba(213,243,106,.09); }
.keyboard-hint { margin: 12px 0 0; color: rgba(145,162,173,.72); font-size: 9px; text-align: center; }
.panel-section { margin-top: 13px; padding: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-heading h2 { margin: 4px 0 16px; font-size: 20px; letter-spacing: -.02em; }
.small-action { margin-top: 3px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 10px; }
.small-action:hover { color: var(--text); border-color: rgba(213,243,106,.3); }
.field-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.field-select { width: 100%; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-3); }
.city-result { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 13px; border-radius: 14px; background: rgba(213,243,106,.07); border: 1px solid rgba(213,243,106,.15); }
.city-pin { width: 13px; height: 13px; border: 3px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 6px rgba(213,243,106,.08); flex: 0 0 auto; }
.city-result strong { font-size: 14px; }
.city-result p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.city-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.city-metrics > div { padding: 10px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); }
.city-metrics span { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }
.city-metrics strong { display: block; margin-top: 5px; font-size: 13px; }
.helper-text { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 12px 0 0; }
.event-section { background: linear-gradient(145deg, rgba(213,243,106,.08), transparent 65%), var(--panel-2); }
.featured-event { margin-top: 10px; }
.event-time { display: inline-block; margin-bottom: 8px; padding: 4px 7px; border-radius: 999px; background: rgba(213,243,106,.1); color: var(--accent); font-size: 9px; }
.featured-event strong { display: block; font-size: 15px; line-height: 1.35; }
.featured-event p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.facts-section { padding-bottom: 10px; }
.fact-list { margin-top: 10px; }
.fact-item { display: grid; grid-template-columns: 7px 1fr; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.fact-item:first-child { border-top: 0; }
.fact-bullet { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.fact-item strong { display: block; font-size: 13px; line-height: 1.4; }
.fact-item p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel-footer { padding: 18px 6px 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.panel-footer p { margin: 2px 0; }

.info-dialog { width: min(540px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 22px; background: var(--panel-2); color: var(--text); padding: 0; box-shadow: var(--shadow); }
.info-dialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(4px); }
.info-dialog form { position: relative; padding: 26px; }
.info-dialog h2 { margin: 7px 34px 14px 0; font-size: 25px; }
.info-dialog p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.info-dialog a { color: var(--accent); }
.dialog-close { position: absolute; right: 15px; top: 13px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 22px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 360px; }
  .map-tools { max-width: 70%; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(540px, 70svh) auto; }
  .control-panel { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .visual-section { min-height: 540px; }
}

@media (max-width: 600px) {
  .topbar { height: 62px; padding: 0 12px; }
  .brand small { display: none; }
  .brand strong { font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .icon-button { width: 36px; height: 36px; }
  .top-actions .icon-button:first-child { display: none; }
  .workspace { grid-template-rows: minmax(510px, 73svh) auto; }
  .visual-overlay--top { padding: 23px 16px; display: block; }
  .visual-overlay--bottom { padding: 18px 14px; align-items: flex-end; }
  .time-heading { max-width: 86%; }
  .heading-meta { max-width: 68%; gap: 7px; }
  .time-heading h1 { font-size: 52px; }
  .time-heading h1 small { display: block; margin-top: 8px; font-size: 15px; }
  .time-heading p { max-width: 88%; font-size: 12px; }
  .view-switch { position: absolute; right: 14px; top: 20px; }
  .view-button { padding: 8px 11px; }
  .status-pill { max-width: 46%; padding: 8px 10px; }
  .map-tools { max-width: 54%; gap: 5px; }
  .tool-button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
  .tool-button .tool-icon { margin: 0; }
  .tool-button span:last-child { display: none; }
  .drag-hint { bottom: 70px; }
  .toast { bottom: 112px; max-width: calc(100% - 30px); overflow: hidden; text-overflow: ellipsis; }
  .control-panel { padding: 10px; }
  .timeline-card, .panel-section { border-radius: 18px; }
  .milestones { gap: 3px; }
  .milestones button { font-size: 9px; }
  .keyboard-hint { display: none; }
  .confidence-badge { font-size: 9px; }
}

@media (max-width: 380px) {
  .top-actions .icon-button:nth-child(2) { display: none; }
  .time-heading h1 { font-size: 46px; }
  .city-metrics { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* v4 — scientific atlas mechanics */
.precise-time {
  height: 36px;
  min-width: 86px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-3);
  overflow: hidden;
}
.precise-time span {
  padding-left: 8px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}
.precise-time input {
  min-width: 0;
  width: 58px;
  height: 100%;
  border: 0;
  padding: 0 6px;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  text-align: right;
}
.precise-time input::-webkit-inner-spin-button { opacity: .45; }

.atlas-section { position: relative; overflow: hidden; }
.atlas-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(var(--accent), transparent 72%);
  opacity: .7;
}
.atlas-heading { align-items: center; }
.atlas-heading h2 { margin-bottom: 8px; }
.age-code {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid rgba(213,243,106,.22);
  border-radius: 7px;
  background: rgba(213,243,106,.07);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}
.atlas-summary {
  margin: 4px 0 14px;
  color: rgba(244,246,240,.86);
  font-size: 12px;
  line-height: 1.58;
}
.atlas-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.atlas-meta-grid > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}
.atlas-meta-grid span,
.atlas-label,
.adjacent-events span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.atlas-meta-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
}
.atlas-meta-grid small {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 9px;
  line-height: 1.35;
}
.atlas-group { margin-top: 15px; }
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.atlas-tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 5px 8px;
  border: 1px solid rgba(213,243,106,.16);
  border-radius: 7px;
  background: rgba(213,243,106,.055);
  color: rgba(244,246,240,.9);
  font-size: 9px;
  line-height: 1.25;
}
.tag-list--ocean .atlas-tag {
  border-color: rgba(120,205,244,.17);
  background: rgba(120,205,244,.055);
  color: #ccecf7;
}
.process-list { margin-top: 7px; }
.process-row {
  display: grid;
  grid-template-columns: 17px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.055);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.process-row:first-child { border-top: 0; }
.process-arrow { color: var(--accent); font-weight: 700; }
.motion-group {
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.motion-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.live-badge {
  flex: 0 0 auto;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(213,243,106,.08);
  color: var(--accent);
  font-size: 8px;
  letter-spacing: .05em;
}
.live-badge.is-loading { animation: pulse 1s infinite; }
.live-badge.is-error { color: var(--danger); background: rgba(255,183,131,.08); }
.motion-list { margin-top: 7px; }
.motion-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.055);
}
.motion-row:first-child { border-top: 0; }
.motion-direction {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(213,243,106,.18);
  border-radius: 50%;
  color: var(--accent);
  font-size: 13px;
  transform: rotate(var(--bearing, 0deg));
}
.motion-copy { min-width: 0; }
.motion-copy strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.motion-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}
.motion-speed {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.motion-note {
  margin: 8px 0 0;
  color: rgba(145,162,173,.78);
  font-size: 9px;
  line-height: 1.45;
}
.adjacent-events {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 15px;
}
.adjacent-events > div {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.adjacent-events strong {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.4;
}
.adjacent-events p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}
.landmass-map-label {
  font-family: "Lucida Console", "Courier New", monospace;
}

@media (max-width: 600px) {
  .timeline-toolbar { grid-template-columns: auto 1fr; }
  .timeline-options { grid-column: 1 / -1; justify-content: flex-end; }
  .precise-time { min-width: 96px; }
  .atlas-meta-grid, .adjacent-events { grid-template-columns: 1fr; }
}


.continent-guide { display: grid; gap: 7px; margin-top: 8px; }
.continent-guide-row {
  padding: 10px 11px;
  border: 1px solid rgba(114,245,255,.12);
  background: rgba(2,10,16,.28);
}
.continent-guide-row > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.continent-guide-row strong { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.continent-guide-row span { color: var(--accent); font: 9px/1.2 var(--mono); text-align: right; text-transform: uppercase; letter-spacing: .05em; }
.continent-guide-row p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.naming-caution { margin: 8px 0 0; color: rgba(255,176,125,.82); font: 9px/1.45 var(--mono); letter-spacing: .035em; }
@media (max-width: 430px) {
  .continent-guide-row > div { display: block; }
  .continent-guide-row span { display: block; margin-top: 4px; text-align: left; }
}

.motion-row--warning { border-color: rgba(255,176,125,.24); }
.motion-row--warning .motion-direction, .motion-row--warning .motion-speed { color: var(--danger); }


/* v4: multi-scale Earth history */
.timeline-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 10px; }
.timeline-mode { min-width: 0; padding: 9px 5px; border: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.035); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.timeline-mode:hover, .timeline-mode.is-active { color: var(--text); border-color: rgba(213,243,106,.4); background: rgba(213,243,106,.09); }
.mode-explanation { margin: 0 0 13px; padding: 8px 9px; border-left: 3px solid var(--accent); background: rgba(213,243,106,.045); color: var(--muted); font-size: 10px; line-height: 1.45; }
.calendar-note { margin: 11px 0 0; padding: 8px 9px; border: 1px solid rgba(255,183,131,.2); color: #e7c5aa; font-size: 10px; line-height: 1.45; }
.planet-state-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.planet-state-grid > div { min-width: 0; padding: 10px; border: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.025); }
.planet-state-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.planet-state-grid strong { display: block; font-size: 11px; line-height: 1.4; }
.tool-button.is-unavailable, .small-action.is-unavailable { opacity: .35; pointer-events: none; filter: grayscale(1); }
.view-button.is-unavailable { opacity: .45; pointer-events: auto; cursor: help; filter: grayscale(.75); }
.visual-section.is-deep-time .drag-hint::before { content: 'СХЕМА · '; color: var(--danger); }
.visual-section.is-deep-time::before { opacity: .7; }
.deep-time-watermark { display: none; }
@media (max-width: 600px) {
  .timeline-modes { grid-template-columns: 1fr; }
  .planet-state-grid { grid-template-columns: 1fr; }
}


/* v8: DOM-based early-Earth visual. This layer does not depend on Canvas or D3. */
.origin-planet-visual {
  --planet-ocean-1: #123c50;
  --planet-ocean-2: #071c2a;
  --planet-land-1: #78874a;
  --planet-land-2: #4f5e32;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 57%;
  width: clamp(280px, 35vw, 470px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 24px 46px rgba(0,0,0,.48));
}
.origin-planet-halo {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 56%, rgba(115,225,255,.12) 66%, transparent 75%);
  box-shadow: 0 0 46px rgba(105,208,238,.16);
}
.origin-planet-disc {
  position: relative;
  width: 78%;
  height: 78%;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(211,246,255,.5);
  background:
    radial-gradient(circle at 34% 25%, rgba(255,255,255,.18), transparent 17%),
    radial-gradient(circle at 38% 34%, var(--planet-ocean-1), var(--planet-ocean-2) 72%);
  box-shadow:
    inset -34px -24px 54px rgba(0,0,0,.42),
    inset 18px 12px 36px rgba(255,255,255,.06),
    0 0 0 1px rgba(105,220,244,.12),
    0 0 34px rgba(69,166,195,.2);
}
.origin-planet-disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.025) 0 1px, transparent 1px 5px),
    linear-gradient(90deg, rgba(255,255,255,.05), transparent 30%, transparent 70%, rgba(0,0,0,.18));
  pointer-events: none;
}
.origin-land {
  position: absolute;
  display: block;
  background: linear-gradient(145deg, var(--planet-land-1), var(--planet-land-2));
  border: 1px solid rgba(224,242,161,.22);
  opacity: .9;
  transform: rotate(var(--r, 0deg));
  clip-path: polygon(8% 22%, 29% 5%, 57% 12%, 82% 4%, 96% 30%, 87% 55%, 97% 76%, 73% 92%, 43% 83%, 21% 97%, 4% 69%, 14% 47%);
  filter: drop-shadow(3px 4px 3px rgba(0,0,0,.22));
}
.origin-land--a { width: 34%; height: 25%; left: 14%; top: 19%; --r: -14deg; }
.origin-land--b { width: 30%; height: 34%; right: 10%; top: 30%; --r: 18deg; }
.origin-land--c { width: 24%; height: 19%; left: 24%; bottom: 11%; --r: 12deg; }
.origin-land--d { width: 16%; height: 13%; right: 21%; bottom: 12%; --r: -22deg; }
.origin-crack {
  position: absolute;
  display: none;
  height: 3px;
  background: #ffd36b;
  box-shadow: 0 0 9px #ff6a22;
  transform-origin: left center;
}
.origin-crack--a { width: 43%; left: 10%; top: 34%; transform: rotate(24deg); }
.origin-crack--b { width: 48%; left: 35%; top: 58%; transform: rotate(-31deg); }
.origin-crack--c { width: 34%; left: 27%; top: 74%; transform: rotate(10deg); }
.origin-band {
  position: absolute;
  left: -8%;
  width: 116%;
  height: 7%;
  border-top: 1px solid rgba(220,248,255,.18);
  border-bottom: 1px solid rgba(220,248,255,.12);
  opacity: .36;
}
.origin-band--a { top: 33%; transform: rotate(-7deg); }
.origin-band--b { top: 62%; transform: rotate(5deg); }
.origin-planet-caption {
  position: absolute;
  top: 91%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 92%;
  padding: 7px 10px;
  border: 1px solid rgba(213,243,106,.22);
  background: rgba(4,13,20,.76);
  color: rgba(225,246,238,.68);
  font: 10px/1.2 "Lucida Console", "Courier New", monospace;
  letter-spacing: .07em;
  text-align: center;
  text-transform: uppercase;
}

.origin-planet-visual[data-visual="magma"] {
  --planet-ocean-1: #ff6a1f;
  --planet-ocean-2: #250805;
  --planet-land-1: #6f2010;
  --planet-land-2: #2b0b06;
}
.origin-planet-visual[data-visual="lava-ocean"] {
  --planet-ocean-1: #d84d18;
  --planet-ocean-2: #230908;
  --planet-land-1: #833015;
  --planet-land-2: #32100a;
}
.origin-planet-visual[data-visual="magma"] .origin-land,
.origin-planet-visual[data-visual="lava-ocean"] .origin-land { opacity: .34; }
.origin-planet-visual[data-visual="magma"] .origin-crack,
.origin-planet-visual[data-visual="lava-ocean"] .origin-crack { display: block; }
.origin-planet-visual[data-visual="magma"] .origin-planet-halo,
.origin-planet-visual[data-visual="lava-ocean"] .origin-planet-halo {
  background: radial-gradient(circle, transparent 52%, rgba(255,96,25,.24) 66%, transparent 76%);
  box-shadow: 0 0 56px rgba(255,91,24,.26);
}
.origin-planet-visual[data-visual="hadean-ocean"] {
  --planet-ocean-1: #40677a;
  --planet-ocean-2: #111b20;
  --planet-land-1: #80613c;
  --planet-land-2: #4b3725;
}
.origin-planet-visual[data-visual="early-ocean"],
.origin-planet-visual[data-visual="microbial-ocean"],
.origin-planet-visual[data-visual="stromatolite"] {
  --planet-ocean-1: #1b7185;
  --planet-ocean-2: #082431;
  --planet-land-1: #777540;
  --planet-land-2: #4b4f2c;
}
.origin-planet-visual[data-visual="oxygen-oases"],
.origin-planet-visual[data-visual="pre-goe"],
.origin-planet-visual[data-visual="goe"],
.origin-planet-visual[data-visual="eukaryote"],
.origin-planet-visual[data-visual="boring-billion"] {
  --planet-ocean-1: #2f879e;
  --planet-ocean-2: #092b3d;
  --planet-land-1: #84935b;
  --planet-land-2: #58653a;
}
.origin-planet-visual[data-visual="goe"] .origin-planet-halo,
.origin-planet-visual[data-visual="eukaryote"] .origin-planet-halo,
.origin-planet-visual[data-visual="boring-billion"] .origin-planet-halo {
  background: radial-gradient(circle, transparent 53%, rgba(128,226,255,.2) 66%, transparent 77%);
  box-shadow: 0 0 58px rgba(92,197,229,.2);
}
.origin-planet-visual[data-visual="rodinia"],
.origin-planet-visual[data-visual="rodinia-breakup"] {
  --planet-ocean-1: #2c758d;
  --planet-ocean-2: #082536;
  --planet-land-1: #9a8150;
  --planet-land-2: #685635;
}
.origin-planet-visual[data-visual="rodinia"] .origin-land--a { width: 53%; height: 42%; left: 22%; top: 25%; }
.origin-planet-visual[data-visual="rodinia"] .origin-land--b,
.origin-planet-visual[data-visual="rodinia"] .origin-land--c,
.origin-planet-visual[data-visual="rodinia"] .origin-land--d { opacity: .22; }
.origin-planet-visual[data-visual="snowball"] {
  --planet-ocean-1: #eaf7fa;
  --planet-ocean-2: #89aab8;
  --planet-land-1: #f8ffff;
  --planet-land-2: #bfdae3;
}
.origin-planet-visual[data-visual="snowball"] .origin-planet-disc {
  box-shadow: inset -32px -25px 48px rgba(42,74,86,.38), 0 0 42px rgba(190,235,247,.3);
}
.origin-planet-visual[data-visual="ediacaran"],
.origin-planet-visual[data-visual="cambrian"],
.origin-planet-visual[data-visual="ordovician"],
.origin-planet-visual[data-visual="silurian"],
.origin-planet-visual[data-visual="devonian"] {
  --planet-ocean-1: #3590aa;
  --planet-ocean-2: #092d42;
  --planet-land-1: #8d9157;
  --planet-land-2: #586a3c;
}
.visual-section.is-deep-time .view-switch,
.visual-section.is-deep-time .map-tools,
.visual-section.is-deep-time .drag-hint { display: none !important; }

@media (max-width: 900px) {
  .origin-planet-visual { width: clamp(250px, 53vw, 410px); top: 59%; }
}
@media (max-width: 600px) {
  .origin-planet-visual { width: min(72vw, 330px); top: 61%; }
  .origin-planet-caption { font-size: 8px; }
}

/* v8.1: desktop workspace must stay viewport-height; the reference panel scrolls independently. */
@media (min-width: 901px) {
  .app-shell {
    height: 100vh;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }
  .workspace {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  .visual-section {
    min-height: 0;
    height: 100%;
  }
  .control-panel {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 900px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: visible;
  }
  .workspace {
    height: auto;
    overflow: visible;
  }
}


/* v9: globe-only interaction + mobile scrubber */
.view-switch { display: none !important; }
.mobile-scrubber { display: none; }

@media (pointer: coarse) {
  #earthCanvas { touch-action: pan-y; }
}

@media (max-width: 900px) {
  .visual-section {
    min-height: 480px;
    height: min(72svh, 680px);
    overscroll-behavior: contain;
  }
  .mobile-scrubber {
    display: block;
    position: absolute;
    z-index: 7;
    left: 12px;
    right: 12px;
    bottom: 10px;
    padding: 9px 11px 10px;
    border: 1px solid rgba(213,243,106,.28);
    background: rgba(4,13,20,.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
  }
  .mobile-scrubber-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: .08em;
  }
  .mobile-scrubber-head strong { color: var(--text); font-size: 11px; text-align: right; }
  #mobileTimeSlider { width: 100%; min-height: 28px; accent-color: var(--accent); }
  .visual-overlay--bottom { bottom: 68px; }
  .drag-hint { bottom: 116px; }
}

@media (max-width: 600px) {
  .visual-section {
    min-height: 460px;
    height: calc(100svh - 62px);
    max-height: 720px;
  }
  .visual-overlay--top { padding-bottom: 8px; }
  .time-heading p { max-width: 78%; }
  .status-pill { display: none; }
  .visual-overlay--bottom { left: 0; right: 0; bottom: 70px; padding: 8px 12px; justify-content: center; }
  .map-tools { max-width: 100%; justify-content: center; }
  .tool-button { width: 38px; height: 38px; }
  .drag-hint { bottom: 122px; font-size: 10px; }
}

@media (max-width: 390px) {
  .time-heading h1 { font-size: 42px; }
  .time-heading p { font-size: 11px; line-height: 1.42; max-width: 74%; }
  .map-tools { gap: 4px; }
  .tool-button { width: 34px; height: 34px; }
}
