:root {
  --bg: #0d1321;
  --panel: #151d2f;
  --panel-2: #1d2940;
  --text: #f8fafc;
  --muted: #a7b4c9;
  --accent: #ff7a1a;
  --accent-2: #ffb25c;
  --success: #43d17b;
  --danger: #ff5a6b;
  --line: rgba(255,255,255,.1);
  --shadow: 0 22px 70px rgba(0,0,0,.35);
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 8%, rgba(255,122,26,.14), transparent 30%),
    radial-gradient(circle at 90% 25%, rgba(81,145,255,.11), transparent 26%),
    linear-gradient(transparent 94%, rgba(255,255,255,.03) 95%);
  background-size: auto, auto, 100% 28px;
}

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(14px, 3vw, 34px);
  background: rgba(13,19,33,.82); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display:flex; align-items:center; gap:10px; background:none; border:0; padding:0; cursor:pointer; text-align:left; }
.brand-mark { width:44px; height:44px; display:grid; place-items:center; border-radius:14px; background:linear-gradient(145deg,var(--accent),#c94e00); box-shadow:0 8px 22px rgba(255,122,26,.28); font-size:24px; }
.brand span:last-child { font-weight: 900; letter-spacing: .03em; line-height:1; }
.brand b { color: var(--accent); }
.brand small { display:block; margin-top:5px; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.05em; }
.stage-tracker { display:flex; align-items:center; gap:6px; min-width:0; }
.stage-dot { width:28px; height:8px; border-radius:99px; background:#28334a; transition:.25s ease; }
.stage-dot.done { background:var(--success); }
.stage-dot.active { background:var(--accent); width:42px; box-shadow:0 0 0 4px rgba(255,122,26,.08); }

.app { width:min(1180px,100%); margin:0 auto; flex:1; padding:clamp(18px,3vw,34px); display:flex; flex-direction:column; }
.hero { text-align:center; max-width:860px; margin:clamp(26px,6vw,72px) auto 26px; }
.eyebrow { display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border:1px solid rgba(255,122,26,.35); border-radius:999px; background:rgba(255,122,26,.08); color:#ffd4b2; font-weight:800; font-size:12px; letter-spacing:.08em; text-transform:uppercase; }
h1 { margin:16px 0 10px; font-size:clamp(38px,8vw,78px); line-height:.92; letter-spacing:-.055em; }
h1 em { color:var(--accent); font-style:normal; }
.lead { margin:0 auto; max-width:680px; color:var(--muted); font-size:clamp(16px,2vw,20px); line-height:1.55; }

.car-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; margin:34px 0; }
.car-card { position:relative; overflow:hidden; border:1px solid var(--line); border-radius:26px; background:linear-gradient(160deg,rgba(255,255,255,.06),rgba(255,255,255,.015)); padding:18px; min-height:300px; box-shadow:var(--shadow); transition:transform .2s ease,border-color .2s ease; }
.car-card:hover { transform:translateY(-4px); border-color:rgba(255,122,26,.5); }
.car-card .badge { position:absolute; top:16px; right:16px; font-size:11px; font-weight:900; letter-spacing:.08em; text-transform:uppercase; color:#ffd2aa; background:rgba(255,122,26,.12); border:1px solid rgba(255,122,26,.28); border-radius:999px; padding:7px 9px; }
.car-card h2 { margin:8px 0 4px; font-size:24px; }
.car-card p { margin:0; color:var(--muted); font-size:14px; }
.car-preview { height:170px; display:grid; place-items:center; margin:16px -4px 8px; }
.car-preview svg { width:100%; max-height:170px; filter:drop-shadow(0 18px 22px rgba(0,0,0,.3)); }
.btn { border:0; cursor:pointer; border-radius:16px; padding:13px 18px; font-weight:900; letter-spacing:.01em; transition:transform .16s ease,filter .16s ease,background .16s ease; }
.btn:active { transform:scale(.98); }
.btn-primary { width:100%; background:linear-gradient(135deg,var(--accent),#ff9b45); color:#1a0c02; box-shadow:0 10px 24px rgba(255,122,26,.22); }
.btn-primary:hover { filter:brightness(1.08); }
.btn-ghost { background:#243049; border:1px solid rgba(255,255,255,.08); }

.game-layout { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:20px; align-items:start; }
.game-panel { background:linear-gradient(160deg,rgba(255,255,255,.06),rgba(255,255,255,.02)); border:1px solid var(--line); border-radius:28px; overflow:hidden; box-shadow:var(--shadow); }
.game-head { padding:18px 20px 14px; display:flex; align-items:flex-start; justify-content:space-between; gap:14px; border-bottom:1px solid var(--line); }
.game-head h2 { margin:0; font-size:clamp(22px,4vw,34px); }
.game-head p { margin:5px 0 0; color:var(--muted); font-size:14px; }
.stage-icon { width:54px; height:54px; flex:0 0 auto; display:grid; place-items:center; border-radius:18px; background:rgba(255,122,26,.12); border:1px solid rgba(255,122,26,.2); font-size:28px; }
.scene-wrap { position:relative; min-height:clamp(360px,58vw,620px); touch-action:none; user-select:none; overflow:hidden; background:linear-gradient(#26324b 0 61%,#1a2235 61% 64%,#121827 64%); }
.scene-wrap::before { content:""; position:absolute; left:0; right:0; top:61%; height:3px; background:rgba(255,255,255,.09); }
.scene-wrap::after { content:"FOX SMART REPAIRS"; position:absolute; top:28px; left:50%; transform:translateX(-50%); color:rgba(255,255,255,.06); font-size:clamp(30px,7vw,82px); font-weight:1000; letter-spacing:-.05em; white-space:nowrap; }
.car-stage { position:absolute; inset:4% 2% 2%; display:grid; place-items:center; }
.car-stage svg { width:min(900px,98%); max-height:94%; overflow:visible; filter:drop-shadow(0 24px 26px rgba(0,0,0,.4)); }

.sidebar { display:flex; flex-direction:column; gap:14px; }
.side-card { background:var(--panel); border:1px solid var(--line); border-radius:22px; padding:16px; }
.side-card h3 { margin:0 0 9px; font-size:14px; letter-spacing:.06em; text-transform:uppercase; color:#d8e0ed; }
.instruction { color:var(--muted); line-height:1.45; font-size:14px; margin:0; }
.progress-label { display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted); margin-bottom:8px; }
.progress-track { height:12px; overflow:hidden; background:#222d43; border-radius:99px; }
.progress-bar { height:100%; width:0; border-radius:inherit; background:linear-gradient(90deg,var(--accent),#ffc26f); transition:width .18s ease; }
.tool-pill { display:flex; align-items:center; gap:10px; padding:11px 12px; background:#202c43; border-radius:14px; font-weight:800; font-size:13px; }
.tool-pill span:first-child { font-size:22px; }
.color-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.swatch { aspect-ratio:1; border:3px solid transparent; border-radius:50%; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(255,255,255,.2),0 5px 14px rgba(0,0,0,.25); }
.swatch.active { border-color:white; transform:scale(1.08); }

.damage-list { display:grid; gap:8px; }
.damage-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 11px; background:#202b41; border-radius:13px; font-size:13px; }
.damage-item b { font-size:16px; }
.damage-item.done { opacity:.48; text-decoration:line-through; }

.tip { color:#dfe7f3; font-size:12px; line-height:1.45; border-left:3px solid var(--accent); padding-left:10px; }

/* Interactive SVG effects */
.dirt { transition:opacity .2s ease,transform .2s ease; transform-origin:center; }
.dirt.cleaned { opacity:0; transform:scale(.3); pointer-events:none; }
.dent { cursor:pointer; transform-box:fill-box; transform-origin:center; transition:transform .18s ease,opacity .18s ease; }
.dent.hit { animation:dentPop .22s ease; }
.dent.fixed { opacity:0; transform:scale(.2); pointer-events:none; }
@keyframes dentPop { 50% { transform:scale(1.28); } }
.sand-mark { transition:opacity .1s linear; }
.paint-mist { pointer-events:none; opacity:.65; }
.sparkle { opacity:.2; cursor:crosshair; transition:opacity .15s ease,transform .15s ease; transform-box:fill-box; transform-origin:center; }
.sparkle.shined { opacity:1; transform:scale(1.35) rotate(15deg); }
.crack-piece { cursor:pointer; transition:opacity .2s ease,transform .2s ease; transform-box:fill-box; transform-origin:center; }
.crack-piece.fixed { opacity:0; transform:scale(.3); }

.toast { position:fixed; left:50%; bottom:28px; transform:translate(-50%,20px); z-index:50; padding:12px 18px; border-radius:16px; background:#f8fafc; color:#111827; font-weight:900; box-shadow:0 20px 50px rgba(0,0,0,.35); opacity:0; pointer-events:none; transition:.25s ease; }
.toast.show { opacity:1; transform:translate(-50%,0); }

.results { max-width:1040px; margin:0 auto; width:100%; }
.results-head { text-align:center; margin:18px auto 26px; }
.results-head .stars { font-size:clamp(30px,7vw,54px); letter-spacing:8px; filter:drop-shadow(0 7px 12px rgba(255,177,69,.15)); }
.comparison { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.compare-card { border:1px solid var(--line); background:linear-gradient(160deg,rgba(255,255,255,.06),rgba(255,255,255,.018)); border-radius:24px; overflow:hidden; }
.compare-card h3 { margin:0; padding:14px 18px; font-size:13px; text-transform:uppercase; letter-spacing:.1em; color:#d6dfec; border-bottom:1px solid var(--line); }
.compare-scene { min-height:330px; display:grid; place-items:center; position:relative; overflow:hidden; background:linear-gradient(#27324a 0 62%,#151d2d 62%); }
.compare-scene svg { width:95%; filter:drop-shadow(0 22px 20px rgba(0,0,0,.38)); }
.result-actions { display:flex; gap:12px; justify-content:center; margin-top:20px; flex-wrap:wrap; }
.result-actions .btn { min-width:190px; }

.confetti { position:fixed; inset:0; pointer-events:none; z-index:45; overflow:hidden; }
.confetti i { position:absolute; top:-20px; width:9px; height:16px; border-radius:3px; background:hsl(var(--h) 85% 58%); animation:fall var(--d) linear forwards; transform:rotate(var(--r)); }
@keyframes fall { to { transform:translate(var(--x),110vh) rotate(760deg); } }

@media (max-width: 900px) {
  .car-grid { grid-template-columns:1fr; max-width:560px; width:100%; margin-left:auto; margin-right:auto; }
  .car-card { min-height:0; }
  .game-layout { grid-template-columns:1fr; }
  .sidebar { display:grid; grid-template-columns:repeat(2,1fr); }
  .scene-wrap { min-height:480px; }
}
@media (max-width: 620px) {
  .topbar { align-items:flex-start; }
  .brand small { display:none; }
  .brand-mark { width:38px; height:38px; border-radius:12px; }
  .stage-tracker { padding-top:8px; gap:4px; }
  .stage-dot { width:16px; height:6px; }
  .stage-dot.active { width:26px; }
  .app { padding:14px; }
  .hero { margin-top:30px; }
  .sidebar { grid-template-columns:1fr; }
  .scene-wrap { min-height:410px; }
  .comparison { grid-template-columns:1fr; }
  .compare-scene { min-height:260px; }
  .footer { font-size:10px; }
}

.footer { display:flex; justify-content:space-between; gap:16px; padding:18px clamp(14px,3vw,34px); color:#73829b; border-top:1px solid var(--line); font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.footer-brand { color:#9eabba; }

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