:root {
  --bg-a: #090513;
  --bg-b: #110a24;
  --neon-violet: #a855f7;
  --neon-blue: #38bdf8;
  --neon-pink: #f472b6;
  --ink: #f9f5ff;
  --muted: #cfbee7;
  --panel: rgba(20, 14, 40, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 20%, #1f1145 0%, var(--bg-b) 35%, var(--bg-a) 100%);
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2vh 2vw;
}

.tv-screen {
  position: relative;
  width: min(96vw, 1720px);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: clamp(20px, 2.6vw, 44px);
  display: grid;
  gap: clamp(12px, 1.4vw, 24px);
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(145deg, rgba(18, 10, 40, 0.82), rgba(8, 8, 24, 0.92));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.tv-header {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
}

.tv-logo {
  width: clamp(86px, 9vw, 150px);
  height: auto;
  flex: 0 0 auto;
}

.tv-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--neon-blue);
  font-size: clamp(0.75rem, 1.1vw, 1.1rem);
}

.tv-branding h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.7rem, 3vw, 3.1rem);
  line-height: 1.08;
}

.tv-grid {
  display: grid;
  gap: clamp(10px, 1.2vw, 18px);
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}

.tv-left-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(10px, 1.1vw, 16px);
  min-height: 0;
}

.tv-right-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 1.1vw, 16px);
  min-height: 0;
}

.tv-card {
  background: var(--panel);
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 16px;
  padding: clamp(14px, 1.25vw, 22px);
}

.tv-card h2 {
  margin: 0 0 .6rem;
  font-size: clamp(1.02rem, 1.5vw, 1.6rem);
  color: var(--neon-pink);
}

.tv-card-top5 {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.tv-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1vw, 16px);
}

.tv-kpi-card {
  display: grid;
  align-content: center;
  text-align: center;
  min-height: clamp(130px, 19vh, 220px);
}

.tv-card-secrets {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-height: 0;
}

.tv-secrets-list {
  margin: 0;
  padding: .2rem .1rem .3rem;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  font-size: clamp(1.1rem, 1.55vw, 1.7rem);
  color: var(--ink);
}

.tv-secrets-marquee {
  height: 100%;
  overflow: hidden;
}

.tv-secrets-track {
  display: grid;
  gap: clamp(8px, 0.8vw, 12px);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.tv-secrets-copy {
  display: grid;
  align-content: start;
  gap: clamp(8px, 0.8vw, 12px);
}

.tv-secrets-list.is-marquee .tv-secrets-track {
  animation: tvSecretsScroll var(--secrets-scroll-duration, 30s) linear infinite;
}

.tv-secret-item,
.tv-secrets-empty {
  margin: 0;
  line-height: 1.3;
  padding: .46rem .7rem;
  text-align: left;
  font-weight: 700;
  text-wrap: pretty;
  background: rgba(5, 3, 14, 0.35);
  border: 2px solid rgba(139, 215, 255, 0.42);
  border-radius: 12px;
}

.tv-secrets-empty {
  display: grid;
  align-content: center;
  height: 100%;
}

@keyframes tvSecretsScroll {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(0, calc(var(--secrets-scroll-distance, 0px) * -1), 0);
  }
}

.tv-ranking {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: clamp(8px, .9vw, 12px);
}

.tv-ranking li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: clamp(1.2rem, 1.9vw, 2.2rem);
  padding: .35rem .55rem;
  background: rgba(5, 3, 14, 0.4);
  border-radius: 10px;
}

.tv-rank {
  color: var(--neon-blue);
  min-width: 64px;
}

.tv-name {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tv-points {
  color: var(--ink);
  font-size: 1em;
  font-weight: 700;
}

.tv-number {
  margin: 0;
  font-size: clamp(2.1rem, 3.7vw, 3.8rem);
  font-weight: 700;
  color: var(--ink);
}

.tv-subtext {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.15vw, 1.3rem);
}

.tv-footer {
  border-top: 1px solid rgba(56, 189, 248, 0.3);
  padding-top: clamp(10px, 1.1vw, 16px);
  overflow: hidden;
}

.tv-ticker {
  width: 100%;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  background: rgba(7, 8, 20, 0.65);
  overflow: hidden;
}

.tv-ticker-track {
  --ticker-duration: 38s;
  margin: 0;
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: clamp(26px, 2vw, 44px);
  padding: clamp(8px, 0.9vw, 13px) 0;
  white-space: nowrap;
  font-size: clamp(0.88rem, 1.2vw, 1.15rem);
  font-weight: 700;
  color: var(--ink);
  animation: tvTickerScroll var(--ticker-duration) linear infinite;
}

.tv-ticker-copy {
  display: inline-flex;
  align-items: center;
  gap: clamp(26px, 2vw, 44px);
  padding-inline: clamp(12px, 1.6vw, 30px);
}


.tv-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.tv-ticker-item.is-correct {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(34, 197, 94, 0.16);
}

.tv-ticker-item.is-wrong {
  border-color: rgba(248, 113, 113, 0.52);
  background: rgba(239, 68, 68, 0.13);
}

.tv-ticker-secret {
  color: #f9d8ff;
}

.tv-ticker-points-buzzer {
  color: #86efac;
}

.tv-ticker-points-target {
  color: #fca5a5;
}

.tv-ticker-track.is-empty {
  display: flex;
  justify-content: center;
  min-width: 100%;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .tv-secrets-list.is-marquee .tv-secrets-track,
  .tv-ticker-track {
    animation: none;
    transform: none;
  }
}

@keyframes tvTickerScroll {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@media (max-width: 1080px) {
  body {
    padding: 1vh 1vw;
  }

  .tv-screen {
    width: 100vw;
    border-radius: 0;
  }

  .tv-grid {
    grid-template-columns: 1fr;
  }

  .tv-left-panel {
    grid-template-rows: auto auto;
  }

  .tv-right-panel {
    grid-template-rows: auto minmax(280px, 1fr);
  }

  .tv-kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tv-kpi-card {
    min-height: auto;
  }
}

.tv-revelation-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(81, 32, 138, 0.9) 0%, rgba(24, 9, 50, 0.98) 60%, rgba(8, 4, 21, 1) 100%);
  animation: revealFadeIn 420ms ease-out;
}

.tv-revelation-card {
  width: min(1200px, 90vw);
  text-align: center;
  border: 2px solid rgba(244, 114, 182, 0.7);
  border-radius: 24px;
  padding: clamp(26px, 4vw, 52px);
  background: rgba(15, 6, 33, 0.85);
  box-shadow: 0 0 36px rgba(168, 85, 247, 0.45);
  animation: revealPulse 2.2s ease-in-out infinite;
}

.tv-revelation-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: .16em;
  color: #f472b6;
  font-size: clamp(1.6rem, 3vw, 3rem);
}

.tv-revelation-participant {
  margin: .7rem 0 1.2rem;
  font-size: clamp(2rem, 5vw, 5rem);
  color: #fff;
}

.tv-revelation-secret-label {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 2rem);
  color: #c4b5fd;
}

.tv-revelation-secret {
  margin: .8rem 0 0;
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 3rem);
  color: #f9f5ff;
}

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

@keyframes revealPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 28px rgba(168, 85, 247, 0.35); }
  50% { transform: scale(1.01); box-shadow: 0 0 44px rgba(168, 85, 247, 0.6); }
}

.tv-join-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity .45s ease, transform .45s ease;
  background: radial-gradient(circle at 30% 20%, rgba(56, 189, 248, 0.2) 0%, rgba(15, 6, 33, 0.97) 45%, rgba(6, 4, 18, 1) 100%);
}

.tv-join-overlay.is-visible {
  opacity: 1;
  transform: scale(1);
}

.tv-join-card {
  width: min(1300px, 94vw);
  border-radius: 28px;
  border: 2px solid rgba(56, 189, 248, 0.7);
  background: rgba(12, 8, 30, 0.94);
  padding: clamp(24px, 4vw, 56px);
  text-align: center;
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.35);
  animation: revealPulse 3.5s ease-in-out infinite;
}

.tv-join-kicker {
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--neon-blue);
  font-weight: 700;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
}

.tv-join-title {
  margin: 0.7rem 0;
  color: #fff;
  font-size: clamp(2rem, 5vw, 5rem);
}

.tv-join-subtitle {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: clamp(1.2rem, 2.3vw, 2.2rem);
}

.tv-join-qr {
  width: min(40vw, 440px);
  min-width: 240px;
  border-radius: 14px;
  border: 4px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  padding: 10px;
}

.tv-join-missing-label {
  margin: 1.3rem 0 0.4rem;
  color: var(--neon-pink);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.2vw, 2.1rem);
}

.tv-join-missing {
  margin: 0;
  color: #fff;
  font-size: clamp(1.3rem, 2.8vw, 2.5rem);
  line-height: 1.35;
}

.tv-missing-secrets-overlay {
  position: fixed;
  right: clamp(18px, 2vw, 36px);
  bottom: clamp(18px, 2vw, 36px);
  z-index: 950;
  width: min(44vw, 760px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .55s ease, transform .55s ease;
}

.tv-missing-secrets-overlay.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tv-missing-secrets-card {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: clamp(12px, 1.2vw, 20px);
  align-items: center;
  border: 2px solid rgba(56, 189, 248, 0.7);
  border-radius: 18px;
  background: rgba(8, 8, 22, 0.92);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.32);
  padding: clamp(12px, 1.4vw, 20px);
}

.tv-missing-secrets-qr {
  width: 100%;
  border-radius: 10px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  padding: 6px;
}

.tv-missing-secrets-title {
  margin: 0;
  color: #fff;
  font-weight: 800;
  font-size: clamp(1.2rem, 1.8vw, 2rem);
}

.tv-missing-secrets-subtitle {
  margin: .3rem 0 .7rem;
  color: var(--neon-blue);
  font-size: clamp(1rem, 1.3vw, 1.45rem);
  font-weight: 700;
}

.tv-missing-secrets-empty {
  margin: .4rem 0 0;
  color: #d8f9ff;
  font-size: clamp(1rem, 1.2vw, 1.35rem);
  font-weight: 700;
}

.tv-missing-secrets-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: .25rem;
  color: #fff;
  font-size: clamp(1rem, 1.28vw, 1.5rem);
  font-weight: 700;
  line-height: 1.28;
}



.tv-card-buzzer {
  display: grid;
  grid-template-columns: minmax(92px, 112px) 1fr;
  align-items: center;
  gap: .6rem .8rem;
  padding: .6rem .8rem;
}

.tv-card-buzzer-title {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--neon-blue);
  font-size: clamp(0.86rem, 1.04vw, 1.1rem);
  font-weight: 700;
  letter-spacing: .03em;
}

.tv-card-buzzer-qr {
  width: 100%;
  max-width: 112px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  padding: 4px;
}

.tv-card-buzzer-missing {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.62rem, 0.72vw, 0.82rem);
  line-height: 1.25;
}

.tv-points-reminder {
  position: absolute;
  top: clamp(12px, 1.6vw, 22px);
  right: clamp(12px, 1.6vw, 22px);
  z-index: 5;
  margin: 0;
  width: min(19vw, 320px);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(8, 8, 22, 0.74);
  font-size: clamp(0.66rem, 0.82vw, 0.84rem);
  line-height: 1.3;
  color: rgba(249, 245, 255, 0.95);
  pointer-events: none;
}

.tv-points-reminder-title {
  margin: 0 0 .35rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: #fff;
}

.tv-points-reminder-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .22rem .5rem;
  align-items: baseline;
}

.tv-points-reminder-row + .tv-points-reminder-row {
  margin-top: .2rem;
}

.tv-points-reminder-role,
.tv-points-reminder-row p {
  margin: 0;
}

.tv-points-reminder-role {
  color: #dbeafe;
  font-weight: 700;
}

.tv-points-good {
  color: #86efac;
  font-weight: 800;
}

.tv-points-bad {
  color: #fca5a5;
  font-weight: 800;
}

.tv-points-bonus {
  color: #fde68a;
  font-weight: 800;
}

.tv-points-reminder-note {
  margin: .35rem 0 0;
  color: rgba(243, 244, 246, 0.92);
  font-size: clamp(0.56rem, 0.68vw, 0.72rem);
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tv-special-buzz-banner {
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(92vw, 1200px);
  padding: 1.2rem 1.8rem;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: linear-gradient(120deg, rgba(236, 72, 153, 0.93), rgba(99, 102, 241, 0.93));
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.6rem, 2.8vw, 3rem);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
}

.tv-special-buzz-banner p {
  margin: 0.2rem 0;
}

.tv-special-buzz-banner.is-visible {
  animation: tv-special-buzz-fade 9s ease-in-out;
  opacity: 1;
}

@keyframes tv-special-buzz-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-24px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  88% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px); }
}
