:root {
  --bg: #050505;
  --fg: #f4f1eb;
  --muted: rgba(244, 241, 235, .52);
  --line: rgba(244, 241, 235, .18);
  --accent: #ed2024;
  --panel: rgba(7, 7, 7, .92);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body {
  color: var(--fg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button, a { font: inherit; }
button { color: inherit; }

.app { position: relative; width: 100%; height: 100%; min-height: 100svh; background: #050505; isolation: isolate; }
#racecraft-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.ambient-noise {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}
.vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.44), transparent 30%, transparent 70%, rgba(0,0,0,.35)),
    linear-gradient(0deg, rgba(0,0,0,.48), transparent 32%),
    radial-gradient(circle at 50% 42%, transparent 20%, rgba(0,0,0,.12) 55%, rgba(0,0,0,.55) 105%);
}

.ui-layer { position: absolute; z-index: 5; transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.is-loading .ui-layer { opacity: 0; pointer-events: none; }

.loader {
  position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; width: 100%;
  background: #050505; transition: opacity 1s ease, visibility 1s ease;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-brand { display: grid; gap: 2px; width: min(420px, 74vw); }
.loader-brand span { color: var(--muted); letter-spacing: .32em; font-size: 10px; }
.loader-brand strong { font-size: clamp(34px, 6vw, 68px); line-height: .92; letter-spacing: -.045em; font-weight: 700; }
.loader-progress { width: 100%; height: 1px; background: rgba(255,255,255,.12); margin-top: 28px; overflow: hidden; }
.loader-progress i { display: block; width: 0%; height: 100%; background: var(--accent); transition: width .18s linear; }
.loader-meta { display: flex; justify-content: space-between; margin-top: 9px; color: var(--muted); font-size: 9px; letter-spacing: .19em; }

.topbar { top: 28px; left: 34px; right: 34px; display: flex; align-items: flex-start; justify-content: space-between; }
.brand { color: var(--fg); text-decoration: none; display: grid; gap: 1px; }
.brand-digikrom { font-size: 8px; letter-spacing: .38em; color: var(--muted); }
.brand-racecraft { font-size: 14px; font-weight: 650; letter-spacing: .14em; }
.top-actions { display: flex; gap: 18px; }
.utility-btn, .text-action {
  border: 0; padding: 0; background: none; color: var(--muted); cursor: pointer; font-size: 9px; letter-spacing: .16em; transition: color .2s ease;
}
.utility-btn:hover, .text-action:hover { color: var(--fg); }
.utility-btn.is-active { color: var(--accent); }
.utility-btn:disabled { opacity: .35; cursor: default; }

.car-meta { left: 34px; top: 50%; transform: translateY(-50%); max-width: 240px; }
.meta-index { font-size: 9px; letter-spacing: .2em; color: var(--muted); margin-bottom: 19px; }
.meta-year { font-size: 10px; letter-spacing: .26em; color: var(--accent); margin-bottom: 8px; }
.car-meta h1 { margin: 0; font-size: clamp(32px, 4vw, 58px); line-height: .85; letter-spacing: -.055em; font-weight: 620; }
.car-meta h1 span { color: rgba(244,241,235,.56); font-weight: 350; }
.meta-driver { margin-top: 17px; font-size: 10px; letter-spacing: .19em; color: var(--muted); }
.text-action { margin-top: 27px; color: var(--fg); }
.text-action span { color: var(--accent); margin-left: 5px; }

.mode-status { right: 34px; top: 50%; transform: translateY(-50%); text-align: right; display: grid; gap: 5px; }
.mode-status span { font-size: 11px; letter-spacing: .22em; }
.mode-status small { font-size: 8px; letter-spacing: .16em; color: var(--muted); }

.mode-nav { bottom: 31px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; border-top: 1px solid var(--line); }
.mode-btn {
  min-width: 132px; padding: 13px 22px 10px; border: 0; border-bottom: 1px solid transparent; background: rgba(0,0,0,.12); color: var(--muted); cursor: pointer;
  font-size: 9px; letter-spacing: .18em; transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.mode-btn span { display: inline-block; margin-right: 8px; font-size: 7px; color: rgba(244,241,235,.28); }
.mode-btn:hover { color: var(--fg); background: rgba(255,255,255,.025); }
.mode-btn.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.mode-btn.is-active span { color: var(--accent); }

.corner-mark { right: 34px; bottom: 34px; color: rgba(244,241,235,.25); font-size: 8px; letter-spacing: .18em; }

.panel {
  position: absolute; z-index: 12; top: 0; right: 0; width: min(620px, 100%); height: 100%; padding: clamp(72px, 11vh, 126px) clamp(30px, 6vw, 80px) 40px;
  background: var(--panel); border-left: 1px solid var(--line); backdrop-filter: blur(18px); transform: translateX(102%); transition: transform .65s cubic-bezier(.17,.84,.23,1); overflow-y: auto;
}
.panel.is-open { transform: translateX(0); }
.panel-close { position: absolute; top: 24px; right: 30px; border: 0; background: none; color: var(--fg); cursor: pointer; font-size: 28px; font-weight: 200; }
.panel-kicker { color: var(--accent); font-size: 9px; letter-spacing: .22em; }
.panel h2 { margin: 12px 0 35px; font-size: clamp(32px, 5vw, 56px); line-height: .94; letter-spacing: -.04em; font-weight: 550; }

.garage-filters { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 30px; }
.filter-chip { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 12px; cursor: pointer; font-size: 8px; letter-spacing: .17em; }
.filter-chip.is-active { border-color: rgba(244,241,235,.65); color: var(--fg); }
.filter-chip:disabled { opacity: .25; cursor: default; }
.garage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.car-card, .future-card { min-height: 230px; padding: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.018); text-align: left; }
.car-card { position: relative; color: var(--fg); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; }
.car-card:hover { border-color: rgba(244,241,235,.45); }
.car-card-no, .car-card-year { font-size: 8px; letter-spacing: .19em; color: var(--muted); }
.car-card-year { margin-top: auto; margin-bottom: 6px; color: var(--accent); }
.car-card strong { font-size: 21px; line-height: .94; letter-spacing: -.03em; }
.car-card small { margin-top: 9px; color: var(--muted); font-size: 8px; letter-spacing: .14em; }
.car-card i { position: absolute; right: 16px; top: 16px; font-style: normal; color: var(--accent); font-size: 7px; letter-spacing: .16em; }
.future-card { display: flex; flex-direction: column; justify-content: flex-end; color: rgba(244,241,235,.22); }
.future-card span { margin-bottom: 7px; font-size: 8px; letter-spacing: .16em; }
.future-card strong { font-size: 18px; font-weight: 400; }
.timeline-preview { display: flex; align-items: center; width: 100%; margin-top: 42px; color: rgba(244,241,235,.28); font-size: 7px; letter-spacing: .1em; }
.timeline-preview i { flex: 1; min-width: 8px; height: 1px; background: var(--line); }
.timeline-preview b { color: var(--fg); font-weight: 500; }

.panel-details { width: min(470px, 100%); }
.panel-details dl { margin: 0; border-top: 1px solid var(--line); }
.panel-details dl div { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.panel-details dt { color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.panel-details dd { margin: 0; font-size: 10px; letter-spacing: .12em; }
.panel-details p, .panel-credits p { margin-top: 30px; max-width: 44ch; color: var(--muted); font-size: 12px; line-height: 1.7; }
.panel-credits { width: min(470px, 100%); }
.credit-links { display: flex; gap: 20px; margin-top: 24px; }
.credit-links a { color: var(--fg); text-decoration: none; font-size: 9px; letter-spacing: .15em; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.credits-digikrom { border-top: 1px solid var(--line); padding-top: 23px; }

.drive-label {
  position: absolute; z-index: 6; left: 50%; top: 19%; transform: translate(-50%, 20px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .55s ease, transform .55s ease;
}
.drive-label.is-visible { opacity: 1; transform: translate(-50%, 0); }
.drive-label span { display: block; color: var(--accent); font-size: 8px; letter-spacing: .2em; }
.drive-label strong { display: block; margin-top: 7px; font-size: clamp(20px, 3vw, 34px); font-weight: 500; letter-spacing: -.025em; }
.drive-label small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .12em; }

@media (max-width: 840px) {
  .topbar { top: 20px; left: 20px; right: 20px; }
  .car-meta { top: auto; left: 20px; bottom: 104px; transform: none; }
  .car-meta h1 { font-size: 33px; }
  .mode-status { display: none; }
  .corner-mark { display: none; }
  .mode-nav { bottom: 22px; width: calc(100% - 40px); }
  .mode-btn { flex: 1; min-width: 0; padding-left: 6px; padding-right: 6px; }
  .mode-btn span { display: none; }
}

@media (max-width: 560px) {
  .brand-digikrom { font-size: 7px; }
  .brand-racecraft { font-size: 11px; }
  .top-actions { gap: 12px; }
  .car-meta { bottom: 98px; }
  .meta-index, .meta-driver, .text-action { display: none; }
  .meta-year { margin-bottom: 5px; }
  .car-meta h1 { font-size: 28px; }
  .panel { padding-left: 24px; padding-right: 24px; }
  .garage-grid { grid-template-columns: 1fr; }
  .future-card { min-height: 110px; }
  .timeline-preview { overflow: hidden; gap: 3px; }
  .timeline-preview span:nth-of-type(n+5), .timeline-preview i:nth-of-type(n+5) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* =========================================================
   RACECRAFT v0.2.0 — GARAGE / MULTI-CAR ARCHIVE
   ========================================================= */

.car-meta h1 .meta-constructor { color: var(--fg); font-weight: 620; }
.car-meta h1 #meta-model { color: rgba(244,241,235,.56); font-weight: 350; }
.car-meta.is-updating { opacity: .18; transform: translateY(-50%) translateX(-8px); }

.car-transition {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 46%, rgba(255,255,255,.025), transparent 30%),
    rgba(3,3,3,.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .48s ease, visibility .48s ease;
}
.car-transition.is-active { opacity: 1; visibility: visible; }
.transition-copy { text-align: center; display: grid; gap: 5px; transform: translateY(-8px); }
.transition-copy span { color: var(--accent); font-size: 9px; letter-spacing: .28em; }
.transition-copy strong { font-size: clamp(27px, 4vw, 52px); font-weight: 540; letter-spacing: -.035em; }
.transition-copy small { margin-top: 7px; color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.transition-line { position: absolute; left: 50%; bottom: 31%; width: min(360px, 62vw); height: 1px; transform: translateX(-50%); background: rgba(255,255,255,.1); overflow: hidden; }
.transition-line i { display: block; width: 0%; height: 100%; background: var(--accent); transition: width .18s linear; }

.panel-garage { width: min(760px, 100%); }
.garage-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 29px; }
.garage-heading-row h2 { margin-bottom: 0; }
.garage-count { padding-bottom: 7px; color: var(--muted); font-size: 8px; letter-spacing: .18em; white-space: nowrap; }

.timeline-wrap { margin: 8px 0 26px; padding: 19px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.timeline-labels { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: var(--muted); font-size: 8px; letter-spacing: .17em; }
.timeline-all { border: 0; padding: 0; background: transparent; color: rgba(244,241,235,.35); cursor: pointer; font-size: 8px; letter-spacing: .14em; }
.timeline-all:hover, .timeline-all.is-active { color: var(--fg); }
.garage-timeline { display: flex; width: 100%; min-height: 42px; align-items: flex-start; }
.timeline-year {
  position: relative;
  flex: 1;
  min-width: 100px;
  border: 0;
  padding: 21px 8px 0;
  background: transparent;
  color: rgba(244,241,235,.34);
  cursor: pointer;
  text-align: center;
  font-size: 8px;
  letter-spacing: .13em;
}
.timeline-year::before { content: ''; position: absolute; top: 8px; left: 0; right: 0; height: 1px; background: var(--line); }
.timeline-year:first-child::before { left: 50%; }
.timeline-year:last-child::before { right: 50%; }
.timeline-year::after { content: ''; position: absolute; top: 4px; left: 50%; width: 9px; height: 9px; border: 1px solid rgba(244,241,235,.36); background: #080808; transform: translateX(-50%) rotate(45deg); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.timeline-year:hover { color: var(--fg); }
.timeline-year.is-active { color: var(--fg); }
.timeline-year.is-active::after { border-color: var(--accent); background: var(--accent); transform: translateX(-50%) rotate(45deg) scale(1.05); }
.timeline-year small { display: block; margin-top: 4px; color: rgba(244,241,235,.24); font-size: 7px; letter-spacing: .1em; }
.timeline-year.is-active small { color: var(--accent); }

.garage-selection { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; }
.garage-selection span { color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.garage-selection strong { font-size: 9px; font-weight: 500; letter-spacing: .15em; }

.garage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.car-card { overflow: hidden; transition: border-color .24s ease, background .24s ease, transform .24s ease; }
.car-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.03); }
.car-card.is-selected { border-color: rgba(237,32,36,.62); }
.car-card-no-row { display: flex; width: 100%; justify-content: space-between; gap: 16px; }
.car-card-no, .car-card-year { margin: 0; }
.car-card-year { color: var(--accent); }
.car-card-body { margin-top: auto; display: grid; width: 100%; gap: 5px; }
.car-card-body strong { font-size: 23px; line-height: .92; letter-spacing: -.035em; font-weight: 540; }
.car-card-model { color: rgba(244,241,235,.53); font-weight: 350; }
.car-card-body small { margin-top: 4px; color: var(--muted); font-size: 8px; letter-spacing: .13em; }
.car-card-number { position: absolute; right: -2px; bottom: -18px; color: rgba(244,241,235,.035); font-size: 96px; font-weight: 700; line-height: 1; letter-spacing: -.08em; pointer-events: none; }
.car-card i { z-index: 1; }

.garage-empty { grid-column: 1 / -1; padding: 44px 20px; border: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 9px; letter-spacing: .16em; }
.garage-footnote { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.garage-footnote span { color: var(--fg); font-size: 8px; letter-spacing: .14em; }
.garage-footnote small { color: var(--muted); text-align: right; font-size: 8px; line-height: 1.45; letter-spacing: .06em; }

.credits-list { display: grid; gap: 24px; }
.credit-entry { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.credit-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.credit-entry .credit-entry-index { color: var(--accent); font-size: 8px; letter-spacing: .18em; }
.credit-entry h3 { margin: 8px 0 7px; font-size: 17px; font-weight: 500; letter-spacing: -.02em; }
.credit-entry p { margin: 0; }
.credit-entry .credit-license-note { margin-top: 9px; color: rgba(244,241,235,.38); font-size: 10px; }
.credit-entry .credit-links { margin-top: 14px; }

@media (max-width: 840px) {
  .car-meta.is-updating { transform: translateX(-8px); }
  .panel-garage { width: 100%; }
  .garage-timeline { overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .timeline-year { flex: 0 0 116px; }
  .garage-footnote { flex-direction: column; }
  .garage-footnote small { text-align: left; }
}

@media (max-width: 560px) {
  .garage-heading-row { align-items: flex-start; }
  .garage-heading-row h2 { font-size: 37px; }
  .garage-grid { grid-template-columns: 1fr; }
  .car-card { min-height: 185px; }
  .garage-selection { display: grid; gap: 5px; }
  .transition-line { bottom: 27%; }
}
.car-transition.is-active { pointer-events: auto; }

/* =========================================================
   RACECRAFT v0.3.0 — CINEMATIC DETAILS / CAMERA DIRECTOR
   ========================================================= */

.cinematic-copy {
  margin: -12px 0 22px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
.cinematic-copy span,
.archive-data-label {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .18em;
}
.cinematic-copy p {
  margin: 8px 0 0;
  max-width: 48ch;
  color: rgba(244,241,235,.46);
  font-size: 11px;
  line-height: 1.6;
}
.details-shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 30px;
}
.detail-shot-card {
  position: relative;
  min-height: 105px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.015);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: border-color .22s ease, background .22s ease, transform .22s ease;
}
.detail-shot-card:hover {
  transform: translateY(-1px);
  border-color: rgba(244,241,235,.45);
  background: rgba(255,255,255,.028);
}
.detail-shot-card.is-active { border-color: rgba(237,32,36,.62); }
.detail-shot-card > span { display: block; color: var(--accent); font-size: 7px; letter-spacing: .18em; }
.detail-shot-card strong { display: block; margin-top: 12px; font-size: 13px; font-weight: 520; letter-spacing: .06em; }
.detail-shot-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 7px; letter-spacing: .10em; }
.detail-shot-card i { position: absolute; top: 13px; right: 12px; color: rgba(244,241,235,.27); font-size: 7px; font-style: normal; letter-spacing: .12em; }
.detail-shot-card.is-active i { color: var(--accent); }
.archive-data-label { margin: 4px 0 12px; }

.detail-shot-nav {
  right: 34px;
  top: 50%;
  width: 174px;
  transform: translateY(-50%) translateX(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s ease, transform .6s cubic-bezier(.17,.84,.23,1), visibility .45s ease;
}
.detail-shot-nav.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.detail-shot-head {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.detail-shot-head span { color: var(--accent); font-size: 7px; letter-spacing: .18em; }
.detail-shot-head strong { font-size: 11px; font-weight: 520; letter-spacing: .17em; }
.detail-shot-buttons { display: grid; }
.detail-shot-dot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border: 0;
  border-right: 1px solid rgba(244,241,235,.12);
  padding: 7px 10px 7px 0;
  background: transparent;
  color: rgba(244,241,235,.34);
  cursor: pointer;
  font-size: 8px;
  letter-spacing: .13em;
  transition: color .2s ease, border-color .2s ease;
}
.detail-shot-dot span { color: rgba(244,241,235,.2); font-size: 7px; }
.detail-shot-dot:hover { color: var(--fg); }
.detail-shot-dot.is-active { color: var(--fg); border-right-color: var(--accent); }
.detail-shot-dot.is-active span { color: var(--accent); }
.detail-exit {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 14px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: right;
  font-size: 8px;
  letter-spacing: .14em;
}
.detail-exit:hover { color: var(--fg); }
.detail-exit span { margin-left: 4px; color: var(--accent); }
.is-detail-mode .mode-status { opacity: 0; pointer-events: none; }
.is-detail-mode .car-meta { opacity: .55; }

@media (max-width: 840px) {
  .detail-shot-nav {
    top: 82px;
    right: 20px;
    width: 150px;
    transform: translateX(18px);
  }
  .detail-shot-nav.is-visible { transform: translateX(0); }
  .detail-shot-head { margin-bottom: 10px; }
  .detail-shot-dot { padding-top: 5px; padding-bottom: 5px; }
}

@media (max-width: 560px) {
  .details-shot-grid { grid-template-columns: 1fr; }
  .detail-shot-nav {
    top: 76px;
    right: 16px;
    width: 130px;
  }
  .detail-shot-head strong { font-size: 9px; }
  .detail-shot-dot { font-size: 7px; }
}


/* =========================================================
   RACECRAFT v0.4.1 — WASD INPUT HOTFIX
   ========================================================= */
.drive-label {
  left: auto;
  right: 34px;
  top: auto;
  bottom: 88px;
  width: min(330px, calc(100vw - 68px));
  transform: translateY(14px);
  text-align: right;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease, transform .5s ease;
}
.drive-label.is-visible { opacity: 1; transform: translateY(0); }
.drive-hud-head { display: grid; gap: 4px; justify-items: end; }
.drive-hud-head span { color: var(--accent); font-size: 8px; letter-spacing: .22em; }
.drive-hud-head small { color: var(--muted); font-size: 7px; letter-spacing: .16em; }
.drive-hud-readout { display: flex; justify-content: flex-end; align-items: flex-end; gap: 25px; margin-top: 13px; }
.drive-speed { display: flex; align-items: baseline; gap: 8px; }
.drive-speed strong { font-size: clamp(40px, 4.6vw, 68px); font-weight: 320; line-height: .86; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.drive-speed span { color: var(--muted); font-size: 7px; letter-spacing: .14em; }
.drive-gear { display: grid; gap: 3px; min-width: 28px; text-align: center; }
.drive-gear span { color: var(--muted); font-size: 7px; letter-spacing: .13em; }
.drive-gear strong { color: var(--fg); font-size: 22px; font-weight: 450; line-height: 1; }
.drive-hud-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--line); }
.drive-hud-controls span { color: rgba(244,241,235,.34); font-size: 7px; letter-spacing: .10em; white-space: nowrap; }
.drive-hud-controls b { color: rgba(244,241,235,.72); font-weight: 550; }
.is-drive-mode .car-meta { opacity: .42; }
.is-drive-mode .mode-status { opacity: .55; }
.is-drive-mode .text-action { pointer-events: none; opacity: .24; }

@media (max-width: 840px) {
  .drive-label { right: 20px; bottom: 86px; width: min(310px, calc(100vw - 40px)); }
  .drive-hud-controls { grid-template-columns: 1fr; justify-items: end; }
  .is-drive-mode .car-meta { opacity: .18; }
}

@media (max-width: 560px) {
  .drive-label { left: 20px; right: 20px; width: auto; bottom: 90px; }
  .drive-hud-readout { gap: 18px; }
  .drive-speed strong { font-size: 40px; }
  .drive-hud-controls { display: none; }
  .drive-hud-head small::after { content: ' · KEYBOARD DRIVE'; }
}


/* =========================================================
   RACECRAFT v0.4.2 — MOBILE DRIVE CONTROLS
   ========================================================= */
.mobile-drive-controls {
  display: none;
  position: absolute;
  z-index: 12;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 66px));
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}
.is-touch-device.is-drive-mode .mobile-drive-controls {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.mobile-steer-wrap { display: grid; gap: 7px; }
.mobile-control-label { color: rgba(244,241,235,.45); font-size: 7px; letter-spacing: .18em; }
.mobile-steer {
  position: relative;
  width: 146px;
  height: 70px;
  border: 1px solid rgba(244,241,235,.18);
  background: rgba(7,7,7,.46);
  backdrop-filter: blur(8px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
.mobile-steer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.018), transparent 30%, transparent 70%, rgba(255,255,255,.018));
  pointer-events: none;
}
.mobile-steer-axis { position: absolute; left: 50%; top: 11px; bottom: 11px; width: 1px; background: rgba(244,241,235,.13); transform: translateX(-50%); }
.mobile-steer-handle {
  position: absolute;
  left: 50%; top: 50%;
  width: 24px; height: 24px;
  border: 1px solid rgba(244,241,235,.66);
  background: rgba(244,241,235,.09);
  transform: translate3d(-50%, -50%, 0);
  transition: border-color .15s ease, background .15s ease;
  pointer-events: none;
}
.mobile-steer.is-active .mobile-steer-handle { border-color: var(--accent); background: rgba(237,32,36,.15); }
.mobile-steer-left, .mobile-steer-right { position: absolute; top: 50%; transform: translateY(-50%); color: rgba(244,241,235,.34); font-size: 15px; }
.mobile-steer-left { left: 12px; }
.mobile-steer-right { right: 12px; }
.mobile-drive-actions { display: flex; gap: 7px; align-items: end; }
.mobile-drive-mini,
.mobile-pedal {
  border: 1px solid rgba(244,241,235,.19);
  background: rgba(7,7,7,.48);
  color: rgba(244,241,235,.74);
  backdrop-filter: blur(8px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.mobile-drive-mini { height: 34px; padding: 0 10px; font-size: 7px; letter-spacing: .12em; }
.mobile-drive-mini:active { border-color: rgba(244,241,235,.55); color: var(--fg); }
.mobile-pedals { display: flex; gap: 8px; align-items: end; }
.mobile-pedal {
  width: 66px;
  height: 86px;
  display: grid;
  place-content: center;
  gap: 5px;
}
.mobile-pedal span { font-size: 20px; line-height: 1; }
.mobile-pedal small { font-size: 6px; letter-spacing: .12em; }
.mobile-pedal-throttle span { color: var(--accent); }
.mobile-pedal.is-pressed { border-color: rgba(244,241,235,.68); background: rgba(244,241,235,.09); }
.mobile-pedal-throttle.is-pressed { border-color: var(--accent); background: rgba(237,32,36,.13); }
.is-touch-device .drive-hud-controls { display: none; }
.is-touch-device.is-drive-mode .mode-nav { opacity: .32; }
.is-touch-device.is-drive-mode .mode-status small { display: none; }

@media (max-width: 740px) {
  .is-touch-device .drive-label {
    top: max(74px, calc(env(safe-area-inset-top) + 62px));
    right: max(16px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: auto;
  }
  .is-touch-device .drive-hud-head small { display: none; }
  .is-touch-device .drive-hud-readout { margin-top: 8px; gap: 15px; }
  .is-touch-device .drive-speed strong { font-size: 34px; }
  .is-touch-device .drive-gear strong { font-size: 18px; }
  .is-touch-device .drive-label { text-align: right; }
  .is-touch-device .drive-hud-head { justify-items: end; }
}

@media (max-width: 560px) and (orientation: portrait) {
  .mobile-drive-controls { bottom: max(78px, calc(env(safe-area-inset-bottom) + 72px)); }
  .mobile-steer { width: 126px; height: 66px; }
  .mobile-pedals { gap: 6px; }
  .mobile-pedal { width: 58px; height: 78px; }
  .mobile-drive-actions { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); flex-direction: column; }
  .mobile-drive-mini { width: 60px; padding: 0 5px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .mobile-drive-controls { bottom: max(20px, env(safe-area-inset-bottom)); }
  .mobile-steer { width: 150px; height: 62px; }
  .mobile-pedal { width: 62px; height: 70px; }
  .mobile-drive-actions { align-self: center; }
  .is-touch-device .drive-label { top: max(62px, calc(env(safe-area-inset-top) + 48px)); }
  .is-touch-device.is-drive-mode .mode-nav { opacity: .18; pointer-events: none; }
}


/* =========================================================
   RACECRAFT v0.6.0 — FORMULA FX
   Speed-reactive DRIVE only. STUDIO remains visually locked.
   ========================================================= */
.speed-fx-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at 50% 53%,
      rgba(255,255,255,0) 0%,
      rgba(255,255,255,0) 44%,
      rgba(214,221,228,.014) 61%,
      rgba(214,221,228,.045) 82%,
      rgba(214,221,228,.085) 100%);
  mix-blend-mode: screen;
  transition: opacity .10s linear;
}
.speed-fx-overlay::before,
.speed-fx-overlay::after {
  content: '';
  position: absolute;
  inset: -12%;
  opacity: .34;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(255,255,255,.018) 8.2%, transparent 8.45%),
    linear-gradient(90deg, transparent 0 91%, rgba(255,255,255,.015) 91.2%, transparent 91.45%);
  filter: blur(1px);
}
.speed-fx-overlay::after {
  inset: -20%;
  opacity: .18;
  transform: scale(1.08);
  background:
    radial-gradient(ellipse at center, transparent 0 55%, rgba(255,255,255,.045) 77%, transparent 78%),
    radial-gradient(ellipse at center, transparent 0 68%, rgba(255,255,255,.025) 88%, transparent 89%);
}
.app:not(.is-drive-mode) .speed-fx-overlay { opacity: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .speed-fx-overlay { display: none; }
}

/* =========================================================
   RACECRAFT v0.6.2 — GARAGE UX POLISH
   Timeline navigation, readable card corner, DIGIKROM signature.
   ========================================================= */

.powered-by {
  right: 34px;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(244,241,235,.28);
  font-size: 7px;
  letter-spacing: .14em;
  text-transform: lowercase;
}
.powered-by > span { white-space: nowrap; }
.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(244,241,235,.54);
  text-decoration: none;
  transition: color .2s ease, opacity .2s ease;
}
.powered-by a > span { font-size: 7px; letter-spacing: .11em; }
.powered-by img {
  display: block;
  width: 90px;
  height: 20px;
  object-fit: contain;
  opacity: .58;
  transition: opacity .2s ease;
}
.powered-by a:hover { color: var(--fg); }
.powered-by a:hover img { opacity: .92; }

.car-card-no-row { align-items: flex-start; }
.car-card-corner {
  display: grid;
  justify-items: end;
  gap: 6px;
  margin-left: auto;
  min-width: 74px;
  text-align: right;
}
.car-card .car-card-corner .car-card-year {
  margin: 0;
  color: rgba(244,241,235,.42);
  font-size: 8px;
  line-height: 1;
  letter-spacing: .18em;
  transition: color .2s ease;
}
.car-card .car-card-corner i {
  position: static;
  display: block;
  color: rgba(244,241,235,.34);
  font-size: 6px;
  line-height: 1.15;
  letter-spacing: .13em;
  white-space: nowrap;
  transition: color .2s ease;
}
.car-card.is-selected .car-card-corner .car-card-year,
.car-card.is-selected .car-card-corner i { color: var(--accent); }
.car-card:not(.is-selected):hover .car-card-corner .car-card-year,
.car-card:not(.is-selected):hover .car-card-corner i { color: var(--fg); }

.garage-timeline {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  cursor: grab;
  touch-action: pan-x;
}
.garage-timeline::-webkit-scrollbar { display: none; }
.garage-timeline.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
  scroll-behavior: auto;
}
.timeline-year { flex: 1 0 100px; }

.timeline-nav {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  min-height: 23px;
}
.timeline-nav[hidden] { display: none; }
.timeline-nav-btn {
  width: 28px;
  height: 23px;
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(244,241,235,.44);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: color .2s ease, opacity .2s ease;
}
.timeline-nav-btn:first-child { text-align: left; }
.timeline-nav-btn:last-child { text-align: right; }
.timeline-nav-btn:hover:not(:disabled) { color: var(--fg); }
.timeline-nav-btn:disabled { opacity: .16; cursor: default; }
.timeline-nav-center {
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.timeline-nav-center > span {
  color: rgba(244,241,235,.25);
  font-size: 6px;
  letter-spacing: .15em;
  white-space: nowrap;
}
.timeline-nav-track {
  position: relative;
  height: 1px;
  background: rgba(244,241,235,.12);
}
.timeline-nav-track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(237,32,36,.72);
  transition: width .08s linear;
}
.timeline-nav-track b {
  position: absolute;
  left: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(237,32,36,.82);
  background: #080808;
  transform: translate(-50%, -50%) rotate(45deg);
  transition: left .08s linear;
}

@media (max-width: 840px) {
  .powered-by {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
  }
  .powered-by a > span { display: none; }
  .powered-by img { width: 72px; height: 16px; }
  .garage-timeline { padding-bottom: 3px; }
}

@media (max-width: 560px) {
  .powered-by > span { display: none; }
  .powered-by img { width: 66px; height: auto; opacity: .48; }
  .timeline-nav { grid-template-columns: 24px minmax(0,1fr) 24px; gap: 8px; }
  .timeline-nav-btn { width: 24px; }
  .timeline-nav-center > span { font-size: 5px; letter-spacing: .1em; }
  .car-card-corner { min-width: 68px; }
}

/* v0.7.0 — sound toggle stays deliberately minimal; red means active. */
#sound-btn.is-active { text-shadow: 0 0 18px rgba(237,32,36,.18); }


/* v0.8.0 — compatibility fallback. Invisible during normal WebGL operation. */
.compatibility-fallback {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 32px;
  background: #050505;
  color: var(--fg, #f4f1eb);
}
.no-webgl .compatibility-fallback { display: grid; }
.compatibility-fallback > div { width: min(560px, 100%); border-left: 1px solid var(--accent, #ed2024); padding: 4px 0 4px 22px; }
.compatibility-fallback span { display: block; margin-bottom: 14px; color: rgba(244,241,235,.38); font-size: 8px; letter-spacing: .2em; }
.compatibility-fallback strong { display: block; font-size: clamp(24px, 5vw, 48px); font-weight: 400; letter-spacing: .04em; }
.compatibility-fallback p { max-width: 48ch; margin: 16px 0 0; color: rgba(244,241,235,.55); font-size: 11px; line-height: 1.7; letter-spacing: .04em; }
.no-webgl #racecraft-canvas, .no-webgl .ui-layer, .no-webgl .loader, .no-webgl .ambient-noise, .no-webgl .vignette { display: none !important; }


/* v1.1.0 — SPECIALS */
.garage-collections {
  display: flex;
  gap: 8px;
  padding: 0 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  margin-bottom: 22px;
}
.collection-tab {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: rgba(255,255,255,.42);
  min-width: 112px;
  height: 34px;
  padding: 0 14px;
  font: inherit;
  font-size: 10px;
  letter-spacing: .18em;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.collection-tab span { color: rgba(255,255,255,.22); margin-right: 8px; }
.collection-tab:hover:not(:disabled) { color: #fff; border-color: rgba(255,255,255,.42); }
.collection-tab.is-active { color: #fff; border-color: rgba(255,255,255,.72); background: rgba(255,255,255,.025); }
.collection-tab.is-active span { color: #ff3333; }
.collection-tab:disabled { opacity: .24; cursor: default; }
.car-card.is-special-card .car-card-number {
  font-size: clamp(70px, 7vw, 118px);
  letter-spacing: -.08em;
  opacity: .035;
}
.mode-btn:disabled {
  opacity: .20;
  cursor: default;
  pointer-events: none;
}
.is-special-entry .meta-index { color: rgba(255,255,255,.48); }
.is-special-entry .meta-index::first-letter { color: #ff3333; }
#timeline-wrap[hidden], #garage-filters[hidden] { display: none !important; }
@media (max-width: 760px) {
  .garage-collections { padding-bottom: 16px; margin-bottom: 16px; }
  .collection-tab { flex: 1 1 0; min-width: 0; }
}
