/* ==========================================================================
   GSTime: Layered Optical Design System
   Atmospheric Horizon, Floating Daylight Surfaces, Hue-Shifted Chromatics
   ========================================================================== */

:root {
  /* Light Mode Canvas & Floating Daylight Surfaces */
  --bg-page: #F6F5FA;
  --bg-surface: #FFFFFF;
  --bg-surface-glass: rgba(255, 255, 255, 0.84);
  --bg-subtle: #F0EFF7;
  --ink-primary: #151B28;
  --ink-secondary: #4D596C;
  --ink-tertiary: #6C788C;
  --border-hairline: rgba(21, 27, 40, 0.08);
  --border-strong: rgba(28, 117, 246, 0.28);
  --rim-top: rgba(255, 255, 255, 0.94);
  --pill-rim-bottom: rgba(166, 200, 255, 0.58);

  /* Hue-Shifted 5-Stop Chromatic Palette */
  --blue-core: #1C75F6;
  --blue-bright: #3B82F6;
  --blue-periwinkle: #8F96FF;
  --periwinkle-bright: #98A0FF;
  --sky-bloom: #6DA6FF;
  --sky-airy: #A6C8FF;
  --cyan-electric: #38D4FF;
  --mint-luminous: #5CECC6;
  --emerald-core: #18D66C;
  --coral-core: #FF4F5E;
  --pink-bloom: #FF7FA8;
  --pink-soft: #F8C8EB;
  --lavender-soft: #E6D4FF;
  --periwinkle-halo: #C7D4FF;
  --amber-core: #FF9F1C;
  --yellow-incandescent: #FFE156;
  --pink-core: #FFB3D9;
  --spark-violet: #7B6CFF;

  /* 5 Hue-Shifted Spectrum Gradients */
  --spec-blue: linear-gradient(135deg, #1C75F6 0%, #8F96FF 100%);
  --spec-coral: linear-gradient(135deg, #FF4F5E 0%, #FF7FA8 100%);
  --spec-amber: linear-gradient(135deg, #FF9F1C 0%, #FFE156 54%, #FFB3D9 100%);
  --spec-emerald: linear-gradient(135deg, #18D66C 0%, #5CECC6 54%, #38D4FF 100%);
  --spec-periwinkle: linear-gradient(135deg, #8F96FF 0%, #7B6CFF 45%, #6DA6FF 78%, #A6C8FF 100%);

  /* Semantic Status Spectrums */
  --spec-syncing: linear-gradient(90deg, #1C75F6 0%, #8F96FF 28%, #6DA6FF 54%, #F8C8EB 80%, #FF7FA8 100%);
  --spec-synced: linear-gradient(90deg, #1C75F6 0%, #8F96FF 30%, #6DA6FF 54%, #5CECC6 80%, #18D66C 100%);
  --spec-holdover: linear-gradient(90deg, #FF9F1C 0%, #FFE156 52%, #FFB3D9 100%);
  --spec-desync: linear-gradient(90deg, #FF4F5E 0%, #FF7FA8 56%, #F8C8EB 100%);

  /* Theme-aware SVG Accent Variables */
  --svg-blue: #1C75F6;
  --svg-violet: #7B6CFF;
  --svg-emerald: #00B84F;
  --svg-amber: #E58600;
  --svg-red: #E03131;

  /* Active State Energy Tokens (default: syncing) */
  --aura-a: rgba(199, 212, 255, 0.52);
  --aura-b: rgba(230, 212, 255, 0.48);
  --aura-c: rgba(248, 200, 235, 0.44);
  --horizon-top: rgba(199, 212, 255, 0.42);
  --horizon-rim: rgba(143, 150, 255, 0.52);
  --horizon-mid: rgba(230, 212, 255, 0.42);
  --horizon-glow: rgba(248, 200, 235, 0.36);
  --underglow-a: rgba(199, 212, 255, 0.56);
  --underglow-b: rgba(248, 200, 235, 0.48);
  --active-spectrum: var(--spec-syncing);
  --status-color: #1C75F6;

  /* Multi-Layered Floating Halo Tokens (rendered on outer wrappers so clip-path never clips glow) */
  --surface-halo-a: rgba(143, 150, 255, 0.22);
  --surface-halo-b: rgba(248, 200, 235, 0.28);
  --surface-halo-hover-a: rgba(28, 117, 246, 0.24);
  --surface-halo-hover-b: rgba(230, 212, 255, 0.38);
  --pill-halo: rgba(28, 117, 246, 0.42);
  --pill-halo-hover: rgba(28, 117, 246, 0.54);
  --shadow-pill-primary:
    0 8px 22px -4px rgba(28, 117, 246, 0.46),
    0 2px 6px -1px rgba(28, 117, 246, 0.26);

  /* Typography: IBM Plex Sans & IBM Plex Mono */
  --font-sans: "IBM Plex Sans", system-ui, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --text-heading: clamp(1.375rem, 2.2vw, 1.75rem);
  --text-body: 0.9375rem;   /* 15px */
  --text-sm: 0.8125rem;     /* 13px */

  /* Unified Continuous Contours */
  --radius-stage: 32px;
  --radius-surface: 28px;
  --radius-pill: 999px;
  --radius-input: 16px;

  /* Damped Harmonic Oscillator Spring Curves */
  --ease-snap: linear(0.0000, 0.0586, 0.1884, 0.3413, 0.4900, 0.6207, 0.7283, 0.8126, 0.8758, 0.9214, 0.9531, 0.9742, 0.9875, 0.9955, 0.9999, 1.0018, 1.0024, 1.0021, 1.0015, 1.0008, 1.0000);
  --ease-float: linear(0.0000, 0.0557, 0.1769, 0.3184, 0.4556, 0.5771, 0.6789, 0.7609, 0.8249, 0.8739, 0.9105, 0.9375, 0.9571, 0.9711, 0.9809, 0.9878, 0.9925, 0.9956, 0.9977, 0.9991, 1.0000);
}

/* Dark Mode: Deep Cosmic Navy Horizon & Translucent Obsidian Glass */
html[data-theme="dark"] {
  --bg-page: #070C1B;
  --bg-surface: rgba(15, 23, 46, 0.80);
  --bg-surface-glass: rgba(13, 21, 44, 0.74);
  --bg-subtle: rgba(26, 38, 72, 0.74);
  --ink-primary: #F2F5FC;
  --ink-secondary: #A6B4CC;
  --ink-tertiary: #7E8EA8;
  --border-hairline: rgba(166, 200, 255, 0.14);
  --border-strong: rgba(143, 150, 255, 0.38);
  --rim-top: rgba(199, 212, 255, 0.22);
  --pill-rim-bottom: rgba(166, 200, 255, 0.68);

  --svg-blue: #6DA6FF;
  --svg-violet: #98A0FF;
  --svg-emerald: #5CECC6;
  --svg-amber: #FFE156;
  --svg-red: #FF7FA8;

  --aura-a: rgba(109, 166, 255, 0.30);
  --aura-b: rgba(143, 150, 255, 0.34);
  --aura-c: rgba(166, 200, 255, 0.24);
  --horizon-top: #122359;
  --horizon-rim: #98A0FF;
  --horizon-mid: #6DA6FF;
  --horizon-glow: rgba(166, 200, 255, 0.56);
  --underglow-a: rgba(109, 166, 255, 0.34);
  --underglow-b: rgba(143, 150, 255, 0.28);
  --status-color: #6DA6FF;

  --surface-halo-a: rgba(8, 16, 46, 0.68);
  --surface-halo-b: rgba(109, 166, 255, 0.14);
  --surface-halo-hover-a: rgba(109, 166, 255, 0.26);
  --surface-halo-hover-b: rgba(143, 150, 255, 0.24);
  --pill-halo: rgba(28, 117, 246, 0.48);
  --pill-halo-hover: rgba(109, 166, 255, 0.56);
}

/* State-Driven Luminous Chromatics */
html[data-state="synced"] {
  --aura-a: rgba(199, 212, 255, 0.48);
  --aura-b: rgba(166, 200, 255, 0.44);
  --aura-c: rgba(92, 236, 198, 0.26);
  --horizon-top: rgba(199, 212, 255, 0.38);
  --horizon-rim: rgba(143, 150, 255, 0.52);
  --horizon-mid: rgba(109, 166, 255, 0.40);
  --horizon-glow: rgba(166, 200, 255, 0.38);
  --underglow-a: rgba(166, 200, 255, 0.48);
  --underglow-b: rgba(230, 212, 255, 0.38);
  --active-spectrum: var(--spec-synced);
  --status-color: #18B860;
}

html[data-theme="dark"][data-state="synced"] {
  --aura-a: rgba(28, 117, 246, 0.28);
  --aura-b: rgba(143, 150, 255, 0.34);
  --aura-c: rgba(109, 166, 255, 0.26);
  --horizon-top: #122359;
  --horizon-rim: #8F96FF;
  --horizon-mid: #6DA6FF;
  --horizon-glow: rgba(166, 200, 255, 0.56);
  --underglow-a: rgba(109, 166, 255, 0.34);
  --underglow-b: rgba(92, 236, 198, 0.22);
  --status-color: #5CECC6;
}

html[data-state="holdover"] {
  --aura-a: rgba(255, 159, 28, 0.22);
  --aura-b: rgba(255, 225, 86, 0.26);
  --aura-c: rgba(255, 179, 217, 0.32);
  --horizon-top: rgba(255, 225, 86, 0.28);
  --horizon-rim: rgba(255, 159, 28, 0.48);
  --horizon-mid: rgba(255, 225, 86, 0.38);
  --horizon-glow: rgba(255, 179, 217, 0.36);
  --underglow-a: rgba(255, 225, 86, 0.34);
  --underglow-b: rgba(255, 179, 217, 0.36);
  --active-spectrum: var(--spec-holdover);
  --status-color: #E58600;
}

html[data-theme="dark"][data-state="holdover"] {
  --aura-a: rgba(255, 159, 28, 0.30);
  --aura-b: rgba(255, 225, 86, 0.22);
  --aura-c: rgba(255, 179, 217, 0.24);
  --horizon-top: #312008;
  --horizon-rim: #FFE156;
  --horizon-mid: #FF9F1C;
  --horizon-glow: rgba(255, 179, 217, 0.42);
  --underglow-a: rgba(255, 159, 28, 0.32);
  --underglow-b: rgba(255, 179, 217, 0.24);
  --status-color: #FFE156;
}

html[data-state="desync"],
html[data-state="unanchored"] {
  --aura-a: rgba(255, 79, 94, 0.20);
  --aura-b: rgba(255, 127, 168, 0.24);
  --aura-c: rgba(248, 200, 235, 0.30);
  --horizon-top: rgba(255, 127, 168, 0.24);
  --horizon-rim: rgba(255, 79, 94, 0.46);
  --horizon-mid: rgba(255, 127, 168, 0.36);
  --horizon-glow: rgba(248, 200, 235, 0.34);
  --underglow-a: rgba(255, 79, 94, 0.28);
  --underglow-b: rgba(248, 200, 235, 0.34);
  --active-spectrum: var(--spec-desync);
  --status-color: #E03131;
}

html[data-theme="dark"][data-state="desync"],
html[data-theme="dark"][data-state="unanchored"] {
  --aura-a: rgba(255, 79, 94, 0.28);
  --aura-b: rgba(255, 127, 168, 0.26);
  --aura-c: rgba(248, 200, 235, 0.20);
  --horizon-top: #35101F;
  --horizon-rim: #FF7FA8;
  --horizon-mid: #FF4F5E;
  --horizon-glow: rgba(248, 200, 235, 0.42);
  --underglow-a: rgba(255, 79, 94, 0.30);
  --underglow-b: rgba(255, 127, 168, 0.24);
  --status-color: #FF7FA8;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue-core);
  outline-offset: 2px;
}

html[data-theme="dark"] a:focus-visible,
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] input:focus-visible {
  outline-color: var(--sky-bloom);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.5;
  color: var(--ink-primary);
  background-color: var(--bg-page);
  background-image:
    radial-gradient(66% 42% at 50% -6%, rgba(166, 200, 255, 0.50), transparent 72%),
    radial-gradient(48% 36% at 14% 16%, rgba(199, 212, 255, 0.46), transparent 72%),
    radial-gradient(46% 34% at 86% 14%, rgba(248, 200, 235, 0.40), transparent 70%),
    radial-gradient(52% 38% at 52% 28%, rgba(255, 236, 222, 0.38), transparent 74%);
  background-attachment: fixed;
  transition: background-color 320ms var(--ease-float), color 320ms var(--ease-float);
}

html[data-theme="dark"] body {
  background-image:
    linear-gradient(180deg, #122359 0%, #0B1536 34%, #070C1B 100%),
    radial-gradient(72% 44% at 50% -8%, rgba(152, 160, 255, 0.28), transparent 68%),
    radial-gradient(48% 36% at 84% 22%, rgba(109, 166, 255, 0.18), transparent 72%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
}

.mono-tight {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Topbar: Single-Line Translucent Glass */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: color-mix(in srgb, var(--bg-page) 78%, transparent);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border-bottom: 1px solid color-mix(in srgb, var(--border-hairline) 70%, transparent);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-primary);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.025em;
}

.brand-emblem {
  flex-shrink: 0;
  overflow: visible;
  filter: drop-shadow(0 4px 10px rgba(28, 117, 246, 0.24));
}

.brand-emblem .emblem-plane-back,
.brand-emblem .emblem-plane-mid,
.brand-emblem .emblem-plane-front,
.brand-emblem .emblem-plane-spark,
.brand-emblem .emblem-plane-rim {
  transition: transform 360ms var(--ease-snap), fill-opacity 300ms var(--ease-float);
}

.brand-emblem .emblem-plane-back {
  animation: emblemFloatBack 7s var(--ease-float) infinite alternate;
}

.brand-emblem .emblem-plane-mid {
  animation: emblemFloatMid 6.2s var(--ease-float) infinite alternate;
}

.brand-emblem .emblem-plane-front,
.brand-emblem .emblem-plane-spark,
.brand-emblem .emblem-plane-rim {
  animation: emblemFloatFront 5.6s var(--ease-float) infinite alternate;
}

.brand:hover .emblem-plane-back {
  transform: translate3d(2px, -1.5px, 0);
}

.brand:hover .emblem-plane-mid {
  transform: translate3d(0.5px, -0.5px, 0);
}

.brand:hover .emblem-plane-front,
.brand:hover .emblem-plane-spark,
.brand:hover .emblem-plane-rim {
  transform: translate3d(-1.5px, 1.5px, 0);
}

.brand:hover .emblem-plane-spark {
  fill-opacity: 0.78;
}

html[data-state="syncing"] .brand-emblem .emblem-plane-back {
  animation: emblemFloatBack 2.2s var(--ease-snap) infinite alternate;
}

html[data-state="syncing"] .brand-emblem .emblem-plane-mid {
  animation: emblemFloatMid 1.9s var(--ease-snap) infinite alternate;
}

html[data-state="syncing"] .brand-emblem .emblem-plane-front,
html[data-state="syncing"] .brand-emblem .emblem-plane-spark,
html[data-state="syncing"] .brand-emblem .emblem-plane-rim {
  animation: emblemPulse 1.8s var(--ease-snap) infinite alternate;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topnav a {
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 220ms var(--ease-snap);
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--ink-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Segmented Controls & Floating Interactive Pills */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 240ms var(--ease-snap), color 220ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.seg-btn.is-active {
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 2px 8px rgba(20, 25, 35, 0.10), inset 0 1px 0 var(--rim-top);
}

html[data-theme="dark"] .seg-btn.is-active {
  background-color: rgba(44, 62, 112, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(190, 214, 255, 0.24);
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), inset 0 1px 0 var(--rim-top);
  transition: background-color 220ms var(--ease-snap), border-color 220ms var(--ease-snap), transform 260ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.icon-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(28, 117, 246, 0.22);
}

html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

.pill-halo {
  display: inline-flex;
  filter: drop-shadow(0 6px 16px var(--pill-halo));
  transition: filter 280ms var(--ease-snap), transform 260ms var(--ease-snap);
}

.pill-halo:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 10px 22px var(--pill-halo-hover));
}

.pill-halo:active {
  transform: translateY(0) scale(0.97);
}

.primary-pill {
  position: relative;
  overflow: hidden;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-pill);
  corner-shape: superellipse(1.5);
  background: linear-gradient(135deg, #1C75F6 0%, #2C7DF7 58%, #5D8EFF 100%);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 5px var(--pill-rim-bottom);
  transition: filter 220ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.primary-pill::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, rgba(166, 200, 255, 0.92) 50%, transparent 100%);
  pointer-events: none;
}

.primary-pill:hover {
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -2px 6px rgba(166, 200, 255, 0.74);
}

.primary-pill.is-busy .resync-icon {
  animation: spin 850ms linear infinite;
}

.pill-btn {
  position: relative;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(21, 27, 40, 0.04),
    inset 0 1px 0 var(--rim-top),
    inset 0 -1.5px 3px rgba(199, 212, 255, 0.34);
  transition: background-color 220ms var(--ease-snap), border-color 220ms var(--ease-snap), transform 260ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.pill-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow:
    0 8px 18px -6px rgba(28, 117, 246, 0.22),
    0 2px 8px rgba(230, 212, 255, 0.30),
    inset 0 1px 0 var(--rim-top),
    inset 0 -1.5px 4px rgba(143, 150, 255, 0.44);
}

.pill-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Main Page Container */
.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 88px;
  display: flex;
  flex-direction: column;
  gap: 56px;
  min-width: 0;
}

/* ==========================================================================
   Opening Viewport: Multi-Layered Luminous Clock Stage
   ========================================================================== */
.halo-stage {
  width: 100%;
  min-width: 0;
  filter:
    drop-shadow(0 18px 34px var(--underglow-a))
    drop-shadow(0 28px 54px var(--underglow-b));
  transition: filter 480ms var(--ease-float);
}

.clock-stage {
  position: relative;
  border-radius: var(--radius-stage);
  corner-shape: superellipse(1.5);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  padding: 28px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: clip;
  contain: paint;
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: border-color 360ms var(--ease-float);
}

html[data-theme="dark"] .clock-stage {
  background: linear-gradient(180deg, rgba(16, 30, 72, 0.88) 0%, rgba(13, 21, 46, 0.86) 52%, rgba(11, 17, 36, 0.92) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-color: rgba(154, 184, 255, 0.20);
}

/* Layer 1: Organic Hyperbolic-Cosine Luminous Atmospheric Horizon */
.energy-horizon {
  position: absolute;
  inset: -8% -4% auto -4%;
  height: 76%;
  pointer-events: none;
  z-index: 0;
  filter: blur(16px);
  opacity: 0.82;
  animation: horizonBreathe 14s var(--ease-float) infinite alternate;
}

.horizon-svg {
  display: block;
  width: 100%;
  height: 100%;
}

html[data-theme="dark"] .energy-horizon {
  height: 54%;
  opacity: 0.52;
  filter: blur(12px);
}

/* Layer 2: Multi-Stop Hue-Shifted Radial Chromatic Blooms */
.energy-aura {
  position: absolute;
  inset: -32% -12% auto -12%;
  height: 148%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(48% 52% at 20% 24%, var(--aura-a), transparent 72%),
    radial-gradient(46% 52% at 80% 22%, var(--aura-b), transparent 70%),
    radial-gradient(44% 50% at 52% 58%, var(--aura-c), transparent 68%);
  filter: blur(34px);
  opacity: 0.96;
  animation: auraDrift 13s var(--ease-float) infinite alternate;
}

/* Layer 3: Bioluminescent Sweep Beam (illuminates surface during sync) */
.energy-beam {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  background: linear-gradient(
    108deg,
    transparent 20%,
    rgba(143, 168, 255, 0.30) 44%,
    rgba(75, 232, 216, 0.26) 54%,
    transparent 76%
  );
  transform: translateX(-60%);
  animation: beamGlide 11s var(--ease-float) infinite;
}

html[data-state="syncing"] .energy-horizon {
  animation-duration: 3.6s;
}

html[data-state="syncing"] .energy-aura {
  animation-duration: 3.2s;
}

html[data-state="syncing"] .energy-beam {
  opacity: 0.62;
  animation-duration: 2.6s;
}

.clock-stage-top,
.clock-readout,
.energy-spectrum-bar,
.assurance-strip {
  position: relative;
  z-index: 1;
}

.clock-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.tz-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.tz-select {
  appearance: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-primary);
  background-color: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  padding: 7px 32px 7px 14px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234F5B6D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), inset 0 1px 0 var(--rim-top);
  transition: border-color 220ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.tz-select:hover,
.tz-select:focus-visible {
  border-color: var(--border-strong);
  box-shadow: 0 6px 16px -6px rgba(28, 117, 246, 0.24);
}

html[data-theme="dark"] .tz-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A6B4CC' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.clock-date {
  font-size: var(--text-body);
  color: var(--ink-secondary);
  font-weight: 400;
}

.copy-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.clock-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding: 20px 0 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.clock-hms {
  font-size: clamp(3.5rem, 11vw, 7.25rem);
  font-weight: 400;
  color: var(--ink-primary);
  text-shadow: 0 2px 24px rgba(28, 117, 246, 0.08);
}

html[data-theme="dark"] .clock-hms {
  text-shadow: 0 2px 16px rgba(7, 12, 27, 0.65), 0 4px 36px rgba(138, 168, 255, 0.26);
}

.clock-ms {
  font-size: clamp(1.75rem, 4.4vw, 3.25rem);
  font-weight: 300;
  color: var(--ink-secondary);
  margin-left: 2px;
}

.clock-ampm {
  font-size: clamp(1.125rem, 2.2vw, 1.75rem);
  font-weight: 500;
  color: var(--ink-secondary);
  margin-left: 12px;
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .clock-ms,
html[data-theme="dark"] .clock-ampm {
  color: rgba(242, 245, 252, 0.84);
  text-shadow: 0 2px 16px rgba(7, 12, 27, 0.65);
}

/* Layer 4: Hue-Shifted Chromatic Spectrum Ribbon */
.energy-spectrum-bar {
  margin: 0 -32px -22px;
  height: 3px;
  background: var(--active-spectrum);
  background-size: 200% 100%;
  opacity: 0.92;
  box-shadow: 0 0 18px 1px var(--underglow-a);
  animation: spectrumFlow 8s var(--ease-float) infinite alternate;
}

html[data-state="syncing"] .energy-spectrum-bar {
  animation-duration: 2.2s;
}

/* Integrated Translucent Assurance Strip */
.assurance-strip {
  margin: 0 -32px;
  padding: 18px 32px;
  border-top: 1px solid var(--border-hairline);
  background-color: color-mix(in srgb, var(--bg-surface) 74%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

html[data-theme="dark"] .assurance-strip {
  background-color: rgba(9, 15, 34, 0.72);
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.metric-label {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.metric-value {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--ink-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value.mono-tight,
#metric-engine {
  font-size: var(--text-body);
  line-height: 1.4;
}

.metric-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--status-color);
  box-shadow: 0 0 12px var(--status-color), 0 0 4px var(--status-color);
  flex-shrink: 0;
}

html[data-state="syncing"] .status-dot {
  animation: dotPulse 1.2s var(--ease-float) infinite alternate;
}

/* Sections */
.section {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-head h2 {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink-primary);
}

.section-desc {
  margin: 0;
  font-size: var(--text-body);
  color: var(--ink-secondary);
  max-width: 68ch;
}

/* Floating Bento Surfaces (Pure White / Translucent Glass + Luminous Underglow) */
.halo-surface {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  filter:
    drop-shadow(0 10px 22px var(--surface-halo-a))
    drop-shadow(0 20px 38px var(--surface-halo-b));
  transition: filter 340ms var(--ease-float);
}

.halo-surface:hover {
  filter:
    drop-shadow(0 14px 28px var(--surface-halo-hover-a))
    drop-shadow(0 24px 44px var(--surface-halo-hover-b));
}

.surface {
  position: relative;
  flex: 1;
  width: 100%;
  min-width: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-surface);
  corner-shape: superellipse(1.5);
  padding: 24px 28px;
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: border-color 260ms var(--ease-snap);
}

html[data-theme="dark"] .surface {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.surface:hover {
  border-color: color-mix(in srgb, var(--border-strong) 65%, var(--border-hairline));
}

/* Section 1: Certified Interval & Causality */
.envelope-surface {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.envelope-legend,
.marzullo-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.marzullo-legend {
  margin-bottom: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.swatch-client {
  background: linear-gradient(135deg, rgba(56, 212, 255, 0.26), rgba(75, 232, 216, 0.26));
  border: 1.5px solid #38D4FF;
}

.swatch-server {
  background: linear-gradient(135deg, rgba(143, 150, 255, 0.36), rgba(143, 168, 255, 0.42));
  border: 1.5px solid #8F96FF;
}

.swatch-watermark {
  width: 14px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed var(--svg-violet);
}

.swatch-band {
  background-color: rgba(28, 117, 246, 0.16);
  border: 1.5px solid var(--svg-blue);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-inlier {
  background-color: var(--svg-emerald);
}

.dot-outlier {
  background-color: var(--svg-red);
}

.envelope-chart-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.envelope-svg {
  display: block;
  width: 100%;
  height: auto;
}

.envelope-readouts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-hairline);
}

.readout-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.readout-label {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.readout-val {
  font-size: var(--text-sm);
  color: var(--ink-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.causality-surface {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.causality-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
}

.mono-input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-page);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  transition: border-color 220ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.mono-input:focus {
  border-color: var(--blue-core);
  box-shadow: 0 0 0 4px rgba(28, 117, 246, 0.14);
}

.preset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.causality-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-hairline);
}

.eval-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  margin: -12px -14px;
  border-radius: 18px;
  corner-shape: superellipse(1.5);
  transition: background-color 280ms var(--ease-float), box-shadow 360ms var(--ease-snap);
}

.eval-pane.is-ignited {
  animation: biolumIgnite 720ms var(--ease-snap);
}

.eval-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eval-source {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--ink-primary);
}

.decision-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  background-color: var(--bg-subtle);
  color: var(--ink-secondary);
  transition: background-color 240ms var(--ease-snap), color 240ms var(--ease-snap), box-shadow 240ms var(--ease-snap);
}

.decision-pill[data-decision="idle"] {
  background-color: var(--bg-subtle);
  color: var(--ink-secondary);
}

.decision-pill[data-decision="yes"] {
  background: linear-gradient(135deg, rgba(0, 184, 79, 0.16), rgba(75, 232, 216, 0.22));
  color: #0B6A3A;
  box-shadow: 0 4px 14px -4px rgba(0, 184, 79, 0.28);
}

html[data-theme="dark"] .decision-pill[data-decision="yes"] {
  color: #6EE7B7;
  box-shadow: 0 4px 16px -4px rgba(52, 211, 153, 0.32);
}

.decision-pill[data-decision="no"] {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.14), rgba(255, 112, 150, 0.20));
  color: #B81D24;
  box-shadow: 0 4px 14px -4px rgba(255, 77, 109, 0.26);
}

html[data-theme="dark"] .decision-pill[data-decision="no"] {
  color: #FF80A0;
  box-shadow: 0 4px 16px -4px rgba(255, 112, 150, 0.30);
}

.decision-pill[data-decision="unknown"] {
  background: linear-gradient(135deg, rgba(255, 168, 0, 0.16), rgba(255, 184, 224, 0.22));
  color: #8A4B00;
  box-shadow: 0 4px 14px -4px rgba(255, 168, 0, 0.24);
}

html[data-theme="dark"] .decision-pill[data-decision="unknown"] {
  color: #FCD34D;
}

.eval-meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  word-break: break-word;
}

/* Section 2: Floating World Clock Matrix */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.world-tile-wrap {
  display: flex;
  min-width: 0;
  filter:
    drop-shadow(0 8px 18px var(--surface-halo-a))
    drop-shadow(0 16px 32px var(--surface-halo-b));
  transition: transform 280ms var(--ease-snap), filter 300ms var(--ease-float);
}

.world-tile-wrap:hover {
  transform: translateY(-2px);
  filter:
    drop-shadow(0 14px 26px var(--surface-halo-hover-a))
    drop-shadow(0 22px 38px var(--surface-halo-hover-b));
}

.world-tile-wrap:active {
  transform: translateY(0) scale(0.99);
}

.world-tile {
  appearance: none;
  text-align: left;
  width: 100%;
  min-width: 0;
  padding: 18px 20px;
  border-radius: var(--radius-surface);
  corner-shape: superellipse(1.5);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: border-color 240ms var(--ease-snap);
}

html[data-theme="dark"] .world-tile {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.world-tile:hover {
  border-color: var(--border-strong);
}

.world-tile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.world-city {
  font-size: var(--text-body);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.world-offset {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.world-time {
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.world-date {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

/* Section 3: Upstream Consensus & Telemetry */
.sources-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
}

.subhead-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.subhead-row h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-primary);
}

.subhead-meta {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.marzullo-chart-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.marzullo-svg {
  display: block;
  width: 100%;
  height: auto;
}

.meta-table {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-hairline);
}

.meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-row dt {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.meta-row dd {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-primary);
  text-align: right;
  min-width: 0;
}

/* Section 4: Developer API & Reproducible WASM */
.api-surface {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.code-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.code-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.code-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
}

.code-row pre {
  margin: 0;
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-input);
  background-color: var(--bg-page);
  border: 1px solid var(--border-hairline);
  overflow-x: auto;
  font-size: var(--text-sm);
  color: var(--ink-primary);
}

.wasm-bar {
  padding-top: 20px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.wasm-hash-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wasm-sha-text {
  font-size: var(--text-sm);
  color: var(--ink-primary);
  word-break: break-all;
}

.doc-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.doc-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--blue-core);
  text-decoration: none;
}

html[data-theme="dark"] .doc-links a {
  color: var(--sky-bloom);
}

.doc-links a:hover {
  text-decoration: underline;
}

/* Floating Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow:
    0 10px 30px -6px rgba(28, 117, 246, 0.28),
    0 6px 18px -4px rgba(123, 108, 255, 0.22);
  z-index: 50;
}

/* ==========================================================================
   Bioluminescent & Atmospheric Keyframe Animations
   ========================================================================== */
@keyframes horizonBreathe {
  0% {
    transform: rotate(-1.6deg) translate3d(0, -1.5%, 0) scaleY(1);
  }
  100% {
    transform: rotate(-1.1deg) translate3d(0, 1.5%, 0) scaleY(1.06);
  }
}

@keyframes auraDrift {
  0% {
    transform: translate3d(-2%, -1.5%, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, 1.8%, 0) scale(1.06);
  }
}

@keyframes beamGlide {
  0% {
    transform: translateX(-68%);
  }
  50% {
    transform: translateX(48%);
  }
  100% {
    transform: translateX(-68%);
  }
}

@keyframes spectrumFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes emblemFloatBack {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(1px, -1px, 0);
  }
}

@keyframes emblemFloatMid {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-0.6px, 0.8px, 0);
  }
}

@keyframes emblemFloatFront {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-1.4px, 1.2px, 0);
  }
}

@keyframes emblemPulse {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-2px, 1.5px, 0);
  }
}

@keyframes dotPulse {
  0% {
    transform: scale(0.88);
    opacity: 0.72;
  }
  100% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@keyframes biolumIgnite {
  0% {
    background-color: rgba(143, 150, 255, 0.22);
    box-shadow: inset 0 0 0 2px rgba(28, 117, 246, 0.36), inset 0 0 24px rgba(143, 150, 255, 0.28);
  }
  100% {
    background-color: transparent;
    box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 transparent;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .energy-horizon,
  .energy-aura,
  .energy-beam,
  .energy-spectrum-bar,
  .status-dot,
  .eval-pane.is-ignited,
  .brand-emblem .emblem-plane-back,
  .brand-emblem .emblem-plane-mid,
  .brand-emblem .emblem-plane-front,
  .brand-emblem .emblem-plane-spark,
  .brand-emblem .emblem-plane-rim,
  .primary-pill.is-busy .resync-icon {
    animation: none;
  }
  body,
  .halo-stage,
  .halo-surface,
  .pill-halo,
  .world-tile-wrap,
  .surface,
  .clock-stage,
  .topnav a,
  .seg-btn,
  .icon-btn,
  .primary-pill,
  .pill-btn,
  .tz-select,
  .mono-input,
  .world-tile,
  .decision-pill,
  .brand-emblem path,
  .brand-emblem rect {
    transition: none;
  }
}

/* Responsive Breakpoints (Clean down to 390px) */
@media (max-width: 920px) {
  .assurance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .assurance-strip .metric-cell:nth-child(5) {
    grid-column: 1 / -1;
  }
  .envelope-readouts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sources-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .causality-results {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .brand {
    gap: 7px;
    font-size: 0.975rem;
    flex-shrink: 0;
  }
  .brand-emblem {
    width: 24px;
    height: 24px;
  }
  .topbar-actions {
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .seg-btn {
    padding: 4px 9px;
    font-size: 0.78rem;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .topbar-actions .primary-pill {
    padding: 6px 12px;
    font-size: 0.8rem;
    gap: 5px;
  }
  .topnav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-hairline);
  }
  .topnav a {
    font-size: 0.8125rem;
  }
  .page {
    padding: 12px 14px 56px;
    gap: 36px;
  }
  .clock-stage {
    padding: 18px 16px 0;
    gap: 16px;
    border-radius: 24px;
  }
  .energy-horizon {
    height: 46%;
    opacity: 0.62;
  }
  html[data-theme="dark"] .energy-horizon {
    height: 48%;
    opacity: 0.52;
  }
  .clock-stage-top {
    gap: 10px;
  }
  .tz-control {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .tz-select {
    padding: 6px 28px 6px 12px;
    font-size: 0.8125rem;
  }
  .clock-date {
    font-size: 0.8125rem;
    color: var(--ink-primary);
    opacity: 0.76;
    white-space: nowrap;
  }
  .copy-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }
  .copy-bar .pill-btn {
    padding: 7px 6px;
    font-size: 0.75rem;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .clock-readout {
    padding: 10px 0 12px;
  }
  .clock-hms {
    font-size: clamp(2.25rem, 11vw, 4.5rem);
  }
  .clock-ms {
    font-size: clamp(1.1rem, 4.8vw, 2rem);
  }
  .clock-ampm {
    margin-left: 6px;
    font-size: 0.95rem;
  }
  .energy-spectrum-bar {
    margin: 0 -16px -16px;
  }
  .assurance-strip {
    margin: 0 -16px;
    padding: 16px 16px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
  }
  .assurance-strip .metric-cell:nth-child(5) {
    grid-column: 1 / -1;
    padding-top: 12px;
    border-top: 1px solid var(--border-hairline);
  }
  .metric-label {
    font-size: 0.75rem;
  }
  .metric-value,
  .metric-value.mono-tight,
  #metric-engine {
    font-size: 0.9rem;
  }
  .surface {
    padding: 18px 16px;
    border-radius: 22px;
  }
  .envelope-svg,
  .marzullo-svg {
    min-width: 0;
  }
  .envelope-readouts {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .causality-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .causality-controls .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .input-group {
    flex: none;
    width: 100%;
  }
  .mono-input {
    font-size: 0.8125rem;
    padding: 9px 12px;
  }
  .preset-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .preset-row .pill-btn {
    padding: 7px 2px;
    font-size: 0.72rem;
    justify-content: center;
    white-space: nowrap;
  }
  .eval-pane {
    margin: 0;
    padding: 12px;
  }
  .world-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .world-tile {
    padding: 14px;
    gap: 5px;
    border-radius: 20px;
  }
  .world-city {
    font-size: 0.875rem;
  }
  .world-time {
    font-size: 1.25rem;
  }
  .world-offset,
  .world-date {
    font-size: 0.75rem;
  }
  .meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 0;
  }
  .meta-row dd {
    text-align: left;
    width: 100%;
    white-space: normal;
    word-break: break-all;
  }
  .code-row pre {
    padding: 11px 12px;
    font-size: 0.78rem;
  }
  .wasm-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .wasm-sha-text {
    font-size: 0.78rem;
    line-height: 1.5;
  }
}

@media (max-width: 390px) {
  .topbar-inner {
    padding: 10px 12px;
  }
  .brand-wordmark {
    font-size: 0.9375rem;
  }
  .seg-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .topbar-actions .primary-pill {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .copy-bar .pill-btn {
    font-size: 0.75rem;
    padding: 7px 4px;
    letter-spacing: -0.015em;
  }
}

@media (max-width: 359px) {
  .topbar-inner {
    padding: 8px 10px;
    gap: 6px;
  }
  .brand {
    gap: 5px;
    font-size: 0.875rem;
  }
  .brand-emblem {
    width: 20px;
    height: 20px;
  }
  .brand-wordmark {
    font-size: 0.875rem;
  }
  .topbar-actions {
    gap: 4px;
  }
  .seg-btn {
    padding: 3px 6px;
    font-size: 0.72rem;
  }
  .icon-btn {
    width: 28px;
    height: 28px;
  }
  .topbar-actions .primary-pill {
    padding: 5px 8px;
    font-size: 0.74rem;
    gap: 4px;
  }
  .topbar-actions .resync-icon {
    width: 13px;
    height: 13px;
  }
  .tz-select {
    padding: 5px 24px 5px 10px;
    font-size: 0.74rem;
  }
  .clock-date {
    font-size: 0.72rem;
  }
  .copy-bar .pill-btn {
    font-size: 0.68rem;
    padding: 6px 3px;
    letter-spacing: -0.02em;
  }
  .clock-hms {
    font-size: clamp(1.9rem, 10.5vw, 2.4rem);
  }
  .clock-ms {
    font-size: clamp(0.95rem, 4.5vw, 1.25rem);
  }
  .clock-ampm {
    margin-left: 4px;
    font-size: 0.82rem;
  }
}
