/* ---------- Autos ---------- */
.car-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.car-tab { flex: none; padding: .6em 1.1em; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; white-space: nowrap; }
.car-tab.active { color: var(--gold2); border-color: rgba(212,175,55,.6); background: linear-gradient(180deg, rgba(212,175,55,.2), rgba(212,175,55,.06)); }
.cls-badge { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 900; font-size: .8rem; padding: .1em .5em; border-radius: 6px; background: var(--c); color: #fff; line-height: 1.4; vertical-align: middle; }
.cls-badge small { font-weight: 600; font-size: .68rem; opacity: .85; }
.car-svg { display: block; margin: 0 auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }

.shop-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.shop-filter input { flex: 1 1 220px; }
.shop-filter select { flex: 0 1 180px; width: auto; }
.cls-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.car-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.car-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .15s; }
.car-card:hover { transform: translateY(-3px); border-color: rgba(212,175,55,.5); }
.cc-top { display: flex; justify-content: space-between; align-items: center; }
.cc-art { height: 110px; display: grid; place-items: center; overflow: hidden; }
.cc-name { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cc-model { font-weight: 700; font-size: 1.02rem; line-height: 1.2; min-height: 2.4em; }
.cc-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; font-size: .78rem; color: var(--muted); margin: 4px 0 8px; }
.cc-specs.big { font-size: .9rem; margin: 10px 0; }
.paint-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.paint-pick button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); cursor: pointer; }
.paint-pick button.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.paint-pick input[type=color] { width: 38px; height: 32px; padding: 0; border-radius: 8px; }

.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.garage-car { display: flex; flex-direction: column; gap: 6px; }
.gc-head { display: flex; gap: 10px; align-items: center; }
.gc-head small { display: block; }
.gc-art { position: relative; height: 130px; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(255,255,255,.06), transparent 70%); border-radius: 12px; overflow: hidden; }
.plate { position: absolute; bottom: 6px; right: 8px; background: #f5f5f5; color: #111; font: 700 .75rem/1 'Inter', monospace; padding: 3px 6px; border-radius: 3px; border-left: 6px solid #1e3799; letter-spacing: .05em; }
.style-art { position: relative; height: 170px; display: grid; place-items: center; overflow: hidden; }
.gc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.cstat { display: grid; grid-template-columns: 4.5em 1fr 6.5em; gap: 8px; align-items: center; font-size: .78rem; }
.cstat span { color: var(--muted); }
.cstat div { height: 7px; background: rgba(255,255,255,.07); border-radius: 4px; overflow: hidden; }
.cstat i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff9f43); border-radius: 4px; }
.cstat b { text-align: right; }
.tn-head { margin-bottom: 10px; }
.tune-row { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tr-ico { font-size: 1.6rem; }
.tr-main small { display: block; }
.tr-lvl { display: flex; gap: 4px; margin: 4px 0; }
.tr-lvl i { width: 22px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); }
.tr-lvl i.on { background: var(--gold); }
.tr-act { display: flex; gap: 4px; }
.wrap-pick { display: flex !important; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ---------- Rennen: Lobby ---------- */
.race-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.race-cars { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.race-car { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: inherit; cursor: pointer; text-align: left; font: inherit; }
.race-car small { display: block; }
.race-car.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.25); }
.race-tracks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.race-track { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: inherit; cursor: pointer; text-align: left; font: inherit; }
.race-track span { font-size: 1.6rem; }
.race-track small { color: var(--muted); font-size: .74rem; }
.race-track.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.25); }
.race-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; align-items: end; }
.race-opts label { margin: 0; }
.race-room { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.race-room small { display: block; }
.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.race-slot { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.race-slot small { display: block; color: var(--muted); }
.rs-pos { font-weight: 900; font-size: 1.2rem; width: 1.6em; text-align: center; color: var(--gold2); }
.race-slot.ai { opacity: .7; }

/* ---------- Rennen: Spiel ---------- */
body.racing { overflow: hidden; }
.race-game { position: fixed; inset: 0; z-index: 140; background: #2e5e2a; touch-action: none; user-select: none; -webkit-user-select: none; }
.race-game canvas#rgCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rg-hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; }
.rg-box { background: rgba(0,0,0,.6); border-radius: 10px; padding: 6px 12px; min-width: 70px; text-align: center; }
.rg-box small { display: block; font-size: .62rem; letter-spacing: .1em; color: #bbb; }
.rg-box b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.rg-exit { pointer-events: auto; margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; cursor: pointer; }
.rg-map { position: absolute; top: 64px; right: 10px; background: rgba(0,0,0,.45); border-radius: 10px; }
.rg-speedo { position: absolute; left: 14px; bottom: 120px; background: rgba(0,0,0,.6); border-radius: 14px; padding: 8px 14px; text-align: center; min-width: 110px; }
.rg-speedo b { font-size: 2rem; font-variant-numeric: tabular-nums; display: block; line-height: 1; }
.rg-speedo small { color: #bbb; }
.rg-nitro { height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.rg-nitro i { display: block; height: 100%; background: linear-gradient(90deg, #3fa9f5, #9be7ff); }
.rg-count { position: absolute; inset: 0; display: grid; place-items: center; font: 900 clamp(4rem, 18vw, 9rem) 'Cinzel', serif; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.8); pointer-events: none; }
.rg-touch { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); pointer-events: none; }
.rg-touch > div { display: flex; gap: 10px; pointer-events: auto; }
.rg-touch button { width: 72px; height: 72px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.45); color: #fff; font-size: 1.6rem; touch-action: none; }
.rg-touch button.on { background: rgba(212,175,55,.55); border-color: var(--gold); }
.rg-touch .gas { background: rgba(46,165,107,.45); }
.rg-touch .nos { background: rgba(63,169,245,.4); }
@media (hover: hover) and (pointer: fine) { .rg-touch { opacity: .35; } .rg-touch:hover { opacity: 1; } }
.rg-result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.65); padding: 16px; }
.rg-res-card { background: var(--panel); border: 1px solid rgba(212,175,55,.5); border-radius: 18px; padding: 20px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; text-align: center; }
.rg-res-card tr.me td { color: var(--gold2); font-weight: 700; }
.rg-res-card table { margin: 10px 0 14px; }

@media (max-width: 860px) {
  .race-layout { grid-template-columns: 1fr; }
  .race-tracks { grid-template-columns: 1fr; }
  .race-opts { grid-template-columns: 1fr 1fr; }
  .rg-touch button { width: 64px; height: 64px; }
  .rg-map { width: 120px; height: 85px; }
}

/* ---------- Autohaus: Filter & Fotos ---------- */
.shop-filter { display: block; }
.sf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sf-row input { flex: 1 1 240px; }
.sf-row select { flex: 0 1 170px; width: auto; }
.sf-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 6px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-f { padding: .4em .8em; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-size: .86rem; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip-f small { color: var(--muted); font-size: .72rem; }
.chip-f:hover { border-color: rgba(212,175,55,.5); }
.chip-f.sel { background: linear-gradient(180deg, rgba(212,175,55,.3), rgba(212,175,55,.12)); border-color: var(--gold); color: var(--gold2); }
.chip-select { width: auto; padding: .35em .7em; border-radius: 999px; font-size: .86rem; }
.sf-more { margin-top: 10px; }
.sf-more summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--gold2); }
.sf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.sf-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
.cc-img { position: relative; margin: -12px -12px 6px; border-radius: 14px 14px 0 0; overflow: hidden; background: #0d1210; aspect-ratio: 16 / 10; display: grid; place-items: center; }
.cc-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-img .cc-art { height: auto; }
.cc-img .cc-top { position: absolute; top: 8px; left: 8px; right: 8px; }
.cc-year { background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; padding: .1em .5em; border-radius: 6px; }
.buy-photo { position: relative; margin: 6px 0 4px; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: #0d1210; }
.buy-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-credit { position: absolute; right: 6px; bottom: 6px; font-size: .66rem; background: rgba(0,0,0,.6); color: #ddd; padding: .1em .5em; border-radius: 6px; }
.buy-paint { display: flex; align-items: center; gap: 12px; }
.buy-paint .paint-pick { flex: 1; margin: 0; }
.gc-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gc-art { height: 160px; }
.gc-paint { position: absolute; left: 6px; bottom: 2px; background: rgba(0,0,0,.55); border-radius: 10px; padding: 2px 4px; }
@media (max-width: 600px) { .sf-grid { grid-template-columns: 1fr; } }

/* ---------- 3D-Autos ---------- */
.car3d-img { opacity: 0; transition: opacity .35s; }
.car3d-img.ready { opacity: 1; }
.car3d-img.failed { opacity: .3; }
.cc-img { background: radial-gradient(ellipse at 50% 70%, #2a3430, #0d1210 75%); }
.cc-photo { object-fit: contain; }
.buy-3d { height: 260px; border-radius: 14px; background: radial-gradient(ellipse at 50% 65%, #2c3632, #0b0f0d 75%); display: grid; place-items: center; overflow: hidden; cursor: grab; }
.buy-3d canvas { display: block; width: 100% !important; height: 100% !important; }
.gc-art { height: 170px; background: radial-gradient(ellipse at 50% 70%, #2a3430, #0d1210 75%); }
.gc-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.rc-3d { width: 96px; height: 60px; object-fit: contain; }
@media (max-width: 600px) { .buy-3d { height: 210px; } }

/* ---------- Werkstatt ---------- */
.ws-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ws-head h2 { margin: 0; }
.ws-3d { height: 280px; position: sticky; top: 0; z-index: 2; }
.ws-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ws-tab { flex: none; position: relative; padding: .55em .85em; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ws-tab.active { color: var(--gold2); border-bottom-color: var(--gold); }
.ws-tab[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: 2px; right: 0; background: var(--gold); color: #111; border-radius: 999px; font-size: .62rem; padding: 0 .4em; }
.ws-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.ws-field { min-width: 0; }
.ws-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.ws-label small { color: var(--muted); font-size: .74rem; }
.ws-range { display: flex; align-items: center; gap: 10px; }
.ws-range input { flex: 1; }
.ws-range span { min-width: 9em; font-size: .85rem; color: var(--muted); }
.glow-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.ws-foot { position: sticky; bottom: -22px; margin: 14px -22px -22px; padding: 12px 22px; background: var(--panel); border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 700px) { .ws-body { grid-template-columns: 1fr; } .ws-3d { height: 200px; } }

.ws-bonus { padding: 10px 14px; margin-bottom: 12px; font-size: .9rem; border-color: rgba(212,175,55,.35); }
.ws-bonus.on { background: linear-gradient(90deg, rgba(212,175,55,.18), var(--panel)); border-color: var(--gold); }
.ws-bonus-line { margin: 0 0 6px; }
.chip-f:disabled { opacity: .4; cursor: not-allowed; }
.tr-lvl i.pro { background: rgba(212,175,55,.15); outline: 1px dashed rgba(212,175,55,.5); }
.tr-lvl i.pro.on { background: linear-gradient(90deg, #d4af37, #ff9f43); }
.tr-lvl i.locked { opacity: .35; }

/* ---------- Rennen: Startampel & Zwischenzeiten ---------- */
.rg-lights { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; padding: 12px 16px; background: #15181c; border-radius: 14px; border: 3px solid #2a2e33; box-shadow: 0 10px 30px rgba(0,0,0,.6); pointer-events: none; }
.rg-lights i { width: clamp(26px, 7vw, 46px); height: clamp(26px, 7vw, 46px); border-radius: 50%; background: #3a0d0d; box-shadow: inset 0 0 8px rgba(0,0,0,.8); transition: background .08s; }
.rg-lights i.on { background: radial-gradient(circle at 35% 35%, #ff8a8a, #ff1a1a 55%, #a00000); box-shadow: 0 0 22px #ff2020; }
.rg-lights.go i { background: #102a12; }
.rg-split { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.72); color: #fff; padding: 8px 16px; border-radius: 12px; font-size: 1rem; font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; }

.rg-bw { display: block; margin-top: 4px; font-size: .7rem; color: #bbb; }
.rg-brake { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); font: 900 clamp(1.2rem, 5vw, 2rem) Inter, sans-serif; color: #fff; background: rgba(217,40,40,.85); padding: 6px 18px; border-radius: 10px; pointer-events: none; letter-spacing: .08em; }
.rg-brake.blink { animation: brakeBlink .35s steps(2) infinite; }
@keyframes brakeBlink { 50% { opacity: .35; } }
.rg-touch .hb { background: rgba(155,89,182,.4); }
/* Rechte Knopfgruppe: 2 × 2 (oben Handbremse & Nitro, unten Bremse & Gas) */
.rg-touch { align-items: flex-end; }
.rg-touch > div:last-child { display: grid; grid-template-columns: repeat(2, auto); gap: 10px; }
.rg-touch .hb, .rg-touch .nos { width: 56px; height: 56px; font-size: 1.3rem; justify-self: center; }
@media (max-width: 860px) { .rg-touch > div:last-child { gap: 8px; } }

/* ---------- Admin: 3D-Modelle ---------- */
.md-steps { margin: 4px 0 12px; padding-left: 18px; }
.md-upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.md-upload #mdSearch { flex: 1 1 260px; }
.md-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--panel2); }
.md-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.md-body { display: grid; grid-template-columns: 260px 1fr; gap: 12px; }
.md-3d { height: 170px; border-radius: 10px; background: radial-gradient(ellipse at 50% 65%, #2c3632, #0b0f0d 75%); display: grid; place-items: center; overflow: hidden; }
.md-mats { display: flex; flex-direction: column; gap: 2px; max-height: 150px; overflow-y: auto; margin-top: 4px; font-size: .85rem; }
.md-tops { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px; margin-top: 6px; }
.md-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font-size: .86rem; }
.md-top.done { border-color: rgba(46,204,113,.5); }
@media (max-width: 700px) { .md-body { grid-template-columns: 1fr; } .md-tops { grid-template-columns: 1fr; } }

/* ---------- Admin: echte Tuning-Teile & Suchlinks ---------- */
.md-top { flex-direction: column; align-items: stretch; }
.md-top-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.md-top-links, .pt-links, .pt-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.md-top-links .btn, .pt-links .btn, .pt-chips .btn { padding: 3px 8px; font-size: .74rem; }
.pt-links { margin: 6px 0 10px; }
.pt-upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.pt-upload #ptName, .pt-upload #ptFits { flex: 1 1 200px; }
.pt-upload #ptPrice { width: 110px; }
.pt-grid { display: grid; grid-template-columns: 1fr 110px 1fr; gap: 8px; margin-bottom: 8px; }
.pt-grid label { display: flex; flex-direction: column; font-size: .78rem; gap: 2px; }
@media (max-width: 700px) { .pt-grid { grid-template-columns: 1fr; } }
