* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #000;
  color: var(--text-main);
  font-family: var(--font-ui);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background-image: radial-gradient(circle at center, #2a2622 0%, #0a0908 100%);
  padding: 10px;
}

/* ── Device shell ── */
.device-shell {
  width: 100%;
  max-width: 480px;
  height: 95vh;
  height: 95dvh;
  max-height: 900px;
  background: var(--metal-dark);
  border: 4px solid #111;
  border-radius: 12px;
  position: relative;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.9),
    inset 0 4px 10px rgba(255, 255, 255, 0.05),
    inset 0 0 0 8px var(--metal-frame);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.device-shell::before,
.device-shell::after {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  width: 6px;
  background: linear-gradient(90deg, #4a2f1c 0%, var(--pipe-copper) 50%, #4a2f1c 100%);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.8);
  z-index: 10;
  pointer-events: none;
}

.device-shell::before {
  left: 1px;
  border-radius: 0 4px 4px 0;
}

.device-shell::after {
  right: 1px;
  border-radius: 4px 0 0 4px;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.8);
}

.screw {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #111;
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9), 0 1px 1px rgba(255, 255, 255, 0.2);
  z-index: 15;
  background-image: linear-gradient(45deg, transparent 40%, #222 40%, #222 60%, transparent 60%);
}

.s-tl { top: 12px; left: 12px; }
.s-tr { top: 12px; right: 12px; }
.s-bl { bottom: 12px; left: 12px; }
.s-br { bottom: 12px; right: 12px; }

/* ── Header & nav ── */
.terminal-header {
  background: var(--metal-frame);
  padding: 22px 16px 12px;
  border-bottom: 4px solid #111;
  z-index: 5;
  flex-shrink: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.brand-title {
  font-family: var(--font-macro);
  font-size: clamp(2.2rem, 8vw, 2.8rem);
  color: #d1c8c0;
  line-height: 1;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 -2px 2px #000;
  margin-bottom: 12px;
}

.nav-switches {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 6px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.nav-label {
  font-family: var(--font-data);
  font-size: 0.48rem;
  font-weight: 700;
  color: var(--warn-yellow);
  letter-spacing: 0.04em;
  transition: 0.25s;
  white-space: nowrap;
  text-shadow: 0 0 4px var(--warn-yellow-dim);
}

.nav-label--tight {
  font-size: 0.4rem;
  letter-spacing: 0;
}

.nav-switch {
  width: 100%;
  height: 22px;
  background: #111;
  border: 2px solid #222;
  border-radius: 11px;
  position: relative;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8);
  transition: 0.25s;
}

.nav-knob {
  width: 18px;
  height: 18px;
  background: var(--warn-yellow);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 8px var(--warn-yellow-dim), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nav-item.active .nav-label {
  color: var(--em-cyan);
  text-shadow: 0 0 6px var(--em-cyan);
}

.nav-item.active .nav-switch {
  border-color: var(--em-cyan);
  background: var(--em-cyan-dim);
}

.nav-item.active .nav-knob {
  background: var(--em-cyan);
  box-shadow: 0 0 10px var(--em-cyan);
  left: calc(100% - 18px);
}

.nav-item:active .nav-switch {
  transform: translateY(2px);
}

/* ── Horizontal viewport ── */
.viewport-container {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.viewport-container::-webkit-scrollbar {
  display: none;
}

.terminal-panel {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  min-height: 0;
  align-self: stretch;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

#vehicle .forge-terminal,
#vehicle .forge-stage {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.terminal-panel::-webkit-scrollbar {
  width: 4px;
}

.terminal-panel::-webkit-scrollbar-thumb {
  background: var(--hw-panel);
}

/* ── Panel typography ── */
.panel-kicker {
  font-family: var(--font-data);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--em-cyan);
}

.panel-title {
  font-family: var(--font-macro);
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 4px #000;
}

.panel-lead {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.panel-lead strong {
  color: var(--text-main);
  font-weight: 600;
}

.panel-pull {
  font-family: var(--font-macro);
  font-size: 1.35rem;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--warn-yellow);
  padding-left: 12px;
  border-left: 3px solid var(--em-cyan);
}

/* ── Hero viewport ── */
.hero-viewport {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border: 4px solid var(--metal-frame);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
}

.hero-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%);
  background-size: 100% 4px;
  z-index: 2;
}

.hero-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.1) saturate(1.15);
}

.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #1a3340 0%, #2d5a6b 40%, #8c5a35 100%);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.hero-fallback span {
  font-family: var(--font-data);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--em-cyan);
  text-transform: uppercase;
}

/* ── Widget panels ── */
.widget-panel {
  background: var(--metal-panel);
  border: 2px solid var(--metal-frame);
  clip-path: var(--cut-sm);
  padding: 14px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.w-title {
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--text-main);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.w-icon {
  width: 10px;
  height: 10px;
  background: var(--em-cyan);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 0 5px var(--em-cyan);
}

.w-icon--gold {
  background: var(--warn-yellow);
  box-shadow: 0 0 5px var(--warn-yellow);
}

.widget-screen {
  background: #15181a;
  border: 2px solid var(--bg-void);
  border-radius: 4px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.8);
}

/* Loop timeline */
.loop-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  padding-left: 8px;
}

.loop-timeline::before {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 12px;
  width: 2px;
  background: var(--em-cyan-dim);
  z-index: 1;
}

.loop-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.step-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--metal-panel);
  border: 2px solid var(--em-cyan);
  box-shadow: 0 0 5px var(--em-cyan);
}

.step-lbl {
  font-family: var(--font-macro);
  font-size: 1.15rem;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.step-sub {
  font-family: var(--font-data);
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* Stat block */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-cell {
  padding: 10px;
  background: var(--hw-dark);
  border: 1px solid #333;
  clip-path: var(--cut-sm);
}

.stat-lbl {
  font-family: var(--font-data);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-macro);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--em-cyan);
  text-shadow: 0 0 8px var(--em-cyan-dim);
}

.stat-val--warn {
  color: var(--warn-yellow);
  text-shadow: 0 0 8px var(--warn-yellow-dim);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  font-family: var(--font-data);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 8px;
  background: var(--hw-dark);
  border: 1px solid #333;
  color: var(--text-muted);
  clip-path: var(--cut-sm);
}

/* Blueprint hauler */
.blueprint {
  position: relative;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    #0d1012;
  background-size: 20px 20px;
  border: 1px solid var(--em-cyan-dim);
  overflow: hidden;
}

.blueprint__silhouette {
  position: absolute;
  inset: 12% 8% 18% 8%;
  border: 2px dashed rgba(0, 229, 255, 0.35);
  clip-path: var(--cut-md);
}

.blueprint__cab {
  position: absolute;
  left: 8%;
  top: 28%;
  width: 22%;
  height: 38%;
  border: 2px solid var(--pipe-copper);
  background: rgba(140, 90, 53, 0.15);
}

.blueprint__bed {
  position: absolute;
  left: 32%;
  top: 22%;
  width: 55%;
  height: 48%;
  border: 2px solid var(--em-cyan);
  background: rgba(0, 229, 255, 0.06);
}

.blueprint__node {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--em-cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--em-cyan);
}

.blueprint__node--1 { top: 35%; left: 42%; }
.blueprint__node--2 { top: 50%; left: 58%; }
.blueprint__node--3 { top: 38%; left: 72%; }

.blueprint__label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-family: var(--font-data);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--em-cyan);
  text-transform: uppercase;
}

.crew-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crew-list li {
  font-family: var(--font-data);
  font-size: 0.68rem;
  color: var(--text-muted);
  padding-left: 12px;
  border-left: 2px solid var(--warn-yellow);
  line-height: 1.45;
}

.crew-list li strong {
  color: var(--text-main);
  display: block;
  font-size: 0.72rem;
  margin-bottom: 2px;
}

/* Region rows */
.region-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.region-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-data);
  font-size: 0.65rem;
  color: var(--em-cyan);
  border-bottom: 1px solid #222;
  padding-bottom: 6px;
}

.region-row span:last-child {
  color: var(--warn-yellow);
}

/* CTA block */
.sponsor-block {
  text-align: center;
  padding: 8px 0 4px;
}

.sponsor-header {
  font-family: var(--font-macro);
  font-size: 1.65rem;
  line-height: 1.05;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 10px;
}

.sponsor-body {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.btn-sponsor {
  width: 100%;
  background: linear-gradient(180deg, var(--warn-yellow), #e57c00);
  border: 4px solid var(--metal-frame);
  color: #111;
  font-family: var(--font-macro);
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  padding: 14px 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  clip-path: var(--cut-sm);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 6px 0 #111;
  transition: 0.1s;
  line-height: 1;
}

.btn-sponsor:hover {
  background: linear-gradient(180deg, var(--em-cyan), #0099aa);
  color: #000;
}

.btn-sponsor:active {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 0 0 #111;
}

.btn-sponsor.is-secured {
  background: linear-gradient(180deg, var(--em-cyan), #0099aa);
  color: #000;
}

/* ── Telemetry footer ── */
.telemetry-footer {
  background: var(--metal-frame);
  border-top: 4px solid #111;
  padding: 10px 12px;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}

.tel-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-data);
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
  gap: 8px;
}

.tel-row span.cyan {
  color: var(--em-cyan);
  text-shadow: 0 0 4px var(--em-cyan-dim);
}

.tel-row span.orange {
  color: var(--kin-orange);
  text-shadow: 0 0 4px var(--kin-orange-dim);
}

.tel-row span.yellow {
  color: var(--warn-yellow);
}

.marquee-container {
  overflow: hidden;
  width: 100%;
}

.marquee {
  display: inline-block;
  white-space: nowrap;
  animation: scrollText 18s linear infinite;
}

@keyframes scrollText {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

@media (min-width: 520px) {
  .nav-label {
    font-size: 0.52rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee {
    animation: none;
  }

  .viewport-container {
    scroll-behavior: auto;
  }
}
