/* 🏁 Veloci-Racer – baut auf arcade-ui.css auf */

.kart-zoom { display: inline-block; animation: kartZoom 2.2s ease-in-out infinite; }
@keyframes kartZoom { 0%, 100% { transform: translateX(-8px) rotate(-3deg); } 50% { transform: translateX(10px) rotate(2deg); filter: drop-shadow(-18px 0 14px rgba(61, 224, 255, 0.7)); } }
.hero-logo h1 span { background: linear-gradient(135deg, var(--cyan), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.howto { margin-top: 1rem; text-align: left; color: #cbd5e1; font-size: 0.85rem; }
.howto summary { cursor: pointer; color: var(--gold); font-weight: 700; }
.howto ul { margin: 0.6rem 0 0 1.1rem; display: grid; gap: 0.35rem; }
.howto kbd { padding: 0.05rem 0.35rem; border-radius: 5px; background: rgba(255,255,255,0.1); border: 1px solid var(--stroke); font-size: 0.75rem; }
.small { font-size: 0.75rem; margin-top: 0.4rem; }
.records-filter { display: flex; gap: 0.4rem; margin: 0.6rem 0; flex-wrap: wrap; }
.records-filter select { flex: 1; min-width: 90px; padding: 0.35rem; border-radius: 8px; background: rgba(0,0,0,0.3); border: 1px solid var(--stroke); }
.records-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.rec-row { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.3rem; font-size: 0.8rem; padding: 0.15rem 0; }
.rec-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row b { color: var(--gold); font-variant-numeric: tabular-nums; }

/* ---------- Lobby ---------- */
.lobby-layout { width: 100%; max-width: 1100px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
.lobby-layout .card { max-width: none; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.lobby-head .room-code { font-size: 2.4rem; margin: 0; }
.track-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 1.25rem; }
.track-card { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.6rem 0.4rem; border-radius: var(--radius-sm); background: rgba(0,0,0,0.25); border: 1.5px solid var(--stroke); cursor: pointer; text-align: center; transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.track-card:hover:not(.readonly) { transform: translateY(-2px); }
.track-card svg { width: 100%; height: 64px; filter: drop-shadow(0 0 6px var(--c)); }
.track-card .cup-icon { height: 64px; display: grid; place-items: center; font-size: 2.6rem; }
.track-card b { font-size: 0.82rem; }
.track-card small { color: var(--muted); font-size: 0.66rem; }
.track-card.selected { border-color: var(--c); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); }
.track-card.readonly { cursor: default; }
.settings-grid.three { grid-template-columns: repeat(3, 1fr); }
.member-list { display: grid; gap: 0.4rem; margin-bottom: 1rem; max-height: 340px; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--stroke); animation: popIn 0.3s cubic-bezier(.3,1.6,.5,1); }
.member-row.me { border-color: rgba(255, 210, 63, 0.5); }
.member-row.cpu { opacity: 0.6; border-style: dashed; }
.member-row .name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .tag { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.kart-dot { width: 22px; height: 14px; border-radius: 6px 9px 3px 3px; background: var(--c); box-shadow: 0 0 10px var(--c); position: relative; flex-shrink: 0; }
.kart-dot::before, .kart-dot::after { content: ""; position: absolute; bottom: -4px; width: 7px; height: 7px; border-radius: 50%; background: #111; border: 1.5px solid #555; }
.kart-dot::before { left: 1px; } .kart-dot::after { right: 1px; }
.kart-dot.sm { width: 16px; height: 10px; }
.kart-dot.sm::before, .kart-dot.sm::after { width: 5px; height: 5px; bottom: -3px; }
.color-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.35rem; margin-bottom: 1rem; }
.color-sw { aspect-ratio: 1; border-radius: 8px; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: 0 0 8px color-mix(in srgb, var(--c) 50%, transparent); transition: transform 0.12s; }
.color-sw:hover:not(:disabled) { transform: scale(1.12); }
.color-sw.sel { border-color: #fff; transform: scale(1.12); }
.color-sw:disabled { opacity: 0.18; cursor: not-allowed; box-shadow: none; }
.start-problem { text-align: center; color: #fda4af; font-size: 0.85rem; min-height: 1.2em; margin-top: 0.5rem; }

/* ---------- Rennen ---------- */
#gameScreen.active { justify-content: flex-start; }
.game-wrap { width: 100%; max-width: 1400px; }
.arena { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 130px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--stroke); box-shadow: var(--shadow); background: #070712; touch-action: none; user-select: none; -webkit-user-select: none; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.nameplate { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 0.68rem; font-weight: 800; padding: 0.1rem 0.45rem; border-radius: 999px; background: rgba(11, 11, 26, 0.72); border: 1.5px solid var(--c); color: #fff; }

.hud { position: absolute; top: 10px; left: 10px; right: 10px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; }
.hud-left { display: flex; flex-direction: column; gap: 0.2rem; align-items: flex-start; }
.hud-place { font-weight: 900; line-height: 0.9; font-size: clamp(3rem, 7vw, 5.2rem); font-style: italic; background: linear-gradient(180deg, #fff, #94a3b8); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 18px rgba(255,255,255,0.25)); }
.hud-place small { font-size: 0.45em; }
.hud-place.p1 { background-image: linear-gradient(180deg, #fff6c2, #ffd23f 50%, #ff8a3d); }
.hud-place.p2 { background-image: linear-gradient(180deg, #ffffff, #cbd5e1 50%, #64748b); }
.hud-place.p3 { background-image: linear-gradient(180deg, #ffe0c2, #f59e5b 50%, #b45309); }
.hud-lap, .hud-time { background: rgba(11,11,26,0.7); border: 1px solid var(--stroke); border-radius: 10px; padding: 0.2rem 0.6rem; font-weight: 800; font-size: 0.9rem; backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
.hud-lap b { color: var(--gold); font-size: 1.1rem; }
.hud-item { justify-self: center; position: relative; }
.item-slot { width: 78px; height: 78px; border-radius: 18px; display: grid; place-items: center; font-size: 2.6rem; background: rgba(11,11,26,0.65); border: 3px solid rgba(255,255,255,0.25); box-shadow: inset 0 0 18px rgba(255,255,255,0.08); backdrop-filter: blur(6px); }
.item-slot.rolling { border-color: var(--cyan); animation: slotShake 0.12s infinite; }
.item-slot.ready { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 210, 63, 0.55), inset 0 0 18px rgba(255,210,63,0.15); animation: popIn 0.35s cubic-bezier(.3,1.6,.5,1); }
@keyframes slotShake { 50% { transform: translateY(-2px) rotate(-2deg); } }
.item-count { position: absolute; bottom: -6px; right: -10px; font-weight: 900; font-size: 1rem; color: var(--gold); text-shadow: 0 2px 6px #000; }
.hud-right { justify-self: end; }
#minimap { width: clamp(110px, 14vw, 180px); height: clamp(110px, 14vw, 180px); background: rgba(11,11,26,0.45); border-radius: 16px; border: 1px solid var(--stroke); backdrop-filter: blur(4px); }

.standings { position: absolute; left: 10px; top: 50%; transform: translateY(-40%); display: flex; flex-direction: column; gap: 2px; pointer-events: none; max-height: 52%; overflow: hidden; }
.st-row { display: flex; align-items: center; gap: 0.35rem; font-size: 0.68rem; font-weight: 800; background: rgba(11,11,26,0.62); border-radius: 999px; padding: 0.08rem 0.55rem 0.08rem 0.25rem; width: max-content; max-width: 170px; }
.st-row .pl { width: 1.3rem; text-align: center; color: var(--muted); }
.st-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row.me { background: rgba(255, 210, 63, 0.3); outline: 1px solid var(--gold); }
.st-row.done .pl { color: var(--gold); }

.speedo { position: absolute; right: 14px; bottom: 12px; text-align: right; pointer-events: none; font-style: italic; }
.speedo b { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,0.6); font-variant-numeric: tabular-nums; }
.speedo small { margin-left: 0.2rem; font-weight: 800; color: var(--muted); }
.mt-bar { width: 140px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.12); margin: 0.2rem 0 0 auto; overflow: hidden; }
#mtFill { height: 100%; width: 0; background: #64748b; transition: width 0.08s linear; }
#mtFill.mt1 { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
#mtFill.mt2 { background: var(--orange); box-shadow: 0 0 10px var(--orange); }
#mtFill.mt3 { background: #c084fc; box-shadow: 0 0 12px #c084fc; }

.center-msg { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.center-msg .big { font-size: clamp(3rem, 12vw, 8rem); font-weight: 900; font-style: italic; background: linear-gradient(135deg, var(--gold), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(255, 77, 141, 0.6)); animation: cdPop 0.7s cubic-bezier(.2,1.6,.4,1) both; }
.center-msg .sub { font-size: clamp(1rem, 3vw, 1.5rem); font-weight: 900; text-shadow: 0 2px 16px rgba(0,0,0,0.9); margin-top: 0.4rem; }
@keyframes cdPop { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lights { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; padding: 10px 14px; border-radius: 16px; background: rgba(11,11,26,0.85); border: 2px solid #333; pointer-events: none; }
.lights span { width: 34px; height: 34px; border-radius: 50%; background: #2a1a1a; box-shadow: inset 0 0 8px #000; transition: background 0.1s; }
.lights span.on { background: #ff3344; box-shadow: 0 0 22px #ff3344; }
.lights span.go { background: #3dff7a; box-shadow: 0 0 22px #3dff7a; }
.banner { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); padding: 0.5rem 1.4rem; border-radius: 999px; font-weight: 900; font-size: clamp(1rem, 2.6vw, 1.6rem); background: rgba(11,11,26,0.8); border: 2px solid var(--cyan); white-space: nowrap; pointer-events: none; animation: popIn 0.35s cubic-bezier(.3,1.6,.5,1); }
.banner.good { border-color: var(--green); color: #d1ffe6; }
.banner.bad { border-color: var(--red); color: #ffd1d9; }
.banner.final { border-color: var(--red); background: linear-gradient(90deg, rgba(255,77,109,0.5), rgba(255,138,61,0.5)); font-size: clamp(1.4rem, 4vw, 2.4rem); }
.spectate-banner { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 0.4rem 1rem; border-radius: 999px; background: rgba(167, 139, 250, 0.22); border: 1px solid rgba(167, 139, 250, 0.55); font-weight: 800; font-size: 0.85rem; pointer-events: none; white-space: nowrap; }
.controls-hint { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 0.6rem; }
.webgl-fail { position: absolute; inset: 0; display: grid; place-items: center; color: #fda4af; font-weight: 800; padding: 2rem; text-align: center; }

.results-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7,7,18,0.55); backdrop-filter: blur(3px); padding: 1rem; }
.results-overlay .card { max-width: 640px; width: 100%; max-height: 92%; overflow-y: auto; }
.results-overlay h2 { margin-bottom: 0.8rem; }
.results-list { display: grid; gap: 0.3rem; margin: 0.8rem 0; text-align: left; }
.res-row { display: grid; grid-template-columns: 1.6rem 18px 1fr 5.4rem 2.6rem 3.6rem; gap: 0.5rem; align-items: center; padding: 0.35rem 0.6rem; border-radius: 9px; background: rgba(255,255,255,0.04); border: 1px solid var(--stroke); font-size: 0.82rem; }
.res-row.cup { grid-template-columns: 1.6rem 18px 1fr 4rem 3.2rem; }
.res-row.head { background: none; border: none; color: var(--muted); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; padding-top: 0; padding-bottom: 0; }
.res-row.me { border-color: rgba(255, 210, 63, 0.6); background: rgba(255,210,63,0.08); }
.res-row .pl { font-weight: 900; text-align: center; }
.res-row .pl.p1 { color: var(--gold); } .res-row .pl.p2 { color: #cbd5e1; } .res-row .pl.p3 { color: #f59e5b; }
.res-row .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .tm { font-variant-numeric: tabular-nums; color: var(--muted); }
.res-row .pts { font-weight: 900; color: var(--green); text-align: right; }
.res-row .tot { font-weight: 900; color: var(--gold); text-align: right; font-variant-numeric: tabular-nums; }
.end-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.touch-controls { position: absolute; inset: auto 0 12px 0; display: none; justify-content: space-between; padding: 0 12px; pointer-events: none; }
.touch-controls .tc-left, .touch-controls .tc-right { display: flex; gap: 10px; pointer-events: auto; align-items: flex-end; }
.touch-controls button { width: 70px; height: 70px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); background: rgba(11, 11, 26, 0.5); color: #fff; font-size: 1.7rem; font-weight: 900; backdrop-filter: blur(4px); touch-action: none; }
.touch-controls button.active { background: rgba(61, 224, 255, 0.35); border-color: var(--cyan); }
.touch-controls .tc-drift { width: 84px; height: 84px; }
.touch-controls .tc-item { width: 62px; height: 62px; margin-bottom: 70px; }
body.touch .touch-controls { display: flex; }
body.touch .controls-hint { display: none; }

/* ---------- Ende ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 0.6rem; margin-bottom: 0.8rem; min-height: 170px; }
.pod { width: 110px; display: flex; flex-direction: column; align-items: center; animation: popIn 0.6s cubic-bezier(.3,1.6,.5,1) both; }
.pod.empty { visibility: hidden; }
.pod-kart { font-size: 2.4rem; filter: drop-shadow(0 0 14px var(--c)); }
.pod-name { font-weight: 800; font-size: 0.8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0.2rem 0; }
.pod-block { width: 100%; display: grid; place-items: center; font-weight: 900; font-size: 1.8rem; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)); border: 1px solid var(--stroke); }
.pod1 .pod-block { height: 90px; color: var(--gold); border-color: rgba(255,210,63,0.6); box-shadow: 0 0 30px rgba(255,210,63,0.25); }
.pod2 .pod-block { height: 64px; color: #cbd5e1; animation-delay: 0.15s; }
.pod3 .pod-block { height: 46px; color: #f59e5b; }
.pod2 { animation-delay: 0.2s; } .pod3 { animation-delay: 0.35s; }
#endTitle { font-size: clamp(1.6rem, 4.5vw, 2.4rem); margin: 0.3rem 0; }
#endTitle span { color: var(--gold); }

@media (max-width: 900px) {
    .lobby-layout { grid-template-columns: 1fr; }
    .track-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid.three { grid-template-columns: 1fr 1fr; }
    .arena { aspect-ratio: auto; height: calc(100vh - 120px); max-height: none; }
    .standings { display: none; }
    .res-row { grid-template-columns: 1.4rem 16px 1fr 4.6rem 2.2rem; }
    .res-row > :nth-child(6) { display: none; }
    .records-list { grid-template-columns: 1fr; }
}

/* Touch-Geräte: Rennen im Vollbild */
body.touch.in-game .topbar, body.touch.in-game .volume-box, body.touch.in-game .controls-hint { display: none; }
body.touch.in-game .arena { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; border: none; z-index: 40; }
body.touch .item-slot { width: 60px; height: 60px; font-size: 2rem; }
body.touch .speedo { right: 50%; transform: translateX(50%); bottom: 14px; text-align: center; }
body.touch .speedo .mt-bar { margin: 0.2rem auto 0; width: 110px; }
body.touch .hud-place { font-size: 2.8rem; }
