/* ====================================================================
   MISTRZ MNOŻENIA – Design System "Liquid Glass"
   Grube, wypukłe szkło: połysk u góry, tęczowa dyspersja na krawędziach,
   miękki cień unoszenia. Inspiracja: nowoczesne "liquid glass" UI.
   ==================================================================== */

:root {
  --bg-1: #f4f6fb;
  --bg-2: #e7eaf2;

  --text: #1a1c24;
  --text-dim: #5c6373;
  --text-faint: #97a0b2;

  --accent: #0a84ff;

  --green-master: #28b85a;
  --green-good: #58cf7a;
  --mid: #ffb43a;
  --bad: #ff463b;
  --empty: #e6e9f1;

  --gold: #f0b429;
  --silver: #aab2c0;

  --radius: 26px;
  --radius-pill: 999px;

  --serif: "Playfair Display", Georgia, serif;
  --display: "Titan One", "Fredoka", system-ui, sans-serif;
  --sans: "Fredoka", -apple-system, BlinkMacSystemFont, system-ui,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Tęczowa dyspersja (chromatic edge) */
  --spectrum: linear-gradient(90deg, #ff5f6d, #ffc371, #7ef0c0, #5b9dff, #c084fc, #ff6fae);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 760px at 50% -12%, #ffffff, transparent 70%),
    radial-gradient(900px 700px at 8% 4%, rgba(120,170,255,0.18), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(196,132,252,0.16), transparent 58%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

.title-serif { font-family: var(--serif); }

/* ====================================================================
   RDZEŃ SZKŁA – wspólny wygląd
   ==================================================================== */
.glass {
  position: relative;
  background: linear-gradient(157deg, rgba(255,255,255,0.5), rgba(255,255,255,0.22));
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: var(--radius);
  box-shadow:
    0 20px 45px rgba(40, 52, 90, 0.18),
    0 2px 6px rgba(40, 52, 90, 0.08),
    inset 0 1.5px 1px rgba(255,255,255,0.95),
    inset 0 -10px 22px rgba(255,255,255,0.30),
    inset 0 -1px 2px rgba(120,140,180,0.25);
  isolation: isolate;
}
/* połysk u góry */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.10) 20%, transparent 46%);
  z-index: 1;
}
/* tęczowa dyspersja u dołu */
.glass::after {
  content: ""; position: absolute; left: 7%; right: 7%; bottom: -5px; height: 18px;
  border-radius: inherit; background: var(--spectrum);
  filter: blur(12px); opacity: 0.40; z-index: -1; pointer-events: none;
}

/* ---------- Punkty ---------- */
.score-label { font-size: .6rem; letter-spacing: 1.5px; color: var(--text-faint); font-weight: 700; }
.score-value { font-size: 1.55rem; font-weight: 800; color: var(--amber, #ff9f0a);
  background: linear-gradient(180deg, #ffcf45, #f0a000); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- Layout ---------- */
#app { max-width: 1000px; margin: 0 auto; padding: 8px 16px 64px; }
.screen { display: none; animation: fade .42s cubic-bezier(.2,.8,.2,1); }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }

/* treść ponad pseudo-warstwami szkła */
.panel > *, .menu-card > *, .quiz > *, .heatmap-wrap > *, .sidebar > *, .confirm-box > * { position: relative; z-index: 2; }

.subtitle { color: var(--text-dim); margin-top: 10px; font-size: 1.05rem; font-weight: 500; }

/* ---------- Panel ---------- */
.panel { padding: 26px; margin: 18px 0; }
.panel-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.panel-desc { color: var(--text-dim); margin-bottom: 18px; font-weight: 500; }
.panel-desc.center { text-align: center; max-width: 640px; margin: 0 auto 20px; }
.screen-title { font-size: 1.4rem; font-weight: 700; }

/* ====================================================================
   PRZYCISKI – wypukłe szklane pigułki
   ==================================================================== */
.btn {
  position: relative; isolation: isolate; overflow: visible;
  font-family: var(--sans); font-weight: 600; cursor: pointer; letter-spacing: -0.01em;
  border: 1px solid rgba(255,255,255,0.7); border-radius: var(--radius-pill);
  padding: 13px 24px; font-size: .98rem; color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.45));
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    0 10px 22px rgba(40,52,90,0.18),
    inset 0 2px 1px rgba(255,255,255,0.95),
    inset 0 -3px 6px rgba(120,140,180,0.25);
  transition: transform .15s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, filter .2s ease;
}
.btn::before { /* połysk */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.15) 38%, transparent 60%);
}
.btn::after { /* tęczowa krawędź */
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -4px; height: 12px;
  border-radius: inherit; background: var(--spectrum); filter: blur(9px); opacity: 0.45; z-index: -1; pointer-events: none;
}
.btn > * { position: relative; z-index: 2; }
.btn:hover { transform: translateY(-2px); }
.btn:hover::after { opacity: 0.7; }
.btn:active { transform: scale(.96) translateY(0); }
.btn-big { width: 100%; padding: 17px; font-size: 1.08rem; }

.btn-primary {
  color: #fff; border: 1px solid rgba(255,255,255,0.4);
  background: linear-gradient(180deg, #6cc0ff 0%, #0a84ff 55%, #0062d6 100%);
  box-shadow:
    0 14px 28px rgba(10,110,230,0.45),
    inset 0 2px 2px rgba(255,255,255,0.8),
    inset 0 -4px 9px rgba(0,40,120,0.45);
}
.btn-primary::before { background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.2) 42%, transparent 64%); }

.btn-ghost { color: var(--text); }

.btn-danger {
  color: #fff; border: 1px solid rgba(255,255,255,0.4);
  background: linear-gradient(180deg, #ff8a82 0%, #ff463b 55%, #d8281f 100%);
  box-shadow: 0 14px 28px rgba(255,69,58,0.4), inset 0 2px 2px rgba(255,255,255,0.7), inset 0 -4px 9px rgba(150,20,10,0.45);
}

/* ---------- Gear select ---------- */
.gear-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.gear-btn {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 16px; border-radius: 20px; cursor: pointer; text-align: left; color: var(--text);
  background: linear-gradient(160deg, rgba(255,255,255,0.6), rgba(255,255,255,0.3));
  backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1.5px solid rgba(255,255,255,0.7);
  box-shadow: 0 10px 22px rgba(40,52,90,0.14), inset 0 1.5px 1px rgba(255,255,255,0.9);
  transition: .2s cubic-bezier(.2,.8,.2,1);
}
.gear-btn > * { position: relative; z-index: 2; }
.gear-btn:hover { transform: translateY(-2px); }
.gear-btn.active { border-color: rgba(10,132,255,0.6);
  background: linear-gradient(160deg, rgba(120,180,255,0.4), rgba(10,132,255,0.18));
  box-shadow: 0 12px 26px rgba(10,132,255,0.28), inset 0 1.5px 1px rgba(255,255,255,0.9); }
.gear-num { font-weight: 700; font-size: 1.05rem; }

/* ---------- Menu grid ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.menu-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 14px; cursor: pointer; color: var(--text);
  transition: .22s cubic-bezier(.2,.8,.2,1);
}
.menu-card:hover { transform: translateY(-5px); }
.menu-card:hover::after { opacity: 0.65; }
.menu-icon { font-size: 2.1rem; }
.menu-name { font-weight: 700; }

/* ---------- Game head + progress ---------- */
.game-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 22px; }
.progress-wrap { flex: 1; display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 16px; border-radius: 99px; background: rgba(120,130,150,0.18);
  overflow: hidden; box-shadow: inset 0 2px 4px rgba(40,52,90,0.12), inset 0 -1px 1px rgba(255,255,255,0.6); }
.progress-fill { height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(180deg, #6cc0ff, #0a84ff);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 0 0 12px rgba(10,132,255,0.5);
  transition: width .45s cubic-bezier(.2,.8,.2,1); }
.progress-text { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-dim); white-space: nowrap; }

/* ---------- Quiz ---------- */
.quiz { padding: 46px 26px; text-align: center; max-width: 560px; margin: 0 auto; }
.quiz-mode { letter-spacing: 1.5px; font-size: .72rem; color: var(--accent); text-transform: uppercase; font-weight: 700; margin-bottom: 16px; }
.question { font-size: clamp(2.8rem, 9vw, 4.8rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 26px; color: var(--text); }
#answerForm { display: flex; gap: 14px; flex-direction: column; align-items: center; }
.answer-input {
  width: 220px; text-align: center; font-family: var(--sans); font-weight: 700;
  font-size: 2.1rem; padding: 14px; border-radius: 18px; color: var(--text);
  background: rgba(255,255,255,0.8); border: 2px solid rgba(255,255,255,0.9); outline: none;
  box-shadow: inset 0 2px 5px rgba(40,52,90,0.12), 0 6px 14px rgba(40,52,90,0.1); transition: .2s;
}
.answer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(10,132,255,0.18), inset 0 2px 5px rgba(40,52,90,0.1); }
.answer-input::-webkit-outer-spin-button, .answer-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#answerForm .btn { width: 220px; }
.feedback { min-height: 1.6em; margin-top: 18px; font-weight: 700; font-size: 1.05rem; }
.feedback.ok { color: var(--green-master); }
.feedback.bad { color: var(--bad); }

/* ====================================================================
   KAFELKI (trening, garaż) – szklane
   ==================================================================== */
.glass-tile {
  position: relative; isolation: isolate;
  background: linear-gradient(157deg, rgba(255,255,255,0.6), rgba(255,255,255,0.28));
  backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: 0 16px 34px rgba(40,52,90,0.16), inset 0 1.5px 1px rgba(255,255,255,0.92), inset 0 -8px 18px rgba(255,255,255,0.28);
}
.glass-tile::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:1;
  background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.08) 22%, transparent 48%); }

.training-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.train-tile {
  position: relative; isolation: isolate; aspect-ratio: 1; border-radius: 22px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(157deg, rgba(255,255,255,0.6), rgba(255,255,255,0.28));
  backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: 0 16px 34px rgba(40,52,90,0.16), inset 0 1.5px 1px rgba(255,255,255,0.92), inset 0 -8px 18px rgba(255,255,255,0.28);
  color: var(--text); font-weight: 800; font-size: 2rem; transition: .2s cubic-bezier(.2,.8,.2,1);
}
.train-tile::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:1;
  background: linear-gradient(180deg, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.1) 24%, transparent 50%); }
.train-tile > * { position: relative; z-index: 2; }
.train-tile:hover { transform: translateY(-4px); }
.train-tile .tt-label { font-size: .66rem; font-weight: 600; color: var(--text-dim); }
.train-tile .tt-badge { position: absolute; top: 8px; right: 10px; font-size: 1.2rem; z-index: 3; }
.train-tile.gold { border-color: rgba(240,180,41,0.7); box-shadow: 0 16px 34px rgba(240,180,41,0.28), inset 0 1.5px 1px rgba(255,255,255,0.92); }
.train-tile.silver { border-color: rgba(170,178,192,0.8); }

/* ---------- Garage ---------- */
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 18px; }
.car-tile {
  position: relative; isolation: isolate; border-radius: 24px; overflow: hidden; cursor: pointer;
  background: linear-gradient(157deg, rgba(255,255,255,0.7), rgba(255,255,255,0.42));
  backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 16px 34px rgba(40,52,90,0.16), inset 0 1.5px 1px rgba(255,255,255,0.95);
  transition: .22s cubic-bezier(.2,.8,.2,1);
}
.car-tile.locked { cursor: default; }
.car-thumb { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; background: linear-gradient(160deg, #1c2533, #0e131d); }
.car-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* zablokowane: jasny, matowy kafelek z delikatną kłódką */
.locked-thumb { background: linear-gradient(160deg, rgba(255,255,255,0.85), rgba(223,230,243,0.6)); }
.lock-badge { font-size: 2.1rem; opacity: 0.45; filter: grayscale(1); }
.car-tile.unlocked:hover { transform: translateY(-6px); box-shadow: 0 26px 52px rgba(40,52,90,0.24), inset 0 1.5px 1px rgba(255,255,255,0.95); }
.car-cap { padding: 14px 15px; position: relative; z-index: 2; }
.car-cap .car-flag { display: block; color: var(--text-dim); font-size: .75rem; font-weight: 600; margin-bottom: 3px; }
.car-cap .car-nm { font-weight: 700; font-size: .98rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-cap .muted { color: var(--text-faint); }
.car-cap .car-nm.muted { font-weight: 500; }

/* ---------- Report / Heatmap ---------- */
.report-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.heatmap-wrap { padding: 20px; }
.heatmap { display: grid; grid-template-columns: 28px repeat(10, 1fr); gap: 5px; }
.hm-cell {
  aspect-ratio: 1; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; cursor: pointer; transition: .12s; color: #fff;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), inset 0 -2px 4px rgba(0,0,0,0.12);
}
.hm-cell:hover { transform: scale(1.1); }
.hm-cell.selected { outline: 2.5px solid var(--text); outline-offset: 1px; }
.hm-head { background: transparent; color: var(--text-faint); cursor: default; font-weight: 800; box-shadow: none; }
.hm-corner { background: transparent; cursor: default; box-shadow: none; }
.hm-master { background: linear-gradient(180deg, #3ed46d, var(--green-master)); }
.hm-good { background: linear-gradient(180deg, #74e093, var(--green-good)); color: #0c3a1a; }
.hm-mid { background: linear-gradient(180deg, #ffc760, var(--mid)); color: #4a2e00; }
.hm-bad { background: linear-gradient(180deg, #ff6b62, var(--bad)); }
.hm-empty { background: var(--empty); color: #aab2c0; box-shadow: inset 0 1px 2px rgba(40,52,90,0.08); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; font-size: .78rem; color: var(--text-dim); font-weight: 500; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.sw-master { background: var(--green-master); } .sw-good { background: var(--green-good); }
.sw-mid { background: var(--mid); } .sw-bad { background: var(--bad); } .sw-empty { background: var(--empty); }

.sidebar { padding: 22px; position: sticky; top: 90px; }
.sidebar h3 { margin-bottom: 8px; font-weight: 700; }
.sb-hint { color: var(--text-dim); font-size: .88rem; font-weight: 500; }
.sb-details.hidden { display: none; }
.sb-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(60,70,100,0.12); font-weight: 500; }
.sb-row b { font-weight: 700; }
.sb-row.sb-acc b { color: var(--accent); font-size: 1.2rem; }
.sb-verdict { margin-top: 14px; font-weight: 700; text-align: center; padding: 12px; border-radius: 16px; background: rgba(10,132,255,0.10); }

.danger-zone { margin-top: 28px; text-align: center; }

/* ====================================================================
   MODALE
   ==================================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 40, 0.32);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.show { display: flex; animation: fade .32s cubic-bezier(.2,.8,.2,1); }

.collectible-card {
  position: relative; isolation: isolate;
  width: 100%; max-width: 384px; padding: 26px; border-radius: 30px; text-align: center; color: var(--text);
  background: linear-gradient(157deg, rgba(255,255,255,0.78), rgba(255,255,255,0.5));
  backdrop-filter: blur(34px) saturate(180%); -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 36px 80px rgba(20,30,60,0.42), inset 0 2px 1px rgba(255,255,255,0.95), inset 0 -10px 24px rgba(255,255,255,0.3);
  max-height: 92vh; overflow-y: auto;
}
.collectible-card::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:1;
  background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.12) 18%, transparent 42%); }
.collectible-card > * { position: relative; z-index: 2; }
.cc-new-banner { font-weight: 800; color: #f0a000; letter-spacing: .3px; font-size: .82rem; margin-bottom: 14px; }
.cc-image { aspect-ratio: 16/10; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; background: #0c1017; color: #7986a3; margin-bottom: 16px; overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 6px 16px rgba(40,52,90,0.18); }
.cc-image img { width: 100%; height: 100%; object-fit: contain; }
.cc-origin { color: var(--text-dim); font-weight: 600; margin-bottom: 2px; }
.cc-name { font-family: var(--sans); font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; line-height: 1.1; }
.cc-dash { display: flex; gap: 12px; margin-bottom: 18px; }
.cc-stat { flex: 1; background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.8); border-radius: 16px; padding: 12px;
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,0.9), 0 4px 10px rgba(40,52,90,0.08); }
.cc-stat-label { display: block; font-size: .6rem; letter-spacing: 1.5px; color: var(--text-faint); font-weight: 700; }
.cc-stat-val { font-weight: 800; font-size: 1.2rem; color: var(--accent); }
.cc-facts { list-style: none; text-align: left; margin-bottom: 20px; }
.cc-facts li { padding: 12px 15px; margin-bottom: 9px; border-radius: 14px;
  background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.7); border-left: 3px solid var(--accent);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.8), 0 3px 8px rgba(40,52,90,0.06);
  font-size: .9rem; font-weight: 500; opacity: 0; transform: translateX(-14px); }
.cc-facts li.in { animation: factIn .42s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes factIn { to { opacity: 1; transform: none; } }

/* Confirm */
.confirm-box { padding: 28px; max-width: 360px; text-align: center; }
.confirm-box h3 { margin-bottom: 8px; font-weight: 700; }
.confirm-box p { color: var(--text-dim); margin-bottom: 20px; font-weight: 500; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

/* Certyfikat (elegancki dyplom) */
.certificate { width: 100%; max-width: 480px; background: #faf6ec; border-radius: 22px; padding: 8px; color: #2a2417;
  box-shadow: 0 36px 80px rgba(20,30,60,0.42); }
.cert-border { border: 3px double #c9a955; border-radius: 16px; padding: 30px 24px; text-align: center; }
.cert-seal { font-size: 2.9rem; }
.cert-top { letter-spacing: 2px; font-size: .68rem; color: #9a7d3c; text-transform: uppercase; margin: 6px 0; font-weight: 700; }
.certificate h2 { font-family: var(--serif); font-size: 1.7rem; color: #7a5d1e; margin-bottom: 14px; }
.cert-line { font-size: .95rem; margin: 6px 0; }
.cert-name { font-family: var(--serif); font-size: 2.3rem; color: #2a2417; margin: 12px 0; }
.cert-foot { margin: 14px 0 18px; font-weight: 700; }
.certificate .btn { background: linear-gradient(180deg, #9a7d3c, #7a5d1e); color: #fff; border: none;
  box-shadow: 0 12px 24px rgba(122,93,30,0.34), inset 0 2px 1px rgba(255,255,255,0.3); }

/* ---------- Responsywność ---------- */
@media (max-width: 760px) {
  .menu-grid, .gear-select { grid-template-columns: 1fr; }
  .report-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .training-grid { grid-template-columns: repeat(2, 1fr); }
  .heatmap { gap: 4px; grid-template-columns: 22px repeat(10, 1fr); }
  .hm-cell { font-size: .6rem; border-radius: 7px; }
}

/* ====================================================================
   PŁYNNE SZKŁO – realne załamanie tła (filtr SVG #liquid)
   Działa w Chrome/Edge; Safari korzysta z fallbacku (mocniejsze rozmycie).
   ==================================================================== */
.lg-filter { position: absolute; width: 0; height: 0; overflow: hidden; }

@supports (backdrop-filter: url(#liquid)) {
  .glass {
    backdrop-filter: url(#liquid) blur(5px) saturate(175%);
  }
  .btn {
    backdrop-filter: url(#liquid) blur(4px) saturate(160%);
  }
  .gear-btn {
    backdrop-filter: url(#liquid) blur(5px) saturate(160%);
  }
  .train-tile {
    backdrop-filter: url(#liquid) blur(6px) saturate(165%);
  }
  .collectible-card {
    backdrop-filter: url(#liquid) blur(9px) saturate(180%);
  }
}

/* ====================================================================
   EKRAN STARTOWY – zabawny, dziecięcy, "wow"
   ==================================================================== */
.hero-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.8rem, 11vw, 5.2rem); line-height: .92; letter-spacing: 0.5px;
  margin: 4px 0 10px;
  background: linear-gradient(115deg, #ff5e6c 0%, #ff9a3d 42%, #2f8bff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(40,52,90,0.10)) drop-shadow(0 8px 16px rgba(40,52,90,0.12));
  animation: popin .55s cubic-bezier(.2,1.2,.4,1) both;
}
.subtitle { color: var(--text-dim); margin: 0 auto; max-width: 440px; font-size: 1.05rem; font-weight: 500; }

/* Kafelek z punktami w lewym górnym rogu (3x większy, bez paska) */
.score-chip {
  width: max-content; margin: 0 0 22px auto;   /* prawy górny róg, nad treścią */
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1;
  padding: 14px 26px 16px;
}
.score-chip .score-label { font-size: .72rem; letter-spacing: 2.5px; color: var(--text-faint); font-weight: 700; margin-bottom: 4px; }
.score-chip .score-value { font-size: 3.1rem; font-weight: 800; }
@media (max-width: 760px) {
  .score-chip { padding: 10px 18px 12px; }
  .score-chip .score-value { font-size: 2.2rem; }
}

/* --- Scena z autem --- */
/* Scena startowa: droga (przewija się) + smugi prędkości + auto (kołysze się).
   Warstwy to przezroczyste PNG: img/droga.png, img/predkosc.png, img/auto_bok.png */
.hero-stage { position: relative; max-width: 460px; height: 200px; margin: 8px auto 0; }

/* DROGA – bezszwowy kafel wycięty z oryginału, przewija się w lewo (auto jedzie w prawo).
   krok animacji = dokładnie szerokość kafla (100px) => brak skoku */
.hs-road {
  position: absolute; left: 0; right: 0; bottom: 8px; height: 46px; z-index: 1;
  background-image: url("img/droga.png");
  background-repeat: repeat-x;
  background-size: 100px 46px;
  background-position: 0 center;
  animation: roadScroll 1.5s linear infinite;
}
@keyframes roadScroll { from { background-position-x: 0; } to { background-position-x: -100px; } }

/* AUTO – bokiem, jedzie w prawo (ma wbudowane smugi); kołysze się w miejscu, miękki cień */
.hs-car {
  position: absolute; left: 50%; bottom: 32px; width: 272px; height: auto; transform: translateX(-50%);
  z-index: 3; transform-origin: center bottom; animation: carBob 1.5s ease-in-out infinite;
  filter: drop-shadow(0 12px 9px rgba(20,40,80,0.28));
}
@keyframes carBob {
  0%,100% { transform: translateX(-50%) translateY(0) rotate(-1deg); }
  50%     { transform: translateX(-50%) translateY(-7px) rotate(1deg); }
}
@keyframes popin { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }

/* --- Panel "Jedziemy" --- */
.play-panel .panel-title { font-family: var(--display); font-weight: 400; font-size: 1.5rem; letter-spacing: .3px; color: var(--text); }
.play-panel { animation: popin .6s cubic-bezier(.2,1,.4,1) both; }

/* karuzela biegów – bardziej zabawnie */
.play-panel .gear-btn { align-items: center; text-align: center; gap: 2px; padding: 16px 10px; }
.gear-emoji { font-size: 1.9rem; line-height: 1; margin-bottom: 4px; display: block; transition: transform .2s; }

/* Dymek podpowiedzi po najechaniu na bieg */
.gear-btn:hover { z-index: 5; }
.gear-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 11px); left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #1b2030; color: #fff; font-size: .78rem; font-weight: 500; line-height: 1.35;
  padding: 9px 13px; border-radius: 11px; width: max-content; max-width: 180px; text-align: center;
  box-shadow: 0 10px 24px rgba(20,30,60,0.32);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 30;
}
.gear-btn[data-tip]::before {
  content: ""; position: absolute; bottom: calc(100% + 5px); left: 50%;
  transform: translateX(-50%) translateY(5px);
  border: 6px solid transparent; border-top-color: #1b2030;
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 30;
}
.gear-btn[data-tip]:hover::after,
.gear-btn[data-tip]:hover::before { opacity: 1; transform: translateX(-50%) translateY(0); }
.play-panel .gear-btn:hover .gear-emoji { transform: scale(1.18) rotate(-6deg); }
.play-panel .gear-btn.active .gear-emoji { animation: bounce .6s ease; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-7px)} 70%{transform:translateY(-3px)} }

.btn-go { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--display); font-weight: 400; letter-spacing: .5px; font-size: 1.25rem; }
.btn-go .go-ic { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.28); align-items: center; justify-content: center; }
.btn-go .go-ic svg { width: 15px; height: 15px; color: #fff; margin-left: 2px; }

/* --- Karty menu z kolorowymi ikonami --- */
.menu-card { animation: popin .6s cubic-bezier(.2,1,.4,1) both; }
.menu-card:nth-child(1) { animation-delay: .05s; }
.menu-card:nth-child(2) { animation-delay: .12s; }
.menu-card:nth-child(3) { animation-delay: .19s; }
.menu-icon {
  width: 60px; height: 60px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px; color: #fff;
  background: linear-gradient(160deg, var(--c1, #5e9dff), var(--c2, #0a84ff));
  box-shadow: 0 10px 20px var(--cshadow, rgba(10,132,255,0.4)), inset 0 1.5px 1px rgba(255,255,255,0.6);
  transition: transform .25s cubic-bezier(.2,1.4,.4,1);
}
.menu-icon svg { width: 30px; height: 30px; }
.menu-card:hover .menu-icon { transform: rotate(-8deg) scale(1.08); }
.menu-name { font-weight: 700; font-size: 1.08rem; }
.accent-amber  { --c1:#ffc24d; --c2:#ff8a2b; --cshadow: rgba(255,138,43,0.42); }
.accent-violet { --c1:#b07cff; --c2:#7b3ff2; --cshadow: rgba(123,63,242,0.42); }
.accent-teal   { --c1:#4fd6c0; --c2:#16a59a; --cshadow: rgba(22,165,154,0.42); }

@media (prefers-reduced-motion: reduce) {
  .hs-car, .hs-road, .hs-speed { animation: none; }
}

/* ====================================================================
   Efekty: animacja poprawnej/błędnej odpowiedzi + przycisk dźwięku
   ==================================================================== */
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
.question.pop { animation: pop .36s cubic-bezier(.2,1.5,.4,1); }

@keyframes shakeX {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); } 40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(6px); }
}
.answer-input.shake { animation: shakeX .42s; border-color: var(--bad); box-shadow: 0 0 0 4px rgba(255,69,58,.18); }

.sound-toggle {
  position: fixed; bottom: 18px; right: 18px; z-index: 70;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer; font-size: 21px;
  border: 1px solid rgba(255,255,255,0.7);
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.5));
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 8px 18px rgba(40,52,90,0.2), inset 0 1.5px 1px rgba(255,255,255,0.9);
  transition: transform .15s ease;
}
.sound-toggle:hover { transform: translateY(-2px) scale(1.05); }
.sound-toggle:active { transform: scale(.94); }

/* ====================================================================
   Nauka: seria (combo), podpowiedź, przycisk Powtórki
   ==================================================================== */
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
.bump { animation: bump .34s cubic-bezier(.2,1.5,.4,1); }

.streak-badge {
  display: none; margin: 0 auto 12px; width: max-content;
  padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: .95rem; color: #fff;
  background: linear-gradient(180deg, #ff9a3d, #ff5e3a);
  box-shadow: 0 6px 16px rgba(255,94,58,0.4), inset 0 1.5px 1px rgba(255,255,255,0.5);
}
.streak-badge.show { display: block; }

.feedback.hint { color: #b06a00; }

.btn-review { width: 100%; margin-top: 10px; font-weight: 600; font-size: .98rem; }

/* ====================================================================
   Synchronizacja (kod rodziny)
   ==================================================================== */
.hidden { display: none; }
.sync-panel { padding: 22px; margin-top: 26px; text-align: center; }
.sync-panel > * { position: relative; z-index: 2; }
.sync-title { font-weight: 700; font-size: 1.2rem; margin-bottom: 4px; }
.sync-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.sync-code { font-size: 1.05rem; margin-bottom: 6px; }
.sync-code b { color: var(--accent); letter-spacing: 2px; font-size: 1.3rem; }
.sync-hint { color: var(--text-dim); font-size: .9rem; margin-bottom: 12px; max-width: 460px; margin-left: auto; margin-right: auto; }

/* ====================================================================
   Układ ekranu startowego: 2 kolumny (animacja | panel biegów)
   ==================================================================== */
.start-top { display: grid; grid-template-columns: 1.02fr .98fr; gap: 24px; align-items: center; margin: 10px 0 18px; }
.start-left { text-align: left; }
.start-left .hero-title { font-size: clamp(2.6rem, 6.5vw, 4.8rem); }
.start-left .subtitle { margin: 0; max-width: 440px; }
.start-left .hero-stage { margin: 16px 0 0; max-width: 100%; height: 200px; }
.start-right { margin: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 860px) {
  .start-top { grid-template-columns: 1fr; gap: 16px; }
  .start-left { text-align: center; }
  .start-left .subtitle { margin: 0 auto; }
}

/* ====================================================================
   Szeroka, pozioma karta auta (zdjęcie | opis), większe czcionki
   ==================================================================== */
.collectible-card { max-width: 860px; padding: 26px 30px; }
.cc-body { display: grid; grid-template-columns: 1.12fr 1fr; gap: 26px; align-items: stretch; margin-bottom: 18px; text-align: left; }
.cc-image { margin-bottom: 0; aspect-ratio: auto; min-height: 300px; height: 100%; }
.cc-info { text-align: left; display: flex; flex-direction: column; }
.cc-origin { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.cc-name { font-size: 2.5rem; margin-bottom: 16px; line-height: 1.05; }
.cc-dash { margin-bottom: 16px; }
.cc-stat { padding: 14px 18px; }
.cc-stat-label { font-size: .66rem; }
.cc-stat-val { font-size: 1.55rem; }
.cc-facts { margin-bottom: 0; }
.cc-facts li { font-size: 1.04rem; padding: 13px 17px; margin-bottom: 10px; line-height: 1.4; }
@media (max-width: 720px) {
  .collectible-card { padding: 20px; }
  .cc-body { grid-template-columns: 1fr; gap: 16px; }
  .cc-image { min-height: 200px; }
  .cc-name { font-size: 1.9rem; }
}
