/* ============================================================
   GeoTiBle — estilos (HUD sobre globo 3D a pantalla completa)
   ============================================================ */
:root {
  --bg:        #05070f;
  --ink:       #e8ecf6;
  --muted:     #94a0b8;
  --line:      rgba(255,255,255,.10);
  --glass:     rgba(12,17,30,.62);
  --glass-2:   rgba(12,17,30,.82);
  --accent:    #7c9cff;
  --accent-2:  #a78bfa;
  --radius:    16px;
  --shadow:    0 18px 48px rgba(0,0,0,.5);
  --font:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

.globe {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* HUD glass shell ------------------------------------------------ */
.hud {
  position: fixed;
  z-index: 5;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow);
}

/* Top bar -------------------------------------------------------- */
.hud-top {
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-weight: 800; font-size: 14px; letter-spacing: .5px;
  color: #0a0f1c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(124,156,255,.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }

.eras { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.era-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--ink);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease, background .15s ease;
  user-select: none;
}
.era-chip:hover { transform: translateY(-1px); background: rgba(255,255,255,.07); }
.era-chip .swatch { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.era-chip.off { opacity: .38; }
.era-chip.off .swatch { box-shadow: none; }

/* Info panel ----------------------------------------------------- */
.panel {
  bottom: 108px;
  left: 16px;
  width: min(340px, calc(100vw - 32px));
  padding: 18px 20px;
  border-radius: var(--radius);
}
.panel-era {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.panel-title { margin: 6px 0 8px; font-size: 22px; line-height: 1.15; }
.panel-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.panel-meta .dot-sep { opacity: .5; }
.panel-desc { margin: 0; font-size: 14px; line-height: 1.55; color: #cdd6ea; }
.panel-ref { display: inline-block; margin-top: 12px; font-size: 12px; color: var(--muted); }
.panel-ref:not(:empty)::before { content: '📖 '; }
.panel-link { display: block; margin-top: 12px; font-size: 12px; color: var(--accent); text-decoration: none; }
.panel-link:hover, .panel-link:focus-visible { text-decoration: underline; }

/* Timeline ------------------------------------------------------- */
.timeline {
  bottom: 16px; left: 16px; right: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--glass-2);
}
.timeline-row { display: flex; align-items: center; gap: 16px; }

.tl-btn {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0f1c; cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.tl-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.tl-btn.ghost { background: rgba(255,255,255,.04); color: var(--ink); }
.tl-btn .ic-pause { display: none; }
body.playing .tl-btn .ic-play { display: none; }
body.playing .tl-btn .ic-pause { display: block; }

.tl-track { position: relative; flex: 1; }
.tl-ticks {
  position: absolute; left: 0; right: 0; top: 24px;
  height: 12px; pointer-events: none;
}
.tl-ticks span {
  position: absolute; transform: translateX(-50%);
  font-size: 10px; color: var(--muted); white-space: nowrap;
}
.tl-ticks span::before {
  content: ''; position: absolute; top: -8px; left: 50%;
  width: 1px; height: 5px; background: var(--line);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill,0%), rgba(255,255,255,.12) var(--fill,0%));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(124,156,255,.7); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); cursor: pointer;
}

.tl-readout { flex: none; text-align: right; min-width: 96px; }
.tl-year { display: block; font-size: 18px; font-weight: 800; letter-spacing: .3px; }
.tl-count { display: block; font-size: 11.5px; color: var(--muted); }

/* Fallback ------------------------------------------------------- */
.fallback {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(5,7,15,.92); padding: 24px;
}
.fallback p { max-width: 460px; text-align: center; color: var(--muted); line-height: 1.6; }
.fallback code { color: var(--accent); }
.hidden { display: none !important; }

/* Responsive ----------------------------------------------------- */
@media (max-width: 640px) {
  .hud-top { gap: 10px; padding: 10px 12px; }
  .brand-sub { display: none; }
  .panel { bottom: 128px; }
  .timeline-row { gap: 10px; flex-wrap: wrap; }
  .tl-track { order: 3; flex-basis: 100%; }
  .tl-ticks { display: none; }
}
