/* ====== Tablica Familiady (ekran/projektor) ====== */
:root {
  --bg-1: #050f26;
  --bg-2: #0b2a63;
  --bg-3: #03081a;
  --gold: #ffd64a;
  --gold-2: #ffe89a;
  --gold-deep: #e89410;
  --slot-dark-1: #123a82;
  --slot-dark-2: #0a2456;
  --slot-edge: #2f6fd6;
  --revealed-1: #ffe17a;
  --revealed-2: #ffb01f;
  --text-dark: #06183a;
  --red: #ff3b3b;
  --green: #2ee07a;
  --teamA: #49a8ff;
  --teamB: #ff8a4c;
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(73, 168, 255, 0.18), transparent 55%),
    radial-gradient(circle at 50% 18%, var(--bg-2), var(--bg-1) 50%, var(--bg-3));
  color: #fff;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* miękkie poświaty studia */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(40% 40% at 22% 28%, rgba(255, 214, 74, 0.12), transparent 70%),
    radial-gradient(45% 45% at 80% 70%, rgba(73, 168, 255, 0.16), transparent 70%);
  filter: blur(6px);
  animation: drift 16s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}
@keyframes drift {
  to {
    transform: translate3d(0, -3%, 0) scale(1.06);
  }
}

/* winieta */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 220px 60px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

#app {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- nagłówek / logo ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
}
.logo {
  font-family: "Bebas Neue", "Montserrat", sans-serif;
  font-size: clamp(30px, 5vw, 62px);
  letter-spacing: 0.2em;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 45%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(122, 70, 0, 0.55))
    drop-shadow(0 0 22px rgba(255, 214, 74, 0.5));
  animation: glowPulse 3.4s ease-in-out infinite;
}
@keyframes glowPulse {
  50% {
    filter: drop-shadow(0 3px 0 rgba(122, 70, 0, 0.55))
      drop-shadow(0 0 34px rgba(255, 214, 74, 0.75));
  }
}
.conn {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.conn .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  transition: background 0.3s, box-shadow 0.3s;
}
.conn.on .dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

/* ---- układ główny ---- */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 28px 18px;
  min-height: 0;
}

.hidden {
  display: none !important;
}

section.splash,
section.category-screen,
section.round-screen,
section.gameover {
  animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---- ekran startowy ---- */
.splash {
  text-align: center;
}
.splash .big {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(64px, 14vw, 200px);
  letter-spacing: 0.1em;
  line-height: 0.95;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 45%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 0 rgba(122, 70, 0, 0.5))
    drop-shadow(0 0 44px rgba(255, 214, 74, 0.5));
  animation: pop 0.6s ease;
}
.splash .sub {
  margin-top: 20px;
  font-size: clamp(16px, 2.5vw, 26px);
  opacity: 0.85;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.splash .sub::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
.splash .hint {
  margin-top: 40px;
  font-size: 15px;
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.06);
  padding: 13px 20px;
  border-radius: 12px;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.splash .hint code {
  color: var(--gold);
  font-weight: 700;
}

/* ---- wybór kategorii ---- */
.category-screen {
  width: 100%;
  max-width: 1120px;
  text-align: center;
}
.choose-banner {
  font-size: clamp(20px, 3.4vw, 38px);
  margin-bottom: 28px;
  font-weight: 700;
}
.choose-banner .team-name {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 214, 74, 0.55);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.cat-card {
  background: linear-gradient(160deg, var(--slot-edge), var(--slot-dark-2));
  border: 2px solid rgba(255, 214, 74, 0.22);
  border-radius: 18px;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 26px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: cardIn 0.45s ease both;
}
.category-grid .cat-card:nth-child(1) { animation-delay: 0.02s; }
.category-grid .cat-card:nth-child(2) { animation-delay: 0.05s; }
.category-grid .cat-card:nth-child(3) { animation-delay: 0.08s; }
.category-grid .cat-card:nth-child(4) { animation-delay: 0.11s; }
.category-grid .cat-card:nth-child(5) { animation-delay: 0.14s; }
.category-grid .cat-card:nth-child(6) { animation-delay: 0.17s; }
.category-grid .cat-card:nth-child(7) { animation-delay: 0.20s; }
.category-grid .cat-card:nth-child(8) { animation-delay: 0.23s; }
.category-grid .cat-card:nth-child(n+9) { animation-delay: 0.26s; }
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}
.cat-card .ic {
  font-size: 46px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}
.cat-card .nm {
  font-weight: 700;
  font-size: 17px;
}
.cat-card.picked {
  border-color: var(--gold);
  transform: scale(1.06);
  box-shadow: 0 0 40px rgba(255, 214, 74, 0.6);
}

/* ---- plansza rundy ---- */
.round-screen {
  width: 100%;
  max-width: 1180px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cat-badge {
  align-self: center;
  background: rgba(255, 214, 74, 0.14);
  border: 1px solid rgba(255, 214, 74, 0.45);
  color: var(--gold);
  padding: 7px 20px;
  border-radius: 999px;
  font-size: 15px;
  letter-spacing: 0.05em;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: 0 0 18px rgba(255, 214, 74, 0.18);
}
.question {
  text-align: center;
  font-size: clamp(20px, 3.2vw, 36px);
  font-weight: 800;
  min-height: 1.4em;
  text-shadow: 0 2px 10px var(--shadow);
}
.mult {
  align-self: center;
  font-size: 13px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--text-dark);
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  padding: 5px 16px;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255, 214, 74, 0.5);
  animation: tagPulse 1.6s ease-in-out infinite;
}
@keyframes tagPulse {
  50% {
    transform: scale(1.05);
  }
}

/* tablica odpowiedzi */
.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  width: 100%;
}
@media (max-width: 760px) {
  .board {
    grid-template-columns: 1fr;
  }
}
.slot {
  position: relative;
  height: 64px;
  border-radius: 14px;
  perspective: 1000px;
  animation: slotIn 0.4s ease both;
}
@keyframes slotIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.slot-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.55s cubic-bezier(0.45, 0.05, 0.2, 1);
  transform-style: preserve-3d;
}
.slot.revealed .slot-inner {
  transform: rotateX(180deg);
}
.face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 18px var(--shadow);
  overflow: hidden;
}
/* awers – ukryta odpowiedź (numer) */
.face-front {
  background: linear-gradient(160deg, var(--slot-dark-1), var(--slot-dark-2));
  border: 1px solid rgba(120, 170, 255, 0.3);
  justify-content: center;
}
.face-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.08) 50%, transparent 60%);
}
.face-front .num {
  font-family: "Bebas Neue", sans-serif;
  font-size: 36px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255, 214, 74, 0.65);
}
/* rewers – odsłonięta odpowiedź */
.face-back {
  transform: rotateX(180deg);
  background: linear-gradient(160deg, var(--revealed-1), var(--revealed-2));
  color: var(--text-dark);
  justify-content: space-between;
  padding: 0 18px;
  font-weight: 800;
}
.face-back::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
}
.slot.revealed .face-back::after {
  animation: gleam 0.8s ease 0.35s;
}
@keyframes gleam {
  from {
    left: -60%;
  }
  to {
    left: 130%;
  }
}
.face-back .ans-text {
  font-size: clamp(15px, 1.9vw, 23px);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.face-back .ans-pts {
  font-family: "Bebas Neue", sans-serif;
  font-size: 32px;
  background: var(--text-dark);
  color: var(--gold);
  border-radius: 9px;
  min-width: 56px;
  text-align: center;
  padding: 2px 8px;
  box-shadow: inset 0 0 10px rgba(255, 214, 74, 0.25);
}

/* ---- dolny pasek: wyniki, pula, błędy ---- */
.bottom {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 1180px;
}
.scorecard {
  flex: 1;
  max-width: 330px;
  position: relative;
  background: linear-gradient(160deg, var(--slot-dark-1), var(--slot-dark-2));
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 12px 18px;
  text-align: center;
  box-shadow: 0 10px 24px var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.scorecard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 4px;
  border-radius: 0 0 6px 6px;
  background: var(--accent, #888);
  opacity: 0.9;
}
#card0 { --accent: var(--teamA); }
#card1 { --accent: var(--teamB); }
.scorecard.active {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(255, 214, 74, 0.5);
  transform: translateY(-3px);
}
.scorecard .tname {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
.scorecard .tscore {
  font-family: "Bebas Neue", sans-serif;
  font-size: 58px;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 16px rgba(255, 214, 74, 0.45);
}
.scorecard.bump .tscore {
  animation: bump 0.4s ease;
}
@keyframes bump {
  40% {
    transform: scale(1.28);
  }
}
.pot {
  width: 190px;
  background: linear-gradient(160deg, rgba(255, 214, 74, 0.18), rgba(255, 214, 74, 0.06));
  border: 2px solid rgba(255, 214, 74, 0.45);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 10px 24px var(--shadow);
}
.pot .label {
  font-size: 13px;
  letter-spacing: 0.14em;
  opacity: 0.8;
  font-weight: 700;
}
.pot .value {
  font-family: "Bebas Neue", sans-serif;
  font-size: 60px;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 18px rgba(255, 214, 74, 0.5);
}
.pot.bump .value {
  animation: bump 0.4s ease;
}

/* błędy (X) */
.strikes {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  pointer-events: none;
  z-index: 40;
}
.xmark {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(90px, 18vw, 230px);
  color: var(--red);
  text-shadow: 0 0 36px rgba(255, 59, 59, 0.9);
  animation: stamp 0.35s ease;
}
.flash-red {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 59, 59, 0.35), transparent 70%);
  z-index: 39;
  pointer-events: none;
  animation: flash 0.5s ease forwards;
}
@keyframes flash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ---- ekran końcowy ---- */
.gameover {
  text-align: center;
}
.gameover .crown {
  font-size: clamp(64px, 12vw, 140px);
  animation: float 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}
.gameover .winner {
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(42px, 9vw, 116px);
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 45%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 44px rgba(255, 214, 74, 0.5));
}
.gameover .finalscores {
  margin-top: 26px;
  display: flex;
  gap: 30px;
  justify-content: center;
  font-size: 24px;
}
.gameover .finalscores .s {
  background: rgba(255, 255, 255, 0.07);
  padding: 16px 30px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.gameover .finalscores .s b {
  color: var(--gold);
  font-family: "Bebas Neue", sans-serif;
  font-size: 44px;
  display: block;
  margin-top: 4px;
}

/* ---- animacje ---- */
@keyframes pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}
@keyframes stamp {
  from {
    transform: scale(2.4);
    opacity: 0;
  }
}
@keyframes float {
  50% {
    transform: translateY(-16px);
  }
}

/* konfetti */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  opacity: 0.9;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}
