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

:root {
  --bg: #0e0f13;
  --panel: #1a1c23;
  --panel-2: #22252e;
  --text: #f2f3f5;
  --muted: #9aa0ab;
  --accent: #53fc18;
  --danger: #ff5c5c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* setup */
#setup-screen {
  max-width: 440px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--panel);
  border-radius: 16px;
  text-align: center;
}
#setup-screen h1 { font-size: 2rem; margin-bottom: .5rem; }
.tagline { color: var(--muted); margin-bottom: 1.5rem; }
#start-form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
#start-form label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
#start-form input, #start-form select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid #333845;
  border-radius: 8px;
  padding: .6rem .8rem;
  font-size: 1rem;
}
.modes {
  border: 1px solid #333845;
  border-radius: 8px;
  padding: .6rem .8rem .8rem;
}
.modes legend { color: var(--muted); font-size: .9rem; padding: 0 .3rem; }
#mode-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.mode-box {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .5rem !important;
  color: var(--text) !important;
  font-size: .95rem !important;
  cursor: pointer;
}
.mode-box input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .5rem !important;
  color: var(--text) !important;
  font-size: .95rem !important;
  cursor: pointer;
}
.check-row input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

#start-form button {
  background: var(--accent);
  color: #08210a;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  border-radius: 8px;
  padding: .7rem;
  cursor: pointer;
}
#start-form button:hover { filter: brightness(1.1); }
.error { color: var(--danger); min-height: 1.2em; font-size: .9rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 1.25rem; }

/* game header */
#game-screen header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1rem;
  background: var(--panel);
}
.logo { font-weight: 700; }
#round-label { color: var(--accent); font-weight: 600; }
#chat-status { font-size: .85rem; color: var(--muted); }
#chat-status[data-state="connected"] { color: var(--accent); }
#chat-status[data-state="solo"] { color: var(--accent); }
#chat-status[data-state="reconnecting"] { color: var(--danger); }
#guess-count { font-size: .85rem; color: var(--muted); }
.spacer { flex: 1; }
header button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid #333845;
  border-radius: 6px;
  padding: .35rem .8rem;
  cursor: pointer;
}
header button:hover { background: #2b2f3a; }

/* chat disconnect banner */
#chat-banner {
  background: var(--danger);
  color: #2a0707;
  font-weight: 700;
  text-align: center;
  padding: .55rem 1rem;
}

/* countdown */
.countdown { position: relative; height: 8px; background: var(--panel-2); }
#countdown-bar { height: 100%; background: var(--accent); width: 0%; transition: width 1s linear; }
#countdown-label {
  position: absolute; right: 10px; top: 10px;
  font-size: .95rem; font-weight: 700; color: var(--accent);
}

/* main layout */
main { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; padding: 1rem; }
#question-area { background: var(--panel); border-radius: 12px; padding: 1.25rem; min-height: 60vh; }
.loading { color: var(--muted); text-align: center; padding: 4rem 1rem; font-size: 1.1rem; }
.prompt { font-size: 1.4rem; font-weight: 700; margin-bottom: 1rem; text-align: center; }

.streams { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.stream-card {
  position: relative;
  background: var(--panel-2);
  border-radius: 10px;
  overflow: hidden;
  width: min(420px, 100%);
}
.stream-number {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #08210a;
  font-weight: 800; font-size: 1.2rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; border: 0; }
.thumb-empty { background: #000; }
.video-wrap { position: relative; }
/* The Kick player overlays title+category (top-left), watching count
   (top-right) and uptime (bottom-left) — on hover too. These opaque strips
   sit above the iframe and keep those answers hidden; the center stays
   clickable for play, bottom-right for fullscreen. */
.video-shield-top {
  position: absolute; top: 0; left: 0; right: 0;
  height: 30%;
  background: var(--panel-2);
}
.video-shield {
  position: absolute; left: 0; bottom: 0;
  width: 62%; height: 22%;
  background: var(--panel-2);
  display: flex; align-items: center;
  padding-left: .8rem;
  font-weight: 700; font-size: .85rem; color: var(--text);
  border-top-right-radius: 8px;
}
.stream-meta { padding: .6rem .8rem; }
.streamer { font-weight: 700; }
.title { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category { color: var(--accent); font-size: .85rem; }
.viewers { font-weight: 600; }

.emote-box { text-align: center; padding: 1rem; }
.emote-box img { width: 160px; height: 160px; object-fit: contain; image-rendering: auto; }

.options {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
  max-width: 640px; margin: 1rem auto 0; padding-left: 0;
  counter-reset: opt;
}
.options li {
  list-style: none; counter-increment: opt;
  background: var(--panel-2); border-radius: 8px; padding: .7rem .9rem;
  font-size: 1.05rem;
}
.options li::before {
  content: counter(opt);
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; margin-right: .6rem;
  background: var(--accent); color: #08210a; font-weight: 800; border-radius: 50%;
}
.options li { cursor: pointer; border: 2px solid transparent; }
.options li:hover { background: #2b2f3a; }
.streams.clickable .stream-card { cursor: pointer; border: 2px solid transparent; }
.streams.clickable .stream-card:hover { border-color: #3a4150; }
.options li.selected, .streams.clickable .stream-card.selected, .host-guess.selected {
  border-color: var(--accent);
}

.host-guess {
  display: flex; gap: .6rem; justify-content: center;
  margin-top: 1rem; padding: .4rem; border: 2px solid transparent; border-radius: 10px;
}
.host-guess input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid #333845; border-radius: 8px;
  padding: .55rem .8rem; font-size: 1.05rem; width: 11rem;
}
.host-guess button {
  background: var(--accent); color: #08210a; font-weight: 700;
  border: none; border-radius: 8px; padding: .55rem 1.1rem; cursor: pointer;
}
.host-guess button:hover { filter: brightness(1.1); }

.chat-hint { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1rem; }

.reveal { margin: 0 0 1rem; text-align: center; }
.result { font-size: 1.2rem; font-weight: 700; color: var(--accent); margin-bottom: .5rem; }
.winners { list-style: none; padding: 0; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.winners li { background: var(--panel-2); border-radius: 8px; padding: .4rem .8rem; }
.no-winners { color: var(--muted); }

/* game over */
.final-scores {
  list-style: none; padding: 0; max-width: 420px; margin: 1.5rem auto;
  display: flex; flex-direction: column; gap: .5rem;
}
.final-scores li {
  display: flex; gap: .8rem; align-items: baseline;
  background: var(--panel-2); border-radius: 8px; padding: .6rem .9rem; font-size: 1.1rem;
}
.final-scores .rank { width: 2rem; text-align: center; }
.final-scores .name { flex: 1; font-weight: 600; }
.final-scores .pts { font-weight: 700; color: var(--accent); }
.game-over-actions { text-align: center; margin-top: 1.5rem; }
#back-btn {
  background: var(--accent); color: #08210a; font-weight: 700; font-size: 1.05rem;
  border: none; border-radius: 8px; padding: .7rem 1.4rem; cursor: pointer;
}
#back-btn:hover { filter: brightness(1.1); }

/* leaderboard */
aside { background: var(--panel); border-radius: 12px; padding: 1rem; }
aside h2 { font-size: 1rem; color: var(--muted); margin-bottom: .75rem; }
#leaderboard { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
#leaderboard li { display: flex; gap: .6rem; align-items: baseline; }
#leaderboard .rank { color: var(--muted); width: 1.4rem; text-align: right; }
#leaderboard .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#leaderboard .pts { font-weight: 700; color: var(--accent); }

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; }
}
