/* ===== JEOPARDY CSS — all styles for jeopardy.html ===== */

/* ===== BASE ===== */
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #080c18; color: #f1f5f9; overflow-x: hidden;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== SCREENS ===== */
.screen {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  padding: 2rem; overflow-y: auto; background: #080c18;
}
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ===== GAME SELECT ===== */
.game-select-container { max-width: 720px; width: 100%; text-align: center; }
.game-select-header h1 {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.game-select-header p { color: #94a3b8; margin-top: 0.25rem; font-size: 0.95rem; }

.shared-name-input {
  width: 100%; max-width: 320px; padding: 0.6rem 1rem; margin-bottom: 1.2rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; color: #f1f5f9; font-size: 0.95rem; font-family: inherit;
  outline: none; transition: border-color 0.2s;
}
.shared-name-input:focus { border-color: rgba(139,92,246,0.5); }
.shared-name-input::placeholder { color: #64748b; }

.game-select-grid { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.game-card {
  background: linear-gradient(135deg, rgba(30,35,50,0.9), rgba(20,24,36,0.95));
  border: 1px solid rgba(255,255,255,0.08); border-radius: 16px;
  padding: 1.5rem; flex: 1; min-width: 280px; max-width: 320px;
  cursor: pointer; transition: all 0.25s ease;
}
.game-card:hover {
  border-color: rgba(139,92,246,0.4);
  background: linear-gradient(135deg, rgba(35,40,58,0.95), rgba(25,29,44,0.95));
  transform: translateY(-2px); box-shadow: 0 8px 30px rgba(139,92,246,0.1);
}
.game-card.selected {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 1px #8b5cf6, 0 0 30px rgba(139,92,246,0.2);
}
.game-card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.game-icon-text { font-size: 1.3rem; font-weight: 900; color: #fff; }
.game-card-info h2 { font-size: 1.15rem; font-weight: 700; color: #f1f5f9; margin-bottom: 0.3rem; }
.game-card-info > p { color: #94a3b8; font-size: 0.85rem; margin-bottom: 0.75rem; }

.game-card-actions { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.btn-game-create {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; border: none; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
}
.btn-game-create:hover { background: linear-gradient(135deg, #7c3aed, #5b51e0); transform: translateY(-1px); }
.btn-game-join {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.3);
  color: #a78bfa; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
}
.btn-game-join:hover { background: rgba(139,92,246,0.25); border-color: rgba(139,92,246,0.5); }
.game-join-input {
  padding: 0.45rem 0.7rem; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  color: #f1f5f9; font-size: 0.8rem; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.game-join-input:focus { border-color: rgba(139,92,246,0.5); }
.game-join-input::placeholder { color: #64748b; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.1rem; font-size: 0.85rem; font-weight: 600; font-family: inherit;
  border: none; border-radius: 10px; cursor: pointer; transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }
.btn-load {
  width: 100%; padding: 0.6rem 1rem; background: rgba(139,92,246,0.08);
  color: #a78bfa; border: 1px solid rgba(139,92,246,0.15); font-size: 0.82rem;
}
.btn-load:hover:not(:disabled) { background: rgba(139,92,246,0.15); }
.btn-load.btn-disabled, .btn-load[disabled] { opacity: 0.35; pointer-events: none; }
.btn-start {
  width: 100%; padding: 0.7rem 1rem; background: linear-gradient(135deg, #10b981, #059669);
  color: white; font-size: 0.88rem;
}
.btn-start:hover:not(:disabled) { transform: translateY(-1px); }
.btn-reset {
  width: 100%; padding: 0.55rem 1rem; background: rgba(244,63,94,0.1);
  color: #f43f5e; border: 1px solid rgba(244,63,94,0.2); font-size: 0.78rem;
}
.btn-reset:hover { background: rgba(244,63,94,0.2); }
.btn-primary { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: white; }
.btn-lg { width: 100%; padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn-leave {
  padding: 0.4rem 0.9rem; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; border-radius: 8px; font-size: 0.8rem; cursor: pointer;
}

/* ===== HOST SIDEBAR ===== */
.host-layout {
  width: 100%; max-width: 1000px; display: grid; grid-template-columns: 260px 1fr;
  gap: 1.25rem; height: calc(100vh - 4rem); min-height: 500px;
}
@media (max-width: 768px) { .host-layout { grid-template-columns: 1fr; height: auto; } }
.host-sidebar {
  background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; padding: 1.25rem; display: flex; flex-direction: column; gap: 0;
}
.sidebar-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
.mini-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mini-logo span { font-size: 1rem; font-weight: 900; color: white; }
.mini-title { font-size: 0.85rem; font-weight: 700; }
.lobby-badge { font-size: 0.72rem; color: #f59e0b; font-weight: 600; }
.lobby-code { font-family: monospace; font-size: 0.88rem; }

/* ===== HOST SCREEN LOBBY CODE DISPLAY ===== */
.host-lobby-code-display {
  text-align: center; padding: 3rem 2rem;
}
.host-lobby-code-label {
  font-size: 0.8rem; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 0.5rem;
}
.host-lobby-code-value {
  font-size: clamp(4rem, 15vw, 10rem); font-weight: 900;
  color: #fbbf24; letter-spacing: 0.08em; font-family: monospace;
  line-height: 1.1; text-shadow: 0 0 40px rgba(251,191,36,0.3);
}

.sidebar-section { padding: 1rem 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-section h3 { font-size: 0.78rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem; }
.count-badge { background: rgba(139,92,246,0.15); color: #a78bfa; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.72rem; }

.players-list { list-style: none; }
.players-list li {
  padding: 0.5rem 0.7rem; border-radius: 8px; font-size: 0.88rem;
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem;
  background: #101525; border: 1px solid transparent;
}
.players-list li.host-player { background: rgba(139,92,246,0.08); border-color: rgba(139,92,246,0.15); }
.empty-state { color: #64748b; font-style: italic; font-size: 0.82rem; }

.controls-section { display: flex; flex-direction: column; gap: 0.5rem; }
.csv-status {
  margin-top: 0.5rem; padding: 0.5rem 0.7rem; border-radius: 8px;
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.15);
  color: #10b981; font-size: 0.78rem; line-height: 1.4;
}
.sidebar-footer { margin-top: auto; padding-top: 0.75rem; }
.status-badge {
  display: block; text-align: center; padding: 0.5rem; border-radius: 8px;
  font-size: 0.78rem; font-weight: 600; background: rgba(245,158,11,0.1);
  color: #f59e0b; border: 1px solid rgba(245,158,11,0.15);
}

.host-main {
  background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.empty-board { text-align: center; }
.empty-board-icon { color: #64748b; margin-bottom: 1rem; opacity: 0.3; }
.empty-board h3 { font-size: 1.1rem; font-weight: 600; color: #94a3b8; margin-bottom: 0.35rem; }
.empty-board p { font-size: 0.82rem; color: #64748b; }

/* ===== PLAYER LOBBY ===== */
.player-lobby-container { text-align: center; max-width: 480px; }
.logo-small {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem; box-shadow: 0 4px 20px rgba(139,92,246,0.3);
}
.logo-small span { font-size: 1.3rem; font-weight: 900; color: white; }
.player-lobby-container h2 { font-size: 1.3rem; color: #94a3b8; margin-bottom: 1rem; }
.lobby-code-box {
  margin-bottom: 2rem; padding: 2rem 1.5rem; background: #161d30;
  border: 2px solid rgba(251,191,36,0.3); border-radius: 20px;
  box-shadow: 0 0 40px rgba(251,191,36,0.1);
}
.code-label { display: block; font-size: 0.75rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 0.5rem; }
.code-value { display: block; font-size: clamp(3.5rem, 12vw, 8rem); font-weight: 900; color: #fbbf24; letter-spacing: 0.1em; font-family: monospace; line-height: 1.1; text-shadow: 0 0 30px rgba(251,191,36,0.3); }

/* ===== GAME BOARD ===== */
.board-header {
  width: 100%; max-width: 1100px; display: flex; justify-content: space-between;
  align-items: center; padding: 0.75rem 0; margin-bottom: 0.75rem; flex-shrink: 0;
}
.board-title { display: flex; align-items: center; gap: 0.75rem; }
.board-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex; align-items: center; justify-content: center;
}
.board-logo span { font-size: 0.95rem; font-weight: 900; color: white; }
.board-title h2 {
  font-size: 1.15rem; font-weight: 700;
  background: linear-gradient(135deg, #f1f5f9, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.board-scores { display: flex; gap: 0.5rem; }
.score-badge {
  background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 0.45rem 0.9rem;
  display: flex; flex-direction: column; align-items: center; min-width: 70px;
}
.score-badge.leading { border-color: #fbbf24; box-shadow: 0 0 15px rgba(251,191,36,0.15); background: rgba(251,191,36,0.05); }
.score-name { font-size: 0.68rem; color: #94a3b8; text-transform: uppercase; }
.score-value { font-size: 1rem; font-weight: 800; color: #fbbf24; }
.score-adjust { display: flex; gap: 2px; margin-top: 4px; }
.adjust-btn {
  width: 22px; height: 22px; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; background: rgba(255,255,255,0.05); color: #94a3b8;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.adjust-btn:hover { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.adjust-btn.minus:hover { border-color: #f43f5e; color: #f43f5e; }
.adjust-btn.plus:hover { border-color: #22c55e; color: #22c55e; }

.board-scroll { width: 100%; flex: 1; overflow: auto; }
.board-grid { display: grid; gap: 0.4rem; min-height: 0; }
.category-header {
  background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 0.75rem 0.4rem; text-align: center;
  font-weight: 800; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: #fbbf24; min-height: 50px;
  display: flex; align-items: center; justify-content: center; line-height: 1.2;
}
.question-cell {
  background: linear-gradient(135deg, #0f2847, #163a62);
  border: 1px solid rgba(59,130,246,0.15); border-radius: 8px;
  padding: 1rem 0.3rem; text-align: center; font-size: 1.5rem; font-weight: 900;
  color: #fbbf24; cursor: pointer; transition: all 0.2s; min-height: 70px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.question-cell:hover:not(.used) { background: linear-gradient(135deg, #163a62, #1d4e80); border-color: rgba(59,130,246,0.3); transform: scale(1.04); }
.question-cell.used { background: #161d30; color: #64748b; border-color: rgba(255,255,255,0.06); cursor: default; opacity: 0.3; }

/* ===== QUESTION SCREEN ===== */
.question-wrapper { width: 100%; max-width: 800px; text-align: center; position: relative; }
.question-card {
  background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px; padding: 2.5rem; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.question-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.question-category {
  font-size: 0.82rem; font-weight: 700; color: #a78bfa; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 0.35rem 0.85rem; background: rgba(139,92,246,0.1); border-radius: 20px;
}
.question-points { font-size: 2rem; font-weight: 900; color: #fbbf24; }
.question-content p { font-size: 1.5rem; font-weight: 600; line-height: 1.5; }
.question-answer {
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
  border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; text-align: left;
}
.answer-label { display: block; font-size: 0.7rem; font-weight: 700; color: #10b981; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.4rem; }
.question-answer p { font-size: 1.2rem; font-weight: 600; color: #10b981; line-height: 1.4; }
.question-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.host-action-btn {
  padding: 0.6rem 1.4rem; border-radius: 10px; font-size: 0.88rem; font-weight: 700;
  font-family: inherit; cursor: pointer; border: 2px solid transparent; transition: all 0.2s;
}
.host-action-btn.correct { background: rgba(16,185,129,0.12); border-color: #10b981; color: #10b981; }
.host-action-btn.correct:hover { background: rgba(16,185,129,0.22); }
.host-action-btn.wrong { background: rgba(244,63,94,0.12); border-color: #f43f5e; color: #f43f5e; }
.host-action-btn.wrong:hover { background: rgba(244,63,94,0.22); }
.host-action-btn.reveal { background: rgba(139,92,246,0.12); border-color: #8b5cf6; color: #a78bfa; }
.host-action-btn.reveal:hover { background: rgba(139,92,246,0.22); }
.host-action-btn.back-board { background: rgba(59,130,246,0.12); border-color: #3b82f6; color: #60a5fa; }
.host-action-btn.back-board:hover { background: rgba(59,130,246,0.22); }

.buzzer-overlay {
  position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%);
  background: rgba(244,63,94,0.1); border: 1px solid rgba(244,63,94,0.3);
  border-radius: 16px; padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 700; color: #f43f5e;
  display: flex; align-items: center; gap: 0.5rem;
}
.buzzer-flash { font-size: 1.3rem; animation: flash 0.5s infinite; }
@keyframes flash { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ===== PLAYER BUZZER ===== */
.player-buzzer {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #f43f5e, #e11d48); color: white;
  border: none; border-radius: 50px; padding: 1rem 2.5rem;
  font-size: 1.3rem; font-weight: 900; font-family: inherit;
  cursor: pointer; box-shadow: 0 4px 30px rgba(244,63,94,0.35);
  z-index: 100; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.1em; display: none;
}
.player-buzzer:hover:not(.disabled) { transform: translateX(-50%) scale(1.05); }
.player-buzzer.disabled { opacity: 0.4; cursor: not-allowed; transform: translateX(-50%) scale(1); }
.player-buzzer .buzzer-icon { font-size: 1.4rem; margin-right: 0.3rem; }

/* ===== SCOREBOARD ===== */
.scoreboard-container { text-align: center; max-width: 520px; }
.trophy-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.scoreboard-container h2 {
  font-size: 1.8rem; font-weight: 800; margin-bottom: 2rem;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.scoreboard-list { list-style: none; margin-bottom: 2rem; }
.scoreboard-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1.25rem; background: #161d30; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; margin-bottom: 0.4rem; font-size: 1rem;
}
.scoreboard-list li:first-child { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.05); }
.rank { font-weight: 900; font-size: 1.2rem; width: 35px; color: #64748b; }
.scoreboard-list li:first-child .rank { color: #fbbf24; }
.player-name { flex: 1; text-align: left; margin-left: 1rem; font-weight: 600; }
.final-score { font-weight: 800; font-size: 1.2rem; color: #fbbf24; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; background: #161d30;
  border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
  padding: 0.85rem 1.25rem; font-size: 0.9rem; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 1000; max-width: 320px;
}
.toast.error { border-color: rgba(244,63,94,0.3); color: #f43f5e; }
.toast.success { border-color: rgba(16,185,129,0.3); color: #10b981; }
.toast.warning { border-color: rgba(251,191,36,0.3); color: #fbbf24; }

/* ===== BACK LINK ===== */
.back-link {
  display: inline-block; margin-top: 1.5rem; color: #64748b; font-size: 0.85rem;
  text-decoration: none; transition: color 0.2s;
}
.back-link:hover { color: #a78bfa; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .screen { padding: 1rem; }
  .game-select-header h1 { font-size: 1.6rem; }
  .board-title h2 { font-size: 1rem; }
  .question-card { padding: 1.5rem; }
  .question-content p { font-size: 1.2rem; }
  .question-points { font-size: 1.5rem; }
  .category-header { font-size: 0.6rem; padding: 0.5rem 0.25rem; min-height: 40px; }
  .question-cell { font-size: 1.1rem; padding: 0.75rem 0.2rem; min-height: 55px; }
  .score-badge { min-width: 60px; padding: 0.35rem 0.5rem; }
  .score-name { font-size: 0.6rem; }
  .score-value { font-size: 0.85rem; }
  .board-header { flex-wrap: wrap; gap: 0.5rem; }
  .player-buzzer { bottom: 1rem; padding: 0.85rem 2rem; font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .question-cell { font-size: 0.95rem; }
  .board-grid { gap: 0.3rem; }
  .category-header { font-size: 0.55rem; }
}

/* ===== ANIMATION ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.screen.active > * { animation: fadeIn 0.4s ease forwards; }
