:root {
  --bg-glass: rgba(14, 18, 34, 0.58);
  --bg-glass-strong: rgba(14, 18, 34, 0.82);
  --border: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --accent: #ff8a1f;
  --accent-2: #ff3d7f;
  --accent-3: #3ce4ff;
  --good: #3ddc84;
  --bad: #ff5468;
  --gold: #ffcc33;
  --silver: #d8e1ec;
  --bronze: #e39a5b;
  --radius: 20px;
  --font-head: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #87c9ff;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui > * { pointer-events: auto; }
#ui .hud, #ui .countdown { pointer-events: none; }

[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.7em; height: 1.7em; padding: 0 .45em; margin: 0 .12em;
  border-radius: 7px; font-size: .78em; font-weight: 700; font-family: var(--font-body);
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}

/* ---------- Ladebildschirm ---------- */
.loading {
  position: fixed; inset: 0; z-index: 10; display: grid; place-content: center; gap: 14px; text-align: center;
  background: linear-gradient(180deg, #5cb8ff, #b7e4ff);
  font-family: var(--font-head); font-size: 22px; transition: opacity .5s;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-car { font-size: 64px; animation: bounce .6s ease-in-out infinite alternate; }
@keyframes bounce { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-12px) rotate(4deg); } }

/* ---------- Topbar ---------- */
.topbar {
  position: absolute; top: 18px; left: 24px; right: 24px; z-index: 4; /* über dem Menü, unter Dialogen */
  display: flex; justify-content: space-between; align-items: center; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-right { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 22px; opacity: 0; transition: opacity .3s; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.brand span, .logo span { color: var(--accent); }
body.racing .brand { opacity: 0; }
body.garage .brand { opacity: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--bg-glass); border: 1px solid var(--border); backdrop-filter: blur(12px);
  font-family: var(--font-head); font-size: 18px;
}
.coin-icon { font-size: 18px; }
.coins.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.2); } }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; font-size: 18px;
  background: var(--bg-glass); border: 1px solid var(--border); backdrop-filter: blur(12px);
  transition: transform .15s;
}
.icon-btn:hover { transform: scale(1.08); }

/* ---------- Karten & Buttons ---------- */
.card {
  background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%); box-shadow: 0 20px 50px rgba(0, 20, 60, .25);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px; border-radius: 16px; font-family: var(--font-head); font-weight: 600; font-size: 18px;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:active { transform: translateY(3px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 5px 0 #b02556, 0 12px 30px rgba(255, 61, 127, .35);
  text-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { box-shadow: 0 2px 0 #b02556, 0 6px 20px rgba(255, 61, 127, .3); }
.btn-primary:disabled { filter: grayscale(.8) brightness(.8); cursor: not-allowed; transform: none; }
.btn-primary .kbd { background: rgba(0,0,0,.18); border-color: rgba(255,255,255,.3); }
.btn-ghost { background: rgba(255,255,255,.1); border: 1px solid var(--border); box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.18); }
.btn-big { font-size: 24px; padding: 16px 26px; border-radius: 18px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Menü ---------- */
.screen {
  position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 80px 40px 40px; gap: 32px; pointer-events: none;
}
.screen > * { pointer-events: auto; }
.menu-left { width: min(430px, 44vw); display: flex; flex-direction: column; gap: 16px; animation: slideIn .5s ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } }

.logo {
  margin: 0; font-family: var(--font-head); font-weight: 700; font-size: clamp(44px, 5.4vw, 68px); line-height: .95;
  letter-spacing: -1px; text-shadow: 0 4px 0 rgba(0,0,0,.18), 0 10px 30px rgba(0,0,0,.2);
  transform: rotate(-2deg); transform-origin: left;
}
.tagline { margin: -4px 0 4px; font-size: 16px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.35); max-width: 360px; }

.track-card { padding: 18px 20px; }
.track-meta { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(61,220,132,.25); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(61,220,132,0); } }
.track-card h2 { margin: 6px 0 10px; font-family: var(--font-head); font-size: 30px; line-height: 1.05; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.12); }
.medals { display: flex; gap: 8px; margin-top: 12px; }
.medal-chip { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: rgba(0,0,0,.18); font-size: 12px; color: var(--muted); }
.medal-chip b { font-family: var(--font-mono); font-size: 14px; color: #fff; margin-top: 2px; }
.medal-chip.got { background: rgba(255, 204, 51, .16); outline: 1px solid rgba(255, 204, 51, .4); }
.next-track { margin-top: 12px; font-size: 13px; color: var(--muted); }
.next-track b { font-family: var(--font-mono); color: #fff; }

.name-field { display: flex; flex-direction: column; gap: 6px; }
.name-field span { font-size: 13px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.name-field input {
  font: 600 18px var(--font-body); color: #fff; padding: 14px 16px; border-radius: 14px; outline: none;
  background: var(--bg-glass-strong); border: 2px solid var(--border); transition: border-color .15s; user-select: text;
}
.name-field input:focus { border-color: var(--accent); }
.name-field input::placeholder { color: rgba(255,255,255,.35); }
.name-field.shake { animation: shake .4s; }
.name-field.shake input { border-color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* Archiv */
.archive-card { width: min(560px, 94vw); text-align: left; }
.archive-card h2 { text-align: center; }
.archive-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; max-height: min(58vh, 520px); overflow-y: auto; padding-right: 4px; }
.archive-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; text-align: left; width: 100%;
  padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--border);
  color: var(--text); font: inherit; cursor: pointer; transition: background .15s, transform .12s;
}
.archive-item:hover { background: rgba(255,255,255,.13); transform: translateY(-1px); }
.archive-item.current { border-color: var(--accent); background: rgba(255,138,31,.12); }
.archive-item.today { border-color: rgba(61,220,132,.6); }
.archive-date { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.archive-name { font-family: var(--font-head); font-size: 18px; font-weight: 600; }
.archive-theme { font-size: 12.5px; color: var(--muted); }
.archive-times { grid-row: 1 / span 3; grid-column: 2; text-align: right; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.archive-times b { font-family: var(--font-mono); color: #fff; font-weight: 700; }
.archive-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; margin-left: 6px; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.track-card.is-archive .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(255,138,31,.25); }
.btn-tile {
  position: relative; flex-direction: column; gap: 4px; padding: 14px 8px; font-size: 15px;
  background: var(--bg-glass); border: 1px solid var(--border); backdrop-filter: blur(12px); box-shadow: 0 4px 0 rgba(0,0,0,.22);
}
.btn-tile:hover { background: rgba(30, 38, 66, .7); transform: translateY(-2px); }
.tile-icon { font-size: 26px; }
.badge {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--bad); font-size: 14px; display: grid; place-items: center; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(255,84,104,.3); animation: pulse-red 1.4s infinite;
}
@keyframes pulse-red { 50% { transform: scale(1.15); } }

.controls-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* Rangliste */
.leaderboard { width: min(360px, 32vw); max-height: calc(100vh - 140px); display: flex; flex-direction: column; padding: 18px; animation: slideInR .5s ease-out; }
@keyframes slideInR { from { opacity: 0; transform: translateX(30px); } }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.lb-head h3 { margin: 0; font-family: var(--font-head); font-size: 21px; }
.lb-sub { font-size: 12px; color: var(--muted); }
.lb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.lb-list li {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 15px;
}
.lb-list li.me { background: rgba(255, 138, 31, .22); outline: 1px solid rgba(255,138,31,.55); }
.lb-rank { font-family: var(--font-head); font-weight: 700; text-align: center; color: var(--muted); }
.lb-list li:nth-child(1) .lb-rank { color: var(--gold); }
.lb-list li:nth-child(2) .lb-rank { color: var(--silver); }
.lb-list li:nth-child(3) .lb-rank { color: var(--bronze); }
.lb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-time { font-family: var(--font-mono); font-size: 14px; }
.lb-empty { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.lb-pb { margin-top: 12px; font-size: 13px; color: var(--muted); }
.lb-pb b { color: #fff; font-family: var(--font-mono); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; }
.hud-top { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.timer-pill {
  display: flex; align-items: center; gap: 12px; padding: 7px 16px; border-radius: 999px;
  background: rgba(10, 14, 28, .62); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.timer { font-family: var(--font-mono); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: .02em; min-width: 104px; text-align: center; }
.timer-sep { width: 1px; height: 16px; background: rgba(255,255,255,.25); }
.cp { font-size: 13px; font-weight: 700; color: var(--accent-3); letter-spacing: .04em; }
.delta { font-family: var(--font-mono); font-weight: 700; font-size: 15px; padding: 3px 12px; border-radius: 999px; opacity: 0; transition: opacity .25s, transform .25s; transform: translateY(-6px); }
.delta.show { opacity: 1; transform: none; }
.delta.good { background: rgba(61,220,132,.9); color: #062a16; }
.delta.bad { background: rgba(255,84,104,.9); color: #2b0309; }
.hud-right { position: absolute; top: 74px; right: 24px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hud-small { font-size: 12.5px; padding: 5px 10px; border-radius: 10px; background: rgba(10,14,28,.5); backdrop-filter: blur(8px); }
.hud-small:empty { display: none; }
.hud-small b { font-family: var(--font-mono); }
.speedo {
  position: absolute; left: 24px; bottom: 22px; display: flex; align-items: baseline; gap: 6px;
  padding: 8px 16px; border-radius: 16px; background: rgba(10,14,28,.55); backdrop-filter: blur(10px);
}
.speedo b { font-family: var(--font-mono); font-size: 30px; min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.speedo span { font-size: 12px; color: var(--muted); font-weight: 600; }
.hud-hint { position: absolute; right: 24px; bottom: 26px; font-size: 12px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); opacity: .85; }
.toast {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(.9); opacity: 0;
  font-family: var(--font-head); font-weight: 700; font-size: 34px; text-shadow: 0 3px 0 rgba(0,0,0,.25), 0 8px 30px rgba(0,0,0,.3);
  transition: opacity .2s, transform .2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700;
  font-size: 150px; color: #fff; text-shadow: 0 6px 0 rgba(0,0,0,.25), 0 16px 50px rgba(0,0,0,.35); pointer-events: none;
}
.countdown span { animation: pop .9s ease-out forwards; }
.countdown span.go { color: var(--good); }
@keyframes pop { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }

/* ---------- Modals ---------- */
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 12, 26, .45); backdrop-filter: blur(4px); z-index: 5; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative; width: min(460px, 92vw); max-height: 92vh; overflow-y: auto; padding: 28px; border-radius: 26px; text-align: center;
  background: var(--bg-glass-strong); border: 1px solid var(--border); backdrop-filter: blur(20px); box-shadow: 0 30px 80px rgba(0,0,0,.4);
  animation: rise .3s cubic-bezier(.2,1.4,.4,1);
}
@keyframes rise { from { transform: translateY(30px) scale(.95); opacity: 0; } }
.modal-card.small { width: min(340px, 92vw); }

/* Einstellungen */
.settings-card { width: min(440px, 94vw); text-align: left; }
.settings-card h2 { text-align: center; }
.settings-group { margin-top: 18px; padding: 16px 18px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid var(--border); }
.settings-group h3 { font-family: var(--font-head); font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.setting-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 12px; padding: 9px 0; font-weight: 600; font-size: 14px; }
.setting-row.toggle-row { grid-template-columns: 1fr auto; }
/* Sprachwahl: zwei Knöpfe nebeneinander, der aktive leuchtet */
.lang-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.18); }
.lang-btn { font: 600 14px var(--font-body, Inter, sans-serif); color: var(--muted); background: transparent; border: 0; border-radius: 10px; padding: 10px 8px; cursor: pointer; transition: background .2s, color .2s; }
.lang-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.lang-btn.active { color: #fff; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.setting-val { font-family: var(--font-mono); font-size: 13px; text-align: right; color: var(--muted); }
.setting-row input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 99px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) var(--p, 50%), rgba(255,255,255,.14) var(--p, 50%));
}
.setting-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); border: 3px solid var(--accent-2); transition: transform .12s;
}
.setting-row input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.setting-row input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent-2); }
.setting-row input[type=range]:disabled { opacity: .4; cursor: default; }
.switch { -webkit-appearance: none; appearance: none; width: 46px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.18); position: relative; cursor: pointer; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch:checked { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.switch:checked::after { transform: translateX(20px); }
.modal-card h2 { margin: 0 0 8px; font-family: var(--font-head); font-size: 30px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.modal-actions.column { flex-direction: column; }
.close-btn { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 16px; }
.close-btn:hover { background: rgba(255,255,255,.2); }

.finish-medal { font-size: 72px; line-height: 1; animation: medal 0.8s cubic-bezier(.2,1.6,.4,1); }
@keyframes medal { from { transform: scale(0) rotate(-30deg); } }
.finish-time { font-family: var(--font-mono); font-weight: 700; font-size: 46px; margin: 4px 0 8px; letter-spacing: -.02em; }
.finish-info { font-size: 15px; color: var(--muted); line-height: 1.6; }
.finish-info b { color: #fff; }
.finish-info .good { color: var(--good); }
.finish-info .bad { color: var(--bad); }
.finish-rewards { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* Zielbildschirm: links Ergebnis, rechts Online-Rangliste */
.finish-card { width: min(860px, 94vw); }
.finish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.finish-main { padding-top: 6px; }
.finish-online { text-align: left; padding: 16px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.upload-row { display: flex; gap: 8px; }
.upload-row input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); color: #fff; font: 600 15px var(--font-body); outline: none;
}
.upload-row input:focus { border-color: var(--accent); }
.upload-row .btn { white-space: nowrap; padding: 11px 16px; }
.upload-row .btn:disabled { opacity: .55; cursor: default; }
.finish-online.archive .upload-row { display: none; }
.upload-status { min-height: 20px; margin: 8px 2px 12px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.upload-status b { color: #fff; }
.upload-status.ok { color: var(--good); }
.upload-status.err { color: var(--bad); }
.online-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-family: var(--font-head); font-weight: 600; font-size: 17px; }
.online-list { gap: 4px; }
.online-list li { padding: 6px 10px; font-size: 14px; }
.online-list .lb-empty { padding: 14px 6px; }
@media (max-width: 760px) {
  .finish-grid { grid-template-columns: 1fr; gap: 16px; }
  .finish-medal { font-size: 56px; }
  .finish-time { font-size: 38px; }
}
.reward-chip { padding: 6px 12px; border-radius: 999px; background: rgba(255,204,51,.15); border: 1px solid rgba(255,204,51,.4); font-size: 13.5px; font-weight: 600; }

/* Glücksrad */
.wheel-card { width: min(520px, 94vw); }
.wheel-wrap { position: relative; width: min(400px, 78vw); aspect-ratio: 1; margin: 16px auto 18px; }
.wheel-wrap canvas { width: 100%; height: 100%; filter: drop-shadow(0 14px 30px rgba(0,0,0,.35)); }
.wheel-pointer {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 2; width: 0; height: 0;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid #fff;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
}
.wheel-odds { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.odds-chip { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.08); display: inline-flex; gap: 6px; align-items: center; }
.odds-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#wheel-next { margin-top: 10px; }

.reward-card { overflow: hidden; }
.reward-burst {
  position: absolute; inset: -50%; z-index: -1; opacity: .35;
  background: repeating-conic-gradient(from 0deg, var(--rar, #fff) 0 10deg, transparent 10deg 20deg);
  animation: spin 12s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reward-rarity { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--rar); color: #111; }
.reward-icon { font-size: 76px; margin: 14px 0 6px; display: grid; place-items: center; animation: medal .8s cubic-bezier(.2,1.6,.4,1); }
.reward-icon .swatch-big { width: 90px; height: 90px; border-radius: 50%; border: 5px solid rgba(255,255,255,.8); box-shadow: 0 10px 30px rgba(0,0,0,.35); }

/* Garage */
.side-panel {
  position: absolute; top: 80px; right: 24px; bottom: 24px; width: min(420px, 92vw); display: flex; flex-direction: column;
  padding: 20px; border-radius: 26px; background: var(--bg-glass-strong); border: 1px solid var(--border);
  backdrop-filter: blur(20px); box-shadow: 0 30px 80px rgba(0,0,0,.35); animation: slideInR .35s ease-out;
}
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-head h2 { margin: 0; font-family: var(--font-head); font-size: 28px; }
.side-head .close-btn { position: static; }
.tabs { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.tab { padding: 8px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; background: rgba(255,255,255,.08); }
.tab.active { background: #fff; color: #111; }
.tab small { opacity: .6; margin-left: 4px; }
.item-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; overflow-y: auto; padding: 4px; align-content: start; flex: 1; }
.item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 16px;
  background: rgba(255,255,255,.06); border: 2px solid transparent; transition: transform .12s, background .12s;
  font-size: 12.5px; font-weight: 600; text-align: center;
}
.item:hover { transform: translateY(-2px); background: rgba(255,255,255,.12); }
.item .rar-bar { position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--rar); }
.item.equipped { border-color: var(--accent); background: rgba(255,138,31,.15); }
.item.equipped::after { content: '✓'; position: absolute; top: 6px; right: 8px; color: var(--accent); font-weight: 800; }
.item.locked { opacity: .45; }
.item.locked .item-icon { filter: grayscale(1) blur(.5px); }
.item.locked::after { content: '🔒'; position: absolute; top: 6px; right: 6px; font-size: 12px; }
.item-icon { font-size: 30px; height: 44px; display: grid; place-items: center; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.75); box-shadow: inset 0 -6px 0 rgba(0,0,0,.18); }
.item-rar { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--rar); }
.garage-foot { margin-top: 12px; text-align: center; }

/* Shop */
.shop-card { width: min(720px, 94vw); text-align: left; }
.shop-head { display: flex; align-items: center; gap: 12px; }
.shop-head h2 { margin: 0; }
.soon-badge { padding: 5px 12px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.shop-item { position: relative; padding: 16px 12px 12px; border-radius: 18px; background: rgba(255,255,255,.06); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.shop-item .item-icon { font-size: 40px; height: 54px; }
.shop-item .name { font-weight: 700; font-size: 14px; }
.shop-item .price { font-family: var(--font-head); font-size: 16px; }
.shop-item .btn { width: 100%; font-size: 14px; padding: 8px; margin-top: 4px; }
.shop-item .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.shop-item .tag { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 999px; background: var(--rar); color: #111; text-transform: uppercase; }

/* Zustände */
body.racing #menu, body.garage #menu { display: none; }
body:not(.racing) #hud { display: none; }

@media (max-width: 860px) {
  .screen { flex-direction: column; align-items: stretch; overflow-y: auto; padding: 70px 16px 16px; }
  .menu-left, .leaderboard { width: 100%; }
}
