/* WWA GRY — wspólne style huba i gier
 *
 * Układ wzorowany na dialed.gg: jasny hub z ciemnymi kartami gier,
 * gry na czarnym, pełnym ekranie, jedna rodzina kroju (Geist).
 *
 * Kolory: każda gra ma własny kolor (--game), widoczny na ikonie i akcentach
 * w grze. Żółty to kolor marki (logo). Zielony i czerwony występują wyłącznie
 * jako stan odpowiedzi.
 *
 * Kształty: karty 24-30px, elementy w kartach 14px, przyciski pill albo koło.
 * Warstwy: topbar 20, nic więcej nie dostaje z-indexu.
 */

/* ============================================================== tokeny */

:root {
  color-scheme: light;

  --font: "Geist", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;

  --bg:        #f4f4f2;
  --text:      #0d0d0d;
  --muted:     #0d0d0d8c;
  --faint:     #0d0d0d59;
  --line:      #0d0d0d14;

  --card-top:  #0e0e0e;
  --card-bot:  #262623;
  --on-card:   #ffffff;
  --on-card-2: #ffffff99;

  --pill:      #0d0d0d;
  --pill-ink:  #ffffff;

  --brand:     #f5c62b;
  --brand-ink: #1c1703;

  --good:      #2fd17e;
  --bad:       #ff5b4d;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --gutter:    clamp(16px, 4vw, 48px);
}

@media (prefers-color-scheme: dark) {
  :root:not(.game-page) {
    color-scheme: dark;
    --bg:       #0b0b0a;
    --text:     #f4f4f2;
    --muted:    #f4f4f28c;
    --faint:    #f4f4f259;
    --line:     #f4f4f214;
    --card-top: #191917;
    --card-bot: #2a2a27;
    --pill:     #f4f4f2;
    --pill-ink: #0d0d0d;
  }
}

/* gry są zawsze ciemne, niezależnie od ustawień systemu */
:root.game-page {
  color-scheme: dark;
  --bg:      #000000;
  --text:    #ffffff;
  --muted:   #ffffff99;
  --faint:   #ffffff59;
  --line:    #ffffff1f;
  --surface: #121211;
  --surface-2: #1c1c1a;
  --pill:    #ffffff;
  --pill-ink:#000000;
}

/* ============================================================= podstawy */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}

h1, h2, h3 {
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0;
}

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============================================================== topbar */

.topbar .wrap {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

/* logo: sama sylwetka Pałacu Kultury (assets/pkin.svg) w kolorze tekstu,
   czyli biała na ciemnym tle i czarna na jasnej stronie głównej */
.logo-mark {
  display: block;
  width: 26px;
  height: 26px;
  margin-top: -3px;
  background: currentColor;
  -webkit-mask: url("../pkin.svg") center / contain no-repeat;
  mask: url("../pkin.svg") center / contain no-repeat;
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav a:hover { color: var(--text); }

.nav .nav-pill {
  color: var(--pill-ink);
  background: var(--pill);
  padding: 9px 16px;
  border-radius: 999px;
}

.nav .nav-pill:hover { color: var(--pill-ink); opacity: 0.88; }

@media (max-width: 560px) {
  .nav .nav-hide-sm { display: none; }
}

/* ============================================================ przyciski */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), opacity 0.2s;
}

.pill:hover { opacity: 0.9; }
.pill:active { transform: scale(0.96); }
.pill i { font-size: 1rem; }

.pill-ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pill-ghost:hover { box-shadow: inset 0 0 0 1px var(--faint); opacity: 1; }

.pill[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* okrągły przycisk start, jak w dialed */
.go {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 1.6rem;
  cursor: pointer;
  flex: none;
  transition: transform 0.25s var(--ease-out);
}

.go:hover { transform: scale(1.06); }
.go:active { transform: scale(0.94); }

/* ================================================================ stopka */

.footer {
  padding: 56px 0 calc(40px + env(safe-area-inset-bottom));
  color: var(--faint);
  font-size: 0.8rem;
}

.footer .wrap { display: flex; flex-direction: column; gap: 16px; }

.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { text-decoration: none; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-note { max-width: 70ch; }

/* =====================================================================
 *                               GRY
 * ===================================================================== */

.game-page .topbar .wrap { height: 64px; max-width: 760px; }

.game-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px var(--gutter) 0;
  min-height: calc(100dvh - 64px);
  display: flex;
  flex-direction: column;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; }

@media (prefers-reduced-motion: no-preference) {
  .screen.is-active { animation: screen-in 0.5s var(--ease-out); }
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* ---------------------------------------------------------- intro gry */

.intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 0 28px;
}

.intro-title {
  font-size: clamp(3.6rem, 15vw, 6.2rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
  text-transform: lowercase;
  padding-bottom: 0.06em; /* zapas na ogonki: ę, ą, j */
}

.intro-copy {
  margin-top: clamp(36px, 10vh, 120px);
  display: grid;
  gap: 18px;
  max-width: 24ch;
  font-size: clamp(1.15rem, 3.4vw, 1.32rem);
  line-height: 1.4;
  color: #adadad;
  letter-spacing: -0.02em;
}

.intro-copy strong { color: var(--text); font-weight: 500; }

.challenge {
  margin-top: 28px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--game, var(--brand)) 16%, transparent);
  color: var(--text);
  font-size: 0.92rem;
}

.challenge[hidden] { display: none; }
.challenge i { color: var(--game, var(--brand)); font-size: 1.2rem; }
.challenge b { font-variant-numeric: tabular-nums; }

.intro-foot {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.intro-start { font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; }
.intro-best { font-size: 0.85rem; color: var(--faint); margin-top: 2px; }
.intro-best b { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- HUD */

.hud {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0 18px;
  font-variant-numeric: tabular-nums;
}

.hud-round { font-size: 0.85rem; color: var(--muted); }
.hud-round b { color: var(--text); font-weight: 500; }

.hud-pot {
  font-size: 0.85rem;
  color: var(--muted);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.hud-pot b {
  color: var(--game, var(--text));
  font-size: 1.05rem;
  font-weight: 500;
  min-width: 3.2ch;
  text-align: right;
}

/* ------------------------------------------------------------ pytanie */

.prompt { margin-bottom: 18px; }

.prompt-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
}

.prompt-q {
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-wrap: balance;
}

.prompt-sub { color: var(--muted); margin-top: 8px; }

/* ---------------------------------------------------------- odpowiedzi */

.answers {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.answers.is-grid { grid-template-columns: 1fr 1fr; }

@media (max-width: 420px) {
  .answers.is-grid { grid-template-columns: 1fr; }
}

.answer {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  text-align: left;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px transparent;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.2s, transform 0.15s var(--ease-out);
}

.answer-key {
  flex: none;
  width: 22px;
  font-size: 0.78rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

@media (hover: none) { .answer-key { display: none; } }

.answer:hover:not(:disabled) { background: var(--surface-2); }
.answer:active:not(:disabled) { transform: scale(0.985); }
.answer:disabled { cursor: default; }

.answer.is-correct { box-shadow: inset 0 0 0 2px var(--good); }
.answer.is-correct .answer-key { color: var(--good); }
.answer.is-wrong   { box-shadow: inset 0 0 0 2px var(--bad); }
.answer.is-wrong .answer-key { color: var(--bad); }
.answer.is-dimmed  { opacity: 0.3; }

@media (prefers-reduced-motion: no-preference) {
  .answer.is-wrong { animation: shake 0.36s var(--ease-out); }
}

@keyframes shake {
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}

/* ------------------------------------------------- wynik rundy (werdykt) */

.verdict[hidden] { display: none; }

.verdict {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 20px;
  align-items: center;
  padding: 8px 0 32px;
}

.round-score {
  font-size: clamp(3rem, 12vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.round-score.is-zero { color: var(--faint); }

.round-roast {
  grid-column: 1;
  font-size: 1.05rem;
  color: var(--muted);
  letter-spacing: -0.02em;
}

.round-reveal { grid-column: 1; font-size: 0.92rem; color: var(--faint); }
.round-reveal b { color: var(--text); font-weight: 500; }

.verdict .go { grid-column: 2; grid-row: 1 / span 3; width: 64px; height: 64px; font-size: 1.4rem; }

@media (prefers-reduced-motion: no-preference) {
  .verdict:not([hidden]) .round-score { animation: pop 0.5s var(--ease-out); }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
}

/* ------------------------------------------------------------- koniec */

.end {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 0 24px;
}

.end-label { font-size: 0.85rem; color: var(--muted); }

.big-score {
  margin-top: 6px;
  font-size: clamp(4.6rem, 22vw, 8rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.big-score span { color: var(--faint); font-size: 0.32em; letter-spacing: -0.03em; margin-left: 0.1em; }

.end-roast {
  margin-top: 16px;
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  letter-spacing: -0.03em;
  line-height: 1.3;
  max-width: 26ch;
}

.end-meta { margin-top: 10px; font-size: 0.88rem; color: var(--faint); }
.end-meta b { color: var(--game, var(--text)); font-weight: 500; }

/* rozbicie na rundy */
.rounds {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.rounds li {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  height: 120px;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.rounds .fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--v) * 10%);
  background: color-mix(in srgb, var(--game, var(--brand)) 30%, transparent);
  transform-origin: bottom;
}

@media (prefers-reduced-motion: no-preference) {
  .rounds .fill { animation: grow 0.8s var(--ease-out) both; animation-delay: calc(var(--i) * 80ms + 200ms); }
}

@keyframes grow { from { transform: scaleY(0); } }

.rounds .v { position: relative; font-weight: 500; font-size: 1rem; letter-spacing: -0.03em; }
.rounds .n { position: relative; font-size: 0.72rem; color: var(--faint); }

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.end-actions .pill { height: 50px; padding: 0 24px; font-size: 0.95rem; }

/* ------------------------------------------------------------- sponsor */

.sponsor {
  margin-top: 32px;
  border-radius: 20px;
  background: var(--surface);
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2px 14px;
  align-items: center;
  text-decoration: none;
  transition: background 0.2s;
}

a.sponsor:hover { background: var(--surface-2); }

.sponsor-icon {
  grid-row: span 3;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--brand);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.sponsor-label { font-size: 0.72rem; color: var(--faint); }
.sponsor-title { font-weight: 500; letter-spacing: -0.02em; }
.sponsor-meta  { font-size: 0.85rem; color: var(--muted); }
.sponsor-arrow { grid-column: 3; grid-row: 1 / span 3; color: var(--faint); font-size: 1.2rem; }

/* stopka gry */
.game-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 24px 0 calc(20px + env(safe-area-inset-bottom));
  font-size: 0.72rem;
  color: var(--faint);
}

.game-foot a { text-decoration: none; }
.game-foot a:hover { color: var(--muted); }

/* =====================================================================
 *                    ELEMENTY GIER PRECYZYJNYCH
 * ===================================================================== */

.round-stage { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

.ask { font-size: 0.85rem; color: var(--muted); }
.ask-big {
  font-size: clamp(1.8rem, 6.5vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.02;
  text-wrap: balance;
}
.ask-sub { color: var(--faint); font-size: 0.92rem; margin-top: 4px; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions .pill { height: 50px; padding: 0 26px; font-size: 0.95rem; }
.pill:disabled { opacity: 0.35; cursor: default; transform: none; }

/* ------------------------------------------------------------- mapa */

.map-wrap {
  position: relative;
  border-radius: 24px;
  background: var(--surface);
  padding: 8px;
  touch-action: manipulation;
}

.wmap {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 640px);
  margin: 0 auto;
  cursor: crosshair;
  overflow: hidden;
}

.wmap .wd {
  fill: #1d1d1b;
  stroke: #ffffff2b;
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: fill 0.3s;
}

.wmap .wd.is-hl { fill: color-mix(in srgb, var(--game) 35%, #1d1d1b); }

.wmap .wriver {
  fill: none;
  stroke: #3d8bff59;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.wpin { pointer-events: none; }
.wpin-halo { fill: color-mix(in srgb, var(--game) 30%, transparent); }
.wpin-dot { fill: var(--game); stroke: #000; stroke-width: 2.5; }
.wpin.is-true .wpin-halo { fill: #ffffff33; }
.wpin.is-true .wpin-dot { fill: #fff; }
.wpin.is-far .wpin-dot { fill: var(--bad); }
.wpin.is-mid .wpin-dot { fill: #f5c62b; }
.wpin.is-near .wpin-dot { fill: var(--good); }

@media (prefers-reduced-motion: no-preference) {
  .wpin-halo { animation: halo 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
}
@keyframes halo { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

.wline { stroke: #ffffffb3; stroke-width: 4; stroke-dasharray: 10 8; }
.wlabel { fill: #fff; font-size: 34px; font-weight: 600; letter-spacing: -0.03em; paint-order: stroke; stroke: #000; stroke-width: 6px; }

/* ----------------------------------------------------------- suwak */

.dial {
  background: var(--surface);
  border-radius: 24px;
  padding: 22px;
  display: grid;
  gap: 16px;
}

.dial-value {
  font-size: clamp(3.4rem, 15vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dial-value small { font-size: 0.35em; color: var(--faint); letter-spacing: -0.02em; margin-left: 0.15em; }

.dial-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }

.step {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.step:active { transform: scale(0.92); }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--game) var(--p, 50%), var(--surface-2) var(--p, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-2); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--game); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 10px #0008; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; }

.dial-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--faint); font-variant-numeric: tabular-nums; }

/* porównanie: twoja odpowiedź vs prawda */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; height: 170px; }
.compare-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 8px; }
.compare-fill {
  border-radius: 12px 12px 6px 6px;
  background: #ffffff33;
  height: calc(var(--h) * 1%);
  transform-origin: bottom;
}
.compare-bar.is-true .compare-fill { background: var(--game); }
@media (prefers-reduced-motion: no-preference) {
  .compare-fill { animation: grow 0.8s var(--ease-out) both; }
}
.compare-label { font-size: 0.8rem; color: var(--faint); }
.compare-label b { display: block; color: var(--text); font-size: 1.1rem; font-weight: 500; letter-spacing: -0.03em; }

/* oś czasu: twój rok vs prawdziwy */
.timeline { position: relative; height: 76px; margin: 4px 18px 0; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 37px; height: 2px; background: var(--line); }
.tl-mark { position: absolute; top: 0; bottom: 0; width: 0; font-variant-numeric: tabular-nums; }
.tl-mark i { position: absolute; top: 31px; left: -7px; width: 14px; height: 14px; border-radius: 50%; background: #ffffff59; }
.tl-mark span { position: absolute; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.tl-mark:not(.is-true) span { top: 0; }
.tl-mark.is-true span { bottom: 0; color: var(--text); }
.tl-mark.is-true i { background: var(--game); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
