:root {
  --bg: #05060f;
  --panel: rgba(14, 26, 36, 0.72);
  --panel-solid: #0c1620;
  --ink: #e6f3ff;
  --ink-dim: #8fb0c4;
  --accent: #3fd6a8;
  --accent-2: #4fc3ff;
  --hot: #ff5fa2;
  --line: rgba(255, 255, 255, 0.12);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  /* chip "well" background for HUD pills / segments / icon buttons. Stronger in
     dark (sits on a translucent panel over a near-black canvas) and barely-there
     in light so chips stay legible on the bright panel without going muddy. */
  --chip-bg: rgba(0, 0, 0, 0.25);
  /* Text/icon color that sits ON the accent gradient (buttons, active segments).
     Dark in both themes — the accent is a bright mint that needs dark ink on top
     for contrast in both light and dark modes. */
  --on-accent: #04141a;
}
/* ===== 3-way theme (Light/Dark/System) — base :root above = native DARK. Opposite (light) WCAG-aware auto-generated (contrast-solving ink/accent vs worst-case surface). ===== */
:root[data-theme="light"]{
  --bg: #f4f4f6;
  --panel: #f6f7f8;
  --panel-solid: #f5f6f7;
  --ink: #00519c;
  --ink-dim: #49728b;
  --accent: #1a7a5d;
  --accent-2: #0071ac;
  --hot: #d50059;
  --line: rgba(0,0,0,0.10);
  --chip-bg: #6c6c6c;
  --on-accent: #ffffff;
}












* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; }

.app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }

.hidden { display: none !important; }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
.loading { flex-direction: column; gap: 14px; color: var(--ink-dim); font-size: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* topbar + language switcher */
.topbar { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 8; }
.topbar [data-i18n-switcher] select,
.topbar select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: 12px; backdrop-filter: blur(8px); }

/* title card */
.title-card { text-align: center; padding: 36px 30px; max-width: 460px; }
.logo { font-family: "Orbitron", "Noto Sans KR", sans-serif; font-weight: 800; font-size: clamp(40px, 12vw, 76px);
  margin: 0 0 6px; letter-spacing: 2px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--ink-dim); margin: 0 0 26px; font-size: 15px; }
.hint { color: var(--ink-dim); margin: 18px 0 0; font-size: 12.5px; opacity: 0.85; }

.btn { font: inherit; font-weight: 700; border: none; border-radius: 999px; padding: 13px 26px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn-primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: 0 8px 24px rgba(63, 214, 168, 0.35); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }

/* controls (HUD) */
.controls { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom)); z-index: 8; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; backdrop-filter: blur(10px); box-shadow: var(--shadow); max-width: calc(100vw - 16px); }
.ctl-group { display: flex; align-items: center; gap: 8px; }
.ctl-group + .ctl-group { border-left: 1px solid var(--line); padding-left: 10px; }
.ctl-label { font-size: 11px; color: var(--ink-dim); padding: 0 2px; white-space: nowrap; }
.seg { display: inline-flex; background: var(--chip-bg); border-radius: 999px; padding: 3px; }
.seg-btn { font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-dim); background: transparent; border: none;
  border-radius: 999px; padding: 6px 11px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.seg-btn.is-on { background: var(--accent); color: var(--on-accent); }
.icon-btn { font-size: 15px; line-height: 1; color: var(--ink); background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: color-mix(in oklab, var(--accent) 18%, transparent); }
.icon-btn.is-on { background: var(--accent); color: var(--on-accent); }

/* HUD pill (point count) */
.hud-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--chip-bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.hud-ic { color: var(--accent); font-size: 12px; }

/* V2: TIME/EPOCH slider group */
.ctl-epoch { gap: 7px; }
.epoch-slider { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 999px;
  background: var(--line); outline: none; cursor: pointer; }
.epoch-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--panel-solid); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.epoch-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--panel-solid); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.epoch-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.epoch-year { min-width: 40px; justify-content: center; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .epoch-slider::-webkit-slider-thumb { box-shadow: none; } }

/* tooltip */
.tooltip { position: absolute; z-index: 12; width: min(230px, calc(100vw - 16px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  backdrop-filter: blur(12px); box-shadow: var(--shadow); pointer-events: none; transition: opacity .1s; }
.tt-name { font-family: "Orbitron", "Noto Sans KR", sans-serif; font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.tt-grid { display: grid; gap: 6px; margin: 0; }
.tt-grid > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.tt-grid dt { color: var(--ink-dim); margin: 0; }
.tt-grid dd { margin: 0; color: var(--ink); font-weight: 600; }
.tt-grid small { color: var(--ink-dim); font-weight: 500; }

.foot { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(70px, calc(env(safe-area-inset-bottom) + 64px));
  z-index: 4; margin: 0; font-size: 11px; color: var(--ink-dim); opacity: 0.7; text-align: center; pointer-events: none; white-space: nowrap; max-width: 92vw; }

/* V3 toast (share/screenshot feedback) */
.toast { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 88px)); z-index: 14;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font-size: 12.5px; font-weight: 600; color: var(--ink);
  backdrop-filter: blur(12px); box-shadow: var(--shadow); pointer-events: none;
  max-width: calc(100vw - 24px); text-align: center; transition: opacity .18s, transform .18s; opacity: 1; }
.toast.is-error { border-color: var(--hot); color: var(--hot); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

@media (max-width: 540px) {
  .foot { display: none; }
  .ctl-label { display: none; }
  .controls { gap: 6px; padding: 6px 8px;
    /* Reserve a right gutter for the GitHub Sponsors .pmp-fab (fixed, ~34px tall,
       bottom-right, z-index ~2147483000, ALWAYS present). Shift the HUD's center
       left by half the FAB gutter and clamp its width so the HUD never reaches the
       FAB band on narrow screens. */
    left: calc(50% - 28px); max-width: calc(100vw - 56px); }
  .seg-btn { padding: 6px 8px; }
  .epoch-slider { width: 80px; }
}
@media (prefers-reduced-motion: reduce) { .spinner, .btn-primary { animation: none; transition: none; } }
