/* Wybór trybuny: przelot nad stadionem (film z modelu 3D), ujęcie z drona, trybuny do dotknięcia
   (każda jednym polem), lista trybun i potwierdzenie miejsca. Do tego skrót na ekran telefonu
   (ekran odliczania). Stadion rusza się na dwóch warstwach — tylko transform i opacity. */

/* Stadion ma się zmieścić cały nad belką potwierdzenia: nagłówki zwarte, wysokość stadionu
   liczona od wysokości ekranu (z paskami przeglądarki — dvh). */
.pick { gap: 10px; }
.pick.has-bar { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
.pick-title {
  font-family: var(--display); font-weight: 400; font-size: clamp(26px, 7.6vw, 40px);
  line-height: 1.02; text-transform: uppercase; text-wrap: balance;
}
.pick-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.pick .start-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pick .start-time { font-size: 20px; }
.pick > .warning { padding-top: 4px; padding-bottom: 4px; font-size: 13px; }

/* ---------- Stadion ---------- */
.arena { position: relative; margin: 0 -20px; overflow: hidden; background: #050a1f; }
.arena::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #050a1f 0, rgba(5, 10, 31, 0) 9%, rgba(5, 10, 31, 0) 91%, #050a1f 100%),
    radial-gradient(90% 70% at 50% 50%, rgba(5, 10, 31, 0) 60%, rgba(5, 10, 31, 0.7) 100%);
}
.arena-map { display: block; width: 100%; height: auto; max-height: calc(100dvh - 290px); margin: 0 auto; touch-action: manipulation; }
.arena-fly, .arena-drone { will-change: transform; }
.arena-drone { position: relative; transform-origin: 50% 55%; animation: drone 26s ease-in-out infinite alternate; }
/* Przelot z modelu 3D: film leży dokładnie na renderze (ten sam kadr), po wylądowaniu znika. */
.arena-film {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
  background: transparent; transition: opacity 450ms ease-out;
}
.arena.is-landed .arena-film { opacity: 0; }
.arena:not(.is-landed) .zone, .arena:not(.is-landed) .zone-letter { opacity: 0; pointer-events: none; }
/* Przed nalotem stadionu nie widać — gotowa mapa (ostatnia klatka) nie może mignąć przed początkiem
   przelotu. Widać ją przy nalocie z CSS (is-flying) i po wylądowaniu. */
.arena:not(.is-landed):not(.is-flying) .arena-map { opacity: 0; }
.zone, .zone-letter { transition: opacity 400ms ease-out; }
/* Bez filmu (brak sieci, oszczędzanie baterii): nalot z samego renderu. */
.arena.is-flying .arena-fly { animation: fly-in 2400ms cubic-bezier(0.22, 0.8, 0.2, 1) both; }
.arena.is-flying .arena-haze { animation: haze 2100ms ease-out both; }
.arena-haze {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 48%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 72%);
}
.is-night .arena-haze { background: radial-gradient(60% 50% at 50% 48%, rgba(170, 196, 255, 0.7), rgba(170, 196, 255, 0) 72%); }
@keyframes fly-in {
  from { opacity: 0; transform: perspective(900px) translate3d(0, 12%, 0) rotateX(58deg) rotateZ(-18deg) scale(0.5); }
  30% { opacity: 1; }
  to { opacity: 1; transform: perspective(900px) translate3d(0, 0, 0) rotateX(0deg) rotateZ(0deg) scale(1); }
}
@keyframes drone {
  from { transform: perspective(1100px) rotateX(7deg) rotateZ(-1.4deg) scale(1.05) translate3d(-1.2%, 0.6%, 0); }
  50% { transform: perspective(1100px) rotateX(10deg) rotateZ(0.6deg) scale(1.09) translate3d(1%, -0.8%, 0); }
  to { transform: perspective(1100px) rotateX(5deg) rotateZ(1.6deg) scale(1.06) translate3d(0.4%, 1%, 0); }
}
@keyframes haze {
  from { opacity: 0.95; transform: scale(0.7); }
  to { opacity: 0; transform: scale(1.9); }
}

.sky {
  display: flex; align-items: center; gap: 7px;
  font: 800 11px/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.sky-icon { width: 12px; height: 12px; border-radius: 50%; background: #ffd25e; }
.is-dusk .sky-icon { background: linear-gradient(180deg, #ffad5a 55%, transparent 55%); }
.is-night .sky-icon { background: none; box-shadow: inset -4px -2px 0 0 #e9edf7; }

/* Trybuny jednym polem: pole dotyku z grubą niewidoczną obwódką (przejścia też wybierają);
   wypełnienie i obwódka w kolorze trybuny zakrywają przejścia między sektorami, a przezroczystość
   całej grupy (nie ścieżek) nie zdradza, gdzie sektory się stykają. Biała krawędź — tylko na zewnątrz. */
.zone { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.zone-hit { fill: transparent; stroke: transparent; stroke-width: 24; stroke-linejoin: round; }
.zone-paint { opacity: 0.36; pointer-events: none; transition: opacity 200ms ease-out; }
.zone-edge { fill: none; stroke: var(--stand); stroke-width: 18; stroke-linejoin: round; }
.zone-fill { fill: var(--stand); stroke: var(--stand); stroke-width: 12; stroke-linejoin: round; }
.has-choice .zone:not(.is-chosen) .zone-paint { opacity: 0.1; }
.zone.is-chosen .zone-paint { opacity: 0.7; }
.zone.is-chosen .zone-edge, .zone:focus-visible .zone-edge { stroke: #fff; }
.zone-off { fill: #050a1f; fill-opacity: 0.55; pointer-events: none; }
.zone-letter {
  font-family: var(--display); font-size: 96px; fill: #fff; text-anchor: middle; dominant-baseline: central;
  cursor: pointer; paint-order: stroke; stroke: rgba(5, 10, 31, 0.6); stroke-width: 6px;
}
.has-choice .zone-letter { fill-opacity: 0.5; }

/* Lista trybun z sektorami z biletu — druga droga wyboru (też dla czytnika ekranu). */
.pick .stands { grid-template-columns: 1fr 1fr; column-gap: 12px; }
.pick .stand:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--line); }

/* ---------- Potwierdzenie miejsca: niska belka na dole ----------
   Wjeżdża z odbiciem, a przycisk co kilka sekund podskakuje — daje znać, że czeka na „tak”. */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; gap: 10px;
  max-width: 560px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(11, 22, 63, 0.97); box-shadow: 0 -14px 32px rgba(0, 0, 0, 0.45), inset 0 4px 0 var(--stand, #fff);
  animation: bar-in 560ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.bar-stand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-names { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.bar-names strong { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1; text-transform: uppercase; }
.bar-names small { font-size: 13px; color: var(--muted); }
.bar-other {
  margin-left: auto; flex: none; min-height: 36px; padding: 0 10px; border: 0;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.5); background: none; color: #fff;
  font: 800 11px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
}
.bar-yes { min-height: 52px; animation: hop 3.4s 1.4s ease-in-out infinite; }
/* Podskok i wciśnięcie to oba transform — pod palcem podskok staje, żeby zadziałało wciśnięcie. */
.bar-yes:active { animation: none; }
@keyframes bar-in { from { transform: translateY(110%); } }
@keyframes hop {
  0%, 82%, 100% { transform: none; }
  87% { transform: translateY(-8px); }
  92% { transform: none; }
  96% { transform: translateY(-3px); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- Skrót na ekran telefonu (ekran odliczania) ---------- */
.add-bar { display: grid; }
.add {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px;
  border: 0; background: #fff; color: var(--navy); text-align: left;
}
.add-icon { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.add-text { display: grid; gap: 2px; }
.add-text strong { font: 800 15px/1.2 var(--sans); letter-spacing: 0.03em; text-transform: uppercase; }
.add-text small { font-size: 13px; color: #3b4673; }
.add.is-done { background: none; color: #fff; box-shadow: inset 0 0 0 2px #3ccf7a; }
.add.is-done small { color: var(--muted); }

/* ---------- Przypomnienie przed pokazem (push, reminder.mjs) ---------- */
.remind { display: grid; gap: 8px; padding: 14px 16px; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28); }
.remind-title { font: 800 15px/1.2 var(--sans); letter-spacing: 0.03em; text-transform: uppercase; }
.remind-text { font-size: 14px; line-height: 1.4; color: var(--muted); }
.remind.is-on { box-shadow: inset 0 0 0 2px #3ccf7a; }
.remind.is-denied .remind-text, .remind.is-shortcut .remind-text { color: #ffd2d8; }
.remind-button {
  justify-self: start; min-height: 44px; padding: 0 18px; border: 0; background: #fff; color: var(--navy);
  font: 800 14px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
}
.remind-button:active { transform: scale(0.96); transition-duration: 90ms; }
.remind-button[aria-busy="true"] { opacity: 0.6; }
.remind-button:disabled { opacity: 0.6; }
.add-sheet {
  width: 100%; max-width: 560px; margin: auto auto 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  border: 0; background: #0b163f; color: #fff; box-shadow: inset 0 4px 0 var(--red);
}
.add-sheet[open] { display: grid; gap: 14px; animation: sheet-up 380ms var(--reveal) both; }
.add-sheet::backdrop { background: rgba(5, 10, 31, 0.72); }
.add-steps { display: grid; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.add-steps li { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.add-steps b { min-width: 16px; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; color: var(--red); }
.ui-icon {
  display: inline-block; width: 1.5em; height: 1.5em; margin: 0 2px; padding: 3px; vertical-align: -0.4em;
  border-radius: 6px; background: rgba(255, 255, 255, 0.14); fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.ui-icon circle { fill: currentColor; stroke: none; }

@media (hover: hover) and (pointer: fine) {
  .zone:hover .zone-paint { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .arena-drone, .arena.is-flying .arena-fly, .arena.is-flying .arena-haze, .bar, .bar-yes, .add-sheet[open] { animation: none; }
  .zone-paint, .zone, .zone-letter, .arena-film { transition: none; }
}
