* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; font-family: "Trebuchet MS", "Segoe UI", sans-serif; color: #fff; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
[hidden] { display: none !important; }

.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow: auto;
}
.screen[data-screen="race"] { pointer-events: none; }
.screen.dim { background: rgba(8, 10, 25, 0.55); backdrop-filter: blur(3px); }
.screen[data-screen="menu"], .screen[data-screen="howto"], .screen[data-screen="select"] {
  background: radial-gradient(ellipse at center, rgba(10,12,35,0.15) 0%, rgba(10,12,35,0.65) 100%);
}

.panel {
  background: linear-gradient(180deg, rgba(28, 32, 70, 0.92), rgba(14, 16, 40, 0.94));
  border: 3px solid rgba(255,255,255,0.14);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  padding: 28px 34px;
  max-height: calc(100vh - 40px); overflow: auto;
  animation: pop .25s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.menu-panel { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 320px; text-align: center; }
.wide { width: min(960px, 100%); }

.logo { margin: 0; font-size: 78px; line-height: .9; font-style: italic; letter-spacing: 2px; display: flex; flex-direction: column; }
.logo span:first-child { color: #ffd23f; text-shadow: 4px 4px 0 #e8322e, 8px 8px 0 rgba(0,0,0,.35); }
.logo span:last-child { color: #fff; text-shadow: 4px 4px 0 #2f6fed, 8px 8px 0 rgba(0,0,0,.35); }
.tagline { margin: 4px 0 14px; color: #aab4e8; }
h2 { margin: 0 0 12px; font-size: 36px; font-style: italic; color: #ffd23f; text-shadow: 3px 3px 0 rgba(0,0,0,.4); }
h3 { margin: 16px 0 8px; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: #9aa6d8; }

.btn {
  font: inherit; font-weight: bold; font-size: 17px; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #4a5299, #343b78);
  border: 2px solid rgba(255,255,255,0.2); border-bottom: 5px solid #1d2150;
  border-radius: 12px; padding: 11px 22px; transition: transform .08s, filter .15s;
}
.btn:hover, .btn:focus-visible { filter: brightness(1.2); outline: none; transform: translateY(-1px); }
.btn:focus-visible { box-shadow: 0 0 0 3px #ffd23f; }
.btn:active { transform: translateY(2px); border-bottom-width: 3px; }
.btn.big { font-size: 22px; padding: 14px 28px; background: linear-gradient(180deg, #ff5a3c, #d8321e); border-bottom-color: #8a1a0e; }
.btn.small { font-size: 14px; padding: 8px 14px; flex: 1; }

.row { display: flex; gap: 10px; margin-top: 6px; }
.row.end { justify-content: space-between; margin-top: 22px; }
.row.center { justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.track-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.track-card {
  font: inherit; color: #fff; text-align: left; cursor: pointer; padding: 10px;
  background: rgba(255,255,255,0.06); border: 3px solid transparent; border-radius: 16px; transition: transform .1s, border-color .15s;
}
.track-card:hover { transform: translateY(-2px); background: rgba(255,255,255,0.1); }
.track-card.selected { border-color: #ffd23f; background: rgba(255,210,63,0.12); }
.track-preview { height: 150px; display: flex; align-items: center; justify-content: center; border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.25); }
.track-preview canvas { max-width: 100%; max-height: 150px; }
.track-name { font-weight: bold; font-size: 18px; margin-top: 8px; }
.badge { display: inline-block; font-size: 10px; padding: 2px 6px; margin-left: 4px; border-radius: 6px; background: #ff7a1a; color: #fff; vertical-align: middle; }
.track-desc { font-size: 13px; color: #aab4e8; margin-top: 2px; }
.track-best { font-size: 12px; color: #ffd23f; margin-top: 6px; }

.select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .select-row { grid-template-columns: 1fr; } .logo { font-size: 56px; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.select-row.three { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 800px) { .select-row.three { grid-template-columns: 1fr; } }
.chip {
  font: inherit; font-weight: bold; color: #fff; cursor: pointer; padding: 10px 16px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.2);
}
.chip.selected { background: #ffd23f; color: #1a1a2e; border-color: #ffd23f; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 3px solid rgba(255,255,255,0.25); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px #ffd23f; transform: scale(1.08); }

.howto-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; align-items: center; }
kbd {
  display: inline-block; min-width: 28px; padding: 3px 7px; margin: 0 2px; text-align: center;
  background: #eef0ff; color: #1a1a2e; border-radius: 6px; border-bottom: 3px solid #9aa0c8; font-weight: bold; font-size: 14px;
}
.items { margin: 0; padding-left: 20px; line-height: 1.7; }
.c-turbo { color: #ff9a3a; } .c-speed { color: #2fd0ff; } .c-shield { color: #7ce8ff; } .c-trap { color: #d17bff; }
.hint { color: #8f99c8; font-size: 13px; }

.results { text-align: center; width: min(640px, 100%); }
#results-title.win { color: #ffd23f; }
#results-title.podium { color: #e8ecff; }
#results-title.lose { color: #ff8a7a; }
.results-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 17px; }
.results-table th { color: #9aa6d8; font-size: 13px; text-transform: uppercase; padding: 6px; border-bottom: 2px solid rgba(255,255,255,.12); }
.results-table td { padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.06); }
.results-table td:nth-child(2) { text-align: left; }
.results-table tr.me td { background: rgba(255,210,63,0.16); color: #ffe14d; font-weight: bold; }
.kart-model { margin-left: 8px; font-size: 12px; font-weight: normal; color: #8f99c8; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: middle; border: 2px solid rgba(0,0,0,.4); }
.record { font-weight: bold; color: #cfd6ff; }
.mode-desc { margin: 6px 0 0; min-height: 1.2em; color: #cfd6ff; }
.champ-box { margin-top: 14px; }
.champ-box h3 { margin-top: 0; }
.results-table td.pts { color: #7cf2a0; font-weight: bold; }
.results-table td.out { color: #ff8a7a; }
.results-table td.win { color: #ffd23f; font-weight: bold; }

/* ---------- Panel admina ---------- */
#admin-login {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 15, 0.7); backdrop-filter: blur(3px);
}
.admin-login-box {
  width: min(340px, 92vw); display: flex; flex-direction: column; gap: 8px; padding: 20px;
  background: #0f1224; border: 2px solid #ff3d6e; border-radius: 14px; color: #e4e8ff;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif; font-size: 13px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.admin-login-box h3 { margin: 0; color: #ff7a9a; font-size: 16px; letter-spacing: 0; text-transform: none; }
.admin-login-box p { margin: 0; color: #aab4e8; }
.admin-login-box .admin-input { flex: none; width: 100%; box-sizing: border-box; }
.admin-login-box .admin-input[hidden] { display: none; }
.admin-login-box .al-error { color: #ff6a5a; min-height: 1.2em; }
.admin-login-box .admin-row { justify-content: flex-end; }
.admin-login-box .al-ok { background: #b3264a; }
.admin-lock { background: none; border: 0; color: #fff; font-size: 15px; cursor: pointer; margin-left: auto; }
.admin-lock + .admin-close { margin-left: 0; }
#admin-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 350px; max-width: 92vw; z-index: 50;
  display: flex; flex-direction: column;
  background: rgba(10, 12, 24, 0.95); border-left: 2px solid #ff3d6e;
  box-shadow: -10px 0 40px rgba(0,0,0,0.5); font-size: 13px; color: #e4e8ff;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}
#admin-panel header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #1a0f22; border-bottom: 1px solid rgba(255,255,255,0.1); }
#admin-panel header b { color: #ff7a9a; font-size: 15px; }
.admin-hint { font-size: 11px; color: #8f99c8; border: 1px solid #555; border-radius: 4px; padding: 0 5px; }
.admin-close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.admin-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.1); }
.admin-tabs button { flex: 1; background: none; border: 0; color: #aab4e8; padding: 9px 4px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.admin-tabs button.active { color: #fff; border-bottom-color: #ff3d6e; background: rgba(255,61,110,0.08); }
.admin-body { overflow-y: auto; padding: 6px 12px 20px; flex: 1; }
.admin-body section { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.07); }
.admin-body h4 { margin: 4px 0 8px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #ff9ab4; }
.admin-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.admin-btn { font: inherit; color: #fff; background: #2e3566; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 6px 10px; cursor: pointer; margin: 2px 0; }
.admin-body section > .admin-btn { display: block; width: 100%; text-align: left; }
.admin-btn:hover { filter: brightness(1.25); }
.admin-btn.warn { background: #5a4410; }
.admin-btn.danger { background: #6b1a26; }
.admin-input { font: inherit; background: #151a33; color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 5px 8px; flex: 1; min-width: 80px; }
.admin-toggle { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.admin-slider { display: grid; grid-template-columns: 1fr 110px 48px; gap: 6px; align-items: center; padding: 3px 0; }
.admin-slider span { font-size: 12px; color: #cfd6ff; }
.admin-slider output { font-family: Consolas, monospace; font-size: 12px; text-align: right; color: #7cf2a0; }
.admin-note { color: #8f99c8; font-size: 12px; margin: 4px 0; }

/* ---------- Monety ---------- */
.coin {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -0.15em;
  background: radial-gradient(circle at 35% 30%, #fff6b0 0 18%, #ffd23f 40%, #d99a00 100%);
  box-shadow: inset 0 0 0 2px #b37a00;
}
.coin-badge {
  align-self: center; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.35); border: 2px solid rgba(255,210,63,0.5); color: #ffd23f;
  padding: 6px 16px; border-radius: 999px; font-size: 20px;
}
.btn:disabled { filter: grayscale(0.6) brightness(0.8); cursor: default; transform: none; }

.podium-screen { align-items: flex-end; justify-content: flex-end; pointer-events: none; }
.podium-skip { pointer-events: auto; margin: 20px; }

/* ---------- Profil, poziomy, karnet ---------- */
.level-badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 6px; background: #2fd0ff; color: #0d1030; font-size: 12px; }
.level-box { display: flex; gap: 18px; align-items: center; background: rgba(255,255,255,0.06); border-radius: 16px; padding: 14px; margin-bottom: 8px; }
.level-big { width: 96px; height: 96px; border-radius: 50%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #7cf2ff, #2f6fed 70%); box-shadow: 0 0 0 4px rgba(255,255,255,0.2), 0 0 30px rgba(47,208,255,0.5); }
.level-big span { font-size: 11px; font-weight: bold; letter-spacing: 1px; }
.level-big b { font-size: 40px; line-height: 1; }
.level-info { flex: 1; }
.level-xp { font-weight: bold; }
.xp-bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; margin: 6px 0; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2fd0ff, #7cf2a0); border-radius: 6px; transition: width .4s; }
.xp-bar.inline { display: inline-block; width: 120px; height: 8px; vertical-align: middle; margin: 0 0 0 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.stat-card { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,0.06); }
.stat-icon { font-size: 24px; }
.stat-label { font-size: 12px; color: #9aa6d8; }
.stat-value { font-size: 17px; font-weight: bold; }
.board-tracks { margin-bottom: 6px; }
.board-tracks .chip { font-size: 12px; padding: 6px 10px; }
.season-progress { background: rgba(255,255,255,0.06); border-radius: 14px; padding: 10px 14px; margin: 6px 0; }
.season-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 8px; }
.tier { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 2px solid transparent; text-align: center; }
.tier.special { background: rgba(155,74,230,0.14); }
.tier.ready { border-color: #37c26a; }
.tier.claimed { opacity: 0.5; }
.tier-num { font-size: 11px; color: #9aa6d8; font-weight: bold; }
.tier-icon { font-size: 28px; }
.tier-label { font-size: 11px; min-height: 2.6em; }
.tier .btn { width: 100%; margin: 0; padding: 4px; font-size: 12px; }
.results-progress { margin: 10px auto 0; max-width: 520px; padding: 8px 12px; border-radius: 12px; background: rgba(47,208,255,0.12); border: 2px solid #2fd0ff; text-align: left; font-size: 14px; }
.rp-up { color: #ffd23f; font-weight: bold; }

/* ---------- Wygląd, kierowcy, skrzynki ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop-grid.drivers { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 3px solid transparent; text-align: center; }
.shop-item.selected { border-color: #ffd23f; background: rgba(255,210,63,0.12); }
.shop-item.locked .shop-preview, .shop-item.locked .shop-emoji { opacity: 0.6; }
.shop-item .btn { width: 100%; margin: 0; }
.shop-preview { width: 70px; height: 90px; border-radius: 8px; background: rgba(0,0,0,0.25); }
.shop-emoji { font-size: 38px; height: 60px; display: flex; align-items: center; }
.shop-emoji.big { font-size: 48px; }
.shop-name { font-weight: bold; font-size: 14px; }
.shop-desc { font-size: 12px; color: #aab4e8; min-height: 3em; }
.num-input { width: 56px; font: inherit; padding: 4px; border-radius: 6px; border: 2px solid rgba(255,255,255,0.3); background: #151a33; color: #fff; }
.crate-box { display: flex; gap: 24px; align-items: center; background: rgba(255,255,255,0.06); border-radius: 16px; padding: 18px; }
.crate-visual { font-size: 90px; width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; border-radius: 20px;
  background: radial-gradient(circle, rgba(255,210,63,0.35), rgba(255,210,63,0) 70%); }
.crate-visual.shaking { animation: shake .15s infinite; }
@keyframes shake { 0% { transform: rotate(-8deg) scale(1.05); } 50% { transform: rotate(8deg) scale(0.95); } 100% { transform: rotate(-8deg) scale(1.05); } }
.crate-result { font-size: 18px; font-weight: bold; min-height: 1.4em; }
.crate-result.ok { color: #7cf2a0; }
.crate-result.error { color: #ff8a7a; }
@media (max-width: 600px) { .crate-box { flex-direction: column; } }

/* ---------- Ustawienia ---------- */
.tabs { margin-bottom: 10px; }
.set-section { background: rgba(255,255,255,0.05); border-radius: 14px; padding: 10px 14px; margin: 8px 0; }
.set-section h3 { margin-top: 2px; }
.set-row { display: grid; grid-template-columns: 1fr 220px 50px; align-items: center; gap: 12px; padding: 5px 0; cursor: pointer; }
.set-row.toggle { grid-template-columns: 1fr auto; }
.set-row input[type="range"] { width: 100%; accent-color: #ffd23f; }
.set-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: #37c26a; }
.set-row output { text-align: right; color: #ffd23f; font-weight: bold; }
.set-status { color: #cfd6ff; font-weight: bold; min-height: 1.2em; }
.set-status.ok { color: #7cf2a0; }
.set-status.error { color: #ff8a7a; }
.table-wrap { overflow-x: auto; }
.bind-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bind-table th { color: #9aa6d8; font-size: 12px; text-align: left; padding: 6px; }
.bind-table td { padding: 4px 6px; border-top: 1px solid rgba(255,255,255,0.06); white-space: nowrap; }
.bind-key { font: inherit; font-weight: bold; min-width: 70px; margin: 2px; padding: 5px 8px; border-radius: 7px; cursor: pointer;
  background: #eef0ff; color: #1a1a2e; border: 0; border-bottom: 3px solid #9aa0c8; }
.bind-key.empty { background: rgba(255,255,255,0.1); color: #8f99c8; border-bottom-color: transparent; }
.bind-key.waiting { background: #ffd23f; }
button:focus-visible, input:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
@media (max-width: 600px) { .set-row { grid-template-columns: 1fr 120px 44px; } }

/* ---------- Zadania ---------- */
.section-head { display: flex; align-items: center; gap: 10px; }
.daily-timer { font-size: 12px; color: #7cf2ff; text-transform: none; letter-spacing: 0; font-weight: normal; }
.mission.daily { background: rgba(47,208,255,0.08); }
.mission.daily.ready { background: rgba(55,194,106,0.14); }
.mission.bonus { border-style: dashed; border-color: rgba(255,210,63,0.5); }
.count-badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 6px; border-radius: 999px; background: #ff3d6e; color: #fff; font-size: 13px; }
.missions-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 10px; }
.mission { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 2px solid transparent; }
.mission.ready { border-color: #37c26a; background: rgba(55,194,106,0.12); }
.mission.claimed { opacity: 0.55; }
.mission-icon { font-size: 30px; width: 40px; text-align: center; }
.mission-info { flex: 1; min-width: 0; }
.mission-name { font-weight: bold; font-size: 16px; }
.mission-desc { font-size: 12px; color: #aab4e8; }
.mission-bar { height: 8px; margin-top: 6px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.mission-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2fd0ff, #7cf2a0); }
.mission-progress { font-size: 11px; color: #cfd6ff; margin-top: 2px; }
.mission-reward { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 104px; flex: none; }
.mission-reward .btn { margin: 0; width: 100%; padding: 6px 4px; font-size: 12px; }
.mission-reward-label { font-size: 12px; font-weight: bold; color: #ffd23f; text-align: center; }
.mission-kart { width: 64px; height: 50px; border-radius: 8px; background: rgba(0,0,0,0.25); }
.big-coin { font-size: 34px; }
.missions-note { background: rgba(55,194,106,0.2); border: 2px solid #37c26a; border-radius: 12px; padding: 8px 12px; color: #fff; font-weight: bold; }
.results-missions { margin: 10px auto 0; max-width: 520px; padding: 8px 12px; border-radius: 12px; background: rgba(55,194,106,0.15); border: 2px solid #37c26a; font-size: 14px; text-align: left; }
@media (max-width: 520px) { .missions-list { grid-template-columns: 1fr; } }

/* ---------- Garaż ---------- */
.garage-head { display: flex; align-items: center; justify-content: space-between; }
.garage-head h2 { margin: 0; }
.garage-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 10px; }
.kart-card {
  display: flex; flex-direction: column; gap: 6px; padding: 12px;
  background: rgba(255,255,255,0.06); border: 3px solid transparent; border-radius: 16px;
}
.kart-card.selected { border-color: #ffd23f; background: rgba(255,210,63,0.12); }
.kart-card.locked .kart-preview { filter: saturate(0.35) brightness(0.8); }
.kart-card .btn { margin-top: 6px; }
.kart-card .btn.buy { background: linear-gradient(180deg, #37c26a, #23984d); border-bottom-color: #145c2e; }
.kart-preview {
  width: 100%; height: 160px; display: block; border-radius: 10px;
  background: repeating-linear-gradient(90deg, #4d5059 0 40px, #555861 40px 80px);
}
.kart-preview.small { width: 90px; height: 70px; flex: none; }
.kart-name { font-weight: bold; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.kart-desc { font-size: 13px; color: #aab4e8; min-height: 1.3em; }
.price { font-size: 15px; color: #ffd23f; }
.stat { display: grid; grid-template-columns: 110px 1fr; align-items: center; font-size: 12px; color: #cfd6ff; }
.stat .bar { height: 8px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: linear-gradient(90deg, #2fd06a, #ffd23f, #ff7a1a); border-radius: 4px; }
.paint-shop { display: flex; gap: 18px; align-items: center; background: rgba(255,255,255,0.06); border-radius: 16px; padding: 12px; margin: 6px 0 4px; }
.paint-shop h3 { margin-top: 0; }
.kart-preview.paint { width: 150px; height: 150px; flex: none; }
.paint-controls { flex: 1; min-width: 0; }
.color-inputs { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: #cfd6ff; }
.color-inputs label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.color-inputs input[type="color"] { width: 44px; height: 32px; border: 2px solid rgba(255,255,255,0.3); border-radius: 8px; background: none; padding: 0; cursor: pointer; }
.swatch.custom { color: #fff; font-size: 18px; font-weight: bold; text-shadow: 0 0 3px #000; background: conic-gradient(#ff3b3b, #ffd23f, #2fbf4a, #2f6fed, #9b4ae6, #ff3b3b); }
@media (max-width: 600px) { .paint-shop { flex-direction: column; } }
/* ---------- Warsztat (ulepszenia) ---------- */
.workshop { background: rgba(255,255,255,0.06); border-radius: 16px; padding: 12px; margin: 10px 0 4px; }
.workshop h3 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.upg-total { font-size: 12px; color: #7ce8ff; font-weight: bold; letter-spacing: 0; text-transform: none; }
.upgrade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 10px; }
.upgrade { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.25); border-radius: 12px; padding: 8px 12px; }
.upg-icon { font-size: 26px; width: 36px; text-align: center; }
.upg-info { flex: 1; min-width: 0; }
.upg-name { font-weight: bold; }
.upg-lvl { font-size: 12px; color: #9aa6d8; font-weight: normal; margin-left: 6px; }
.upg-desc { font-size: 12px; color: #aab4e8; margin-top: 3px; }
.upg-desc b { color: #7cf2a0; }
.pips { display: flex; gap: 4px; margin-top: 4px; }
.pips b { width: 22px; height: 7px; border-radius: 4px; background: rgba(255,255,255,0.15); }
.pips b.on { background: linear-gradient(90deg, #2fd0ff, #7cf2a0); box-shadow: 0 0 6px rgba(124,242,160,0.6); }
.upgrade .btn { flex: none; margin: 0; }
.stat .bar { position: relative; }
.stat .bar em { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #2fd0ff, #7cf2ff); border-radius: 0 4px 4px 0; }
@media (max-width: 520px) { .upgrade-grid { grid-template-columns: 1fr; } }
.current-kart { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,0.06); padding: 8px 12px; border-radius: 14px; }
.current-kart .btn { margin-left: auto; flex: none; }

/* ---------- Nagroda po wyścigu ---------- */
.reward { margin: 10px auto 0; max-width: 360px; background: rgba(255,210,63,0.08); border: 2px solid rgba(255,210,63,0.35); border-radius: 14px; padding: 10px 16px; }
.reward-item { display: flex; justify-content: space-between; font-size: 14px; color: #cfd6ff; }
.reward-item b { color: #ffd23f; }
.reward-total { margin-top: 6px; font-size: 20px; font-weight: bold; color: #ffd23f; }
.reward-balance { font-size: 13px; color: #aab4e8; font-weight: normal; }

/* ---------- Edytor torów ---------- */
.screen.editor-screen { padding: 0; align-items: stretch; justify-content: stretch; background: #10132a; gap: 0; }
.editor-side { width: 330px; flex: none; border-radius: 0; max-height: 100vh; padding: 18px 20px; animation: none; border-width: 0 3px 0 0; }
.editor-side h2 { margin: 0 0 10px; }
.editor-side h3 { margin: 16px 0 6px; }
.editor-side .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.editor-side .chip { padding: 6px 11px; font-size: 13px; }
.editor-field { margin-bottom: 10px; }
.editor-field label { display: block; font-size: 12px; opacity: .7; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.editor-field input { width: 100%; box-sizing: border-box; font: inherit; font-weight: bold; padding: 8px 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: #fff; }
.editor-canvas-wrap { flex: 1; position: relative; min-width: 0; }
.editor-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.ed-status { font-size: 13px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.06); margin: 8px 0; line-height: 1.45; }
.ed-status .ok { color: #7cf2a0; } .ed-status .err { color: #ff8a7a; } .ed-status .warn { color: #ffd23f; }
.ed-list { display: flex; flex-direction: column; gap: 6px; }
.ed-item { display: flex; gap: 6px; align-items: center; }
.ed-item .chip { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-item .chip.del { flex: none; padding: 6px 10px; }
.ed-empty { font-size: 13px; opacity: .6; }
.badge.custom { background: #7c5cff; }

/* Przyciski akcji (START / GRAJ) zawsze widoczne u dołu przewijanego panelu */
.row.end.sticky-actions {
  position: sticky; bottom: -28px; z-index: 5;
  margin: 18px -34px -28px; padding: 14px 34px 18px;
  background: linear-gradient(180deg, rgba(14, 16, 40, 0) 0%, rgba(14, 16, 40, 0.96) 28%, rgba(14, 16, 40, 0.98) 100%);
  border-radius: 0 0 20px 20px;
}
.badge.shortcut { background: #c98a2e; }

/* ---------- Poziomy driftu ---------- */
.drift-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.drift-level { font: inherit; color: #fff; text-align: left; cursor: pointer; display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12); }
.drift-level:hover { background: rgba(124,232,255,0.1); }
.drift-level.selected { border-color: #7ce8ff; background: rgba(124,232,255,0.16); box-shadow: 0 0 0 2px rgba(124,232,255,0.3); }
.drift-level.locked { opacity: 0.45; cursor: not-allowed; }
.dl-num { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: bold; font-size: 18px;
  background: linear-gradient(135deg, #3a7bff, #7c5cff); }
.dl-info { flex: 1; min-width: 0; }
.dl-name { font-weight: bold; }
.dl-meta, .dl-goals { font-size: 12px; opacity: 0.75; }
.dl-req { font-size: 11px; color: #ffb03a; margin-top: 2px; }
.dl-req.ok { color: #7cf2a0; }
.dl-right { text-align: right; flex: none; }
.dl-stars i { font-style: normal; font-size: 18px; color: rgba(255,255,255,0.25); }
.dl-stars i.on { color: #ffd23f; text-shadow: 0 0 6px rgba(255,210,63,0.6); }
.dl-best { font-size: 11px; opacity: 0.7; }
.badge.wide { background: #2a8cff; } .badge.narrow { background: #3a9a4a; }

/* ---------- Kariera, bossowie, wyzwanie tygodnia, gablota ---------- */
.career-league { background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.career-league.locked { opacity: 0.5; }
.career-league.done { border-color: #ffd23f; }
.cl-head { display: flex; gap: 12px; align-items: center; }
.cl-icon { font-size: 34px; }
.cl-name { font-size: 20px; font-weight: bold; }
.cl-head > div:nth-child(2) { flex: 1; }
.cl-stars { font-weight: bold; color: #ffd23f; white-space: nowrap; }
.cl-sponsor { margin: 8px 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cl-sponsor .btn.sponsor { flex: 0 1 200px; line-height: 1.2; }
.cl-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.cl-event { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 8px 10px; }
.cl-event .btn { flex: none; margin: 0; }
.ce-num { width: 30px; height: 30px; border-radius: 50%; background: #3a7bff; display: grid; place-items: center; font-weight: bold; flex: none; }
.ce-info { flex: 1; min-width: 0; }
.ce-name { font-weight: bold; }
.ce-stars i { font-style: normal; color: rgba(255,255,255,0.25); } .ce-stars i.on { color: #ffd23f; }
.boss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.boss-card { background: linear-gradient(180deg, rgba(124,92,255,0.18), rgba(0,0,0,0.25)); border: 2px solid rgba(255,255,255,0.14); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.boss-card.locked { opacity: 0.45; } .boss-card.beaten { border-color: #ffd23f; }
.boss-name { font-weight: bold; font-size: 17px; }
.boss-trick { font-size: 13px; color: #ffb4d0; }
.weekly-box { background: rgba(255,255,255,0.05); border-radius: 16px; padding: 14px; }
.weekly-preview { float: right; margin: 0 0 8px 12px; }
.weekly-goals { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; font-weight: bold; }
.weekly-box .big-start { font-size: 20px; margin-top: 12px; clear: both; display: block; width: 100%; }
.results-special { margin: 10px auto 0; max-width: 560px; padding: 8px 12px; border-radius: 12px; background: rgba(255,46,136,0.12); border: 2px solid #ff2e88; font-size: 14px; text-align: left; }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.trophy { text-align: center; padding: 10px; border-radius: 14px; background: rgba(255,255,255,0.04); filter: grayscale(1); opacity: 0.45; }
.trophy.got { filter: none; opacity: 1; background: linear-gradient(180deg, rgba(255,210,63,0.2), rgba(0,0,0,0.2)); border: 2px solid #ffd23f; }
.trophy-icon { font-size: 38px; } .trophy-name { font-weight: bold; } .trophy-desc { font-size: 12px; opacity: 0.8; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.badge-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.04); opacity: 0.5; }
.badge-card.got { opacity: 1; background: rgba(59,255,122,0.12); }
.badge-card span { font-size: 26px; }
#quali-title.win { color: #ffd23f; } #quali-title.podium { color: #e8ecff; } #quali-title.lose { color: #ff8a7a; }

/* Wybór wyścigu w 3 krokach */
.steps { margin-bottom: 6px; }
.steps .chip { font-size: 15px; padding: 8px 16px; }
.steps .chip.done { background: rgba(59, 255, 122, 0.18); border-color: #3bff7a; color: #d8ffe4; }
.steps .chip.done::after { content: ' ✔'; }
.select-summary { margin: 2px 0 10px; font-weight: bold; color: #ffd23f; }
.mode-chips .chip { font-size: 15px; padding: 10px 16px; }

/* Wybór języka w menu */
.lang-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.lang-chip { font-size: 13px; padding: 5px 9px; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.lang-grid .lang-chip { font-size: 16px; padding: 10px 14px; text-align: left; }

/* ---------- Sterowanie dotykowe ---------- */
#touch-controls { position: fixed; inset: 0; pointer-events: none; z-index: 40; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#touch-controls[hidden] { display: none; }
.tc-btn, .tc-steer { position: absolute; pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
.tc-btn { width: 74px; height: 74px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); background: rgba(16,20,44,0.42);
  color: #fff; font: bold 24px/1 "Trebuchet MS", sans-serif; display: flex; align-items: center; justify-content: center; box-shadow: none; }
.tc-btn.on { background: rgba(255,210,63,0.5); border-color: #ffd23f; transform: scale(0.94); }
.tc-steer { left: calc(14px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 250px; height: 118px; display: flex; gap: 10px; }
.tc-half { flex: 1; border-radius: 26px; border: 2px solid rgba(255,255,255,0.4); background: rgba(16,20,44,0.42); color: #fff; font-size: 34px; display: grid; place-items: center; }
.tc-half.on { background: rgba(255,210,63,0.5); border-color: #ffd23f; }
.tc-gas { right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 96px; height: 96px; font-size: 30px; background: rgba(40,160,80,0.45); }
.auto-gas .tc-gas { opacity: 0.45; }
.tc-brake { right: calc(122px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); background: rgba(190,50,50,0.45); }
.tc-drift { right: calc(122px + env(safe-area-inset-right)); bottom: calc(100px + env(safe-area-inset-bottom)); }
.tc-item { right: calc(24px + env(safe-area-inset-right)); bottom: calc(124px + env(safe-area-inset-bottom)); }
.tc-item.ready { border-color: #ffd23f; box-shadow: 0 0 14px rgba(255,210,63,0.7); }
.tc-nitro { right: calc(24px + env(safe-area-inset-right)); bottom: calc(212px + env(safe-area-inset-bottom)); font-size: 16px; --fill: 0%;
  background: linear-gradient(0deg, rgba(47,123,255,0.75) var(--fill), rgba(16,20,44,0.42) var(--fill)); }
.no-nitro .tc-nitro { display: none; }
.tc-btn.small { width: 52px; height: 52px; font-size: 26px; }
.tc-up { right: calc(210px + env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); }
.tc-down { right: calc(210px + env(safe-area-inset-right)); bottom: calc(40px + env(safe-area-inset-bottom)); }
#touch-controls:not(.manual) .tc-up, #touch-controls:not(.manual) .tc-down { display: none; }
.tc-pause { left: calc(50% - 22px); bottom: calc(52px + env(safe-area-inset-bottom)); width: 44px; height: 44px; font-size: 18px; opacity: 0.8; }
@media (max-height: 420px) { .tc-btn { width: 62px; height: 62px; } .tc-gas { width: 80px; height: 80px; } .tc-steer { width: 210px; height: 96px; }
  .tc-item { bottom: calc(104px + env(safe-area-inset-bottom)); } .tc-nitro { bottom: calc(176px + env(safe-area-inset-bottom)); right: calc(110px + env(safe-area-inset-right)); } .tc-drift { bottom: calc(88px + env(safe-area-inset-bottom)); right: calc(186px + env(safe-area-inset-right)); } .tc-brake { right: calc(106px + env(safe-area-inset-right)); } }

/* ---------- Mapa świata kariery ---------- */
.world-map { position: relative; width: 100%; border-radius: 18px; overflow: hidden; border: 2px solid rgba(255,255,255,0.14); background: #0f3a66; }
.world-map svg { display: block; width: 100%; height: auto; }
.world-map .wm-node { cursor: pointer; }
.world-map .wm-node:hover circle.wm-dot, .world-map .wm-node.sel circle.wm-dot { stroke: #ffd23f; stroke-width: 5; }
.world-map .wm-locked { cursor: not-allowed; }
.wm-detail { margin-top: 10px; background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 12px 14px; }
.wm-detail h3 { margin: 0 0 6px; }
.wm-detail .cl-event { margin-top: 8px; }
.wm-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; opacity: 0.85; margin: 6px 2px; }

/* Części gokarta i ghost */
.shop-emoji.part { font-size: 30px; }
.ghost-code { width: 100%; min-height: 70px; font: 12px monospace; margin-top: 8px; border-radius: 10px; background: rgba(0,0,0,0.35); color: #cfe8ff; border: 1px solid rgba(255,255,255,0.2); padding: 6px; }
.track-letters { font: bold 12px "Trebuchet MS", sans-serif; letter-spacing: 3px; margin-top: 2px; color: rgba(255,255,255,0.35); }
.track-letters b { color: #ffe14d; }
.track-letters.full { color: #7cf2a0; }

/* Karnet: wyzwania sezonu */
.season-challenges { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-bottom: 8px; }
.season-ch { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 8px 10px; }
.season-ch.done { border-color: #3bff7a; background: rgba(59,255,122,0.1); }
.season-ch .sc-icon { font-size: 26px; }
.season-ch .sc-info { flex: 1; min-width: 0; font-size: 14px; }
.season-ch .xp-bar { margin: 4px 0 2px; }
.season-ch .sc-pts { font-weight: bold; color: #ffd23f; white-space: nowrap; }
#season-actions { align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

/* Telefon trzymany pionowo: podpowiedź, żeby go obrócić */
.tc-rotate { display: none; position: absolute; left: 50%; top: 38%; transform: translateX(-50%); width: min(80vw, 320px); padding: 14px 16px; border-radius: 16px;
  background: rgba(12,14,34,0.88); border: 2px solid #ffd23f; color: #fff; text-align: center; font: bold 30px/1.2 "Trebuchet MS", sans-serif; pointer-events: none; }
.tc-rotate span { display: block; font-size: 16px; margin-top: 6px; }
#touch-controls.portrait .tc-rotate { display: block; animation: tcRotate 4s ease forwards; }
@keyframes tcRotate { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
