/* TeslaCamHUD — Tesla x SpaceX tech UI */

@font-face {
  font-family: "D-DIN";
  src: local("DIN Alternate"), local("DIN"), local("Arial Narrow"), local("Helvetica Neue");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --white-100: rgba(240, 240, 250, 1);
  --white-90: rgba(240, 240, 250, 0.9);
  --white-70: rgba(240, 240, 250, 0.7);
  --white-50: rgba(240, 240, 250, 0.5);
  --white-35: rgba(240, 240, 250, 0.35);
  --white-20: rgba(240, 240, 250, 0.2);
  --white-12: rgba(240, 240, 250, 0.12);
  --white-08: rgba(240, 240, 250, 0.08);
  --black: #000;
  --surface: #0a0a0c;
  --surface-2: #111114;
  --accent: #ffffff;
  --tesla-red: #e31937;
  --tesla-red-glow: rgba(227, 25, 55, 0.45);
  --cyan: #5eead4;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
  --font: "D-DIN", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--white-100);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--white-08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--white-100);
  margin-right: 8px;
}

.logo-mark {
  width: 18px;
  height: 18px;
  position: relative;
  flex-shrink: 0;
}
.logo-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--white-100);
  border-radius: 50%;
}
.logo-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--tesla-red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--tesla-red-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--white-50);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--white-20);
  background: transparent;
  color: var(--white-100);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover:not(:disabled) {
  background: var(--white-100);
  color: var(--black);
  border-color: var(--white-100);
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary {
  background: var(--white-100);
  color: var(--black);
  border-color: var(--white-100);
}
.btn.primary:hover:not(:disabled) {
  background: transparent;
  color: var(--white-100);
}
.btn.ghost {
  border-color: transparent;
  color: var(--white-70);
}
.btn.ghost:hover:not(:disabled) {
  color: var(--white-100);
  background: var(--white-08);
  border-color: transparent;
}

.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(227, 25, 55, 0.06), transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.03), transparent 60%),
    linear-gradient(180deg, transparent 0%, var(--black) 100%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--white-08) 1px, transparent 1px),
    linear-gradient(90deg, var(--white-08) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  opacity: 0.35;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
}

.hero-copy h1 {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: none;
  margin-bottom: 16px;
  white-space: nowrap;
}
.hero-copy .tagline {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--tesla-red);
  text-transform: uppercase;
  margin-bottom: 20px;
  max-width: 36ch;
}
.hero-copy .desc {
  font-size: 15px;
  color: var(--white-70);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 42ch;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-meta {
  display: flex;
  gap: 28px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--white-08);
}
.hero-meta div { display: flex; flex-direction: column; gap: 4px; }
.hero-meta .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white-35);
}
.hero-meta .value {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--white-90);
}

.hud-preview {
  position: relative;
  aspect-ratio: 21 / 9;
  max-height: 220px;
  background: var(--surface);
  border: 1px solid var(--white-12);
  overflow: hidden;
}
.hud-preview-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #0c1220 0%, #1a1520 40%, #0a0e14 100%);
}
.hud-preview-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 60%, rgba(80, 120, 180, 0.15), transparent),
    linear-gradient(transparent 60%, rgba(0, 0, 0, 0.7));
}
.hud-preview-road {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 140%;
  height: 32%;
  transform: translateX(-50%);
  background:
    linear-gradient(to top, rgba(20, 24, 32, 0.9), transparent),
    repeating-linear-gradient(90deg, transparent, transparent 48px, rgba(255,255,255,0.03) 48px, rgba(255,255,255,0.03) 50px);
  clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}
.hud-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hud-preview-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white-50);
  border: 1px solid var(--white-12);
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.4);
}

.stage-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 48px;
  gap: 16px;
  min-height: calc(100vh - var(--header-h));
}
.stage-wrap.active { display: flex; }

#stage {
  position: relative;
  background: #000;
  border: 1px solid var(--white-12);
  max-width: min(1100px, 100%);
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
#video { display: none; }
#hudCanvas {
  display: block;
  width: 100%;
  max-height: 68vh;
  background: #000;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(1100px, 100%);
  padding: 4px 0;
}
.controls input[type="range"] {
  flex: 1;
  height: 2px;
  appearance: none;
  background: var(--white-12);
  outline: none;
}
.controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--white-100);
  cursor: pointer;
}
.time-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--white-50);
  min-width: 100px;
  text-align: right;
}

.debug {
  width: min(1100px, 100%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--white-35);
  border: 1px solid var(--white-08);
  background: var(--surface);
  padding: 12px 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.debug strong { color: var(--white-70); font-weight: 500; }

.hint {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white-35);
  text-align: center;
}
.hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--white-12);
  padding: 2px 6px;
  color: var(--white-50);
  margin: 0 2px;
}

.features {
  border-top: 1px solid var(--white-08);
  padding: 64px 24px 80px;
  background: var(--surface);
}
.features-inner { max-width: 1100px; margin: 0 auto; }
.features h2 {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--white-50);
  margin-bottom: 36px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--white-08);
  border: 1px solid var(--white-08);
}
@media (max-width: 720px) {
  .feature-grid { grid-template-columns: 1fr; }
}
.feature {
  background: var(--black);
  padding: 28px 24px;
}
.feature .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--tesla-red);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.feature h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.feature p {
  font-size: 13px;
  color: var(--white-50);
  line-height: 1.6;
}

footer {
  border-top: 1px solid var(--white-08);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-35);
}
footer a { color: var(--white-50); text-decoration: none; }
footer a:hover { color: var(--white-100); }

body.playing .hero,
body.playing .features { display: none; }
body:not(.playing) .stage-wrap { display: none !important; }
