:root {
  --background: #08111f;
  --background-deep: #050b14;
  --surface: #17283e;
  --surface-dark: #0f1d30;
  --surface-light: #203650;

  --primary: #8b5cf6;
  --primary-dark: #6d3de7;
  --secondary: #20b8d8;
  --secondary-light: #9eeafa;

  --success: #31d17c;
  --danger: #ef5b68;
  --warning: #f6b84a;

  --text: #f7f9fc;
  --text-soft: #b9c7da;
  --text-muted: #8798ae;

  --border: rgba(255, 255, 255, 0.11);

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);

  --radius: 24px;
  --radius-small: 15px;

  --shell-padding: clamp(14px, 3vw, 42px);

  /* =======================================================
     HERO SPACING CONTROLS

     Change these values to freely adjust the spacing on the
     left side of the hero section.
     ======================================================= */

  --hero-copy-padding-top: clamp(22px, 4vh, 52px);
  --hero-copy-padding-bottom: clamp(22px, 4vh, 52px);
  --hero-copy-padding-left: clamp(4px, 1vw, 16px);
  --hero-copy-padding-right: clamp(4px, 1vw, 16px);

  --hero-eyebrow-heading-gap: 40px;
  --hero-heading-description-gap: 68px;
  --hero-description-pills-gap: 26px;
  --hero-pills-actions-gap: 168px;

  --hero-heading-size: clamp(2.35rem, 4.7vw, 5.2rem);
  --hero-description-size: clamp(0.96rem, 1.3vw, 1.18rem);

  --hero-grid-column-gap: clamp(20px, 3vw, 44px);
  --hero-stats-height: 150px;
}

/* =========================================================
   GLOBAL RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow: hidden;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);

  background:
    radial-gradient(
      circle at top left,
      rgba(139, 92, 246, 0.19),
      transparent 34rem
    ),
    radial-gradient(
      circle at top right,
      rgba(32, 184, 216, 0.17),
      transparent 32rem
    ),
    linear-gradient(
      145deg,
      var(--background),
      #0b1627 55%,
      var(--background-deep)
    );
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;

  opacity: 0.1;

  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 3px,
      rgba(80, 220, 255, 0.07) 4px
    );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  background:
    radial-gradient(
      circle at 50% 20%,
      rgba(32, 184, 216, 0.12),
      transparent 42%
    );
}

/* =========================================================
   APPLICATION SHELL
   ========================================================= */

.app-shell {
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0 var(--shell-padding);

  display: grid;
  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto;

  overflow: hidden;
}

main {
  min-height: 0;
  padding: 12px 0;
  overflow: hidden;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  position: relative;
  z-index: 1000;

  width: auto;
  min-height: 64px;

  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  margin-right: calc(var(--shell-padding) * -1);
  margin-left: calc(var(--shell-padding) * -1);

  padding: 9px var(--shell-padding);

  border-bottom: 1px solid var(--border);

  visibility: visible !important;
  opacity: 1 !important;

  background:
    linear-gradient(
      90deg,
      rgba(8, 17, 31, 0.98),
      rgba(15, 29, 48, 0.98),
      rgba(8, 17, 31, 0.98)
    );

  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.22);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;

  padding: 0;
  border: 0;

  color: var(--text);
  background: transparent;

  text-align: left;
  cursor: pointer;
}

.brand-mark {
  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.04em;

  background:
    linear-gradient(
      145deg,
      var(--primary),
      var(--secondary)
    );

  box-shadow:
    0 10px 28px rgba(139, 92, 246, 0.26),
    0 0 18px rgba(32, 184, 216, 0.15);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand small {
  margin-top: 2px;
  color: var(--text-soft);
}

#soundToggle {
  min-height: 40px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  border-radius: 13px;

  color: var(--text);

  background:
    rgba(255, 255, 255, 0.05);
}

/* =========================================================
   SCREEN MANAGEMENT
   ========================================================= */

.screen {
  display: none;
  width: 100%;
}

.screen.active {
  width: 100%;
  height: 100%;
  min-height: 0;

  overflow: hidden;

  animation: fadeIn 0.25s ease;
}

.centered-screen.active {
  display: grid;
  place-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   COMMON ELEMENTS
   ========================================================= */

.eyebrow {
  display: inline-block;

  color: var(--secondary-light);

  font-size: 1.76rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);

  background:
    linear-gradient(
      145deg,
      rgba(25, 43, 68, 0.97),
      rgba(15, 29, 48, 0.98)
    );

  box-shadow: var(--shadow);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.button,
.icon-button,
.text-button,
.stat-card {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 48px;
  padding: 0 21px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: var(--radius-small);

  font-weight: 800;
  text-decoration: none;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.button:hover,
.icon-button:hover,
.clickable-stat:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: #ffffff;

  background:
    linear-gradient(
      145deg,
      var(--primary),
      var(--primary-dark)
    );

  box-shadow:
    0 14px 30px rgba(109, 61, 231, 0.28);
}

.button.secondary {
  color: var(--text);

  border: 1px solid var(--border);

  background:
    rgba(255, 255, 255, 0.06);
}

.button.danger {
  color: #ffffff;

  background:
    linear-gradient(
      145deg,
      #ef5b68,
      #c93c50
    );
}

.button.full-width {
  width: 100%;
  margin-top: 22px;
}

.icon-button {
  min-height: 42px;
  padding: 0 14px;

  border: 1px solid var(--border);
  border-radius: 13px;

  color: var(--text);

  background:
    rgba(255, 255, 255, 0.05);

  transition: 0.2s ease;
}

.text-button {
  padding: 8px 0;

  color: var(--secondary-light);
  background: transparent;

  font-weight: 800;
}

/* =========================================================
   HERO GRID FULL-HEIGHT LAYOUT
   ========================================================= */

#welcomeScreen.active {
  display: grid !important;
  grid-template-rows:
    minmax(0, 1fr)
    var(--hero-stats-height);

  gap: 12px;

  width: 100%;
  height: 100%;
  min-height: 0;

  overflow: hidden;
}

#welcomeScreen .hero-grid {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;

  display: grid;
  grid-template-columns:
    minmax(0, 1.08fr)
    minmax(320px, 0.92fr);

  grid-template-rows:
    minmax(0, 1fr);

  gap: var(--hero-grid-column-gap);

  align-items: stretch !important;
}

/* =========================================================
   HERO COPY

   The HTML order is expected to be:

   eyebrow
   h1
   hero-description
   feature-pills
   hero-actions
   ========================================================= */

#welcomeScreen .hero-copy {
  width: 100%;
  height: 100% !important;
  min-width: 0;
  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;

  padding:
    var(--hero-copy-padding-top)
    var(--hero-copy-padding-right)
    var(--hero-copy-padding-bottom)
    var(--hero-copy-padding-left);
}

/* Eyebrow */

#welcomeScreen .hero-copy .eyebrow {
  display: block;

  margin: 0 0 var(--hero-eyebrow-heading-gap);

  color: var(--secondary-light);

  font-size: clamp(0.72rem, 0.9vw, 0.84rem);
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

/* Heading */

#welcomeScreen .hero-copy h1 {
  width: 100%;
  max-width: 920px;

  margin:
    0
    0
    var(--hero-heading-description-gap);

  font-size: var(--hero-heading-size);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

/* Description */

#welcomeScreen .hero-copy .hero-description {
  width: 100%;
  max-width: 760px;

  margin:
    0
    0
    var(--hero-description-pills-gap);

  color: var(--text-soft);

  font-size: var(--hero-description-size);
  line-height: 1.6;
}

/* Feature pills now appear above the action buttons */

#welcomeScreen .feature-pills {
  width: 100%;

  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 10px;

  margin:
    0
    0
    var(--hero-pills-actions-gap);
}

#welcomeScreen .feature-pills span {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  padding: 8px 12px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: var(--text-soft);

  background:
    rgba(255, 255, 255, 0.04);

  font-size: 0.8rem;
}

#welcomeScreen .feature-pills strong {
  color: var(--secondary-light);
}

/* Hero action buttons */

#welcomeScreen .hero-actions {
  width: 100%;

  display: flex;
  align-items: stretch;
  flex-wrap: wrap;

  gap: 38px;

  margin: 0;
}

#welcomeScreen .hero-button {
  min-width: 225px;
  min-height: 68px;

  display: inline-flex;
  align-items: center;
  justify-content: flex-start;

  gap: 12px;
  padding: 10px 18px;

  text-align: left;
}

#welcomeScreen .button-icon {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 12px;

  background:
    rgba(255, 255, 255, 0.1);
}

#welcomeScreen .button-content {
  display: grid;
  gap: 3px;
}

#welcomeScreen .button-content strong,
#welcomeScreen .button-content small {
  display: block;
}

#welcomeScreen .button-content small {
  color: rgba(255, 255, 255, 0.72);

  font-size: 0.72rem;
  font-weight: 600;
}

/* =========================================================
   HERO VISUAL
   ========================================================= */

#welcomeScreen .hero-visual {
  position: relative;

  align-self: stretch !important;

  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0 !important;
  max-height: none !important;

  margin: 0 !important;
  padding: 0;

  overflow: hidden;

  border: 1px solid rgba(32, 184, 216, 0.34);
  border-radius: var(--radius);

  background:
    linear-gradient(
      145deg,
      rgba(17, 34, 56, 0.98),
      rgba(8, 17, 31, 0.98)
    );

  box-shadow:
    var(--shadow),
    0 0 28px rgba(32, 184, 216, 0.13);

  animation:
    heroCardPulse 3.6s ease-in-out infinite;
}

#welcomeScreen .hero-visual > img {
  position: absolute;
  inset: 0;

  z-index: 1;

  display: block;

  width: 100% !important;
  height: 100% !important;
  min-width: 100%;
  min-height: 100% !important;
  max-width: none;
  max-height: none;

  margin: 0;
  padding: 0;

  object-fit: cover !important;
  object-position: center top !important;

  animation:
    heroImagePulse 4.2s ease-in-out infinite;
}

#welcomeScreen .hero-visual-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;

  width: 100%;
  height: 100%;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  padding: clamp(18px, 2vw, 28px);

  pointer-events: none;

  background:
    linear-gradient(
      to bottom,
      rgba(5, 11, 20, 0.08),
      transparent 48%,
      rgba(5, 11, 20, 0.82)
    );
}

#welcomeScreen .hero-visual .image-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;

  width: 100%;
  height: 100%;
  min-height: 0 !important;
}

.hero-status {
  width: fit-content;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 8px 11px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;

  color: var(--secondary-light);

  background:
    rgba(5, 11, 20, 0.65);

  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  backdrop-filter: blur(10px);
}

.hero-status-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: var(--success);

  box-shadow:
    0 0 12px var(--success);
}

.hero-visual-title {
  display: grid;
  gap: 4px;

  text-shadow:
    0 3px 15px rgba(0, 0, 0, 0.8);
}

.hero-visual-title span {
  color: var(--secondary-light);

  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-visual-title strong {
  font-size: clamp(1.45rem, 3vw, 2.5rem);
}

/* =========================================================
   HERO ANIMATIONS
   ========================================================= */

@keyframes heroCardPulse {
  0%,
  100% {
    border-color:
      rgba(32, 184, 216, 0.3);

    box-shadow:
      var(--shadow),
      0 0 20px rgba(32, 184, 216, 0.12);
  }

  50% {
    border-color:
      rgba(139, 92, 246, 0.62);

    box-shadow:
      var(--shadow),
      0 0 36px rgba(32, 184, 216, 0.22),
      0 0 48px rgba(139, 92, 246, 0.13);
  }
}

@keyframes heroImagePulse {
  0%,
  100% {
    transform: scale(1.01);
    filter: brightness(0.96) saturate(1);
  }

  50% {
    transform: scale(1.04);
    filter: brightness(1.08) saturate(1.12);
  }
}

/* =========================================================
   HOME STATISTICS
   ========================================================= */

#welcomeScreen .stats-grid {
  position: relative;
  z-index: 5;

  width: 100%;
  height: var(--hero-stats-height);
  min-height: var(--hero-stats-height);

  margin: 0;
  padding: 0;

  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 14px;
  align-items: stretch;
}

#welcomeScreen .stat-card {
  width: 100%;
  height: var(--hero-stats-height);
  min-height: var(--hero-stats-height);
  padding: 20px 22px;

  display: flex;
  flex-direction: column;
  justify-content: center;

  text-align: left;
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 19px;

  background:
    linear-gradient(
      145deg,
      rgba(27, 48, 74, 0.95),
      rgba(15, 29, 48, 0.98)
    );

  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.18),
    inset 0 0 20px rgba(32, 184, 216, 0.025);

  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#welcomeScreen .stat-card span,
#welcomeScreen .stat-card strong,
#welcomeScreen .stat-card small {
  display: block;
}

#welcomeScreen .stat-card span {
  color: var(--text-soft);

  font-size: 0.9rem;
  font-weight: 700;
}

#welcomeScreen .stat-card strong {
  margin-top: 10px;

  color: var(--text);

  font-size: clamp(1.7rem, 2.5vw, 2.2rem);
  line-height: 1;
}

#welcomeScreen .stat-card small {
  margin-top: 10px;

  color: var(--text-muted);

  font-size: 0.78rem;
}

.clickable-stat:hover {
  border-color:
    rgba(32, 184, 216, 0.72);

  box-shadow:
    0 0 24px rgba(32, 184, 216, 0.16),
    inset 0 0 22px rgba(32, 184, 216, 0.05);
}

/* =========================================================
   COMMON INTERNAL SCREEN HEADINGS
   ========================================================= */

.section-heading,
.game-topbar,
.timer-row,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.section-heading h2,
.game-topbar h2,
.results-card h2,
.dialog-heading h2,
.handoff-card h2 {
  margin: 6px 0 0;

  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

/* =========================================================
   GAME SETUP
   ========================================================= */

#setupScreen.active {
  display: flex;
  flex-direction: column;
}

.setup-layout {
  flex: 1;
  min-height: 0;

  display: grid;
  grid-template-columns:
    minmax(280px, 0.82fr)
    minmax(0, 1.18fr);

  gap: 16px;
}

.form-card {
  min-height: 0;
  padding: clamp(18px, 2.5vw, 26px);

  overflow: auto;
}

.form-card h3 {
  margin-top: 0;
}

.form-grid,
.player-name-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 17px;
}

label {
  display: grid;
  gap: 8px;

  color: var(--text-soft);

  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;

  border: 1px solid var(--border);
  border-radius: 13px;

  color: var(--text);
  background: #102038;

  outline: none;
}

input:focus,
select:focus {
  border-color: var(--secondary);

  box-shadow:
    0 0 0 3px rgba(32, 184, 216, 0.13);
}

#multiplayerFields {
  display: grid;
  gap: 18px;
}

.scoring-note {
  margin-top: 21px;
  padding: 14px;

  border: 1px solid rgba(32, 184, 216, 0.16);
  border-radius: 14px;

  color: var(--text-soft);

  background:
    rgba(32, 184, 216, 0.08);
}

.error-message {
  min-height: 22px;
  margin: 12px 0 0;

  color: #ffadb5;
}

/* =========================================================
   LOADING AND HANDOFF
   ========================================================= */

.loading-card,
.handoff-card {
  width: min(620px, 100%);
  padding: clamp(34px, 6vw, 62px);

  text-align: center;
}

.spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;

  border: 6px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--secondary);
  border-radius: 50%;

  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.handoff-card {
  position: relative;
  overflow: hidden;

  border-color:
    rgba(32, 184, 216, 0.32);
}

.handoff-countdown {
  display: block;

  margin-top: 24px;

  color: var(--secondary-light);

  font-size: clamp(5rem, 12vw, 9rem);
  line-height: 1;

  text-shadow:
    0 0 22px rgba(32, 184, 216, 0.55);
}

/* =========================================================
   GAME SCREEN
   ========================================================= */

#gameScreen.active {
  display: flex;
  flex-direction: column;
}

.game-topbar {
  flex: 0 0 auto;
}

.game-topbar h2 {
  font-size: clamp(1.45rem, 3vw, 2.35rem);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;

  color: var(--text-soft);
}

.scoreboard {
  flex: 0 0 auto;

  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(140px, 1fr));

  gap: 10px;
  margin: 8px 0;
}

.player-score {
  padding: 10px 13px;

  border: 1px solid var(--border);
  border-radius: 15px;

  background:
    rgba(255, 255, 255, 0.035);
}

.player-score.active {
  border-color:
    rgba(32, 184, 216, 0.75);

  background:
    rgba(32, 184, 216, 0.1);

  box-shadow:
    0 0 18px rgba(32, 184, 216, 0.18);
}

.player-score span,
.player-score strong {
  display: block;
}

.player-score span {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.player-score strong {
  margin-top: 4px;
  font-size: 1rem;
}

.hud-status {
  display: flex;
  align-items: center;
  gap: 10px;

  margin-bottom: 6px;

  color: var(--secondary-light);

  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.hud-status span:last-child {
  margin-left: auto;
  color: var(--text-soft);
}

.hud-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: var(--success);

  box-shadow:
    0 0 12px var(--success);
}

.question-card {
  position: relative;
  overflow: hidden;

  flex: 1;
  min-height: 0;

  padding:
    clamp(14px, 2vh, 24px)
    clamp(18px, 3vw, 34px);

  display: flex;
  flex-direction: column;

  border-color:
    rgba(64, 220, 255, 0.3);
}

.timer-row {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.timer-row strong {
  color: var(--text);
  font-size: 1.25rem;
}

.timer-track {
  height: 8px;
  margin-top: 8px;

  overflow: hidden;

  border-radius: 999px;

  background:
    rgba(255, 255, 255, 0.08);
}

.timer-bar {
  width: 100%;
  height: 100%;

  border-radius: inherit;

  background:
    linear-gradient(
      90deg,
      var(--secondary),
      var(--primary)
    );

  transition:
    width 1s linear,
    background 0.2s ease;
}

.question-category {
  margin: 12px 0 4px;

  color: var(--secondary-light);

  font-size: 0.85rem;
  font-weight: 800;
}

#questionText {
  margin: 0 0 12px;

  font-size: clamp(1.1rem, 2.1vw, 1.75rem);
  line-height: 1.2;
}

.answer-grid {
  flex: 1;
  min-height: 0;

  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 9px;
}

.answer-button {
  position: relative;
  overflow: hidden;

  min-height: clamp(48px, 7vh, 64px);
  padding: 10px 14px;

  border: 1px solid rgba(120, 210, 255, 0.2);
  border-radius: 16px;

  color: var(--text);

  background:
    rgba(255, 255, 255, 0.045);

  cursor: pointer;
  text-align: left;

  font-size: clamp(0.88rem, 1.25vw, 1rem);
  font-weight: 750;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-2px);

  border-color:
    rgba(32, 184, 216, 0.8);

  background:
    rgba(32, 184, 216, 0.09);
}

.answer-button.correct {
  border-color:
    rgba(49, 209, 124, 0.75);

  background:
    rgba(49, 209, 124, 0.13);
}

.answer-button.incorrect {
  border-color:
    rgba(239, 91, 104, 0.75);

  background:
    rgba(239, 91, 104, 0.13);
}

.feedback-panel {
  position: sticky;
  bottom: 0;
  z-index: 20;

  margin-top: 8px;
  padding: 10px 13px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background:
    rgba(15, 29, 48, 0.98);
}

.feedback-panel p {
  margin: 4px 0 8px;

  color: var(--text-soft);

  font-size: 0.9rem;
}

/* =========================================================
   RESULTS
   ========================================================= */

#resultsScreen.active {
  display: grid;
  place-items: center;
}

.results-card {
  width: min(980px, 100%);
  max-height: 100%;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px);

  overflow: auto;

  text-align: center;
}

.results-card > p,
.dialog-description {
  color: var(--text-soft);
}

.winner-banner,
.solo-result-headline {
  margin: 20px 0;
  padding: 18px;

  border-radius: 18px;

  font-size: 1.2rem;
  font-weight: 900;
}

.final-standings,
.history-list {
  display: grid;
  gap: 12px;

  margin: 20px 0;

  text-align: left;
}

.standing-row,
.history-row {
  display: grid;
  grid-template-columns:
    52px
    1fr
    auto;

  gap: 14px;
  align-items: center;

  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background:
    rgba(255, 255, 255, 0.035);
}

.result-stats {
  display: grid;
  grid-template-columns:
    repeat(3, 1fr);

  gap: 12px;
  margin: 20px 0;
}

.result-stat {
  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 16px;

  background:
    rgba(255, 255, 255, 0.035);
}

.results-actions {
  justify-content: center;
  margin-top: 22px;
}

/* =========================================================
   DIALOGS
   ========================================================= */

dialog {
  width: min(760px, calc(100% - 28px));
  max-height: 85vh;

  padding: 0;
  overflow: auto;

  border: 1px solid var(--border);
  border-radius: 22px;

  color: var(--text);

  background:
    var(--surface);

  box-shadow: var(--shadow);
}

dialog::backdrop {
  background:
    rgba(0, 0, 0, 0.74);

  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 26px;
}

.dialog-actions {
  justify-content: flex-end;
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
  position: relative;
  z-index: 1000;

  width: auto;
  min-height: 46px;

  display: block !important;

  margin-right: calc(var(--shell-padding) * -1) !important;
  margin-left: calc(var(--shell-padding) * -1) !important;

  padding:
    7px
    var(--shell-padding)
    8px !important;

  border-top: 1px solid var(--border);

  color: var(--text-soft);
  text-align: center;

  visibility: visible !important;
  opacity: 1 !important;

  background:
    linear-gradient(
      90deg,
      rgba(8, 17, 31, 0.98),
      rgba(15, 29, 48, 0.98),
      rgba(8, 17, 31, 0.98)
    );

  box-shadow:
    0 -8px 30px rgba(0, 0, 0, 0.2);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;

  font-size: 0.82rem;
}

.footer-content p,
.footer-version {
  margin: 0;
}

.footer-content a {
  color: var(--secondary-light);

  font-weight: 800;
  text-decoration: none;
}

.footer-divider {
  color: var(--primary);
}

.footer-version {
  margin-top: 4px;

  color: var(--text-muted);

  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =========================================================
   SHORT LAPTOP SCREENS
   ========================================================= */

@media (max-height: 820px) and (min-width: 901px) {
  :root {
    --hero-copy-padding-top: 12px;
    --hero-copy-padding-bottom: 12px;

    --hero-eyebrow-heading-gap: 12px;
    --hero-heading-description-gap: 14px;
    --hero-description-pills-gap: 14px;
    --hero-pills-actions-gap: 16px;

    --hero-heading-size: clamp(1.8rem, 3.5vw, 3.6rem);
    --hero-description-size: 0.84rem;

    --hero-stats-height: 120px;
  }

  .site-header {
    min-height: 56px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

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

  main {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  #welcomeScreen.active {
    gap: 8px;
  }

  #welcomeScreen .hero-button {
    min-height: 58px;
  }

  #welcomeScreen .stat-card {
    padding: 14px 16px;
  }

  #welcomeScreen .stat-card strong {
    font-size: 1.55rem;
  }

  .site-footer {
    min-height: 38px;
    padding-top: 4px !important;
    padding-bottom: 5px !important;
  }

  .footer-version {
    display: none;
  }
}

/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100%;

    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;

    overflow: visible;
  }

  main {
    overflow: visible;
  }

  .screen.active {
    height: auto;
    overflow: visible;
  }

  #welcomeScreen.active {
    height: auto;

    display: block !important;

    overflow: visible;
  }

  #welcomeScreen .hero-grid {
    height: auto !important;

    grid-template-columns: 1fr;
    grid-template-rows: auto;

    gap: 24px;
  }

  #welcomeScreen .hero-copy {
    height: auto !important;

    padding:
      26px
      0
      10px;
  }

  #welcomeScreen .hero-visual {
    height: clamp(320px, 58vw, 520px) !important;
    min-height: 320px !important;
  }

  #welcomeScreen .stats-grid {
    height: auto;
    min-height: 0;

    margin-top: 20px;

    grid-template-columns: 1fr;
  }

  #welcomeScreen .stat-card {
    height: 150px;
    min-height: 150px;
  }

  .setup-layout {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 620px) {
  :root {
    --shell-padding: 13px;

    --hero-copy-padding-top: 20px;
    --hero-copy-padding-bottom: 8px;

    --hero-eyebrow-heading-gap: 14px;
    --hero-heading-description-gap: 16px;
    --hero-description-pills-gap: 18px;
    --hero-pills-actions-gap: 20px;

    --hero-heading-size: clamp(2rem, 11vw, 3rem);
    --hero-description-size: 0.92rem;
  }

  .site-header {
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

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

  .brand strong {
    font-size: 0.92rem;
  }

  .brand small {
    font-size: 0.68rem;
  }

  #soundToggle {
    min-height: 36px;
    padding: 0 10px;

    font-size: 0.78rem;
  }

  main {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  #welcomeScreen .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  #welcomeScreen .hero-button {
    width: 100%;
    min-width: 0;
  }

  #welcomeScreen .hero-visual {
    height: 310px !important;
    min-height: 310px !important;
  }

  .form-grid,
  .player-name-grid,
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .game-topbar,
  .section-heading,
  .dialog-heading {
    align-items: flex-start;
  }

  .game-topbar {
    flex-direction: column;
    gap: 9px;
  }

  .scoreboard {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .question-card {
    padding: 15px;
  }

  #nextQuestionButton,
  .results-actions .button {
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    gap: 3px;
  }

  .footer-divider {
    display: none;
  }
}

/* =========================================================
   VERY SMALL MOBILE SCREENS
   ========================================================= */

@media (max-width: 390px) {
  .brand strong {
    font-size: 0.88rem;
  }

  .brand small {
    display: none;
  }

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

  #questionText {
    font-size: 1.15rem;
  }

  .answer-button {
    font-size: 0.88rem;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   FORCE HERO COPY SPACING OVERRIDE
   ========================================================= */

#welcomeScreen .hero-copy {
  display: grid !important;

  grid-template-columns: 1fr;
  grid-template-rows:
    auto
    auto
    auto
    auto
    auto;

  align-content: center !important;
  align-items: start !important;

  /* Change this value for equal spacing between all items */
  row-gap: 39px !important;

  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;

  padding:
    34px
    12px !important;
}

/* Remove older margins so they cannot interfere */

#welcomeScreen .hero-copy > .eyebrow,
#welcomeScreen .hero-copy > h1,
#welcomeScreen .hero-copy > .hero-description,
#welcomeScreen .hero-copy > .feature-pills,
#welcomeScreen .hero-copy > .hero-actions {
  margin: 0 !important;
}

/* Ensure each section occupies its own grid row */

#welcomeScreen .hero-copy > .eyebrow {
  grid-row: 1;
}

#welcomeScreen .hero-copy > h1 {
  grid-row: 2;
}

#welcomeScreen .hero-copy > .hero-description {
  grid-row: 3;
}

#welcomeScreen .hero-copy > .feature-pills {
  grid-row: 4;
}

#welcomeScreen .hero-copy > .hero-actions {
  grid-row: 5;
}

/* =========================================================
   FORCE HERO EYEBROW FONT-SIZE OVERRIDE
   ========================================================= */

#welcomeScreen .hero-copy > .eyebrow {
  font-size: 1.05rem !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  letter-spacing: 0.17em !important;
}

/* =========================================================
   FEATURE PILLS + HERO ACTIONS FORCE OVERRIDE
   ========================================================= */

/* Desktop: keep all feature pills on one line when space allows */
#welcomeScreen .hero-copy > .feature-pills {
  width: 100% !important;

  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;

  gap: 10px !important;

  margin: 0 0 34px !important;
}

#welcomeScreen .hero-copy > .feature-pills span {
  width: 100% !important;
  min-width: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 9px 10px !important;

  text-align: center !important;
  white-space: nowrap !important;

  font-size: 0.76rem !important;
  line-height: 1.1 !important;
}

/* Space the hero buttons across the available width */
#welcomeScreen .hero-copy > .hero-actions {
  width: 100% !important;

  display: grid !important;
  grid-template-columns:
    repeat(2, minmax(220px, 1fr)) !important;

  gap: clamp(18px, 2.5vw, 34px) !important;

  margin: 0 !important;
}

#welcomeScreen .hero-copy > .hero-actions .hero-button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 68px !important;

  justify-content: flex-start !important;

  padding:
    12px
    clamp(16px, 2vw, 24px) !important;
}

/* =========================================================
   MEDIUM / SHORT DESKTOP SCREENS
   ========================================================= */

@media (max-width: 1180px) and (min-width: 901px) {
  #welcomeScreen .hero-copy > .feature-pills {
    gap: 8px !important;
  }

  #welcomeScreen .hero-copy > .feature-pills span {
    padding: 8px 7px !important;

    font-size: 0.66rem !important;
    letter-spacing: -0.01em !important;
  }

  #welcomeScreen .hero-copy > .hero-actions {
    gap: 18px !important;
  }

  #welcomeScreen .hero-copy > .hero-actions .hero-button {
    min-height: 62px !important;
    padding-right: 14px !important;
    padding-left: 14px !important;
  }
}

/* =========================================================
   TABLET: TWO ROWS OF TWO PILLS
   ========================================================= */

@media (max-width: 900px) {
  #welcomeScreen .hero-copy > .feature-pills {
    grid-template-columns:
      repeat(2, minmax(0, 1fr)) !important;

    gap: 10px !important;

    margin-bottom: 28px !important;
  }

  #welcomeScreen .hero-copy > .feature-pills span {
    min-height: 42px !important;

    padding: 8px 10px !important;

    white-space: normal !important;

    font-size: 0.75rem !important;
    line-height: 1.2 !important;
  }

  #welcomeScreen .hero-copy > .hero-actions {
    grid-template-columns:
      repeat(2, minmax(0, 1fr)) !important;

    gap: 14px !important;
  }

  #welcomeScreen .hero-copy > .hero-actions .hero-button {
    min-height: 64px !important;
  }
}

/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 620px) {
  #welcomeScreen .hero-copy > .feature-pills {
    grid-template-columns:
      repeat(2, minmax(0, 1fr)) !important;

    gap: 8px !important;

    margin-bottom: 24px !important;
  }

  #welcomeScreen .hero-copy > .feature-pills span {
    min-height: 40px !important;

    padding: 7px 8px !important;

    white-space: normal !important;

    font-size: 0.68rem !important;
    line-height: 1.15 !important;
  }

  #welcomeScreen .hero-copy > .hero-actions {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  #welcomeScreen .hero-copy > .hero-actions .hero-button {
    width: 100% !important;
    min-height: 60px !important;
  }
}

/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 390px) {
  #welcomeScreen .hero-copy > .feature-pills {
    gap: 7px !important;
  }

  #welcomeScreen .hero-copy > .feature-pills span {
    padding: 6px !important;

    font-size: 0.62rem !important;
  }
}

/* =========================================================
   FORCE GAP BETWEEN HERO ACTION BUTTONS
   ========================================================= */

#welcomeScreen .hero-copy > .hero-actions {
  width: 100% !important;

  display: grid !important;
  grid-template-columns:
    repeat(2, minmax(0, 1fr)) !important;

  column-gap: 36px !important;
  row-gap: 16px !important;

  margin: 0 !important;
  padding: 0 !important;
}

#welcomeScreen .hero-copy > .hero-actions > .hero-button {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}