/* ============================================================================
   Prism - Online Trivia Game
   Dark Theme with Prismatic Rainbow Accents
   ============================================================================ */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12121f;
  --bg-tertiary: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #b0b0c0;
  --text-muted: #666680;
  --border-color: #2a2a3e;
  --border-light: #3a3a4e;
  --prism-gradient: linear-gradient(135deg, #ff006e 0%, #fb5607 20%, #ffbe0b 40%, #8338ec 60%, #3a86ff 80%, #00d9ff 100%);
  --cyan: #00d9ff;
  --purple: #8338ec;
  --pink: #ff006e;
  --green: #27ae60;
  --gold: #ffbe0b;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 15px rgba(255,0,110,0.4); } 50% { box-shadow: 0 0 30px rgba(255,0,110,0.8); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes celebrate { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.05) rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gradient-shift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* ============================================================================
   GLOBAL
   ============================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); margin-bottom: 0.75rem; }
a { color: var(--cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--purple); }
img { max-width: 100%; }

/* ============================================================================
   LAYOUT
   ============================================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ============================================================================
   LANDING PAGE
   ============================================================================ */
.hero {
  text-align: center;
  padding: 3rem 1rem 1rem;
  animation: slideUp 0.4s ease;
}

.hero .logo-img {
  width: 220px;
  height: auto;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(131,56,236,0.3));
}

.hero .subtitle {
  font-size: 1.35rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto 2rem;
}

.card {
  display: block;
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  text-align: center;
  animation: slideUp 0.4s ease;
  font-family: inherit;
  font-size: inherit;
  width: 100%;
}
.card:hover {
  border-color: var(--border-light);
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}
.card h2 { font-size: 1.3rem; margin-bottom: 0.4rem; color: var(--text-primary); }
.card p { font-size: 0.95rem; color: var(--text-secondary); margin: 0; }

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  background: var(--prism-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================================
   MODAL
   ============================================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; animation: fadeIn 0.2s; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  max-width: 550px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.4rem; }
.modal-close {
  width: 36px; height: 36px;
  border: none; background: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.instructions-list {
  padding-left: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.instructions-list li { margin-bottom: 0.5rem; }
.instructions-list strong { color: var(--text-primary); }

/* ============================================================================
   PAGE HEADER
   ============================================================================ */
.page-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* ============================================================================
   JOIN PAGE
   ============================================================================ */
.join-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
  padding: 2rem 1rem;
}
.join-card {
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  max-width: 450px;
  width: 100%;
  backdrop-filter: blur(10px);
  animation: slideUp 0.4s;
}
.join-card h1 {
  text-align: center;
  margin-bottom: 2rem;
  background: var(--prism-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.room-code-input {
  width: 100%;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  transition: border-color 0.2s;
}
.room-code-input:focus { outline: none; border-color: var(--purple); }
.room-code-input::placeholder { color: var(--text-muted); font-weight: 400; letter-spacing: 0.15em; }

.player-name-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.player-name-input:focus { outline: none; border-color: var(--purple); }
.player-name-input::placeholder { color: var(--text-muted); }

.join-button {
  width: 100%;
  padding: 1rem;
  background: var(--prism-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 0.5rem;
  font-family: inherit;
}
.join-button:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255,0,110,0.3); }

.error-message {
  background: rgba(255,0,110,0.15);
  border: 1px solid var(--pink);
  color: var(--pink);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.9rem;
  text-align: center;
  display: none;
}
.error-message.show { display: block; animation: slideDown 0.3s; }

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

input, textarea, select {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(131,56,236,0.1);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--prism-gradient); color: #fff; font-weight: 700; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255,0,110,0.3); }

.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-light); }
.btn-secondary:hover:not(:disabled) { border-color: var(--purple); background: rgba(131,56,236,0.1); }

.btn-danger { background: var(--pink); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #e60060; }

.btn-success { background: var(--green); color: #fff; font-weight: 700; }
.btn-success:hover:not(:disabled) { background: #229954; }

.btn-small { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ============================================================================
   CREATE PAGE
   ============================================================================ */
.create-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.create-container { max-width: 1000px; padding: 2rem 1.5rem; }

.form-section {
  margin-bottom: 2rem;
  background: rgba(26,26,46,0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.form-section h2 {
  font-size: 1.15rem;
  color: var(--cyan);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.preset-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.preset-btn {
  padding: 0.6rem 1rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.preset-btn:hover { border-color: var(--purple); color: var(--text-primary); }
.preset-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }

.category-builder { margin-top: 1rem; }
.category-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
}
.category-card:hover { border-color: var(--border-light); }

.category-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.category-title-input { flex: 1; font-size: 1rem; font-weight: 600; }
.category-actions { display: flex; gap: 0.5rem; align-items: center; }

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--cyan);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.3s;
  padding: 0.25rem;
}
.toggle-btn.expanded { transform: rotate(180deg); }

.questions-container { display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.questions-container.show { display: block; animation: slideDown 0.3s; }

.question-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}
.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}
.question-points { font-weight: 700; color: var(--gold); font-size: 0.95rem; }
.question-fields { display: grid; gap: 0.75rem; }

.media-section {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}
.media-upload-btn { flex-shrink: 0; }
.media-preview { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.media-preview img { max-width: 80px; max-height: 80px; border-radius: 4px; object-fit: cover; }
.media-preview audio, .media-preview video { height: 40px; max-width: 200px; }
.media-info { font-size: 0.8rem; color: var(--text-muted); flex: 1; }
.media-remove-btn { flex-shrink: 0; }
.hidden-file-input { display: none; }

.controls { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.demo-btn { background: var(--purple) !important; }

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
}
.create-btn { padding: 0.85rem 2rem; font-size: 1.05rem; }

.success-message {
  background: rgba(39,174,96,0.15);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: none;
}
.success-message.show { display: block; animation: slideDown 0.3s; }

.category-count-display {
  display: inline-block;
  background: var(--purple);
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
}

/* ============================================================================
   HOST PAGE
   ============================================================================ */
.host-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-right { font-size: 0.9rem; color: var(--text-secondary); }

.logo-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--prism-gradient);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}
.header-label {
  font-size: 1rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border-light);
  padding-left: 1rem;
}

/* Lobby */
.phase-lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.lobby-section {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.room-code-display { text-align: center; margin-bottom: 1.5rem; }
.room-code-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}
.room-code {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--cyan);
  font-family: 'Courier New', monospace;
  margin-bottom: 1rem;
  user-select: all;
}
.copy-btn {
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
  font-family: inherit;
}
.copy-btn:hover { background: #6c2dc7; }

.share-link-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}
.share-link-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}
.share-link {
  font-size: 0.8rem;
  color: var(--cyan);
  word-break: break-all;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.75rem;
}
.share-link-copy-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.2s;
  font-family: inherit;
}
.share-link-copy-btn:hover { border-color: var(--cyan); }

.player-list { margin-top: 1rem; }
.player-list-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.players { display: grid; gap: 0.5rem; }
.player-item {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideIn 0.3s ease;
}
.player-name { font-weight: 600; }

.start-game-btn {
  width: 100%;
  padding: 1rem;
  margin-top: 1.25rem;
  background: var(--prism-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.start-game-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(131,56,236,0.4); }
.start-game-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Board Phase */
.phase-board { display: grid; grid-template-columns: 1fr 250px; gap: 1.5rem; }
.board-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}
.game-board { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.category-col-header {
  background: linear-gradient(135deg, rgba(131,56,236,0.3), rgba(58,134,255,0.2));
  color: var(--text-primary);
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--border-light);
}
.question-cell {
  background: linear-gradient(135deg, rgba(131,56,236,0.15), rgba(58,134,255,0.1));
  color: var(--gold);
  padding: 1rem 0.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid var(--border-color);
}
.question-cell:hover:not(.answered) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(131,56,236,0.3);
  border-color: var(--purple);
}
.question-cell.answered {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.4;
  text-decoration: line-through;
  border-color: transparent;
}

.scoreboard-sidebar {
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  max-height: 600px;
  overflow-y: auto;
}
.scoreboard-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-secondary); }
.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}
.score-item:last-child { border-bottom: none; }
.score-player-name { font-weight: 600; flex-grow: 1; }
.score-value {
  background: var(--purple);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
  font-size: 0.85rem;
}

.end-game-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.2s;
  font-family: inherit;
}
.end-game-btn:hover { background: #e60060; }

/* Question Phase */
.phase-question { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }
.question-display {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}
.question-text {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.4;
  color: var(--text-primary);
}
.question-media { margin-bottom: 1.5rem; text-align: center; }
.question-image { max-width: 100%; max-height: 300px; border-radius: var(--radius-md); }
.question-audio, .question-video { width: 100%; }

.answer-reveal {
  background: var(--bg-tertiary);
  border-left: 4px solid var(--purple);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}
.answer-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.4rem; }
.answer-text { font-size: 1.25rem; font-weight: 700; color: var(--cyan); }

.control-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.buzzer-section {
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}
.buzzer-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; }
.buzzer-list { display: flex; flex-direction: column; gap: 0.6rem; }
.buzzer-item {
  background: var(--bg-tertiary);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 4px solid var(--border-light);
}
.buzzer-item.first { background: rgba(255,190,11,0.1); border-left-color: var(--gold); }
.buzzer-name { font-weight: 600; font-size: 0.9rem; }
.buzzer-actions { display: flex; gap: 0.5rem; }
.buzzer-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.buzzer-btn-correct { background: var(--green); color: #fff; }
.buzzer-btn-correct:hover { background: #229954; }
.buzzer-btn-wrong { background: var(--pink); color: #fff; }
.buzzer-btn-wrong:hover { background: #e60060; }

/* Finished Phase */
.phase-finished {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 150px);
}
.results-card {
  background: var(--bg-secondary);
  padding: 3rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  max-width: 600px;
  width: 100%;
  text-align: center;
}
.results-title { font-size: 2rem; font-weight: 800; margin-bottom: 2rem; }
.results-list { margin-bottom: 2rem; }
.result-item {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
}
.result-item.winner {
  background: var(--prism-gradient);
  color: #fff;
  font-weight: 700;
  transform: scale(1.03);
  box-shadow: 0 6px 25px rgba(131,56,236,0.4);
}
.result-rank { font-weight: 800; color: var(--purple); min-width: 30px; }
.result-item.winner .result-rank { color: #fff; }
.celebration { font-size: 1.5rem; margin-left: 0.5rem; }

/* ============================================================================
   PLAYER PAGE
   ============================================================================ */
.player-info { text-align: right; }
.player-display-name { color: var(--gold); font-weight: 600; font-size: 1.1rem; }
.room-code-small { font-size: 0.85rem; color: var(--text-muted); }

.phase-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.lobby-phase {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex: 1;
  padding: 2rem 0;
}
.waiting-message { font-size: 1.3rem; color: var(--text-secondary); font-weight: 300; }
.waiting-animation { font-size: 3rem; animation: bounce 1.2s infinite; }

.board-phase { display: flex; flex-direction: column; gap: 1.5rem; flex: 1; }
.board-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.score-card {
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  text-align: center;
}

.board { display: grid; gap: 0.5rem; flex: 1; }
.board-category {
  background: rgba(131,56,236,0.2);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.4rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid var(--border-light);
}
.board-clue {
  background: linear-gradient(135deg, rgba(131,56,236,0.15), rgba(58,134,255,0.1));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
}
.board-clue.answered { opacity: 0.25; text-decoration: line-through; color: var(--text-muted); }

.question-phase { display: flex; flex-direction: column; gap: 1.5rem; flex: 1; }
.question-box {
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  backdrop-filter: blur(10px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
}
.media-container {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}
.media-container img { max-width: 100%; max-height: 300px; object-fit: contain; }
.media-container audio, .media-container video { width: 100%; max-height: 300px; }

/* Buzzer */
.buzzer-button {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  margin: 0 auto;
}
.buzzer-button.disabled { background: #444; color: #888; cursor: not-allowed; }
.buzzer-button.active {
  background: var(--pink);
  color: #fff;
  animation: pulse 0.6s infinite;
  box-shadow: 0 0 30px var(--pink), 0 8px 30px rgba(255,0,110,0.5);
}
.buzzer-button.active:active { transform: scale(0.95); }
.buzzer-button.buzzed {
  background: var(--gold);
  color: #1a1a2e;
  cursor: default;
  animation: none;
  box-shadow: 0 8px 30px rgba(255,190,11,0.4);
}

.buzz-order {
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.buzz-order h3 { font-size: 0.95rem; margin-bottom: 0.75rem; color: var(--text-secondary); }
.buzz-list { list-style: none; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.buzz-item {
  background: rgba(255,255,255,0.1);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  animation: slideIn 0.2s ease;
}
.buzz-item.current { background: var(--pink); font-weight: 700; }

/* Finished */
.finished-phase {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  text-align: center;
  padding: 2rem 0;
}
.final-scoreboard {
  background: rgba(26,26,46,0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
}
.podium { display: flex; flex-direction: column; gap: 0.75rem; }
.podium-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
}
.podium-rank { font-weight: 800; font-size: 1.3rem; width: 35px; }
.podium-rank.first { color: var(--gold); }
.podium-rank.second { color: #c0c0c0; }
.podium-rank.third { color: #cd7f32; }
.podium-name { flex: 1; text-align: left; font-weight: 500; }
.podium-score { font-weight: 700; color: var(--gold); }

.winner-message { font-size: 2.5rem; font-weight: 800; color: var(--gold); animation: bounce 1s infinite; }
.confetti { position: fixed; width: 10px; height: 10px; pointer-events: none; border-radius: 2px; }
.home-button {
  background: var(--prism-gradient);
  border: none;
  color: #fff;
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.home-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(131,56,236,0.4); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
}
.overlay-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 90%;
}
.overlay-content h2 { margin-bottom: 1rem; }
.overlay-content p { margin-bottom: 1.5rem; color: var(--text-secondary); }

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  background: var(--bg-secondary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s ease;
  min-width: 260px;
  border-left: 4px solid var(--cyan);
  font-size: 0.9rem;
}
.toast.success { border-left-color: var(--green); }
.toast.info { border-left-color: var(--cyan); }
.toast.warning { border-left-color: var(--gold); }
.toast.error { border-left-color: var(--pink); }
.toast-icon { font-size: 1.1rem; }
.toast-message { color: var(--text-primary); }

/* Player page toast (centered bottom) */
body > .toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  top: auto;
  right: auto;
  background: rgba(26,26,46,0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-left: none;
  z-index: 999;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1200px) {
  .phase-board { grid-template-columns: 1fr; }
  .phase-question { grid-template-columns: 1fr; }
  .scoreboard-sidebar { max-height: none; }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.3rem; }
  .action-cards { grid-template-columns: 1fr; max-width: 400px; }
  .phase-lobby { grid-template-columns: 1fr; }
  .host-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .room-code { font-size: 2.75rem; letter-spacing: 5px; }
  .question-text { font-size: 1.3rem; }
  .input-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .buzzer-button { width: 120px; height: 120px; font-size: 1.2rem; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .hero .logo-img { width: 150px; }
  .hero .subtitle { font-size: 1.1rem; }
  .room-code { font-size: 2rem; letter-spacing: 3px; }
  .buzzer-button { width: 100px; height: 100px; font-size: 1rem; }
  .container { padding: 0 0.75rem; }
  .question-text { font-size: 1.15rem; }
}
