/* Host projector view — KGTS themed, optimized for 100% zoom. */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate .card {
  border-color: rgba(139,0,0,0.3);
}

.host {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 16px 24px;
  overflow: hidden;
}

/* ── top bar ── */
.host-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.round-pill {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid rgba(139,0,0,0.35);
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap;
  background: rgba(139,0,0,0.08);
}
.host-title {
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}
.counters { display: flex; gap: 20px; margin-left: auto; }
.counter { text-align: center; line-height: 1; }
.counter span { font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 800; display: block; color: var(--fg); }
.counter small { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }
.counter.big span {
  color: var(--accent);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  filter: drop-shadow(0 0 8px rgba(220,38,38,0.3));
}

/* ── main stage ── */
.stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow-y: auto;
}

/* join panel */
.join-panel {
  display: flex;
  gap: 32px;
  align-items: center;
  padding: 28px 40px;
}
.room-code {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--accent);
  filter: drop-shadow(0 0 12px rgba(220,38,38,0.4));
}
.join-url { font-size: 0.9rem; word-break: break-all; color: var(--muted); }
.qr { width: 220px; height: 220px; border-radius: 14px; background: #fff; padding: 8px; }

/* prompt + reveal */
.prompt-panel {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.prompt {
  font-size: clamp(1.3rem, 2.5vw, 2.2rem);
  text-align: center;
  margin: 0;
  line-height: 1.2;
}
.reveal-area {
  width: 100%;
  min-height: 260px;
  display: grid;
  place-items: center;
}
.reveal-area canvas { width: 100%; height: 38vh; max-height: 400px; }
.summary {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ff6b6b;
  text-align: center;
  text-shadow: 0 0 14px rgba(139,0,0,0.5), 0 2px 10px rgba(0,0,0,.5);
}

.game-rules { width: 100%; display: flex; justify-content: center; margin-bottom: 24px; }
.game-rules:empty { display: none; }
.matrix-table { width: 100%; max-width: 600px; border-collapse: collapse; margin-top: 10px; font-size: 1.2rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.matrix-table th, .matrix-table td { padding: 12px 16px; text-align: center; border: 1px solid var(--border); }
.matrix-table th { background: rgba(139, 0, 0, 0.1); font-weight: 800; color: var(--fg); text-transform: uppercase; }
.matrix-table td strong { font-weight: 800; font-size: 1.3rem; }
.matrix-table tr:first-child th { border-top: none; }
.matrix-table tr th:first-child, .matrix-table tr td:first-child { border-left: none; }
.matrix-table tr:last-child th, .matrix-table tr:last-child td { border-bottom: none; }
.matrix-table tr th:last-child, .matrix-table tr td:last-child { border-right: none; }

/* ── bottom: controls + leaderboard ── */
.host-bottom {
  display: flex;
  justify-content: center;
  align-items: end;
  padding-top: 10px;
  border-top: 1px solid rgba(139,0,0,0.15);
}
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.controls button { padding: 10px 16px; font-size: 0.9rem; border-radius: 10px; }


/* ── split/steal chart ── */
.ss-wrap { display: flex; gap: 48px; width: 100%; justify-content: center; }
.ss-col { flex: 1; max-width: 540px; }
.ss-title { text-align: center; font-weight: 800; margin-bottom: 12px; color: var(--muted); font-size: 1.2rem; }
.ss-bars { display: flex; gap: 16px; align-items: end; height: 360px; }
.ss-bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: end; }
.ss-pts { font-weight: 800; font-size: 1.4rem; }
.ss-col-bar { width: 70%; flex: 1; display: flex; align-items: end; margin: 8px 0; }
.ss-fill { width: 100%; background: linear-gradient(180deg, #ef4444, #8B0000); border-radius: 8px 8px 0 0; }
.ss-count { font-weight: 700; font-size: 1.2rem; }
.ss-opp { font-size: 0.95rem; color: var(--muted); text-align: center; }

/* ── option bars ── */
.opt-wrap { display: flex; gap: 20px; align-items: end; height: 360px; width: 100%; justify-content: center; }
.opt-bar { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: end; }
.opt-head { font-weight: 800; font-size: 1.2rem; margin-bottom: 8px; }
.opt-head .won { color: var(--green); }
.opt-head .lost { color: var(--pink); }
.opt-col { width: 80%; flex: 1; display: flex; align-items: end; }
.opt-fill { width: 100%; background: linear-gradient(180deg, #ef4444, #8B0000); border-radius: 8px 8px 0 0; }
.opt-fill.win { background: linear-gradient(180deg, var(--green), #2ea55f); }
.opt-count { margin-top: 8px; font-weight: 700; font-size: 1.2rem; }

/* ── word table ── */
.word-table { width: 100%; max-width: 680px; }
.word-row {
  display: grid;
  grid-template-columns: 1fr auto auto 54px;
  gap: 10px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.95rem;
}
.word-row.invalid { opacity: 0.4; }
.w-word { font-weight: 800; font-size: 1.05rem; }
.w-meta, .w-bonus { color: var(--muted); font-size: 0.85rem; }
.w-total { font-weight: 800; color: var(--accent); text-align: right; font-size: 1.05rem; }

/* ── good vs evil ── */
.ge-align { display: flex; gap: 40px; justify-content: center; margin-bottom: 24px; }
.ge-side { text-align: center; font-weight: 800; padding: 12px 32px; border-radius: 16px; border: 1px solid var(--border); }
.ge-side.good { background: rgba(93,255,155,.12); }
.ge-side.evil { background: rgba(255,77,148,.12); }
.ge-n { font-size: 3rem; }
.ge-opts { display: flex; gap: 12px; justify-content: center; height: 200px; align-items: end; margin-bottom: 24px; }
.ge-opt { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: end; }
.ge-opt-bar { width: 32px; flex: 1; display: flex; gap: 4px; align-items: end; }
.ge-g { flex: 1; background: var(--green); border-radius: 4px 4px 0 0; }
.ge-e { flex: 1; background: var(--pink); border-radius: 4px 4px 0 0; }
.ge-opt-num { font-weight: 800; margin-bottom: 4px; font-size: 1.1rem; }
.ge-opt-cnt { font-size: 0.85rem; color: var(--muted); }
.ge-pairs { display: flex; gap: 40px; justify-content: center; }
.ge-pair-table { flex: 1; max-width: 400px; }
.ge-pair-title { font-weight: 800; margin-bottom: 8px; font-size: 1.1rem; }
.ge-pair-title.good { color: var(--green); }
.ge-pair-title.evil { color: var(--pink); }
.ge-pair-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); font-size: 1.05rem; }

/* ── final leaderboard overlay ── */
.final-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(24px);
  display: grid;
  place-items: center;
  animation: fadeIn 0.7s ease;
}
.final-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(139, 0, 0, 0.25), transparent 70%),
    radial-gradient(40% 40% at 20% 80%, rgba(255, 0, 0, 0.08), transparent 60%),
    radial-gradient(40% 40% at 80% 80%, rgba(139, 0, 0, 0.10), transparent 60%);
  pointer-events: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.final-content {
  position: relative;
  text-align: center;
  max-width: 640px;
  width: 92%;
}
.final-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  margin: 0 0 10px;
  color: #fffde0;
  text-shadow: 0 0 30px rgba(139, 0, 0, 0.6), 0 2px 20px rgba(0,0,0,0.6);
  letter-spacing: -0.01em;
}
.final-subtitle {
  font-size: 1rem;
  color: rgba(255,253,224,0.45);
  margin: 0 0 24px;
  font-weight: 400;
}
.final-divider {
  width: 70px;
  height: 3px;
  background: #8B0000;
  margin: 0 auto 22px;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(139,0,0,0.5);
}
.final-board {
  list-style: none;
  padding: 0;
  margin: 0;
}
.final-board li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  margin: 5px 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 0, 0, 0.25);
  color: #fffde0;
  font-size: 1.1rem;
  font-weight: 600;
  animation: slideUp 0.45s ease both;
  transition: background 0.2s, border-color 0.2s;
}
.final-board li:hover {
  background: rgba(139, 0, 0, 0.12);
  border-color: rgba(139, 0, 0, 0.45);
}
.final-board li:nth-child(1) {
  background: linear-gradient(135deg, rgba(255,215,0,0.12), rgba(139,0,0,0.08));
  border-color: rgba(255,215,0,0.35);
  font-size: 1.3rem;
  padding: 14px 22px;
}
.final-board li:nth-child(2) {
  background: linear-gradient(135deg, rgba(192,192,192,0.08), rgba(139,0,0,0.06));
  border-color: rgba(192,192,192,0.3);
  font-size: 1.2rem;
}
.final-board li:nth-child(3) {
  background: linear-gradient(135deg, rgba(205,127,50,0.10), rgba(139,0,0,0.06));
  border-color: rgba(205,127,50,0.3);
  font-size: 1.15rem;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.final-board li:nth-child(1) { animation-delay: 0.1s; }
.final-board li:nth-child(2) { animation-delay: 0.2s; }
.final-board li:nth-child(3) { animation-delay: 0.3s; }
.final-board li:nth-child(4) { animation-delay: 0.4s; }
.final-board li:nth-child(5) { animation-delay: 0.48s; }
.final-board li:nth-child(6) { animation-delay: 0.54s; }
.final-board li:nth-child(7) { animation-delay: 0.6s; }
.final-board li:nth-child(8) { animation-delay: 0.64s; }
.final-board li:nth-child(9) { animation-delay: 0.68s; }
.final-board li:nth-child(10) { animation-delay: 0.72s; }
.final-rank {
  margin-right: 14px;
  min-width: 34px;
  text-align: center;
  font-size: 1.05em;
}
.final-rank.gold { color: #ffd700; filter: drop-shadow(0 0 6px rgba(255,215,0,0.4)); }
.final-rank.silver { color: #c0c0c0; filter: drop-shadow(0 0 4px rgba(192,192,192,0.3)); }
.final-rank.bronze { color: #cd7f32; filter: drop-shadow(0 0 4px rgba(205,127,50,0.3)); }
.final-name { flex: 1; text-align: left; color: #fffde0; }
.final-score {
  color: #ff4444;
  font-weight: 900;
  font-size: 1.05em;
  filter: drop-shadow(0 0 8px rgba(255,0,0,0.3));
}

@media (max-width: 820px) {
  .join-panel { flex-direction: column; gap: 20px; padding: 24px; }
  .host-top { flex-wrap: wrap; }
}

/* Lobby Player Grid */
.lobby-players-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.lobby-player-pill { padding: 12px 24px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; font-weight: 700; font-size: 1.2rem; color: var(--fg); animation: fadeInScale 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
