/* Historical Globe — app styles */

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body { font-family: var(--font-sans); color: var(--fg-on-dark); user-select: none; }

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 64px 1fr auto;
  overflow: hidden;
  transition: background 0.8s var(--ease-in-out);
}

.bg-texture {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(201, 169, 77, 0.05) 1px, transparent 1.5px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
}

/* ─── Top bar ──────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid rgba(232, 221, 176, 0.08);
  background: linear-gradient(180deg, rgba(10, 31, 26, 0.6) 0%, rgba(10, 31, 26, 0) 100%);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 0 12px rgba(201, 169, 77, 0.3)); }
.brand-name {
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  color: #faf8f3;
}
.brand-sub {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--rm-gold-400); font-weight: 600;
}
.topbar-center { text-align: center; }
.eyebrow.gold { color: var(--rm-gold-400); font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; }
.eyebrow-xs { color: var(--rm-gold-500); font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; display: block; margin-bottom: 4px; opacity: 0.85; }
.topbar-right { display: flex; justify-content: flex-end; gap: 10px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(232, 221, 176, 0.18);
  background: rgba(255,255,255,0.03);
  color: #faf8f3; font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  cursor: pointer;
  transition: all .3s var(--ease-out);
}
.ghost-btn:hover { border-color: rgba(232, 201, 122, 0.5); background: rgba(201, 169, 77, 0.08); }

/* ─── Stage body ────────────────────────────────────────── */
.stage-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.left-pane, .right-pane {
  padding: 20px 20px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,169,77,0.2) transparent;
}
.left-pane::-webkit-scrollbar, .right-pane::-webkit-scrollbar { width: 4px; }
.left-pane::-webkit-scrollbar-thumb, .right-pane::-webkit-scrollbar-thumb { background: rgba(201,169,77,0.2); }

/* ─── Globe area ────────────────────────────────────────── */
.globe-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.globe-mount {
  position: absolute;
  inset: 0;
}
.globe-mount canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ring-ornament {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, var(--rm-gold-500), transparent);
  pointer-events: none;
}
.ring-ornament.top { top: 24px; }
.ring-ornament.bottom { bottom: 24px; }

.hint.drag-hint {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(250, 248, 243, 0.38);
  pointer-events: none;
  font-weight: 500;
}

/* ─── Era panel (left) ──────────────────────────────────── */
.era-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.015) 100%);
  border: 1px solid rgba(232, 221, 176, 0.08);
  border-radius: 16px;
  padding: 22px 20px;
  backdrop-filter: blur(12px);
}
.era-head .era-title {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
  margin-top: 6px; color: #faf8f3;
}
.era-head .era-en {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--rm-gold-400); margin-top: 6px; font-weight: 500;
}
.era-year { margin: 10px 0 20px; }
.era-year-big { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.era-year-ko { font-size: 12px; color: rgba(250,248,243,0.55); margin-top: 4px; letter-spacing: 0.02em; }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
.stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(232, 221, 176, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--rm-gold-400); letter-spacing: -0.02em; line-height: 1; }
.stat-lab { font-size: 10.5px; color: rgba(250,248,243,0.55); margin-top: 6px; letter-spacing: 0.04em; line-height: 1.3; }

.climate-card, .event-card, .empire-hover {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(232, 221, 176, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.climate-name { font-size: 15px; font-weight: 600; color: #faf8f3; }
.climate-en { font-size: 11px; color: rgba(250,248,243,0.5); letter-spacing: 0.05em; margin-top: 2px; }
.climate-bar {
  height: 3px; background: rgba(255,255,255,0.05); border-radius: 999px;
  margin-top: 10px; overflow: hidden;
}
.climate-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rm-gold-600), #e86b3a);
  transition: width 0.8s var(--ease-out);
}
.climate-hint { font-size: 11.5px; color: rgba(250,248,243,0.6); margin-top: 10px; line-height: 1.5; }

.event-title { font-size: 15px; font-weight: 600; color: #faf8f3; }
.event-en { font-size: 11px; color: rgba(250,248,243,0.5); margin-top: 2px; }

.empire-name { font-size: 16px; font-weight: 700; color: var(--rm-gold-400); letter-spacing: -0.01em; }
.empire-en { font-size: 11.5px; color: rgba(250,248,243,0.55); margin-top: 2px; letter-spacing: 0.02em; }
.empire-dates { font-size: 11px; color: rgba(250,248,243,0.4); margin-top: 8px; }

/* ─── Right pane cards ──────────────────────────────────── */
.side-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.015) 100%);
  border: 1px solid rgba(232, 221, 176, 0.08);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(12px);
}
.side-list { margin-top: 10px; }

.empire-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; background: none; border: none;
  padding: 10px 6px; border-radius: 8px;
  cursor: pointer; text-align: left;
  color: inherit;
  transition: background .2s;
}
.empire-row:hover { background: rgba(201, 169, 77, 0.06); }
.empire-dot {
  width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}
.empire-info { flex: 1; min-width: 0; }
.empire-name-row { font-size: 13px; font-weight: 600; color: #faf8f3; }
.empire-life {
  height: 2px; background: rgba(255,255,255,0.06); border-radius: 999px;
  margin: 6px 0 4px; overflow: hidden;
}
.empire-life-bar {
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--rm-gold-500), transparent);
  transition: width 0.4s ease;
}
.empire-dates-row { font-size: 10.5px; color: rgba(250,248,243,0.4); letter-spacing: 0.03em; }

.city-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 4px;
}
.city-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--rm-gold-400);
  box-shadow: 0 0 8px var(--rm-gold-500);
  margin-top: 6px; flex-shrink: 0;
}
.city-name { font-size: 13px; font-weight: 500; color: #faf8f3; }
.city-name .dim { color: rgba(250,248,243,0.4); font-weight: 400; }
.city-founded { font-size: 10.5px; color: rgba(250,248,243,0.45); margin-top: 2px; }

.empty-note { font-size: 12px; color: rgba(250,248,243,0.4); padding: 10px 6px; font-style: italic; }

/* ─── Bottom bar ────────────────────────────────────────── */
.bottombar {
  position: relative;
  z-index: 2;
  padding: 10px 24px 18px;
  background: linear-gradient(0deg, rgba(10, 31, 26, 0.7) 0%, rgba(10, 31, 26, 0) 100%);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(232, 221, 176, 0.06);
}

/* chapter strip */
.chapter-strip {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
  scrollbar-width: none;
}
.chapter-strip::-webkit-scrollbar { display: none; }
.chapter-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(232, 221, 176, 0.08);
  color: #faf8f3;
  cursor: pointer;
  white-space: nowrap;
  min-width: 108px;
  transition: all .3s var(--ease-out);
}
.chapter-btn:hover { border-color: rgba(232, 201, 122, 0.5); background: rgba(201, 169, 77, 0.07); }
.chapter-btn.on {
  background: linear-gradient(180deg, rgba(201, 169, 77, 0.18), rgba(201, 169, 77, 0.06));
  border-color: rgba(232, 201, 122, 0.65);
}
.chapter-btn-year { font-size: 10px; letter-spacing: 0.12em; color: var(--rm-gold-400); font-weight: 600; text-transform: uppercase; }
.chapter-btn-name { font-size: 13px; font-weight: 600; margin-top: 2px; }

/* timeline */
.timeline { position: relative; padding: 10px 0 22px; }
.timeline-track {
  position: relative;
  height: 44px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0.03) 100%);
  border-top: 1px solid rgba(232, 221, 176, 0.08);
  border-bottom: 1px solid rgba(232, 221, 176, 0.08);
  cursor: pointer;
}
.climate-band { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.tick {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid rgba(232, 221, 176, 0.06);
  pointer-events: none;
}
.tick span {
  position: absolute; bottom: -18px; left: 3px;
  font-size: 9.5px; letter-spacing: 0.08em;
  color: rgba(250,248,243,0.4);
}
.chapter-flag {
  position: absolute;
  top: -8px; bottom: 0;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; pointer-events: auto;
}
.chapter-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--rm-gold-500);
  box-shadow: 0 0 8px var(--rm-gold-500);
}
.chapter-label {
  position: absolute; top: -22px;
  font-size: 9.5px; color: var(--rm-gold-400);
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0; transition: opacity .2s;
}
.chapter-flag:hover .chapter-label { opacity: 1; }

.timeline-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, rgba(201,169,77,0.02) 0%, rgba(201,169,77,0.22) 100%);
  pointer-events: none;
  border-right: 1px solid rgba(232, 201, 122, 0.4);
}

.timeline-head {
  position: absolute; top: -18px;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center;
}
.timeline-year {
  font-size: 11px; font-weight: 600; color: var(--rm-gold-300);
  letter-spacing: 0.1em;
  background: rgba(10, 31, 26, 0.88);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 201, 122, 0.3);
  white-space: nowrap;
}
.timeline-stem {
  width: 1px;
  height: 10px;
  background: var(--rm-gold-500);
}
.timeline-knob {
  width: 14px; height: 14px; border-radius: 999px;
  background: var(--rm-gold-400);
  border: 2px solid #0f2e25;
  box-shadow: 0 0 18px rgba(232, 201, 122, 0.8);
  margin-top: -2px;
}
.timeline-knob.pulsing { animation: knob-pulse 1.4s ease-in-out infinite; }
@keyframes knob-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(232, 201, 122, 0.6); }
  50%      { box-shadow: 0 0 22px rgba(232, 201, 122, 1); }
}

/* play controls */
.play-controls {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.play-btn {
  width: 42px; height: 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--rm-gold-500), var(--rm-gold-700));
  border: 1px solid rgba(255,255,255,0.12);
  color: #0f2e25;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(201, 169, 77, 0.4);
  transition: transform .15s;
}
.play-btn:hover { transform: translateY(-1px); }
.play-btn:active { transform: translateY(0); }

.mini-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232, 221, 176, 0.12);
  color: #faf8f3;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.mini-btn:hover { border-color: var(--rm-gold-500); color: var(--rm-gold-300); }

.sep { width: 1px; height: 22px; background: rgba(232, 221, 176, 0.1); margin: 0 4px; }

.speed-group { display: flex; align-items: center; gap: 6px; }
.speed-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(232, 221, 176, 0.1);
  color: #faf8f3;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.speed-chip .dim { color: rgba(250,248,243,0.4); font-weight: 400; font-size: 10.5px; margin-left: 3px; }
.speed-chip:hover { border-color: rgba(232, 201, 122, 0.5); }
.speed-chip.on {
  background: rgba(201, 169, 77, 0.18);
  border-color: var(--rm-gold-500);
  color: var(--rm-gold-300);
}

/* ─── Tweaks panel ──────────────────────────────────────── */
.tweaks-panel {
  position: fixed;
  bottom: 130px; right: 20px;
  width: 320px;
  background: rgba(10, 31, 26, 0.92);
  border: 1px solid rgba(232, 201, 122, 0.25);
  border-radius: 16px;
  padding: 18px 18px 20px;
  z-index: 20;
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 80px -16px rgba(0,0,0,0.55), 0 0 1px rgba(232, 201, 122, 0.2);
  animation: tweak-in 0.4s var(--ease-out);
}
@keyframes tweak-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tweaks-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tweaks-close {
  background: none; border: none; color: rgba(250,248,243,0.5);
  cursor: pointer; font-size: 14px; padding: 4px 8px;
}
.tweaks-close:hover { color: var(--rm-gold-400); }

.tweak-row { margin-bottom: 16px; }
.tweak-row:last-child { margin-bottom: 0; }
.tweak-row label {
  display: block;
  font-size: 11.5px; letter-spacing: 0.04em;
  color: rgba(250,248,243,0.8);
  margin-bottom: 8px;
  font-weight: 500;
}
.tweak-row label .dim { color: rgba(250,248,243,0.4); font-weight: 400; font-size: 11px; margin-left: 6px; }

.tweak-row input[type="range"] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  outline: none;
}
.tweak-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--rm-gold-400);
  border: 2px solid #0f2e25;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(232, 201, 122, 0.5);
}
.tweak-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--rm-gold-400);
  border: 2px solid #0f2e25;
  cursor: pointer;
}

.palette-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette-swatch {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(232, 221, 176, 0.1);
  border-radius: 10px;
  color: #faf8f3;
  cursor: pointer;
  font-size: 11.5px;
  transition: all .2s;
}
.palette-swatch:hover { border-color: rgba(232, 201, 122, 0.5); }
.palette-swatch.on { border-color: var(--rm-gold-500); background: rgba(201, 169, 77, 0.12); }
.palette-swatch .sw { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.palette-swatch .palette-name { margin-left: 4px; font-weight: 500; }

.toggle-row { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232, 221, 176, 0.1);
  color: rgba(250,248,243,0.7);
  font-size: 11.5px; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.toggle-chip.on {
  background: rgba(201, 169, 77, 0.18);
  border-color: var(--rm-gold-500);
  color: var(--rm-gold-300);
}

/* ─── responsive clamp for narrow screens ───────────────── */
@media (max-width: 1100px) {
  .stage-body { grid-template-columns: 260px 1fr 260px; }
}
@media (max-width: 860px) {
  .stage-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; }
  .left-pane, .right-pane { display: none; }
}

.gold-shimmer {
  background: linear-gradient(90deg,
    var(--rm-gold-600) 0%, var(--rm-gold-300) 40%, #f5e4a8 50%, var(--rm-gold-300) 60%, var(--rm-gold-600) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.premium-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rm-gold-500) 30%, var(--rm-gold-300) 50%, var(--rm-gold-500) 70%, transparent);
  opacity: 0.5;
}
