/* SPOT Darts Club: licznik darta na tablety przy tarczach. Propozycja „nowoczesna”.
   Kolory, kroje i znak pochodzą z systemu designu „Spot Łódź”. Na życzenie właściciela
   interfejs odchodzi od „kanciastej” reguły marki: treści leżą w zaokrąglonych panelach
   na ciemniejszym tle, a przyciski i klawisze są jaśniejszymi, wypełnionymi polami, żeby
   było od razu widać, czego można dotknąć. Trzy wyraźne poziomy jasności: tło, panel, klawisz.
   Klapka (tablica odjazdów) zostaje dla głównego wyniku i dla 180. */

:root {
  /* Paleta marki */
  --bordo: #450b0b;
  --oliwka-ciemna: #594812;
  --oliwka: #756328;
  --braz: #643c16;
  --piasek: #ebd1a1;
  --krem: #eee6d6;
  --czern: #1a1a18;

  /* Poziomy: tło (najciemniejsze), panel (bordo marki), klawisz (jaśniejszy), wgłębienie. */
  --ground: #280606;
  --panel: #4a0d0c;
  --key: #7a332b;
  --key-press: #874839;
  --well: #280606;
  --ink: var(--piasek);
  --ink-muted: rgba(235, 209, 161, 0.88);
  --ink-quiet: rgba(235, 209, 161, 0.74);
  --hair: rgba(235, 209, 161, 0.2);
  --line: var(--piasek);
  --surface: var(--piasek);
  --on-surface: var(--bordo);

  --r-s: 1rem;
  --r-m: 1.25rem;
  --r-l: 1.75rem;

  /* Właściciel wybrał proste, bezszeryfowe nagłówki i cyfry. Charlton zostaje dla hasła
     i imienia gracza, bo to krój haseł marki. */
  --font-sans: "Cerebri Sans", Outfit, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-numerals: var(--font-sans);
  --font-flare: Charlton, Georgia, serif;

  /* Ruch: jedna krzywa wejścia, jedna dla przesunięć na ekranie, jedna dla szuflady */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 150ms;
  --t-fast: 200ms;
  --t-move: 280ms;
}

/* Skala: 1rem = 16px na ekranie 1472 x 920 (Lenovo Idea Tab Pro), proporcjonalnie na innych. */
html {
  font-size: min(1.087vw, 1.7391vh);
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  /* Przesuwanie w arkuszach zostaje, powiększanie dwoma palcami nie. */
  touch-action: pan-x pan-y;
  /* Tablet w trybie kiosku: cały ekran jest powierzchnią dotykową, zaznaczanie tekstu
     przytrzymaniem palca tylko przeszkadza w grze. */
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
dl,
dd,
ol {
  margin: 0;
  padding: 0;
}

ol {
  list-style: none;
}

img,
svg,
video {
  display: block;
}

img,
a {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

::selection {
  background: var(--piasek);
  color: var(--bordo);
}

/* ------------------------------------------------------------------ układ */

.app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 2.5rem 1.5rem;
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.topbar__side {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar__mark {
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  border-radius: var(--r-m);
  background: var(--panel);
  transition: opacity var(--t-fast) ease, transform var(--t-press) ease-out, background-color var(--t-press) ease;
}

.topbar__mark img {
  height: 2.4rem;
  width: auto;
}

.topbar__mark:active {
  transform: scale(0.96);
  background: var(--key);
}

/* Na stronie głównej stoi pełne logo, więc znak w rogu znika. */
.app[data-screen="home"] .topbar__mark {
  opacity: 0;
  pointer-events: none;
}

.topbar__game {
  display: none;
  gap: 0.6rem;
}

.app[data-screen="game"] .topbar__game {
  display: flex;
}

.topbar__nav {
  display: flex;
  gap: 0.6rem;
}

.nav-btn {
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border-radius: var(--r-s);
  background: var(--key);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color var(--t-press) ease, transform var(--t-press) ease-out;
}

.nav-btn:active,
.nav-btn.is-pressed {
  background: var(--key-press);
  transform: scale(0.96);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.screen {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
}

.screen.is-active {
  display: flex;
}

.rule {
  height: 2px;
  background: var(--line);
}

.rule--ink {
  background: var(--czern);
}

/* Zaokrąglony panel na treść */
.panel {
  border-radius: var(--r-l);
  background: var(--panel);
}

/* ---------------------------------------------------------------- przyciski */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: 0 2.25rem;
  border-radius: var(--r-m);
  background: var(--key);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: transform var(--t-press) ease-out, background-color var(--t-press) ease;
}

.btn:not(:disabled):active,
.btn.is-pressed {
  transform: scale(0.96);
  background: var(--key-press);
}

.btn--primary {
  background: var(--surface);
  color: var(--bordo);
  font-weight: 600;
}

.btn--primary:not(:disabled):active,
.btn--primary.is-pressed {
  background: var(--krem);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Przełącznik segmentowy: równe kolumny, wskaźnik przesuwany samym transformem.
   Promień zewnętrzny = promień wskaźnika + odstęp. */
.seg {
  --seg-pad: 0.3rem;
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: var(--seg-pad);
  border-radius: var(--r-m);
  background: var(--well);
}

.seg__opt {
  position: relative;
  z-index: 1;
  min-width: 6rem;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: 0.7rem;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: color var(--t-fast) ease;
}

.seg__opt[aria-checked="true"] {
  color: var(--bordo);
}

.seg__thumb {
  position: absolute;
  top: var(--seg-pad);
  bottom: var(--seg-pad);
  left: var(--seg-pad);
  border-radius: 0.7rem;
  background: var(--surface);
  transition: transform var(--t-move) var(--ease-in-out);
}

.seg.is-static .seg__thumb {
  transition: none;
}

.seg--num .seg__opt {
  font-family: var(--font-numerals);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  min-width: 5rem;
  padding: 0 1rem;
}

.seg--wide {
  display: grid;
  width: 100%;
}

.seg--wide .seg__opt {
  min-height: 3.2rem;
}

/* ------------------------------------------------------------- strona główna */

.screen--home {
  align-items: center;
}

.home {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  column-gap: 4.5rem;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-bottom: 2.25rem;
}

.home__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home__logo {
  width: 100%;
  max-width: 32rem;
  height: auto;
}

.home__slogan {
  margin-top: 3rem;
  font-family: var(--font-flare);
  font-size: 2.6rem;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

.home__menu {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.menu-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 8.75rem;
  padding: 1.4rem 2rem;
  border-radius: var(--r-l);
  background: var(--key);
  text-align: left;
  transition: background-color var(--t-press) ease, transform var(--t-press) ease-out;
}

button.menu-row:active,
button.menu-row.is-pressed {
  background: var(--key-press);
  transform: scale(0.98);
}

.menu-row__name {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu-row__hint {
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--ink-muted);
}

/* Główne działanie: największe i najjaśniejsze pole na ekranie. */
.menu-row--primary {
  min-height: 12rem;
  padding: 1.75rem 2.25rem;
  background: var(--surface);
  color: var(--bordo);
}

.menu-row--primary .menu-row__name {
  font-size: 4.2rem;
}

.menu-row--primary .menu-row__hint {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--bordo);
}

button.menu-row--primary:active,
button.menu-row--primary.is-pressed {
  background: var(--krem);
}

.menu-row--static {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  padding: 0.9rem 0.9rem 0.9rem 2rem;
  background: var(--panel);
}

.menu-row--static .menu-row__name {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  text-transform: none;
  letter-spacing: 0;
}

.seg--lang .seg__opt {
  min-height: 2.9rem;
  min-width: 7.5rem;
}

.home__credit {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 0.85rem;
  color: var(--ink-quiet);
}

/* Jedno wejście przy pierwszym otwarciu: logo, hasło, potem pola menu. */
@media (prefers-reduced-motion: no-preference) {
  .home.is-intro .home__logo {
    animation: rise 900ms var(--ease-out) 150ms both;
  }

  .home.is-intro .home__slogan {
    animation: unveil 1100ms var(--ease-out) 650ms both;
  }

  .home.is-intro .menu-row {
    animation: rise 600ms var(--ease-out) both;
  }

  .home.is-intro .menu-row--primary { animation-delay: 500ms; }
  .home.is-intro .home__pair .menu-row:nth-child(1) { animation-delay: 620ms; }
  .home.is-intro .home__pair .menu-row:nth-child(2) { animation-delay: 720ms; }
  .home.is-intro .menu-row--static { animation-delay: 840ms; }

  .home.is-intro .home__credit {
    animation: fade 600ms ease 1200ms both;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes unveil {
  from { clip-path: inset(0 50% 0 50%); opacity: 0; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}

/* ---------------------------------------------------------------- ustawienia */

.screen--setup {
  justify-content: center;
}

.setup {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 70rem;
  height: 100%;
}

.setup__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3rem;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  padding: 0 0 1.25rem;
}

.setup__fields {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem 2rem;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 4.7rem;
  border-bottom: 1px solid var(--hair);
}

.field:last-child {
  border-bottom: 0;
}

.field__label {
  font-size: 1.3rem;
  font-weight: 500;
}

.field--names {
  align-items: flex-start;
  padding: 0.9rem 0;
}

.field--names .field__label {
  padding-top: 0.75rem;
}

.names {
  display: grid;
  grid-template-columns: repeat(2, 18rem);
  gap: 0.6rem;
}

.name-field {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 3.3rem;
  padding: 0 1.1rem;
  border-radius: var(--r-s);
  border: 2px solid transparent;
  background: var(--key);
  font-size: 1.3rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color var(--t-fast) ease, background-color var(--t-press) ease;
}

.name-field.is-empty {
  color: var(--ink-muted);
}

.name-field.is-active {
  border-color: var(--line);
  color: var(--ink);
}

.name-field.is-active::after {
  content: "";
  width: 2px;
  height: 1.4em;
  margin-left: 2px;
  background: var(--ink);
  animation: caret 1.1s steps(1) infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

.setup__actions {
  display: flex;
  justify-content: space-between;
  padding-top: 1.25rem;
}

.setup__actions .btn {
  min-height: 4.5rem;
  min-width: 11rem;
}

.setup__actions .btn--primary {
  min-width: 22rem;
  font-size: 1.4rem;
}

/* ----------------------------------------------------------------------- gra */

.game {
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  column-gap: 1.25rem;
  width: 100%;
  height: 100%;
  padding-top: 0.75rem;
  /* Dół ekranu zostaje wolny na komentarz do gry, żeby nigdy nie zasłaniał klawiszy. */
  padding-bottom: 5.5rem;
}

.game__board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.now {
  /* Wcięcia klapek mają kolor tła, na którym stoją, czyli panelu. */
  --ground: var(--panel);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.5rem 1.25rem;
}

.now__label {
  font-size: 1.1rem;
  color: var(--ink-muted);
}

/* Imię prostym krojem: w Charltonie cyfra 1 wygląda jak litera I, więc „Gracz 1” czytałoby się „Gracz I”. */
.now__name {
  margin-top: 0.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now__row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.stats__item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.5rem 0.8rem 0.55rem;
  border-radius: var(--r-s);
  background: var(--well);
}

.stats dt {
  font-size: 0.95rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.stats dd {
  font-family: var(--font-numerals);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#stat-format {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
}

/* Podpowiedź zamknięcia: jasne pole, bo to najważniejsza informacja w końcówce lega. */
.checkout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding: 0.7rem 1.25rem 0.6rem;
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--bordo);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity var(--t-fast) ease, transform var(--t-move) var(--ease-out);
}

.checkout.is-on {
  opacity: 1;
  transform: none;
}

.checkout__label {
  font-size: 1.15rem;
  font-weight: 500;
}

.checkout__route {
  font-family: var(--font-numerals);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.standings {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem;
}

.standings__row {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto 5.5rem;
  align-items: center;
  column-gap: 1rem;
  min-height: 3.1rem;
  padding: 0 1.1rem;
  border-radius: var(--r-s);
  color: var(--ink-muted);
  transition: color var(--t-fast) ease, background-color var(--t-move) ease;
}

/* Gracz, który rzuca, ma jasne pole: widać to z drugiego końca toru. */
.standings__row.is-current {
  background: var(--surface);
  color: var(--bordo);
}

.standings__mark {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  transform: scale(0.75);
  transition: transform var(--t-move) var(--ease-out), background-color var(--t-fast) ease;
}

.standings__row.is-current .standings__mark {
  background: currentColor;
  transform: scale(1);
}

.standings__name {
  font-size: 1.4rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.standings__meta {
  font-size: 1rem;
  white-space: nowrap;
}

.standings__score {
  font-family: var(--font-numerals);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.standings__score.is-changed {
  animation: score-in 420ms var(--ease-out) both;
}

@keyframes score-in {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: none; }
}

/* Kolumna wpisywania */
.game__input {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.9rem;
}

.entry {
  display: none;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.game__input[data-mode="darts"] .entry--darts,
.game__input[data-mode="sum"] .entry--sum {
  display: flex;
}

.slot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  height: 5.4rem;
  border-radius: var(--r-m);
  border: 2px solid transparent;
  background: var(--well);
  transition: border-color var(--t-fast) ease;
}

/* Pole, do którego trafi następny rzut. */
.slot.is-next {
  border-color: var(--ink);
}

.slot__val {
  min-height: 1em;
  font-family: var(--font-numerals);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.slot__cap {
  font-size: 0.95rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.slot--sum {
  flex: 1.25;
  background: var(--surface);
  color: var(--bordo);
}

.slot--sum .slot__cap {
  color: var(--bordo);
  font-weight: 500;
}

.entry--sum .slot--sum {
  flex: 1;
}

.entry__hint {
  flex: 1;
  align-self: center;
  padding: 0 1rem;
  font-size: 1.15rem;
  color: var(--ink-muted);
  text-wrap: balance;
}

.keypad {
  display: none;
  flex: 1;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.game__input[data-mode="darts"] .keypad--darts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.game__input[data-mode="sum"] .keypad--sum {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.key {
  display: grid;
  place-items: center;
  min-height: 3rem;
  border-radius: var(--r-s);
  border: 2px solid transparent;
  background: var(--key);
  font-family: var(--font-numerals);
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  /* Klawisze są wciskane raz za razem: reakcja natychmiast, bez podróży. */
  transition: background-color 120ms ease, transform 120ms ease-out, color 120ms ease;
}

.keypad--sum .key {
  font-size: 2.6rem;
}

.key:not(:disabled):active,
.key.is-pressed {
  background: var(--key-press);
  transform: scale(0.96);
}

.key--word {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.15;
  padding: 0 0.4rem;
}

/* Cofnij: ciemne pole z obrysem, żeby nie myliło się z cyframi. */
.key--undo {
  background: var(--well);
  border-color: var(--hair);
}

/* Double i Triple to przełączniki: obrys, a po włączeniu pełne pole. */
.key--mult {
  background: var(--well);
  border-color: var(--line);
}

.key--mult[aria-pressed="true"] {
  background: var(--surface);
  color: var(--bordo);
}

.key--submit {
  background: var(--surface);
  color: var(--bordo);
  font-size: 1.35rem;
  font-weight: 600;
}

.key--submit:not(:disabled):active,
.key--submit.is-pressed {
  background: var(--krem);
}

.key:disabled {
  opacity: 0.3;
  cursor: default;
}

.game__submit {
  flex: none;
  width: 100%;
  min-height: 4.6rem;
  margin-top: 0.5rem;
  font-size: 1.45rem;
}

.game__input[data-mode="sum"] .game__submit {
  display: none;
}

/* ------------------------------------------------------------ pole wyniku */

/* Duże jasne pole z wynikiem gracza, który rzuca. Liczba odlicza przy zmianie,
   a w rogu na chwilę pojawia się, ile ubyło w tej kolejce. */
.score {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 12rem;
  padding: 0 1.75rem 1.2rem;
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--bordo);
  overflow: hidden;
}

.score__label {
  position: absolute;
  top: 1.1rem;
  left: 1.75rem;
  font-size: 1.25rem;
  font-weight: 500;
}

.score__num {
  font-family: var(--font-numerals);
  font-size: 10rem;
  font-weight: 600;
  line-height: 0.78;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.score__delta {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  padding: 0.4rem 1rem;
  border-radius: var(--r-s);
  background: var(--bordo);
  color: var(--piasek);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  opacity: 0;
}

/* Małe pole z liczbą, wspólne dla gier (wybrane pole, cel). */
.numfield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2em;
  padding: 0.12em 0.4em;
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--bordo);
  font-family: var(--font-numerals);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------- komentarz i komunikat */

.banner {
  position: fixed;
  left: 2.5rem;
  right: 2.5rem;
  bottom: 1.5rem;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4.5rem;
  padding: 0 2rem;
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--bordo);
  pointer-events: none;
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 260ms ease, transform 420ms var(--ease-out);
}

.banner__text {
  max-width: 100%;
  overflow: hidden;
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 900ms var(--ease-out) 180ms;
}

.banner.is-shown {
  opacity: 1;
  transform: none;
}

.banner.is-shown .banner__text {
  clip-path: inset(0 0 0 0);
}

.toast {
  position: fixed;
  left: 50%;
  top: 5.5rem;
  z-index: 400;
  max-width: 80vw;
  padding: 0.9rem 1.75rem;
  border-radius: var(--r-m);
  background: var(--krem);
  color: var(--czern);
  font-size: 1.25rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -0.6rem);
  transition: opacity 180ms ease, transform 240ms var(--ease-out);
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------------- 180 */

.max {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 310;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.75rem;
  background: var(--bordo);
  --ground: var(--bordo);
}

.max.is-open {
  display: flex;
}

.max__num {
  min-width: 34rem;
  padding: 2.5rem 4rem 2.25rem;
  border-radius: 3rem;
  background: var(--surface);
  color: var(--bordo);
  font-family: var(--font-numerals);
  font-size: 18rem;
  font-weight: 600;
  line-height: 0.85;
  letter-spacing: -0.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.max__cap {
  font-family: var(--font-flare);
  font-size: 3.2rem;
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------- wygrany leg */

.finale {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 320;
  display: none;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 5rem;
  padding: 3rem 6rem;
  background: var(--bordo);
}

.finale.is-open {
  display: grid;
}

.finale__ring {
  position: relative;
  width: 33rem;
  height: 33rem;
}

.finale__ring svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.finale__circle {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.6;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.finale__center {
  position: absolute;
  top: 3.5rem;
  right: 3.5rem;
  bottom: 3.5rem;
  left: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.finale__label {
  font-size: 1.35rem;
  color: var(--ink-muted);
}

.finale__name {
  margin-top: 0.75rem;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4.5rem;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.finale__meta {
  margin-top: 1.1rem;
  font-size: 1.35rem;
  color: var(--ink-muted);
}

.finale__joke {
  max-width: 34rem;
  font-size: 2.1rem;
  line-height: 1.3;
  text-wrap: balance;
}

.finale__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 3rem;
}

.finale__actions .btn {
  min-height: 4.75rem;
}

.finale__actions .btn--primary {
  min-width: 18rem;
  font-size: 1.45rem;
}

/* ------------------------------------------------------------------ arkusze */

.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.is-open {
  display: flex;
}

.modal__scrim {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(16, 4, 4, 0.8);
}

/* Motyw Krem: jasny arkusz, jak cennik w druku. */
.sheet {
  --ground: var(--krem);
  --panel: #e2d7c1;
  --key: #d8cbb0;
  --key-press: #c6b794;
  --well: #e2d7c1;
  --ink: var(--czern);
  --ink-muted: var(--oliwka-ciemna);
  --ink-quiet: var(--oliwka-ciemna);
  --hair: rgba(26, 26, 24, 0.2);
  --line: var(--czern);
  --surface: var(--bordo);
  --on-surface: var(--piasek);
  position: relative;
  width: 46rem;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2.5rem 3.5rem 2.75rem;
  border-radius: 1.75rem;
  background: var(--ground);
  color: var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--oliwka) transparent;
}

.sheet--wide {
  width: 74rem;
}

.sheet--pin {
  width: 46rem;
}

.sheet button:focus-visible,
.sheet a:focus-visible {
  outline-color: var(--czern);
}

.sheet__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--key);
  transition: transform var(--t-press) ease-out, background-color var(--t-press) ease;
}

.sheet__close svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.sheet__close:active {
  transform: scale(0.96);
  background: var(--key-press);
}

.sheet__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 4.2rem;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 1.25rem;
}

.sheet__title--s {
  font-size: 3.8rem;
}

.sheet__logo {
  width: 11rem;
  height: auto;
  margin: 1.5rem auto 0;
}

/* Cennik */
.prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 5rem;
  padding: 1.75rem 0 1rem;
}

.prices__group h3 {
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.2rem;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
}

.prices__row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 1.35rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.prices__row span:first-child {
  text-transform: uppercase;
}

.prices__note {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.5;
  padding-bottom: 0.5rem;
}

.prices__note strong {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
}

/* Zasady */
.rules {
  display: grid;
  grid-template-columns: 24rem minmax(0, 1fr);
  column-gap: 3.5rem;
  align-items: start;
  padding-top: 2rem;
}

.rules__board svg {
  width: 100%;
  height: auto;
}

.rules__legend {
  margin-top: 1.25rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.rules__text h3 {
  margin: 1.1rem 0 0.2rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.rules__text h3:first-child {
  margin-top: 0;
}

.rules__text p {
  max-width: 66ch;
  font-size: 1.1rem;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Gry */
.gamelist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1.5rem;
}

.gamelist__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 2rem;
  padding: 1.5rem 1.5rem 1.5rem 2rem;
  border-radius: var(--r-l);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--t-press) ease, transform var(--t-press) ease-out;
}

.gamelist__row:active {
  background: var(--key);
  transform: scale(0.98);
}

.gamelist__name {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
}

.gamelist__desc {
  display: block;
  margin-top: 0.6rem;
  font-size: 1.15rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.gamelist__go {
  display: inline-flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0 1.75rem;
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--piasek);
  font-size: 1.2rem;
  font-weight: 600;
}

/* PIN */
.pin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  column-gap: 3rem;
  align-items: center;
  padding-top: 2rem;
}

.pin__info {
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
}

.pin__display {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 6.5rem;
  border-radius: var(--r-m);
  background: var(--panel);
  font-family: var(--font-numerals);
  font-size: 4rem;
  line-height: 1;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.pin__error {
  min-height: 1.5em;
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bordo);
}

.keypad--pin {
  display: grid;
  flex: none;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  margin-top: 0;
}

.keypad--pin .key {
  min-height: 4.2rem;
}

.keypad--pin .key--undo {
  border-color: transparent;
}

.keypad--pin .key--submit {
  color: var(--piasek);
}

.keypad--pin .key--submit:not(:disabled):active {
  background: var(--czern);
}

/* ------------------------------------------------------- klawiatura do imion */

.kbd {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 260;
  padding: 1.1rem 3rem 1.6rem;
  border-radius: 1.75rem 1.75rem 0 0;
  background: var(--czern);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 340ms var(--ease-drawer), visibility 0s linear 340ms;
}

.kbd.is-open {
  transform: none;
  visibility: visible;
  transition: transform 340ms var(--ease-drawer), visibility 0s;
}

.kbd__head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  height: 2.8rem;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.kbd__who {
  font-size: 1.05rem;
  color: var(--ink-muted);
}

.kbd__value {
  font-size: 1.6rem;
  font-weight: 500;
  white-space: pre;
}

.kbd__row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.kbd__key {
  flex: 1;
  max-width: 5.2rem;
  min-height: 3.6rem;
  border-radius: var(--r-s);
  background: rgba(235, 209, 161, 0.16);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ink);
  transition: background-color 120ms ease, transform 120ms ease-out;
}

.kbd__key:active,
.kbd__key.is-pressed {
  background: rgba(235, 209, 161, 0.34);
  transform: scale(0.96);
}

.kbd__key--wide {
  flex: 1.7;
  max-width: 8.5rem;
}

.kbd__key--wide svg {
  width: 1.7rem;
  height: 1.7rem;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.kbd__key--space {
  flex: 5;
  max-width: 34rem;
  font-size: 1.1rem;
  color: var(--ink-muted);
}

.kbd__key--done {
  flex: 2;
  max-width: 15rem;
  background: var(--surface);
  color: var(--bordo);
  font-size: 1.25rem;
  font-weight: 600;
}

.kbd__key--done:active {
  background: var(--krem);
}

/* ---------------------------------------------------------- ekran spoczynkowy */

.idle {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 500;
  display: none;
  /* Kolor tła filmu z logo, żeby krawędzie się nie odcinały. */
  background: #400808;
  opacity: 0;
  transition: opacity 500ms ease;
}

.idle.is-open {
  display: block;
}

.idle.is-shown {
  opacity: 1;
}

/* Wyjście jest szybsze niż wejście. */
.idle.is-leaving {
  transition-duration: 300ms;
}

.idle video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idle__fold {
  opacity: 0;
}

/* Zwijanie zasłania złożone logo: przy wyjściu oraz przy powtórce co pół minuty
   (wtedy numer tarczy zostaje na miejscu). */
.idle.is-folding .idle__fold,
.idle.is-replaying .idle__fold {
  opacity: 1;
}

.idle__hint,
.idle__board {
  position: absolute;
  bottom: 2.75rem;
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 900ms ease, transform 900ms var(--ease-out);
}

.idle__hint {
  left: 3rem;
  font-size: 1.3rem;
  color: var(--ink-muted);
}

/* Numer tarczy wyłania się w rogu dopiero wtedy, gdy logo jest już złożone. */
.idle__board {
  right: 3.5rem;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  color: var(--piasek);
}

.idle__board-label {
  font-size: 2.4rem;
  color: var(--ink-muted);
}

.idle__board-num {
  font-size: 13rem;
  font-weight: 600;
  line-height: 0.8;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.idle.is-ready .idle__hint,
.idle.is-ready .idle__board {
  opacity: 1;
  transform: none;
}

.idle.is-folding .idle__hint,
.idle.is-folding .idle__board {
  opacity: 0;
  transition-duration: 160ms;
}

/* ------------------------------------------------------------- orientacja */

.rotate {
  display: none;
}

@media (orientation: portrait) {
  .app,
  .banner {
    display: none;
  }

  .rotate {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px;
    font-size: 20px;
    text-align: center;
  }
}

/* --------------------------------------------------------- ograniczony ruch */

@media (prefers-reduced-motion: reduce) {
  .seg__thumb,
  .banner,
  .banner__text,
  .kbd,
  .checkout {
    transition-duration: 0.01ms;
    transition-delay: 0s;
  }

  .standings__score.is-changed {
    animation: fade 200ms ease both;
  }

  .name-field.is-active::after {
    animation: none;
  }
}

/* Najechanie myszą tylko tam, gdzie jest mysz (podgląd na komputerze). */
@media (hover: hover) and (pointer: fine) {
  .nav-btn:hover,
  .btn:not(.btn--primary):not(:disabled):hover,
  .key:not(:disabled):not(.key--submit):not(.key--mult):not(.key--undo):hover,
  button.menu-row:not(.menu-row--primary):hover {
    background: var(--key-press);
  }

  .btn--primary:not(:disabled):hover,
  .key--submit:not(:disabled):hover,
  .kbd__key--done:hover,
  button.menu-row--primary:hover {
    background: var(--krem);
  }

  .kbd__key:not(.kbd__key--done):hover {
    background: rgba(235, 209, 161, 0.26);
  }

  .gamelist__row:hover {
    background: var(--key);
  }
}

/* ------------------------------------------------------------------ ruletka */

/* Ruletka leży nad wygaszaczem: konkurs ogłoszony przez serwer musi być widoczny. */
.rlt {
  z-index: 510;
}

.rlt__body {
  padding-top: 2rem;
}

.rlt__body--text {
  max-width: 46rem;
  margin: 0 auto;
  text-align: center;
}

.rlt__body--wheel {
  display: grid;
  grid-template-columns: 27rem minmax(0, 1fr);
  column-gap: 4rem;
  align-items: center;
}

.rlt__lead {
  font-size: 1.4rem;
  line-height: 1.4;
}

.rlt__lead--gap {
  margin-top: 1.5rem;
}

.rlt__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7rem;
  height: 5.5rem;
  margin-top: 0.6rem;
  padding: 0 1.5rem;
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--piasek);
  font-family: var(--font-numerals);
  font-size: 3.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rlt__num--out {
  background: var(--panel);
  color: var(--czern);
}

.rlt__msg {
  margin-top: 1rem;
  font-size: 1.2rem;
  line-height: 1.5;
}

.rlt__msg--strong {
  font-weight: 600;
  color: var(--bordo);
}

.rlt__prize {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.rlt__note {
  margin-top: 1rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--oliwka-ciemna);
}

.rlt__actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.rlt .btn--primary {
  min-width: 15rem;
  color: var(--piasek);
}

.rlt .btn--primary:not(:disabled):active {
  background: var(--czern);
}

/* „Pomiń” pojawia się po chwili, żeby nikt nie zamknął konkursu odruchowo. */
.rlt__skip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease, transform var(--t-press) ease-out, background-color var(--t-press) ease;
}

.rlt__skip.is-on {
  opacity: 1;
  pointer-events: auto;
}

.rlt__wheel {
  position: relative;
}

.rlt__wheel svg {
  width: 100%;
  height: auto;
}

.rlt__pointer {
  position: absolute;
  top: -0.6rem;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  margin-left: -0.8rem;
  border-left: 0.8rem solid transparent;
  border-right: 0.8rem solid transparent;
  border-top: 1.4rem solid var(--bordo);
}

.rlt__keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.rlt__keys .key {
  min-height: 3.4rem;
  font-size: 1.8rem;
}

.rlt__keys .key[aria-pressed="true"] {
  background: var(--surface);
  color: var(--piasek);
}

.rlt__confirm {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 6.5rem;
  margin-top: 1.25rem;
}

.rlt__confirm .rlt__num {
  margin-top: 0;
}

.rlt__result .btn {
  margin-top: 1.75rem;
}

/* ------------------------------------------------------- warianty kolorystyczne
   Dwa warianty tej samej aplikacji. Bordo jest domyślny, czerń włącza adres /czern/
   (albo ?motyw=czern przy podglądzie lokalnym). Różnią się tylko kolorami poziomów. */

html[data-theme="czern"] {
  --ground: #121211;
  --panel: #232120;
  --key: #57110f;
  --key-press: #7a221d;
  --well: #0b0b0a;
}

html[data-theme="czern"] .max,
html[data-theme="czern"] .finale {
  background: var(--ground);
}
