/* ============ TRAPEX EV FIGHTER — Simulation UI ============ */
:root {
  --bg: #050507;
  --panel: rgba(12, 12, 16, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e7e7ea;
  --muted: #8a8a93;
  --accent: #ff4614;
  --accent2: #f97316;
  --red: #e02424;
  --green: #2dd4731a;
  --ok: #34d399;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; position: absolute; inset: 0; }

.hidden { display: none !important; }

/* ============ FADER ============ */
#fader {
  position: absolute; inset: 0; background: #000;
  opacity: 0; pointer-events: none; transition: opacity 0.7s ease;
  z-index: 60;
}
#fader.on { opacity: 1; pointer-events: all; }

/* ============ INTRO ============ */
#intro {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 55% at 70% 20%, rgba(150, 35, 8, 0.28), transparent 60%),
    radial-gradient(ellipse 70% 60% at 25% 85%, rgba(70, 16, 4, 0.25), transparent 65%),
    #030304;
  transition: opacity 0.8s ease;
}
#intro.fading { opacity: 0; pointer-events: none; }

.intro-inner { text-align: center; padding: 24px; max-width: 860px; }

#logoAnim {
  font-style: italic; font-weight: 900;
  font-size: clamp(64px, 11vw, 132px);
  letter-spacing: 0.01em; line-height: 1;
  color: #fff; user-select: none;
}
#logoAnim .lt {
  display: inline-block; opacity: 0;
  transform: translateY(0.55em);
  animation: ltDrop 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
#logoAnim .lt:nth-child(1) { animation-delay: 0.25s; }
#logoAnim .lt:nth-child(2) { animation-delay: 0.35s; }
#logoAnim .lt:nth-child(3) { animation-delay: 0.45s; }
#logoAnim .lt:nth-child(4) { animation-delay: 0.55s; }
#logoAnim .lt:nth-child(5) { animation-delay: 0.65s; }
#logoAnim .lt:nth-child(6) { animation-delay: 0.75s; }
@keyframes ltDrop { to { opacity: 1; transform: translateY(0); } }

.logo-line {
  width: 0; height: 2px; margin: 18px auto 14px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: lineGrow 0.7s ease-out 1.15s forwards;
}
@keyframes lineGrow { to { width: min(420px, 60vw); } }

.logo-sub {
  font-weight: 300; letter-spacing: 0.65em; text-indent: 0.65em;
  font-size: clamp(15px, 2.4vw, 26px); color: #fff;
  opacity: 0; animation: fadeUp 0.8s ease 1.5s forwards;
}
.tagline {
  margin-top: 34px; color: var(--muted); font-size: 13px;
  letter-spacing: 0.3em; text-transform: uppercase;
  opacity: 0; animation: fadeUp 0.8s ease 1.9s forwards;
}
.tagline2 {
  margin-top: 10px; color: var(--text); font-size: clamp(15px, 2vw, 19px);
  font-weight: 500;
  opacity: 0; animation: fadeUp 0.8s ease 2.1s forwards;
}
.intro-foot {
  margin-top: 26px; color: #55555e; font-size: 11px; letter-spacing: 0.08em;
  opacity: 0; animation: fadeUp 0.8s ease 2.8s forwards;
}
.intro-credit {
  margin-top: 9px; color: #44444c; font-size: 10px; letter-spacing: 0.05em;
  opacity: 0; animation: fadeUp 0.8s ease 3.1s forwards;
}
.intro-credit a { color: #6a6a74; text-decoration: none; border-bottom: 1px solid #33333a; }
.intro-credit a:hover { color: #9a9aa6; border-bottom-color: #55555e; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.btn-major {
  position: relative;
  margin-top: 38px; padding: 18px 52px;
  font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0.35em;
  color: #fff; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  cursor: pointer; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0; animation: fadeUp 0.8s ease 2.4s forwards;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  overflow: hidden;
}
.btn-major::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg); transition: all 0.7s ease;
}
.btn-major:hover { 
  background: rgba(255, 70, 20, 0.15); border-color: rgba(255, 70, 20, 0.6); 
  transform: translateY(-4px) scale(1.02); 
  box-shadow: 0 15px 40px rgba(255, 70, 20, 0.25), 0 0 20px rgba(255, 70, 20, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2); 
  color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}
.btn-major:hover::before { left: 150%; }
.btn-major:active { transform: translateY(0) scale(0.98); }

/* ---- language select ---- */
#langSelect {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px; padding: 24px;
  background: inherit;
}
.lang-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.lang-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 240px; padding: 36px 20px;
  font-family: inherit; color: var(--text);
  background: rgba(20, 20, 25, 0.6); border: 1px solid rgba(255, 255, 255, 0.08); 
  border-radius: 20px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  cursor: pointer; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.lang-btn::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.5s ease;
}
.lang-btn:hover:not(:disabled) {
  transform: translateY(-6px) scale(1.02); 
  background: rgba(255, 70, 20, 0.08);
  border-color: rgba(255, 70, 20, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 70, 20, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.lang-btn:hover:not(:disabled)::before {
  opacity: 1;
  background: radial-gradient(circle at 50% 0%, rgba(255, 70, 20, 0.2) 0%, transparent 70%);
}
.lang-btn:disabled { opacity: 0.3; cursor: not-allowed; filter: grayscale(100%); }
.lang-btn .lang-name { 
  position: relative; z-index: 2;
  font-size: 26px; font-weight: 900; font-style: italic; letter-spacing: 0.06em; 
  text-shadow: 0 4px 12px rgba(0,0,0,0.8);
  transition: all 0.4s ease;
}
.lang-btn:hover:not(:disabled) .lang-name {
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}
.lang-btn .lang-native { 
  position: relative; z-index: 2;
  font-size: 11px; font-weight: 700; letter-spacing: 0.25em; color: var(--accent2); text-transform: uppercase; 
  transition: all 0.4s ease;
}
.lang-btn:hover:not(:disabled) .lang-native {
  color: #ffaa66;
  text-shadow: 0 0 12px rgba(255, 70, 20, 0.6);
}

/* ---- scenario select ---- */
#select {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px; padding: 24px;
  background: inherit;
}
.select-title { font-size: 15px; font-weight: 600; letter-spacing: 0.5em; text-indent: 0.5em; color: var(--muted); }
.cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; max-width: 1100px; }
.card {
  width: 300px; padding: 0 0 20px; border-radius: 16px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--panel-border);
  cursor: pointer; transition: all 0.25s ease;
}
.card:hover { transform: translateY(-5px); border-color: rgba(255, 70, 20, 0.6); box-shadow: 0 18px 50px rgba(255, 70, 20, 0.18); }
.card-art { height: 130px; margin-bottom: 16px; background-size: cover; background-position: center; }
.art-garage { background: linear-gradient(180deg, rgba(10,10,14,0) 25%, rgba(10,10,14,0.65) 100%), url('../images/trapex_garage.jpg') center/cover; }
.art-street { background: linear-gradient(180deg, rgba(5,6,10,0) 25%, rgba(5,6,10,0.65) 100%), url('../images/trapex_street.jpg') center/cover; }
.art-hub    { background: linear-gradient(180deg, rgba(6,8,10,0) 25%, rgba(6,8,10,0.65) 100%), url('../images/trapex_hub.jpg') center/cover; }
.card h3 { padding: 0 18px; font-size: 16px; font-weight: 800; font-style: italic; letter-spacing: 0.04em; }
.card p { padding: 8px 18px 12px; font-size: 13px; color: var(--muted); line-height: 1.5; min-height: 64px; }
.card-tag {
  display: inline-block; margin: 0 18px; padding: 5px 10px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em;
  color: var(--accent2); background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25); border-radius: 6px;
}

.btn-ghost {
  padding: 12px 26px; font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.2em;
  color: var(--text); background: transparent; border: 1px solid #3a3a42; border-radius: 10px;
  cursor: pointer; transition: all 0.2s ease;
}
.btn-ghost:hover { border-color: #777; background: rgba(255,255,255,0.05); }
.btn-ghost.small { padding: 9px 18px; font-size: 11px; }

/* ============ HUD ============ */
#hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: auto; }

#brandChip {
  position: absolute; top: 22px; left: 26px;
  font-style: italic; font-weight: 900; font-size: 21px; color: #fff;
  letter-spacing: 0.02em; user-select: none;
}
#brandChip span {
  font-style: normal; font-weight: 300; font-size: 11px; letter-spacing: 0.45em;
  color: var(--muted); display: block; margin-top: 1px;
}

#telemetry {
  position: absolute; top: 22px; right: 26px; width: 190px;
  padding: 13px 16px 15px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px;
  backdrop-filter: blur(10px);
}
#telemetry label { font-size: 9px; font-weight: 600; letter-spacing: 0.22em; color: var(--muted); }
#tempVal {
  margin-top: 4px; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ok); transition: color 0.5s ease;
}
#tempVal.warm { color: #fbbf24; }
#tempVal.hot { color: var(--accent); }
#tempBar { margin-top: 9px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
#tempBar i {
  display: block; height: 100%; width: 2%;
  background: linear-gradient(90deg, #34d399, #fbbf24 45%, #ff4614 75%, #ff1f0f);
  border-radius: 2px; transition: width 0.4s ease;
}

#alert {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  padding: 11px 22px; border-radius: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.18em;
  background: rgba(190, 24, 24, 0.16); border: 1px solid rgba(255, 60, 40, 0.55);
  color: #ff6a4d; backdrop-filter: blur(8px);
  animation: alertPulse 1.1s ease-in-out infinite;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
#alert.ok {
  background: rgba(16, 120, 80, 0.16); border-color: rgba(52, 211, 153, 0.55);
  color: var(--ok); animation: none;
}
@keyframes alertPulse { 50% { border-color: rgba(255, 60, 40, 0.15); } }

#captions {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  width: min(780px, 92vw); text-align: center; pointer-events: none;
}
#capTitle {
  font-size: clamp(20px, 3.2vw, 32px); font-weight: 900; font-style: italic;
  letter-spacing: 0.03em; color: #fff; text-shadow: 0 2px 30px rgba(0,0,0,0.9);
  opacity: 0; transition: opacity 0.6s ease, transform 0.6s ease; transform: translateY(8px);
}
#capSub {
  margin-top: 8px; font-size: clamp(13px, 1.6vw, 16px); color: #c9c9d2; line-height: 1.55;
  text-shadow: 0 1px 18px rgba(0,0,0,0.95);
  opacity: 0; transition: opacity 0.6s ease 0.15s, transform 0.6s ease 0.15s; transform: translateY(8px);
}
#captions.show #capTitle, #captions.show #capSub { opacity: 1; transform: translateY(0); }

#statCard {
  position: absolute; left: 26px; bottom: 150px; width: 280px;
  padding: 18px 20px;
  background: var(--panel); border: 1px solid var(--panel-border); border-left: 3px solid var(--accent);
  border-radius: 14px; backdrop-filter: blur(10px);
  animation: fadeUp 0.6s ease;
}
#statCard .num { font-size: 36px; font-weight: 900; color: #fff; line-height: 1.05; }
#statCard .lbl { margin-top: 6px; font-size: 13px; color: var(--text); line-height: 1.45; }
#statCard .src { margin-top: 10px; font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }

#beatDots {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%);
  display: flex; gap: 8px; pointer-events: none;
}
#beatDots i {
  width: 26px; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.16);
  transition: background 0.4s ease;
}
#beatDots i.done { background: rgba(255,255,255,0.45); }
#beatDots i.now { background: var(--accent); }

#controlsBar {
  position: absolute; right: 26px; bottom: 22px;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
#controlsBar button {
  padding: 10px 16px; font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--text); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  cursor: pointer; backdrop-filter: blur(10px); transition: all 0.2s ease;
}
#controlsBar button:hover { border-color: rgba(255, 70, 20, 0.6); color: #fff; }
#controlsBar button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#btnMute { padding: 9px 13px; display: flex; align-items: center; justify-content: center; }
#btnMute svg { width: 15px; height: 15px; display: block; }
#btnMute.active { background: var(--panel); border-color: var(--panel-border); color: var(--muted); }

#hint {
  position: absolute; left: 26px; bottom: 26px;
  font-size: 10.5px; letter-spacing: 0.14em; color: var(--muted);
  padding: 10px 14px; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; backdrop-filter: blur(8px);
}
#hint b { color: var(--text); }

/* hide cinematic overlays while the product inspector is open */
#hud.inspector-open #captions,
#hud.inspector-open #beatDots,
#hud.inspector-open #telemetry,
#hud.inspector-open #statCard,
#hud.inspector-open #alert { display: none; }

/* ============ INSPECTOR ============ */
#inspector { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
#inspectorPanel {
  position: absolute; top: 50%; right: 30px; transform: translateY(-50%);
  width: min(330px, 86vw); padding: 26px 26px 22px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px;
  backdrop-filter: blur(14px); pointer-events: auto;
}
#insTitle { font-size: 22px; font-weight: 900; font-style: italic; color: #fff; }
#insSpecs { margin: 16px 0 4px; list-style: none; }
#insSpecs li {
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12.5px; color: var(--text); line-height: 1.5;
  display: flex; justify-content: space-between; gap: 14px;
}
#insSpecs li b { color: var(--muted); font-weight: 600; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; flex-shrink: 0; padding-top: 1px; }
#insSpecs li span { text-align: right; }
#insSpecs li.desc { display: block; color: #b9b9c2; font-size: 12px; }
.ins-switch { display: flex; gap: 8px; margin: 18px 0 14px; }
.ins-switch button {
  flex: 1; padding: 10px 0; font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  background: transparent; color: var(--muted); border: 1px solid #3a3a42; border-radius: 9px; cursor: pointer;
  transition: all 0.2s ease;
}
.ins-switch button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#insClose { width: 100%; }

/* ============ RESPONSIVE ============ */
@media (max-width: 760px) {
  #brandChip { font-size: 16px; }
  #telemetry { width: 150px; padding: 10px 13px; top: 16px; right: 16px; }
  #tempVal { font-size: 22px; }
  #statCard { width: 220px; left: 16px; bottom: 170px; padding: 13px 15px; }
  #statCard .num { font-size: 26px; }
  #captions { bottom: 120px; }
  #controlsBar { right: 12px; bottom: 14px; gap: 6px; }
  #controlsBar button { padding: 9px 11px; font-size: 10px; }
  #alert { font-size: 10px; padding: 9px 13px; top: 116px; }
  #beatDots { display: none; }
  #hint { display: none; }
}
