*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: rgba(16, 20, 28, 0.90);
  --ink-muted: rgba(24, 30, 42, 0.52);
  --border: rgba(16, 20, 28, 0.14);
  --pill-bg: rgba(255, 255, 255, 0.58);
  --pill-hover: rgba(255, 255, 255, 0.88);
  --pill-active-bg: rgba(16, 20, 28, 0.90);
  --pill-active-ink: #f8fafd;
}

body.theme-dark {
  --ink: rgba(242, 246, 255, 0.94);
  --ink-muted: rgba(214, 224, 242, 0.58);
  --border: rgba(255, 255, 255, 0.16);
  --pill-bg: rgba(16, 20, 30, 0.50);
  --pill-hover: rgba(34, 42, 60, 0.78);
  --pill-active-bg: rgba(244, 248, 255, 0.94);
  --pill-active-ink: #0b0e16;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

.mono-label {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* =========================================================
   Apple iOS / macOS System-Update White Progress Preloader
   ========================================================= */
#apple-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.85s ease;
}

#apple-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.apple-bar-track {
  width: min(224px, 54vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.apple-bar-fill {
  width: 8%;
  height: 100%;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
  transition: width 0.28s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: width;
}

/* =========================================================
   WebGL Fullscreen Canvas
   ========================================================= */
#webgl-root {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#webgl-root canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* =========================================================
   Minimal Apple / Lusion HUD Framing
   ========================================================= */
.hud-top {
  position: fixed;
  top: 24px;
  left: 30px;
  right: 30px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  color: var(--ink);
  transition: color 0.65s ease;
}

.hud-brand {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px 0;
  opacity: 0.92;
  transition: opacity 0.25s ease;
}

.hud-brand:hover {
  opacity: 1;
}

.g-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.g-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.dot-b { background: #4285f4; }
.dot-r { background: #ea4335; }
.dot-y { background: #fbbc05; }
.dot-g { background: #34a853; }

.hud-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
}

.hud-meta .sep {
  opacity: 0.4;
}

/* Bottom-Left Minimal Editorial Title */
.hud-caption {
  position: fixed;
  left: 30px;
  bottom: 28px;
  z-index: 20;
  max-width: 340px;
  pointer-events: none;
  color: var(--ink);
  transition: color 0.65s ease;
}

.caption-title {
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 300;
  letter-spacing: 0.20em;
  margin-bottom: 6px;
}

.caption-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Bottom-Center Glass Mode Dock */
.mode-dock {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-pill {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.35s ease,
              border-color 0.35s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-pill:hover {
  background: var(--pill-hover);
  transform: translateY(-1px);
}

.dock-pill.is-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-ink);
  border-color: transparent;
}

.hud-whisper {
  position: fixed;
  right: 30px;
  bottom: 32px;
  z-index: 20;
  color: var(--ink-muted);
  pointer-events: none;
  transition: color 0.65s ease;
}

@media (max-width: 960px) {
  .hud-caption {
    bottom: 84px;
    left: 20px;
    right: 20px;
    max-width: none;
  }

  .hud-whisper {
    display: none;
  }
}

@media (max-width: 640px) {
  .hud-top {
    top: 16px;
    left: 16px;
    right: 16px;
  }

  .mode-dock {
    bottom: 16px;
    width: calc(100vw - 24px);
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .dock-pill {
    padding: 7px 11px;
    font-size: 9.5px;
  }
}
