:root {
  --bg: #06090e;
  --bg-surface: rgba(11, 17, 26, 0.82);
  --bg-card: rgba(15, 23, 36, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(34, 211, 238, 0.45);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --cyan: #22d3ee;
  --orange: #f97316;
  --magenta: #ec4899;
  --green: #22c55e;
  --gold: #eab308;
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  touch-action: none;
}

canvas#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  outline: none;
  touch-action: none;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(4, 7, 12, 0.75) 100%);
}

/* Navigation Header */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 20;
  pointer-events: none;
}

nav > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-main);
  white-space: nowrap;
}

.brand em {
  color: var(--cyan);
  font-style: normal;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--cyan);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: rgba(15, 23, 36, 0.75);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(12px);
}

.segmented button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.segmented button[aria-selected="true"],
.segmented button[aria-checked="true"] {
  background: var(--cyan);
  color: #04070b;
  font-weight: 600;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.35);
}

/* Hero Content Area */
.hero-content {
  position: fixed;
  top: 84px;
  left: 36px;
  width: 420px;
  max-width: calc(100vw - 72px);
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hero-content > * {
  pointer-events: auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

h1 {
  font-size: clamp(32px, 4.4vw, 52px);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #ffffff;
}

h1 em {
  font-style: normal;
  color: var(--cyan);
}

.lede {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 380px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  border: 1px solid var(--border);
  background: rgba(15, 23, 36, 0.7);
  color: var(--text-main);
  backdrop-filter: blur(10px);
}

.btn:hover {
  background: rgba(26, 38, 56, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--cyan);
  color: #04070b;
  border-color: var(--cyan);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.25);
}

.btn.primary:hover {
  background: #38e1fc;
  box-shadow: 0 6px 22px rgba(34, 211, 238, 0.4);
}

/* Interactive Floating Inspector HUD Tooltip (Learn Mode) */
.inspector-card {
  position: fixed;
  z-index: 100;
  width: 310px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  background: rgba(8, 14, 22, 0.92);
  border: 1px solid var(--border-active);
  border-radius: 12px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 24px rgba(34, 211, 238, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity, left, top;
}

.inspector-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.card-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.card-role {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
}

.card-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.card-actions .btn {
  padding: 7px 12px;
  font-size: 10.5px;
  flex: 1;
}

/* Bottom Controls Dock */
.dock {
  position: fixed;
  bottom: 24px;
  left: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
  gap: 12px;
}

.dock > * {
  pointer-events: auto;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 20px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dock-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}

.dock-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.dock-btn[aria-selected="true"] {
  background: rgba(34, 211, 238, 0.18);
  color: var(--cyan);
  font-weight: 600;
}

.dock-hint {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dock-hint span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
}

/* Focus Reset Button */
#btn-unfocus {
  position: fixed;
  top: 84px;
  right: 28px;
  z-index: 25;
  padding: 7px 14px;
  font-size: 11px;
}

/* Boot Screen */
#boot {
  position: fixed;
  inset: 0;
  background: #04070b;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

#boot.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-mark {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
}

.boot-mark em {
  color: var(--cyan);
  font-style: normal;
}

.boot-bar {
  width: 220px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

#boot-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transition: width 0.3s ease;
}

.boot-status {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

#btn-enter {
  margin-top: 8px;
  padding: 10px 24px;
  font-size: 12px;
}

/* Mobile Responsive Optimization (<= 768px) */
@media (max-width: 768px) {
  nav {
    height: 52px;
    padding: 0 14px;
  }

  .brand {
    font-size: 11.5px;
    letter-spacing: 0.08em;
  }

  .nav-center {
    display: none; /* Collapsed on mobile to prevent clutter */
  }

  .nav-right {
    gap: 8px;
  }

  .segmented button {
    padding: 4px 8px;
    font-size: 10px;
  }

  .hero-content {
    top: 60px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    gap: 10px;
    background: linear-gradient(180deg, rgba(6, 9, 14, 0.85) 0%, rgba(6, 9, 14, 0) 100%);
    padding-bottom: 12px;
    pointer-events: none;
  }

  .eyebrow {
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }

  h1 {
    font-size: 26px;
    line-height: 1.05;
  }

  .lede {
    display: none; /* Hide long paragraph on mobile so 3D synth is fully visible */
  }

  .hero-actions {
    margin-top: 0;
    gap: 8px;
  }

  .hero-actions .btn {
    padding: 6px 12px;
    font-size: 10.5px;
  }

  /* Bottom Sheet Drawer for Inspector on Mobile */
  .inspector-card {
    position: fixed;
    bottom: 74px;
    left: 14px;
    right: 14px;
    z-index: 30;
    margin-top: 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(34, 211, 238, 0.15);
  }

  .dock {
    left: 12px;
    right: 12px;
    bottom: 14px;
    gap: 6px;
    justify-content: center;
  }

  .dock-group {
    padding: 4px 6px;
    gap: 4px;
  }

  .dock-btn {
    padding: 4px 8px;
    font-size: 9.5px;
  }

  .dock-hint {
    display: none;
  }

  #btn-unfocus {
    top: 58px;
    right: 14px;
    padding: 5px 10px;
    font-size: 10px;
  }
}
