/* =========================================================
   KURA WARZYW – Kebab Challenge
   Styl: kreskówkowy fast-food, mobile-first
   ========================================================= */

:root {
  --yellow: #ffc93c;
  --yellow-dark: #f0a500;
  --orange: #ff7a00;
  --orange-dark: #e05e00;
  --red: #e63946;
  --green: #3fa34d;
  --green-light: #7bc950;
  --blue: #2e86ab;
  --purple: #8f5bd3;
  --cream: #fff6e2;
  --paper: #fffdf7;
  --ink: #2b2118;
  --ink-soft: #6b5a48;
  --line: #2b2118;
  --shadow: 0 6px 0 rgba(43, 33, 24, .22);
  --radius: 18px;
  --radius-lg: 26px;
  --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --topbar-h: 62px;
  --max-w: 980px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 201, 60, .45) 0 22%, transparent 55%),
    radial-gradient(circle at 88% 8%, rgba(255, 122, 0, .30) 0 20%, transparent 52%),
    radial-gradient(circle at 78% 92%, rgba(123, 201, 80, .32) 0 18%, transparent 50%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 .4em; line-height: 1.05; }
p { line-height: 1.5; }

/* ---------------- Przyciski ---------------- */

.btn {
  --btn-bg: var(--orange);
  --btn-fg: #fff;
  appearance: none;
  border: 3px solid var(--line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1rem, 3.6vw, 1.22rem);
  letter-spacing: .3px;
  padding: 14px 22px;
  min-height: 52px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--line);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  text-align: center;
  width: 100%;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: 0 5px 0 var(--line); transform: none; }
.btn--big { font-size: clamp(1.1rem, 4.6vw, 1.5rem); padding: 18px 26px; min-height: 62px; }
.btn--green { --btn-bg: var(--green); }
.btn--yellow { --btn-bg: var(--yellow); --btn-fg: var(--ink); }
.btn--red { --btn-bg: var(--red); }
.btn--blue { --btn-bg: var(--blue); }
.btn--ghost { --btn-bg: #fff; --btn-fg: var(--ink); }
.btn--sm { font-size: 1rem; padding: 10px 16px; min-height: 46px; }
.btn-row { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 620px) { .btn-row--2 { grid-template-columns: 1fr 1fr; } }

.iconbtn {
  appearance: none;
  border: 3px solid var(--line);
  background: #fff;
  border-radius: 50%;
  width: 46px; height: 46px;
  min-width: 46px;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  display: grid; place-items: center;
  touch-action: manipulation;
}
.iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

/* ---------------- Karty ---------------- */

.card {
  background: var(--paper);
  border: 4px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 4vw, 26px);
}
.card + .card { margin-top: 14px; }

.badge {
  display: inline-block;
  background: var(--yellow);
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .95rem;
}
.badge--red { background: var(--red); color: #fff; }
.badge--green { background: var(--green-light); }
.badge--blue { background: var(--blue); color: #fff; }

/* ---------------- Topbar + progress ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px calc(8px);
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(255, 253, 247, .95);
  backdrop-filter: blur(6px);
  border-bottom: 4px solid var(--line);
}
.topbar__player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__avatar {
  width: 42px; height: 42px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  flex: none;
}
.topbar__meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.topbar__name {
  font-family: var(--font-display); font-weight: 800; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw;
}
.topbar__score { font-size: .85rem; color: var(--ink-soft); }
.topbar__score b { color: var(--orange-dark); font-size: 1rem; }

.progress {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0; padding: 0;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}
.progress li {
  flex: 0 1 auto;
  display: flex; flex-direction: column; align-items: center;
  font-size: .58rem; font-weight: 700; color: var(--ink-soft);
  max-width: 64px;
}
.progress__label {
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.15;
}
.progress__dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: #fff;
  display: grid; place-items: center;
  font-size: .9rem;
  transition: transform .2s ease, background .2s ease;
}
.progress li[data-state="done"] .progress__dot { background: var(--green-light); }
.progress li[data-state="active"] .progress__dot { background: var(--yellow); transform: scale(1.16); box-shadow: 0 0 0 4px rgba(255,201,60,.35); }
.progress__label { display: none; }

/* Bardzo waskie ekrany - zmniejszamy topbar, zeby pasek postepu sie zmiescil. */
@media (max-width: 430px) {
  .topbar { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .topbar__avatar { width: 34px; height: 34px; }
  .topbar__name { max-width: 18vw; font-size: .82rem; }
  .topbar__score { font-size: .75rem; }
  .progress { gap: 2px; }
  .progress__dot { width: 26px; height: 26px; font-size: .76rem; border-width: 2px; }
  .iconbtn { width: 38px; height: 38px; min-width: 38px; font-size: 1rem; }
}
@media (min-width: 720px) {
  .progress__label { display: block; margin-top: 2px; }
  .progress li { width: 96px; max-width: 96px; }
  .topbar__name { max-width: 180px; }
}

/* Duze ekrany desktopowe - jest mnostwo wolnego miejsca w poziomie,
   wiec powiekszamy ikonki paska i rozsuwamy je, zeby caly pasek byl czytelny,
   a nie tylko wasko wypelniony na srodku. Ten blok musi byc PO bloku
   min-width:720px w kaskadzie, inaczej przy szerokich ekranach (gdzie oba
   media query pasuja) wygrywalby ten wczesniejszy i wymuszal wasze kolumny
   (byl to powod, dla ktorego etykiety etapow zlewaly sie na desktopie). */
@media (min-width: 1000px) {
  .topbar { padding: 10px 28px; gap: 22px; }
  .topbar__avatar { width: 52px; height: 52px; border-width: 3px; }
  .topbar__name { font-size: 1.08rem; max-width: 240px; }
  .topbar__score { font-size: .95rem; }
  .topbar__score b { font-size: 1.1rem; }
  .progress { gap: 16px; }
  .progress__dot { width: 44px; height: 44px; font-size: 1.25rem; border-width: 3px; }
  .progress li { width: 128px; max-width: 128px; font-size: .7rem; }
  .progress__label { font-size: .8rem; }
  .iconbtn { width: 52px; height: 52px; min-width: 52px; font-size: 1.4rem; }
}

/* ---------------- Ekran startowy ---------------- */

.start {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  position: relative;
  min-height: calc(100dvh - 40px);
  overflow: hidden;
}
.start__logo { position: relative; z-index: 2; }
.start__title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 13vw, 5.4rem);
  font-weight: 800;
  line-height: .92;
  color: var(--orange);
  text-shadow:
    3px 3px 0 var(--line), -2px -2px 0 var(--line), 2px -2px 0 var(--line), -2px 2px 0 var(--line),
    0 10px 0 rgba(43,33,24,.18);
  margin: 0;
  transform: rotate(-2deg);
}
.start__sub {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5.4vw, 2rem);
  background: var(--ink); color: var(--yellow);
  display: inline-block;
  padding: 4px 20px; border-radius: 999px;
  transform: rotate(1.5deg);
  margin-top: 6px;
}
.start__lead {
  max-width: 30ch; margin: 18px auto 6px;
  font-size: clamp(1rem, 4vw, 1.15rem); font-weight: 700;
  position: relative; z-index: 2;
  text-shadow: 0 2px 8px rgba(255, 246, 226, .95), 0 0 14px rgba(255, 246, 226, .9);
}
.start__prize {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--yellow); border: 3px solid var(--line); border-radius: 999px;
  padding: 6px 16px; font-weight: 900; margin-bottom: 20px;
  box-shadow: 0 4px 0 var(--line);
}
.start__cta { max-width: 380px; width: 100%; position: relative; z-index: 2; }
/* Klasyczna czarna czcionka - drobny tekst potrafi wypasc na ikonce tla, wiec dajemy mu jeszcze poswiate. */
.start__note {
  color: #000;
  font-weight: 700;
  font-size: .92rem;
  text-shadow: 0 0 10px var(--cream), 0 0 6px var(--cream), 0 1px 2px var(--cream);
}

/* Animowane tlo ekranu startowego.
   Kazda ikonka to <span class="floater"><i>emoji</i></span>:
   - zewnetrzny span animuje TOR ruchu (--path),
   - wewnetrzne <i> animuje "charakter" ikonki (--wig): kiwanie, obrot, pulsowanie.
   Dzieki rozdzieleniu na dwie warstwy oba ruchy nie nadpisuja sobie transformacji.
   Parametry (pozycja, rozmiar, tempo, opoznienie) sa losowane w JS i wstrzykiwane
   jako zmienne CSS, wiec tlo za kazdym razem uklada sie troche inaczej. */

.floaters { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }

.floater {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: var(--size);
  line-height: 1;
  opacity: var(--op, .9);
  will-change: transform;
  animation-name: var(--path);
  animation-duration: var(--dur);
  animation-delay: var(--delay);
  animation-timing-function: var(--ease, linear);
  animation-iteration-count: infinite;
  filter: drop-shadow(0 4px 0 rgba(43, 33, 24, .10));
}
.floater > i {
  display: inline-block;
  font-style: normal;
  animation-name: var(--wig, none);
  animation-duration: var(--wig-dur, 1s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

/* --- tory ruchu ---
   Kurczaki (🐓🐤) domyslnie sa zwrocone w lewo, wiec bieg w prawo wymaga
   odbicia lustrzanego, a bieg w lewo - nie. */
@keyframes pathRunRight { from { transform: translateX(0) scaleX(-1); } to { transform: translateX(132vw) scaleX(-1); } }
@keyframes pathRunLeft  { from { transform: translateX(0); }            to { transform: translateX(-132vw); } }
@keyframes pathFall     { from { transform: translateY(-20vh); }        to { transform: translateY(122vh); } }
@keyframes pathHover    { 0%, 100% { transform: translateY(0); }        50% { transform: translateY(-28px); } }
@keyframes pathOrbit {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(52px, -38px); }
  50%  { transform: translate(96px, 8px); }
  75%  { transform: translate(38px, 44px); }
  100% { transform: translate(0, 0); }
}
@keyframes pathDrift {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(-34px, -58px); }
  100% { transform: translate(0, 0); }
}

/* --- "charakter" ikonki --- */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes wigBob    { 0%, 100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-10px) rotate(7deg); } }
@keyframes wigSpin   { to { transform: rotate(360deg); } }
@keyframes wigTumble { to { transform: rotate(-360deg); } }
@keyframes wigWobble { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
@keyframes wigPulse  { 0%, 100% { transform: scale(1) rotate(-4deg); } 50% { transform: scale(1.16) rotate(4deg); } }

@media (prefers-reduced-motion: reduce) {
  .floater, .floater > i { animation: none !important; }
  .floater--runner { display: none; }
}

/* ---------------- Formularze ---------------- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-family: var(--font-display); font-weight: 700; margin-bottom: 4px; font-size: 1.05rem;
}
.field input[type="text"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 13px 16px;
  min-height: 52px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}
.field input:focus-visible, .btn:focus-visible, .iconbtn:focus-visible, .opt:focus-visible {
  outline: 4px solid var(--blue); outline-offset: 2px;
}
.field__error { color: var(--red); font-weight: 800; font-size: .9rem; min-height: 1.2em; display: block; margin-top: 3px; }

.nickpreview {
  text-align: center; background: var(--yellow); border: 3px dashed var(--line);
  border-radius: 14px; padding: 10px; margin-top: 6px; font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 800;
}

/* ---------------- Kreator avatara ---------------- */

.avatar-editor { display: grid; gap: 14px; }
@media (min-width: 760px) { .avatar-editor { grid-template-columns: 260px 1fr; align-items: start; } }

.avatar-stage {
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #fff 0 12px, #fff8e8 12px 24px);
  border: 4px solid var(--line); border-radius: var(--radius-lg);
  padding: 10px;
  position: relative;
}
.avatar-stage canvas { width: min(220px, 60vw); height: auto; image-rendering: auto; }

.opt-group { margin-bottom: 12px; }
.opt-group__title { font-family: var(--font-display); font-weight: 800; font-size: 1rem; margin-bottom: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  appearance: none;
  border: 3px solid var(--line);
  background: #fff;
  border-radius: 12px;
  min-width: 46px; min-height: 46px;
  padding: 6px 12px;
  font-weight: 800; font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  touch-action: manipulation;
}
.opt[aria-pressed="true"] { background: var(--yellow); transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt--color { padding: 0; width: 46px; height: 46px; border-radius: 50%; }
.opt--color[aria-pressed="true"] { box-shadow: 0 0 0 4px rgba(43,33,24,.25); transform: scale(1.06); }

/* ---------------- Instrukcje etapu ---------------- */

.stage-head { text-align: center; margin-bottom: 6px; }
.stage-head__icon { font-size: clamp(3rem, 14vw, 4.6rem); line-height: 1; display: block; }
.stage-head__kicker { font-weight: 900; color: var(--orange-dark); letter-spacing: 1px; text-transform: uppercase; font-size: .85rem; }
.stage-head__title { font-size: clamp(1.6rem, 7vw, 2.6rem); }

.rules { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.rules li {
  background: var(--cream); border: 3px solid var(--line); border-radius: 14px;
  padding: 10px 14px; font-weight: 700; display: flex; gap: 10px; align-items: flex-start;
}
.rules li b { color: var(--orange-dark); }
.rules__ico { font-size: 1.2rem; line-height: 1.3; flex: none; }

/* Odznaka z ikonka etapu - ta sama stylistyka co kropki paska postepu na gorze gry. */
.rules__badge {
  width: 34px; height: 34px;
  min-width: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--yellow);
  display: grid; place-items: center;
  font-size: 1.15rem;
  box-shadow: 0 3px 0 var(--line);
}

.controls-box {
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; margin-top: 10px;
  font-weight: 700;
}
.controls-box b { color: var(--yellow); }
.key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2em; box-sizing: content-box;
  background: #fff; color: var(--ink); border-radius: 6px;
  padding: 1px 8px; font-family: var(--font-display); font-weight: 800; margin: 0 2px;
  border-bottom: 3px solid #bbb;
}

.official-warning {
  background: var(--red); color: #fff; border: 3px solid var(--line); border-radius: 14px;
  padding: 12px 16px; text-align: center; font-weight: 800; margin-top: 12px;
  box-shadow: var(--shadow);
}
.official-warning small { display: block; font-weight: 700; opacity: .92; margin-top: 2px; }

.attempts-left { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin-top: 8px; }
.attempts-dots { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.attempts-dots i {
  width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--line); background: #fff; display: block;
}
.attempts-dots i.used { background: var(--red); }

.scorelist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.scorelist li {
  display: flex; justify-content: space-between; background: var(--cream);
  border: 3px solid var(--line); border-radius: 12px; padding: 8px 14px; font-weight: 800;
}
.scorelist li.best { background: var(--green-light); }

/* ---------------- Ekran gry ---------------- */

body.is-playing { overflow: hidden; touch-action: none; }

.play {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #ffeec2;
  display: flex; flex-direction: column;
  touch-action: none;
  overscroll-behavior: none;
}
.play__hud {
  display: flex; align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  background: rgba(43,33,24,.92); color: #fff;
  font-family: var(--font-display); font-weight: 800;
  flex: none;
  min-height: 46px;
}
.hud__avatar {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7);
  background: var(--yellow); flex: none;
}
.hud__chip {
  background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px 12px;
  font-size: clamp(.85rem, 3.4vw, 1.05rem); white-space: nowrap;
}
.hud__chip b { color: var(--yellow); }
.hud__chip--danger { background: var(--red); }
.hud__spacer { flex: 1; }
.hud__lives { letter-spacing: 2px; font-size: 1.1rem; }
.hud__bonus {
  background: var(--purple); border-radius: 999px; padding: 3px 12px; font-size: .9rem;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

.play__stage {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
.play__stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

.play__test-banner {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; border: 3px solid var(--line);
  border-radius: 999px; padding: 3px 16px; font-weight: 900; z-index: 5;
  font-size: .85rem; pointer-events: none;
}

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(43,33,24,.72); color: #fff; z-index: 10;
  font-family: var(--font-display); font-size: clamp(4rem, 26vw, 10rem); font-weight: 800;
}
.countdown span { animation: popIn .55s ease; display: block; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.pause-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 12;
  background: rgba(43,33,24,.82); color: #fff; text-align: center; padding: 20px;
}

/* Joystick */
.joystick {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 132px; height: 132px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  border: 4px solid rgba(43,33,24,.35);
  touch-action: none;
  z-index: 8;
}
.joystick__knob {
  position: absolute; left: 50%; top: 50%;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: rgba(255,122,0,.85);
  border: 4px solid rgba(43,33,24,.55);
  pointer-events: none;
}
.joystick--left { left: calc(16px + env(safe-area-inset-left)); right: auto; }

/* ---------------- Podsumowanie etapu ---------------- */

.summary { text-align: center; }
.summary__kicker { font-family: var(--font-display); font-size: clamp(1.6rem, 8vw, 2.6rem); color: var(--green); }
.summary__stat { font-size: 1.15rem; font-weight: 800; margin: 4px 0; }
.summary__score {
  font-family: var(--font-display); font-size: clamp(3rem, 18vw, 5.5rem); font-weight: 800;
  color: var(--orange); line-height: 1; margin: 8px 0;
  text-shadow: 3px 3px 0 var(--line);
}
.summary__msg {
  background: var(--yellow); border: 3px dashed var(--line); border-radius: 16px;
  padding: 12px; font-weight: 800; font-style: italic; margin: 12px 0;
}

/* ---------------- Etap 5 ---------------- */

.riddle__prompt {
  font-family: var(--font-display); font-size: clamp(1.15rem, 5vw, 1.6rem);
  background: var(--cream); border: 3px solid var(--line); border-radius: 16px;
  padding: 16px; text-align: center; font-weight: 700;
}
.riddle__meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 10px 0; font-weight: 800; }
.riddle__slots { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0; }
.riddle__word { display: flex; gap: 5px; }
.riddle__slot {
  width: 30px; height: 40px; border-bottom: 5px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; text-transform: uppercase;
}
.riddle__slot.filled { color: var(--orange-dark); }
.riddle__answer {
  width: 100%; text-align: center; text-transform: uppercase; letter-spacing: 2px;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 800;
  padding: 12px; min-height: 54px; border: 3px solid var(--line); border-radius: 14px;
}
.hints { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.hints li {
  background: #fff; border: 3px solid var(--line); border-left-width: 10px; border-left-color: var(--purple);
  border-radius: 12px; padding: 8px 12px; font-weight: 700;
}
.timer-bar { height: 14px; border: 3px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.timer-bar__fill { height: 100%; background: var(--green); transition: width .25s linear; }
.timer-bar__fill.low { background: var(--red); }

.feedback { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; min-height: 1.6em; }
.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }

/* ---------------- Finał + ranking ---------------- */

.final { text-align: center; }
.final__title {
  font-family: var(--font-display); font-size: clamp(2rem, 10vw, 4rem); color: var(--orange);
  text-shadow: 3px 3px 0 var(--line); transform: rotate(-2deg);
}
.final__kebab { font-size: clamp(4rem, 22vw, 8rem); display: inline-block; animation: dance 1.4s ease-in-out infinite; }
@keyframes dance {
  0%,100% { transform: rotate(-8deg) translateY(0) scale(1); }
  25% { transform: rotate(8deg) translateY(-10px) scale(1.05); }
  50% { transform: rotate(-6deg) translateY(0) scale(.98); }
  75% { transform: rotate(10deg) translateY(-6px) scale(1.04); }
}
.final__score {
  font-family: var(--font-display); font-size: clamp(3.4rem, 20vw, 6.5rem); font-weight: 800;
  color: var(--green); line-height: 1; text-shadow: 3px 3px 0 var(--line);
}
.breakdown { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.breakdown li {
  display: flex; align-items: center; gap: 10px; background: var(--cream);
  border: 3px solid var(--line); border-radius: 14px; padding: 10px 14px; font-weight: 800; text-align: left;
}
.breakdown li span:last-child { margin-left: auto; color: var(--orange-dark); font-size: 1.15rem; }
.breakdown small { display: block; font-weight: 700; color: var(--ink-soft); font-size: .78rem; }

.podium { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 700px) {
  .podium { grid-template-columns: 1fr 1.15fr 1fr; align-items: end; }
  .podium__card--1 { order: 2; } .podium__card--2 { order: 1; } .podium__card--3 { order: 3; }
}
.podium__card {
  background: var(--paper); border: 4px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px; text-align: center; box-shadow: var(--shadow); position: relative;
}
.podium__card--1 { background: linear-gradient(180deg, #fff2c0, #ffd75e); }
.podium__card--2 { background: linear-gradient(180deg, #fbfbfb, #dfe3e6); }
.podium__card--3 { background: linear-gradient(180deg, #ffe6cf, #f0b183); }
.podium__medal { font-size: 2.4rem; line-height: 1; }
.podium__avatar { width: 84px; height: 84px; border: 3px solid var(--line); border-radius: 50%; background: #fff; }
.podium__name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin-top: 4px; }
.podium__pts { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--orange-dark); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.rank { width: 100%; border-collapse: collapse; font-weight: 700; min-width: 340px; }
table.rank th, table.rank td { padding: 10px 8px; text-align: left; border-bottom: 2px solid rgba(43,33,24,.14); }
table.rank th { font-family: var(--font-display); font-size: .9rem; text-transform: uppercase; letter-spacing: .5px; }
table.rank td:last-child, table.rank th:last-child { text-align: right; font-family: var(--font-display); font-size: 1.05rem; }
table.rank tr.me { background: var(--yellow); }
table.rank tr.me td { font-weight: 900; }
.rank-avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); vertical-align: middle; margin-right: 8px; background: #fff; }
.myplace {
  text-align: center; font-family: var(--font-display); font-size: 1.4rem; font-weight: 800;
  background: var(--yellow); border: 3px solid var(--line); border-radius: 16px; padding: 10px; margin-top: 14px;
}

/* ---------------- Pomocnicze ---------------- */

.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.mt { margin-top: 14px; }
.spinner {
  width: 44px; height: 44px; border: 5px solid rgba(43,33,24,.15); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto;
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; font-weight: 800;
  padding: 12px 20px; border-radius: 999px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: min(92vw, 460px); text-align: center; line-height: 1.35;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

.offline-badge {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  background: var(--red); color: #fff; font-weight: 800; padding: 6px 16px;
  border-radius: 999px; z-index: 210; font-size: .9rem;
}

[hidden] { display: none !important; }

.rotate-hint {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(43,33,24,.95); color: #fff;
  display: grid; place-items: center; text-align: center; padding: 24px;
}
.rotate-hint__icon { font-size: 4rem; animation: rotateHint 2s ease-in-out infinite; display: block; }
@keyframes rotateHint { 0%,40% { transform: rotate(0); } 60%,100% { transform: rotate(90deg); } }
.rotate-hint__inner { max-width: 320px; }
.rotate-hint .btn { margin-top: 16px; }

.blocked {
  background: var(--red); color: #fff; border: 4px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; text-align: center; font-weight: 800; box-shadow: var(--shadow);
}
