/* DFIU.BUZZ — Game Show Platform Styles
   Dark mode, hacker-con aesthetic
   Mobile-first, Space Mono + DM Sans
*/

/* ═══════════════════════════════════════
   Custom Properties (Design Tokens)
═══════════════════════════════════════ */
:root {
  /* Colors */
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a26;
  --bg-hover: #1e1e2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.15);

  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.15);
  --cyan-glow: 0 0 20px rgba(0, 229, 255, 0.35);

  --magenta: #ff0066;
  --magenta-dim: rgba(255, 0, 102, 0.15);
  --magenta-glow: 0 0 30px rgba(255, 0, 102, 0.5);

  --amber: #ffb800;
  --amber-dim: rgba(255, 184, 0, 0.15);

  --green: #00e676;
  --red: #ff3d00;
  --silver: #b0bec5;
  --bronze: #ff8f00;

  --text-primary: #f0f0f8;
  --text-secondary: #8080a0;
  --text-muted: #4a4a6a;

  /* Typography */
  --font-mono: 'Space Mono', 'Courier New', monospace;
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* Type scale */
  --text-xs: clamp(0.65rem, 1.5vw, 0.75rem);
  --text-sm: clamp(0.8rem, 2vw, 0.875rem);
  --text-base: clamp(0.9rem, 2.5vw, 1rem);
  --text-lg: clamp(1rem, 3vw, 1.125rem);
  --text-xl: clamp(1.1rem, 3.5vw, 1.25rem);
  --text-2xl: clamp(1.25rem, 4vw, 1.5rem);
  --text-3xl: clamp(1.5rem, 5vw, 2rem);
  --text-4xl: clamp(2rem, 7vw, 3rem);
  --text-hero: clamp(2.5rem, 10vw, 5rem);

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 350ms;
}

/* ═══════════════════════════════════════
   Reset + Base
═══════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  min-height: 100dvh;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input {
  font-family: var(--font-ui);
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   App Shell
═══════════════════════════════════════ */
#app {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

#view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: view-enter var(--t-slow) var(--ease-out) both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   Logo
═══════════════════════════════════════ */
.join-logo {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--sp-3);
  user-select: none;
}

.logo-df { color: var(--cyan); }
.logo-iu { color: var(--text-primary); }
.logo-dot { color: var(--magenta); }
.logo-buzz { color: var(--amber); }

/* ═══════════════════════════════════════
   Buttons
═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 52px;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--t-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--cyan);
  color: #000;
}
.btn-primary:hover:not(:disabled) {
  background: #33eeff;
  box-shadow: var(--cyan-glow);
}

.btn-accent {
  background: var(--magenta);
  color: #fff;
}
.btn-accent:hover:not(:disabled) {
  background: #ff338b;
  box-shadow: var(--magenta-glow);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.2);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-join {
  width: 100%;
  font-size: var(--text-lg);
  min-height: 56px;
  font-family: var(--font-mono);
}

.btn-control {
  width: 100%;
  margin-bottom: var(--sp-3);
  min-height: 56px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--t-fast) var(--ease-out);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-kick-danger:hover { background: var(--magenta-dim); color: var(--magenta); border-color: var(--magenta); }

/* ═══════════════════════════════════════
   Form Elements
═══════════════════════════════════════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.input-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.input-field {
  width: 100%;
  min-height: 52px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-lg);
  transition: border-color var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
  outline: none;
}

.input-field:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-code {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.error-message {
  color: var(--magenta);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--sp-2) 0;
  display: none;
  animation: shake 0.3s var(--ease-out);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ═══════════════════════════════════════
   Spinner
═══════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════
   JOIN VIEW
═══════════════════════════════════════ */
.view-join {
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  min-height: 100dvh;
  min-height: 100vh;
}

.join-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-6);
}

.join-tagline {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-6);
}

.join-host-link {
  margin-top: var(--sp-5);
  text-align: center;
  font-size: var(--text-sm);
}

.link-secondary {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.link-secondary:hover { color: var(--text-primary); }

/* ═══════════════════════════════════════
   LOBBY VIEW
═══════════════════════════════════════ */
.view-lobby {
  align-items: center;
  justify-content: flex-start;
  padding: var(--sp-6);
}

.lobby-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: var(--sp-8);
}

.lobby-header {
  margin-bottom: var(--sp-8);
}

.lobby-code-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.lobby-code-label {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}

.lobby-code {
  font-family: var(--font-mono);
  font-size: var(--text-hero);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-shadow: var(--cyan-glow);
  line-height: 1;
}

.lobby-status {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

/* Pulse animation */
.lobby-pulse {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.pulse-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  opacity: 0;
  animation: pulse-expand 2s ease-out infinite;
}

.pulse-ring--2 {
  animation-delay: 0.8s;
}

@keyframes pulse-expand {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.lobby-waiting-text {
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.lobby-count {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.count-number {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
  display: inline-block;
  transition: transform var(--t-base) var(--ease-spring);
}

.count-number.count-bump {
  animation: count-bump 0.4s var(--ease-spring);
}

@keyframes count-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); color: var(--cyan); }
  100% { transform: scale(1); }
}

.count-label {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: player-enter 0.3s var(--ease-out) both;
}

@keyframes player-enter {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.lobby-player--me {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

.player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.player-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.you-badge {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: var(--sp-1);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

/* ═══════════════════════════════════════
   PLAY VIEW
═══════════════════════════════════════ */
.view-play {
  min-height: 100dvh;
  min-height: 100vh;
}

.play-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100vh;
  padding: 0 var(--sp-4);
}

.play-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0 var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}

.play-round-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
}

.play-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Question */
.play-question {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-bottom: var(--sp-6);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.question-category {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.question-difficulty {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.diff-easy { color: var(--green); background: rgba(0, 230, 118, 0.1); border: 1px solid rgba(0, 230, 118, 0.2); }
.diff-medium { color: var(--amber); background: var(--amber-dim); border: 1px solid rgba(255, 184, 0, 0.2); }
.diff-hard { color: var(--magenta); background: var(--magenta-dim); border: 1px solid rgba(255, 0, 102, 0.2); }

.question-text {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  flex: 1;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 500;
  text-align: left;
  min-height: 72px;
  transition: all var(--t-base) var(--ease-out);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-2px);
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.answer-btn--selected {
  border-color: var(--cyan) !important;
  background: var(--cyan-dim) !important;
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.3);
}

.answer-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.answer-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--cyan);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.answer-text {
  font-size: var(--text-sm);
  line-height: 1.3;
}

.answer-submitted-msg {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--sp-3);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   BUZZER
═══════════════════════════════════════ */
.play-buzzer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-4);
}

.buzzer-prompt {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-transform: uppercase;
  animation: buzzer-prompt-pulse 1s ease-in-out infinite alternate;
}

@keyframes buzzer-prompt-pulse {
  from { opacity: 0.5; }
  to { opacity: 1; color: var(--magenta); }
}

.buzzer-btn {
  width: min(320px, 80vw);
  height: min(320px, 80vw);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff3399, #cc0044);
  border: 4px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  position: relative;
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
  box-shadow:
    0 8px 32px rgba(255, 0, 102, 0.5),
    0 2px 8px rgba(255, 0, 102, 0.3),
    inset 0 -4px 0 rgba(0,0,0,0.3),
    inset 0 4px 0 rgba(255,255,255,0.1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.buzzer-btn:hover:not(:disabled) {
  box-shadow:
    0 12px 48px rgba(255, 0, 102, 0.7),
    0 4px 16px rgba(255, 0, 102, 0.5),
    inset 0 -4px 0 rgba(0,0,0,0.3),
    inset 0 4px 0 rgba(255,255,255,0.15);
  transform: translateY(-3px) scale(1.02);
}

.buzzer-btn:active:not(:disabled),
.buzzer-btn.buzzer--touch:not(:disabled) {
  transform: scale(0.94) translateY(4px);
  box-shadow:
    0 2px 16px rgba(255, 0, 102, 0.4),
    0 1px 4px rgba(255, 0, 102, 0.3),
    inset 0 4px 0 rgba(0,0,0,0.3),
    inset 0 -2px 0 rgba(255,255,255,0.05);
}

.buzzer-btn--pressed {
  background: radial-gradient(circle at 35% 35%, #888, #555);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transform: none !important;
  cursor: default;
  opacity: 0.7;
}

.buzzer-btn:disabled {
  cursor: default;
}

.buzzer-label {
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.buzzer-status {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.buzzer-status--first {
  color: var(--cyan);
  font-family: var(--font-mono);
  animation: first-buzz 0.5s var(--ease-spring);
}

@keyframes first-buzz {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════
   QUESTION REVEAL
═══════════════════════════════════════ */
.play-reveal {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-bottom: var(--sp-6);
}

.reveal-question {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.4;
}

.reveal-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.reveal-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 64px;
  position: relative;
  transition: all 0.3s var(--ease-out);
}

.reveal-option--correct {
  border-color: var(--green);
  background: rgba(0, 230, 118, 0.1);
  animation: correct-reveal 0.5s var(--ease-spring);
}

.reveal-option--correct .answer-letter {
  color: var(--green);
}

.reveal-option--wrong {
  border-color: var(--magenta);
  background: var(--magenta-dim);
  opacity: 0.6;
}

.reveal-option--wrong .answer-letter {
  color: var(--magenta);
}

@keyframes correct-reveal {
  0% { transform: scale(0.95); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.correct-mark {
  position: absolute;
  right: var(--sp-4);
  color: var(--green);
  font-size: var(--text-xl);
  font-weight: 700;
}

.reveal-answer {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--green);
  padding: var(--sp-4);
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: var(--radius-md);
}

.result-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
  font-weight: 700;
  animation: result-slide-in 0.4s var(--ease-spring) both;
}

@keyframes result-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result-banner--correct {
  background: rgba(0, 230, 118, 0.15);
  border: 1.5px solid rgba(0, 230, 118, 0.4);
  color: var(--green);
}

.result-banner--wrong {
  background: var(--magenta-dim);
  border: 1.5px solid rgba(255, 0, 102, 0.4);
  color: var(--magenta);
}

.result-icon {
  font-size: var(--text-2xl);
}

.result-explanation {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   SCORING (in play view)
═══════════════════════════════════════ */
.play-scoring {
  flex: 1;
  padding-bottom: var(--sp-6);
}

.scoring-title, .scoreboard-title {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-4);
  color: var(--amber);
}

.scoreboard-title--final {
  font-size: var(--text-4xl);
  color: var(--amber);
  text-shadow: 0 0 30px rgba(255, 184, 0, 0.4);
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.score-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: score-enter 0.3s var(--ease-out) both;
}

@keyframes score-enter {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.score-row--me {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

.score-rank {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.score-name {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-pts {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--amber);
}

/* ═══════════════════════════════════════
   SCOREBOARD VIEW
═══════════════════════════════════════ */
.view-scoreboard {
  padding: var(--sp-6);
  align-items: center;
}

.scoreboard-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* Podium */
.podium {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.podium-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  animation: podium-reveal 0.5s var(--ease-spring) both;
}

@keyframes podium-reveal {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.podium-gold {
  border-color: var(--amber);
  background: var(--amber-dim);
  box-shadow: 0 0 20px rgba(255, 184, 0, 0.2);
}

.podium-silver {
  border-color: var(--silver);
  background: rgba(176, 190, 197, 0.08);
  animation-delay: 0.1s;
}

.podium-bronze {
  border-color: var(--bronze);
  background: rgba(255, 143, 0, 0.08);
  animation-delay: 0.2s;
}

.podium-me {
  box-shadow: 0 0 0 2px var(--cyan), 0 0 20px rgba(0, 229, 255, 0.2);
}

.podium-rank {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.podium-gold .podium-rank { color: var(--amber); }
.podium-silver .podium-rank { color: var(--silver); }
.podium-bronze .podium-rank { color: var(--bronze); }

.podium-name {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
}

.podium-pts {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.score-list--rest {
  margin-top: var(--sp-3);
}

.final-cta {
  margin-top: var(--sp-8);
  text-align: center;
}

.final-thanks {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   WAITING STATE
═══════════════════════════════════════ */
.play-waiting {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}

.waiting-text {
  color: var(--text-secondary);
  font-size: var(--text-xl);
  font-family: var(--font-mono);
  animation: waiting-dots 1.5s ease-in-out infinite;
}

@keyframes waiting-dots {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ═══════════════════════════════════════
   HOST VIEW — Auth
═══════════════════════════════════════ */
.view-host-auth {
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  min-height: 100dvh;
  min-height: 100vh;
}

.host-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-6);
}

.host-auth-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: var(--sp-5);
}

/* ═══════════════════════════════════════
   HOST VIEW — Dashboard
═══════════════════════════════════════ */
.view-host {
  min-height: 100dvh;
  min-height: 100vh;
}

.host-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100vh;
}

/* Host info bar */
.host-info-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.info-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.info-code {
  flex-shrink: 0;
}

.code-copy-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.15em;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: 0 -6px;
  transition: all var(--t-fast) var(--ease-out);
  min-height: 0;
}

.code-copy-btn:hover {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

.status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.status-lobby { color: var(--cyan); background: var(--cyan-dim); border-color: rgba(0, 229, 255, 0.25); }
.status-round-active { color: var(--green); background: rgba(0, 230, 118, 0.1); border-color: rgba(0, 230, 118, 0.3); }
.status-buzzer-open { color: var(--magenta); background: var(--magenta-dim); border-color: rgba(255, 0, 102, 0.3); animation: buzzer-status-pulse 0.8s ease-in-out infinite alternate; }
.status-question-reveal { color: var(--amber); background: var(--amber-dim); border-color: rgba(255, 184, 0, 0.3); }
.status-scoring { color: var(--amber); background: var(--amber-dim); border-color: rgba(255, 184, 0, 0.3); }
.status-finished { color: var(--text-secondary); }

@keyframes buzzer-status-pulse {
  from { box-shadow: 0 0 0 0 rgba(255, 0, 102, 0.3); }
  to { box-shadow: 0 0 0 6px rgba(255, 0, 102, 0); }
}

.info-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

/* Host main layout */
.host-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--sp-4);
  padding: var(--sp-4);
}

@media (min-width: 768px) {
  .host-main {
    flex-direction: row;
    align-items: flex-start;
  }

  .host-left {
    flex: 1;
    min-width: 0;
  }

  .host-right {
    width: 320px;
    flex-shrink: 0;
  }
}

.host-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.control-group {
  display: flex;
  flex-direction: column;
}

.control-hint {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
}

.host-question-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.host-question-text {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin-top: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.host-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.host-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.activity-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
}

@media (min-width: 720px) {
  .activity-mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.activity-form {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.activity-monitor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.activity-results {
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.poll-result-row {
  margin-bottom: var(--sp-3);
}

.poll-result-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-1);
}

.poll-result-bar {
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.poll-result-bar span {
  display: block;
  height: 100%;
  background: var(--cyan);
  box-shadow: var(--cyan-glow);
  transition: width var(--t-base) var(--ease-out);
}

.text-response-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 360px;
  overflow-y: auto;
}

.text-response-row {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.text-response-name {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.text-response-body {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.buzzer-lock-winner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid rgba(255, 0, 102, 0.3);
  border-radius: var(--radius-md);
  background: var(--magenta-dim);
  font-size: var(--text-xl);
}

.text-response-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.text-response-input {
  min-height: 140px;
  resize: vertical;
  line-height: 1.4;
  padding-top: var(--sp-3);
  white-space: pre-wrap;
}

.host-buzz-queue {
  background: var(--bg-card);
  border: 1px solid rgba(255, 0, 102, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.buzz-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}

.buzz-entry:last-child { border-bottom: none; }

.buzz-entry--first {
  animation: first-buzz-entry 0.4s var(--ease-spring);
}

@keyframes first-buzz-entry {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.buzz-rank {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  width: 30px;
  flex-shrink: 0;
}

.buzz-name {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 600;
}

.buzz-winner-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--magenta-dim);
  color: var(--magenta);
  border: 1px solid rgba(255, 0, 102, 0.3);
}

/* Player panel */
.host-players {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.panel-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}

.host-player-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.host-player-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: player-enter 0.2s var(--ease-out) both;
}

.host-player-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  min-width: 0;
}

.player-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-connected { background: var(--green); }
.dot-disconnected { background: var(--text-muted); }

.host-player-name {
  font-size: var(--text-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-player-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}

.host-player-score {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--amber);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--t-fast) var(--ease-out);
}

.editable-score:hover {
  border-color: var(--amber);
  background: var(--amber-dim);
}

.score-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.host-player-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--sp-6) 0;
}

/* ═══════════════════════════════════════
   RECONNECT OVERLAY
═══════════════════════════════════════ */
#reconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-6);
  background: rgba(10, 10, 15, 0.9);
  border-bottom: 1px solid var(--magenta);
  backdrop-filter: blur(8px);
  gap: var(--sp-3);
  transform: translateY(-100%);
  transition: transform 0.3s var(--ease-out);
}

#reconnect-overlay.is-visible {
  transform: translateY(0);
}

.reconnect-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 0, 102, 0.3);
  border-top-color: var(--magenta);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.reconnect-text {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--magenta);
  font-weight: 600;
}

.reconnect-dots::after {
  content: '';
  animation: reconnect-dots 1.5s steps(4, end) infinite;
}

@keyframes reconnect-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ═══════════════════════════════════════
   RESPONSIVE: Wider screens
═══════════════════════════════════════ */
@media (min-width: 480px) {
  .answer-grid {
    gap: var(--sp-4);
  }
  .answer-btn {
    min-height: 80px;
  }
  .play-wrap {
    padding: 0 var(--sp-6);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .view-play {
    align-items: center;
  }
}
