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

:root {
  --bg: #05070a;
  --panel: #0b1014;
  --panel-2: #111820;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.66);
  --gold: #f2b84b;
  --orange: #eb6a2f;
  --teal: #27d0c5;
  --green: #3bd67d;
  --red: #ff5b6e;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

.host-page,
.join-page {
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(242, 184, 75, 0.09), transparent 32%),
    linear-gradient(245deg, rgba(39, 208, 197, 0.08), transparent 36%),
    var(--bg);
}

.host-shell {
  width: 100vw;
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(76px, auto) 1fr minmax(112px, auto);
  gap: 18px;
  padding: 22px;
}

.host-topbar,
.host-footer,
.leaderboard-panel,
.question-stage,
.join-card {
  background: rgba(11, 16, 20, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.host-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
}

.eyebrow,
.question-kicker,
.panel-title,
.qr-label,
.event-code,
.session-id {
  color: var(--teal);
  font-size: clamp(0.74rem, 1.2vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.host-topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2.4vw, 2.35rem);
  line-height: 1.05;
}

.round-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
  flex-wrap: wrap;
}

.sponsor-chip,
.sponsor-name {
  border: 1px solid rgba(242, 184, 75, 0.48);
  color: var(--gold);
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(242, 184, 75, 0.09);
}

.sponsor-logo {
  height: 46px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

.host-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 22vw);
  gap: 18px;
}

.question-stage {
  min-width: 0;
  padding: clamp(22px, 4vw, 54px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.question-stage h2,
.waiting-stage h2 {
  margin: 8px 0 28px;
  font-size: clamp(2.2rem, 5vw, 5.8rem);
  line-height: 1.02;
  max-width: 14ch;
}

.waiting-stage {
  display: grid;
  place-items: center;
  text-align: center;
}

.waiting-stage p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.pulse-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(59, 214, 125, 0.14);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choice-tile {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}

.choice-label {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(39, 208, 197, 0.14);
  color: var(--teal);
  font-weight: 900;
}

.choice-text {
  min-width: 0;
  font-size: clamp(1rem, 1.65vw, 1.45rem);
  font-weight: 800;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.choice-tile.is-selected {
  border-color: var(--gold);
}

.choice-tile.is-correct {
  border-color: rgba(59, 214, 125, 0.78);
  background: rgba(59, 214, 125, 0.14);
}

.leaderboard-panel {
  min-width: 0;
  padding: 18px;
}

.leaderboard-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.rank {
  color: var(--gold);
  font-weight: 900;
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.score {
  font-weight: 900;
  color: var(--green);
}

.host-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
}

.qr-panel {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.qr-panel img {
  width: 86px;
  height: 86px;
  background: #fff;
  border-radius: 6px;
}

.join-url {
  max-width: min(68vw, 900px);
  color: var(--text);
  font-size: clamp(1rem, 2vw, 2rem);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.event-code {
  display: inline-flex;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(242, 184, 75, 0.45);
  border-radius: var(--radius);
  color: #07110f;
  background: var(--gold);
  font-size: clamp(0.98rem, 1.8vw, 1.45rem);
}

.session-id {
  color: var(--muted);
  text-align: right;
}

.empty-panel {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.empty-panel.compact {
  margin-top: 14px;
  padding: 12px;
}

.join-page {
  display: grid;
  place-items: center;
  padding: 16px;
}

.join-card {
  width: min(100%, 480px);
  padding: 22px;
}

.play-max {
  display: block;
  width: min(38vw, 132px);
  max-height: 210px;
  object-fit: contain;
  margin: -6px auto 12px;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.42));
}

.join-card h1 {
  margin: 6px 0 16px;
  font-size: clamp(2rem, 12vw, 3.6rem);
  line-height: 1;
}

.join-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.play-card p {
  line-height: 1.45;
}

.play-card input {
  text-transform: uppercase;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.join-message {
  color: var(--gold);
  font-weight: 800;
}

.join-direct-link {
  display: block;
  margin-top: 14px;
  color: var(--teal);
  font-weight: 900;
  text-align: center;
}

.join-form,
.orb-link-form {
  display: grid;
  gap: 12px;
}

.join-form label,
.orb-link-form label {
  color: var(--muted);
  font-weight: 800;
}

.join-form input,
.orb-link-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 0 14px;
  font-size: 1.08rem;
}

.join-form button,
.orb-link-form button,
.primary-link {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #160c04;
  font-weight: 900;
  text-decoration: none;
}

.join-card .choice-grid {
  grid-template-columns: 1fr;
}

.join-card .choice-tile {
  width: 100%;
}

.player-status-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid rgba(39, 208, 197, 0.24);
  border-radius: var(--radius);
  background: rgba(39, 208, 197, 0.07);
}

.player-status-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.player-status-panel strong {
  color: var(--green);
  font-size: 1.45rem;
}

.status-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-status-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.join-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-button,
.secondary-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.secondary-button:disabled {
  color: var(--muted);
}

.join-card.disabled,
.join-card.error {
  border-color: rgba(235, 106, 47, 0.44);
}

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

  .host-main {
    grid-template-columns: 1fr;
  }

  .leaderboard-panel {
    display: none;
  }

  .question-stage h2,
  .waiting-stage h2 {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .host-topbar,
  .host-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .qr-panel img {
    width: 72px;
    height: 72px;
  }

  .join-actions {
    grid-template-columns: 1fr;
  }
}

@media (orientation: portrait) and (min-width: 760px) {
  .host-shell {
    grid-template-rows: auto 1fr auto;
  }

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