:root {
  --bg: #070816;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --stroke: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --soft: rgba(255, 255, 255, 0.55);
  --primary: #ffb703;
  --primary-2: #fb8500;
  --accent: #00f5d4;
  --danger: #ef476f;
  --success: #06d6a0;
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 183, 3, 0.20), transparent 32rem),
    radial-gradient(circle at 78% 12%, rgba(0, 245, 212, 0.12), transparent 28rem),
    radial-gradient(circle at 52% 95%, rgba(247, 37, 133, 0.18), transparent 31rem),
    linear-gradient(135deg, #070816 0%, #10122d 50%, #190b2f 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  isolation: isolate;
  padding: clamp(18px, 2vw, 32px);
}

.bg-orb {
  position: fixed;
  width: 38vw;
  height: 38vw;
  min-width: 420px;
  min-height: 420px;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.42;
  z-index: -1;
  pointer-events: none;
  animation: float 8s ease-in-out infinite alternate;
}

.orb-a {
  left: -8vw;
  top: 10vh;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.40), transparent 62%);
}

.orb-b {
  right: -9vw;
  bottom: -8vw;
  background: radial-gradient(circle, rgba(67, 97, 238, 0.48), transparent 64%);
  animation-delay: -2s;
}

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(30px, -22px, 0) scale(1.05); }
}

.glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.13), rgba(255,255,255,0.06));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  max-width: 1780px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar.compact {
  margin-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #201000;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 36px rgba(251, 133, 0, 0.28);
}

.brand strong {
  display: block;
  font-size: clamp(1rem, 1.25vw, 1.35rem);
  letter-spacing: -0.03em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.nav-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.nav-pills a {
  padding: 11px 15px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  transition: 0.22s ease;
}

.nav-pills a:hover,
.nav-pills .nav-score {
  color: var(--text);
  border-color: rgba(255, 183, 3, 0.5);
  background: rgba(255, 183, 3, 0.13);
  transform: translateY(-1px);
}

.dashboard-grid {
  max-width: 1780px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.75fr);
  gap: 24px;
}

.hero-panel,
.setup-panel,
.games-section {
  padding: clamp(24px, 3vw, 48px);
}

.hero-panel {
  min-height: 470px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "✦";
  position: absolute;
  right: 6%;
  top: 8%;
  font-size: clamp(7rem, 12vw, 14rem);
  color: rgba(255,255,255,0.05);
  line-height: 1;
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
  font-size: 0.78rem;
  margin-bottom: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 930px;
  margin-bottom: 18px;
  font-size: clamp(3.25rem, 6.2vw, 7.8rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.45rem, 2.2vw, 2.6rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(1.3rem, 1.65vw, 2rem);
  letter-spacing: -0.04em;
}

.hero-panel p {
  max-width: 830px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.28vw, 1.45rem);
  line-height: 1.55;
}

.hero-actions,
.control-row,
.quiz-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  color: var(--text);
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-primary {
  color: #1b1100;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 40px rgba(251, 133, 0, 0.26);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
}

.btn-score {
  color: #061311;
  background: linear-gradient(135deg, #00f5d4, #06d6a0);
  box-shadow: 0 18px 40px rgba(6, 214, 160, 0.22);
}

.btn-danger {
  background: rgba(239, 71, 111, 0.18);
  border: 1px solid rgba(239, 71, 111, 0.45);
}

.full {
  width: 100%;
}

.stats-strip {
  width: min(100%, 720px);
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stats-strip span {
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 20px;
  background: rgba(0,0,0,0.18);
}

.stats-strip strong,
.stats-strip small {
  display: block;
}

.stats-strip strong {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1;
}

.stats-strip small {
  margin-top: 5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.setup-panel {
  min-height: 470px;
}

.panel-title-row,
.score-title-row,
.play-header,
.team-topline,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #081a13;
  background: var(--success);
  font-size: 0.84rem;
  font-weight: 900;
}

.steps-list,
.mini-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.8;
}

.steps-list li::marker,
.mini-list li::marker {
  color: var(--primary);
  font-weight: 900;
}

.games-section {
  grid-column: 1 / -1;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading p {
  color: var(--muted);
}

.game-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 18px;
}

.game-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.game-card p {
  color: var(--muted);
  line-height: 1.5;
}

.game-card .btn {
  margin-top: auto;
}

.game-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.10);
  font-size: 2.1rem;
}

.score-card {
  border-color: rgba(0, 245, 212, 0.30);
}

.footer-note {
  max-width: 1780px;
  margin: 22px auto 0;
  color: var(--soft);
  text-align: center;
  font-size: 0.95rem;
}

.play-layout,
.scoreboard-layout {
  max-width: 1780px;
  min-height: calc(100vh - 126px);
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.play-layout {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 390px);
}

.play-card,
.side-panel,
.scoreboard-hero,
.score-control {
  padding: clamp(22px, 2.5vw, 42px);
}

.play-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(100vh - 132px);
}

.counter {
  flex: 0 0 auto;
  padding: 14px 18px;
  border-radius: 999px;
  color: #120f03;
  background: linear-gradient(135deg, var(--primary), #fff2a3);
  font-size: clamp(1.1rem, 1.4vw, 1.7rem);
  font-weight: 950;
  box-shadow: 0 16px 34px rgba(255,183,3,0.22);
}

.challenge-zone {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(24px, 4vw, 72px);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.08), transparent 62%),
    rgba(0,0,0,0.16);
}

.emoji-line {
  font-size: clamp(5rem, 11vw, 13rem);
  letter-spacing: 0.05em;
  line-height: 1.1;
  filter: drop-shadow(0 18px 26px rgba(0,0,0,0.35));
}

.challenge-text,
.scramble-stage .challenge-text {
  margin: 20px auto 0;
  max-width: 900px;
  color: var(--muted);
  font-size: clamp(1.25rem, 1.7vw, 2rem);
  line-height: 1.4;
}

.story-clue,
.quiz-question {
  max-width: 1100px;
  margin: 0 auto;
  font-size: clamp(2rem, 3.6vw, 4.65rem);
  line-height: 1.15;
  letter-spacing: -0.055em;
  font-weight: 850;
}

.answer-box {
  padding: clamp(18px, 2vw, 28px);
  margin-top: 18px;
  border: 1px solid rgba(255, 183, 3, 0.35);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.16), rgba(255,255,255,0.07));
  animation: popIn 0.28s ease both;
}

.answer-box h2 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 3vw, 4.3rem);
}

.answer-box p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.45rem);
}

.answer-label {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #1d1200;
  background: var(--primary);
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.74rem;
}

.hidden {
  display: none !important;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.side-panel {
  min-height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-weight: 800;
}

.switch-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.tip-box {
  margin-top: auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  line-height: 1.5;
}

.tip-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.tip-box p {
  margin-bottom: 0;
}

.quiz-options {
  justify-content: center;
  width: 100%;
  margin-top: 30px;
}

.choice-btn {
  min-width: min(100%, 300px);
  padding: 22px 32px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  color: var(--text);
  background: rgba(255,255,255,0.10);
  font-size: clamp(1.2rem, 1.8vw, 2.2rem);
  font-weight: 950;
  cursor: pointer;
  transition: 0.22s ease;
}

.choice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.16);
}

.choice-btn.correct {
  color: #041b12;
  background: linear-gradient(135deg, #06d6a0, #a7f3d0);
}

.choice-btn.wrong {
  background: linear-gradient(135deg, #ef476f, #ff8fab);
}

.choice-btn.dimmed {
  opacity: 0.5;
}

.scramble-word {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(8px, 1vw, 16px);
  max-width: 1120px;
}

.letter-card,
.letter-space {
  display: grid;
  place-items: center;
}

.letter-card {
  min-width: clamp(54px, 5vw, 92px);
  min-height: clamp(64px, 5.8vw, 102px);
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 22px;
  background: rgba(255,255,255,0.12);
  font-size: clamp(2.1rem, 4.3vw, 5.6rem);
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 16px 36px rgba(0,0,0,0.24);
  animation: letterFloat 1.8s ease-in-out infinite alternate;
}

.letter-space {
  width: clamp(18px, 2vw, 36px);
}

.scramble-word.revealed .letter-card {
  color: #130f00;
  background: linear-gradient(135deg, var(--primary), #fff3b0);
  animation: snap 0.42s ease both;
}

@keyframes letterFloat {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-5px) rotate(1deg); }
}

@keyframes snap {
  0% { transform: scale(0.88) rotate(-8deg); opacity: 0.72; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.scoreboard-layout {
  grid-template-columns: minmax(0, 1fr) minmax(310px, 420px);
}

.scoreboard-hero {
  min-height: calc(100vh - 132px);
}

.leader-banner {
  margin: 10px 0 20px;
  padding: 18px 22px;
  border: 1px solid rgba(0, 245, 212, 0.26);
  border-radius: 22px;
  color: #061311;
  background: linear-gradient(135deg, #00f5d4, #80ffdb);
  font-size: clamp(1.25rem, 1.8vw, 2rem);
  font-weight: 950;
  text-align: center;
  box-shadow: 0 18px 44px rgba(0,245,212,0.16);
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
}

.team-card {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--team-color) 23%, transparent), rgba(255,255,255,0.07)),
    rgba(0,0,0,0.16);
  box-shadow: 0 22px 54px rgba(0,0,0,0.28);
}

.team-card::before {
  content: "";
  position: absolute;
  inset: -35% -25% auto auto;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--team-color);
  opacity: 0.18;
  filter: blur(20px);
}

.rank-badge {
  position: relative;
  display: inline-flex;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #0d0d12;
  background: var(--team-color);
  font-weight: 950;
}

.team-topline {
  position: relative;
  align-items: center;
}

.team-color-dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--team-color);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--team-color) 22%, transparent);
}

.team-name-input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: clamp(1.35rem, 2vw, 2.3rem);
  font-weight: 950;
  letter-spacing: -0.04em;
}

.team-color-input {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
}

.score-number {
  position: relative;
  margin: 22px 0;
  font-size: clamp(4rem, 7vw, 9rem);
  line-height: 0.85;
  font-weight: 1000;
  letter-spacing: -0.08em;
  text-shadow: 0 18px 36px rgba(0,0,0,0.26);
}

.team-controls {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.team-controls button {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  font-weight: 900;
  cursor: pointer;
}

.team-controls .plus {
  color: #071511;
  background: var(--team-color);
}

.team-controls .remove {
  background: rgba(239,71,111,0.18);
}

.score-control {
  min-height: calc(100vh - 132px);
}

.muted {
  color: var(--muted);
}

.team-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.team-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.team-form input[type="text"] {
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  outline: 0;
}

.team-form input[type="color"] {
  width: 100%;
  min-height: 50px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
}

.control-divider {
  height: 1px;
  margin: 20px 0;
  background: rgba(255,255,255,0.12);
}

@media (min-width: 1600px) {
  .game-cards {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 1280px) {
  .topbar,
  .dashboard-grid,
  .play-layout,
  .scoreboard-layout {
    max-width: 1100px;
  }

  .topbar,
  .dashboard-grid,
  .play-layout,
  .scoreboard-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-pills {
    justify-content: flex-start;
  }

  .game-cards,
  .teams-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }

  .play-card,
  .side-panel,
  .scoreboard-hero,
  .score-control {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .nav-pills a {
    padding: 9px 11px;
    font-size: 0.88rem;
  }

  .hero-panel,
  .setup-panel,
  .games-section,
  .play-card,
  .side-panel,
  .scoreboard-hero,
  .score-control {
    padding: 20px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(2.6rem, 18vw, 4.3rem);
  }

  .stats-strip,
  .game-cards,
  .teams-grid,
  .team-controls {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .play-header,
  .score-title-row {
    flex-direction: column;
  }

  .challenge-zone {
    min-height: 300px;
    padding: 18px;
  }

  .emoji-line {
    font-size: clamp(4rem, 24vw, 7rem);
  }

  .story-clue,
  .quiz-question {
    font-size: clamp(1.65rem, 9vw, 3rem);
  }

  .choice-btn {
    width: 100%;
  }

  .letter-card {
    min-width: 44px;
    min-height: 52px;
    border-radius: 16px;
    font-size: 2rem;
  }
}
