/* Seismic Earth: deep-space navy with warm seismic accents.
   Built by Dr. Safeer Ali Mirani · safeer.ali.mirani@gmail.com */
:root {
  --ink: #05070e;
  --gold: #B08D57;
  --gold-2: #e0b872;
  --hot: #ff7a4d;
  --text: #e9edf6;
  --muted: #9aa8c6;
  --panel: rgba(10, 15, 28, 0.74);
  --border: rgba(176, 141, 87, 0.30);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font); color: var(--text);
  background: radial-gradient(1200px 900px at 60% 15%, #0b1428 0%, var(--ink) 62%);
}
#gpu { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; touch-action: none; }
#gpu:active { cursor: grabbing; }

/* City labels overlay */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.city-label {
  position: absolute; left: 0; top: 0;
  font: 11px/1.2 "Inter", "Segoe UI", system-ui, sans-serif;
  color: rgba(232, 237, 247, 0.86);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap; transform-origin: center; will-change: transform;
  margin: -7px 0 0 -2px;
}
.city-label .dot {
  display: inline-block; width: 3px; height: 3px; border-radius: 50%;
  background: var(--gold-2); margin-right: 4px; vertical-align: middle;
  box-shadow: 0 0 4px rgba(224, 184, 114, 0.8);
}

/* HUD */
#hud { position: fixed; top: 18px; left: 20px; z-index: 6; display: flex; flex-direction: column; gap: 14px; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; line-height: 1; color: var(--hot); filter: drop-shadow(0 0 12px rgba(255, 122, 77, 0.6)); }
.title { font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.subtitle { font-size: 11px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.stats { display: flex; gap: 18px; }
.stats dt { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stats dd { font-size: 18px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; }

/* Panel */
#panel {
  position: fixed; top: 18px; right: 18px; z-index: 6; width: 262px;
  max-height: calc(100vh - 36px); overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 16px;
}
#panel section { padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
#panel section:first-child { padding-top: 2px; border-top: none; }
#panel h2 {
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.9px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between;
}
.val { color: var(--gold-2); font-weight: 700; text-transform: none; letter-spacing: 0; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }

select, #source, #speed, #search {
  width: 100%; padding: 8px 10px; border-radius: 9px; background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border); color: var(--text); font-size: 12.5px; font-family: var(--font);
}
#speed { width: auto; flex: none; }
#search::placeholder { color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--hot); }

button.ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; transition: transform 0.08s, color 0.15s, border-color 0.15s;
}
button.ghost:hover { color: var(--text); border-color: var(--gold-2); }
button.ghost:active { transform: scale(0.97); border-color: var(--hot); color: var(--text); }
button.ghost.tiny { padding: 2px 8px; font-size: 10px; }
#load { width: 100%; margin-top: 8px; }
#play { flex: 1; }

/* Developer credit at the foot of the control panel */
.panel-credit {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10.5px; color: var(--muted); line-height: 1.6; text-align: center;
}
.panel-credit b { color: var(--gold-2); font-weight: 600; }
.panel-credit a { color: var(--gold-2); text-decoration: none; }
.panel-credit a:hover { text-decoration: underline; }

/* Focus: keyboard-only, matches the gold accent */
select:focus, #search:focus { outline: none; border-color: var(--gold-2); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; border-radius: 6px; }
button.ghost:focus-visible { outline-offset: 3px; }
input[type="range"]:focus-visible { outline-offset: 4px; }
a:focus-visible { outline-offset: 3px; border-radius: 3px; }
button:focus:not(:focus-visible), select:focus:not(:focus-visible), input:focus:not(:focus-visible) { outline: none; }

/* Keyboard shortcut chips */
kbd {
  display: inline-block; min-width: 20px; padding: 2px 7px; margin-right: 6px;
  font: 600 11px/1.4 var(--font); color: var(--gold-2); text-align: center;
  background: rgba(224, 184, 114, 0.1); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px;
}

/* Depth legend */
.legend-bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #ff5933 0%, #ffd933 33%, #4de68c 66%, #598cff 100%); }
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 3px; }
.legend-note { font-size: 10.5px; color: var(--muted); margin-top: 7px; font-style: italic; }

/* Pick */
#pick .pick-place { font-size: 14px; font-weight: 600; color: var(--text); }
#pick .pick-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
#pick .pick-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--gold-2); text-decoration: none; }
#pick .pick-link:hover { text-decoration: underline; }

/* Hint */
#hint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 6; font-size: 12px;
  color: var(--muted); background: rgba(5, 7, 14, 0.5); padding: 7px 16px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06); backdrop-filter: blur(8px); pointer-events: none; max-width: 92vw; text-align: center;
}
#hint span { color: var(--gold-2); font-weight: 600; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px;
  background: radial-gradient(800px 600px at 50% 40%, rgba(14, 24, 46, 0.55), rgba(5, 7, 14, 0.92));
}
.overlay.hidden, .hidden { display: none !important; }
#loading-text { color: var(--muted); font-size: 14px; letter-spacing: 0.3px; max-width: 360px; text-align: center; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 122, 77, 0.2); border-top-color: var(--hot); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nogpu-card { max-width: 420px; text-align: center; padding: 34px 30px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; }
.nogpu-card h1 { color: var(--gold-2); font-size: 22px; margin-bottom: 12px; }
.nogpu-card p { color: var(--text); font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.nogpu-card .muted { color: var(--muted); font-size: 12.5px; }

/* About / data-provenance + shortcuts cards */
#about, #shortcuts { z-index: 25; }
.about-card {
  max-width: 460px; max-height: 82vh; overflow-y: auto; text-align: left;
  padding: 24px 26px; background: rgba(10, 15, 28, 0.94); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 11px;
}
.about-card #about-close, .about-card > button.ghost.tiny { align-self: flex-end; margin-bottom: 2px; }
.about-card h1 { color: var(--gold-2); font-size: 19px; }
.about-card p { color: var(--text); font-size: 13px; line-height: 1.55; }
.about-card p.muted { color: var(--muted); font-size: 11.5px; }
.about-card b { color: var(--gold-2); font-weight: 600; }
.about-credit { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.7; display: flex; flex-direction: column; gap: 4px; }
.about-credit b { color: var(--gold-2); }
.about-credit a { color: var(--gold-2); text-decoration: none; }
.about-credit a:hover { text-decoration: underline; }

/* First-load onboarding toast */
#onboard { background: none; pointer-events: none; align-items: flex-end; justify-content: center; padding-bottom: 66px; }
#onboard-card {
  pointer-events: auto; max-width: 460px; text-align: center; font-size: 12.5px; color: var(--text);
  background: rgba(10, 15, 28, 0.9); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 18px; box-shadow: var(--shadow);
  animation: onboard-in 0.4s ease-out, onboard-out 0.5s ease-in 6.5s forwards;
}
#onboard-card b { color: var(--gold-2); }
@keyframes onboard-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes onboard-out { to { opacity: 0; visibility: hidden; } }

#panel::-webkit-scrollbar { width: 7px; }
#panel::-webkit-scrollbar-thumb { background: rgba(176, 141, 87, 0.3); border-radius: 4px; }
@media (max-width: 640px) {
  #panel { width: 210px; max-height: 56vh; }
  .stats dd { font-size: 15px; }
  #hint { font-size: 11px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  #onboard-card { animation: none; }
  button.ghost { transition: none; }
}

/* loading overlay stays see-through so the globe shows while quakes stream in */
#loading { background: rgba(5, 7, 14, 0.42); pointer-events: none; }
