/* =============================================================================
   快問快答遊戲 - Neon + Kahoot 風格 UI
   ============================================================================= */

/* =============================================================================
   CSS 變數系統
   ============================================================================= */
:root {
  /* Kahoot 四色 */
  --kahoot-red: #e21b3c;
  --kahoot-blue: #1368ce;
  --kahoot-yellow: #d89e00;
  --kahoot-green: #26890c;

  /* 主持人色板 */
  --host-bg-primary: #0a0e1a;
  --host-bg-secondary: #111827;
  --host-surface: rgba(255, 255, 255, 0.06);
  --host-surface-border: rgba(255, 255, 255, 0.1);
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00e5;
  --neon-blue: #4d7cff;

  /* 玩家色板 */
  --player-bg: #f8fafc;
  --player-surface: #ffffff;
  --player-text: #1e293b;
  --player-text-secondary: #64748b;
  --player-border: #e2e8f0;

  /* 語義色 */
  --color-success: #22c55e;
  --color-error: #ef4444;
  --color-warning: #f59e0b;

  /* 間距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 圓角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* 過渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* 字體 */
  --font-display: 'Orbitron', sans-serif;
  --font-body-zh: 'Noto Sans TC', sans-serif;
  --font-body-en: 'Inter', sans-serif;
}

/* =============================================================================
   基礎樣式
   ============================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 16px 0;
}

body, html {
  height: 100vh;
  margin: 0;
  padding: 0;
  font-family: var(--font-body-zh), var(--font-body-en), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--host-bg-primary);
  color: var(--player-text);
  overflow-x: hidden;
}

/* 覆寫 skeleton.css 的 .container 限制寬度 */
.container {
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#root {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =============================================================================
   共享 UI 組件
   ============================================================================= */

/* 卡片組件 */
.card {
  background: var(--player-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--player-border);
  margin-bottom: 20px;
  transition: all var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 按鈕組件 */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 140px;
  outline: none;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--kahoot-blue);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #0f5bbd;
  box-shadow: 0 4px 16px rgba(19, 104, 206, 0.4);
}

.btn-success {
  background: var(--kahoot-green);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #1f7a0a;
  box-shadow: 0 4px 16px rgba(38, 137, 12, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
  box-shadow: 0 4px 16px rgba(160, 174, 192, 0.4);
}

.btn-danger {
  background: var(--kahoot-red);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c81634;
  box-shadow: 0 4px 16px rgba(226, 27, 60, 0.4);
}

/* 計時器組件 */
.timer {
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

/* 參與者介面的計時器樣式 */
.player-interface .timer {
  background: var(--player-surface);
  border: 2px solid var(--player-border);
}

.player-interface .timer-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--player-text);
  text-shadow: none;
}

.player-interface .timer.urgent {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--color-error);
}

.player-interface .timer.urgent .timer-number {
  color: var(--color-error);
  text-shadow: none;
  font-weight: 800;
}

.player-interface .timer-label {
  color: var(--player-text-secondary);
  text-shadow: none;
  font-weight: 600;
}

/* 參與者介面計時器進度條 */
.player-interface .timer-bar {
  background: var(--player-border);
}

.player-interface .timer.urgent .timer-bar {
  background: rgba(239, 68, 68, 0.15);
}

.player-interface .timer-progress {
  background: var(--kahoot-green);
}

.player-interface .timer.urgent .timer-progress {
  background: var(--color-error);
}

.timer.urgent {
  background: rgba(239, 68, 68, 0.2);
  animation: urgentPulse 1s infinite;
}

.timer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.timer-number {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.6), 0 0 40px rgba(0, 240, 255, 0.3);
}

.timer.urgent .timer-number {
  color: var(--color-error);
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.3);
}

.timer-label {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.timer-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.timer-progress {
  height: 100%;
  background: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
  transition: width 0.5s ease;
}

.timer.urgent .timer-progress {
  background: var(--color-error);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

/* =============================================================================
   房間選擇器 — 深色底 + neon 標題
   ============================================================================= */

.room-selector {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--host-bg-primary);
  box-sizing: border-box;
}

.selector-content {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.homepage-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.homepage-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.5));
  flex-shrink: 0;
}

.selector-content h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--neon-cyan);
  margin: 0;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.5), 0 0 60px rgba(0, 240, 255, 0.2);
  animation: neonGlow 3s ease-in-out infinite;
  letter-spacing: 1px;
  line-height: 1.1;
}

.selector-content p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 28px;
}

.selector-options {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.create-room, .join-room {
  text-align: center;
}

/* 首頁卡片保持白色 */
.room-selector .card {
  background: var(--player-surface);
  border: 1px solid var(--player-border);
}

.create-room h3, .join-room h3 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--player-text);
}

.create-room p, .join-room p {
  font-size: 1.15rem;
  color: var(--player-text-secondary);
  margin-bottom: 20px;
}

.room-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--player-border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}

.room-input:focus {
  outline: none;
  border-color: var(--kahoot-blue);
  box-shadow: 0 0 0 3px rgba(19, 104, 206, 0.15);
}

/* =============================================================================
   載入畫面 — 深色底 + Orbitron 標題
   ============================================================================= */

.loading {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--host-bg-primary);
  position: relative;
  overflow: hidden;
}

.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.08) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: loadingGlow 4s ease-in-out infinite;
}

.loading-content {
  text-align: center;
  color: white;
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  padding: 48px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.05);
  max-width: 480px;
  width: 90vw;
}

.loading-animation {
  margin-bottom: 32px;
}

.quiz-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.5));
  animation: logoFloat 3s ease-in-out infinite;
}

.loading-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.3s;
}

.dot:nth-child(3) {
  animation-delay: 0.6s;
}

.loading-title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.loading-title-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.5));
  animation: logoFloat 3s ease-in-out infinite;
}

.loading-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.2);
  letter-spacing: 2px;
}

.loading-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 32px;
  font-weight: 500;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-normal);
}

.step.active {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.1);
}

.step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.step.active .step-icon {
  background: var(--neon-cyan);
  color: var(--host-bg-primary);
  font-weight: 900;
}

.step-text {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
}

.step.active .step-text {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

/* Loading 動畫效果 */
@keyframes loadingGlow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 錯誤畫面 */
.error-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--host-bg-primary);
}

.error-content {
  text-align: center;
  background: var(--player-surface);
  padding: 3rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--player-border);
  max-width: 500px;
  margin: 0 1rem;
}

.error-content h2 {
  margin-bottom: 1rem;
  color: var(--color-error);
  font-size: 2rem;
}

.error-content p {
  color: var(--player-text);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* 用戶名輸入畫面 — 白色底 (玩家風格)
   safe center：視窗夠高就置中；內容超過視窗時自動 fallback 到 flex-start 並可滾動，
   避免被父層 #root { height: 100vh } 直接剪掉底部。 */
.username-input-screen {
  height: 100vh;
  display: flex;
  align-items: safe center;
  justify-content: center;
  background: var(--player-bg);
  padding: 1.5rem 1rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.username-input-content {
  text-align: center;
  background: var(--player-surface);
  padding: 3rem 2.75rem 2.75rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--player-border);
  width: 100%;
  max-width: 520px;
  margin: 1rem;
}

.username-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.username-title-logo {
  width: 72px;
  height: 72px;
  border-radius: 14px;
}

.username-input-content h2 {
  font-size: 3.25rem;
  margin: 0;
  font-weight: 800;
}

.username-subtitle {
  color: var(--player-text-secondary);
  font-size: 1.75rem;
  margin-bottom: 2rem;
}

.line-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 22px 24px;
  background: #06C755;
  border: none;
  color: #fff;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 4px 14px rgba(6, 199, 85, 0.22);
  letter-spacing: 0.5px;
}
.line-login-btn:hover { filter: brightness(1.05); }
.line-login-btn:active { transform: translateY(1px); }
.line-login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.username-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--player-text-secondary);
  margin: 1.5rem 0 1.5rem;
  font-size: 1.4rem;
  gap: 12px;
}
.username-divider::before,
.username-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--player-border);
}

.username-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.username-avatar-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.username-avatar-uploader {
  position: relative;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 2px dashed var(--player-border);
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.username-avatar-uploader:hover {
  border-color: var(--kahoot-blue);
  background: rgba(19, 104, 206, 0.04);
}
.username-avatar-uploader input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.username-avatar-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.username-avatar-placeholder {
  font-size: 3.2rem;
  line-height: 1;
  color: var(--player-text-secondary);
}
.username-avatar-caption {
  font-size: 1.4rem;
  color: var(--player-text-secondary);
}
.username-avatar-error {
  color: #d33;
  font-size: 1.3rem;
  margin-top: 2px;
}

.username-input {
  font-size: 1.85rem;
  padding: 20px 22px;
}

.username-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 22px 24px;
  background: var(--kahoot-blue);
  color: #fff;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(19, 104, 206, 0.22);
}
.username-submit-btn:hover { filter: brightness(1.05); }
.username-submit-btn:active { transform: translateY(1px); }
.username-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
  transform: none;
  box-shadow: none;
}

.username-input-content h2 {
  margin-bottom: 1rem;
  color: var(--player-text);
  font-size: 2rem;
}

.username-input-content p {
  color: var(--player-text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.username-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--player-border);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  margin-bottom: 0;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.username-input:focus {
  outline: none;
  border-color: var(--kahoot-blue);
  box-shadow: 0 0 0 3px rgba(19, 104, 206, 0.1);
}

.username-input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.username-input-content form {
  display: flex;
  flex-direction: column;
}

.username-input-content .btn {
  margin-top: 0;
}

/* =============================================================================
   主持人介面 — 深色底 + 霓虹色
   ============================================================================= */

/* 4A: 全屏容器 */
.host-interface-fullscreen {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--host-bg-primary);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 240, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255, 0, 229, 0.04) 0%, transparent 60%);
}

/* 4B: 頂部欄 */
.host-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(32px) saturate(180%);
  border-bottom: 1px solid rgba(0, 240, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.title-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

/* 4C: 標題 */
.host-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  margin: 0;
  letter-spacing: 1px;
}

/* 4D: 資訊欄 */
.host-info-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 240, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 10px 18px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: all var(--transition-fast);
}

.info-item:hover {
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.25);
}

.info-icon {
  font-size: 19px;
  opacity: 0.9;
}

.info-label {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
}

.info-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--neon-cyan);
  white-space: nowrap;
}

/* 4E: 主持人 top bar 控制區 — 題目集 + icon 按鈕 */
.top-bar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-question-set {
  height: 40px;
  padding: 0 32px 0 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2300f0ff' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--transition-fast);
  max-width: 220px;
}

.top-bar-question-set:hover:not(:disabled) {
  border-color: rgba(0, 240, 255, 0.45);
  background-color: rgba(0, 240, 255, 0.06);
}

.top-bar-question-set:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18);
}

.top-bar-question-set:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.top-bar-question-set option {
  background: var(--host-bg-secondary);
  color: white;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.icon-btn svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.icon-btn:active:not(:disabled) {
  transform: translateY(0);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn-primary {
  background: var(--kahoot-blue);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(19, 104, 206, 0.4);
}

.icon-btn-primary:hover:not(:disabled) {
  background: #1a7ae0;
  box-shadow: 0 4px 14px rgba(19, 104, 206, 0.55);
}

.icon-btn-success {
  background: var(--kahoot-green);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(38, 137, 12, 0.4);
}

.icon-btn-success:hover:not(:disabled) {
  background: #2ea30f;
  box-shadow: 0 4px 14px rgba(38, 137, 12, 0.55);
}

.icon-btn-danger {
  background: rgba(226, 27, 60, 0.18);
  border-color: rgba(226, 27, 60, 0.45);
}

.icon-btn-danger:hover:not(:disabled) {
  background: var(--kahoot-red);
  border-color: var(--kahoot-red);
  box-shadow: 0 4px 14px rgba(226, 27, 60, 0.45);
}

/* 主題目區域 */
.main-question-area {
  position: absolute;
  top: 440px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 60px 32px;
  overflow-y: auto;
}

.question-display {
  width: 100%;
  max-width: 1600px;
  text-align: center;
  color: white;
  position: relative;
}

.question-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 20px;
}

.question-number {
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.question-timer {
  position: absolute;
  top: -40px;
  right: 20px;
  transform: scale(1.5);
  transform-origin: top right;
  z-index: 60;
}

/* 主持人題目文字 */
.main-question-text {
  font-family: var(--font-body-zh), sans-serif;
  font-size: clamp(2.4rem, 3.6vw, 4rem);
  font-weight: 900;
  color: white;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  margin-bottom: 32px;
  line-height: 1.15;
  text-align: center;
}

/* 題目圖片容器 */
.question-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  padding: 0 20px;
}

.question-image {
  max-width: 100%;
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(0, 240, 255, 0.15);
  transition: all var(--transition-normal);
  object-fit: contain;
}

.question-image:hover {
  transform: scale(1.02);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* 4F: 題目選項 — Kahoot 四色色塊 */
.question-options-display {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.option-display {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 28px 36px;
  border: none;
  border-radius: var(--radius-xl);
  transition: all var(--transition-normal);
  min-height: 120px;
  width: 100%;
  box-sizing: border-box;
}

/* Kahoot 四色選項 — 主持人端 */
.option-display[data-option="0"] {
  background: var(--kahoot-red);
}
.option-display[data-option="1"] {
  background: var(--kahoot-blue);
}
.option-display[data-option="2"] {
  background: var(--kahoot-yellow);
}
.option-display[data-option="3"] {
  background: var(--kahoot-green);
}

/* 沒有 data-option 的後備 */
.option-display:not([data-option]) {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.option-display.correct {
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.6), inset 0 0 20px rgba(34, 197, 94, 0.2);
  outline: 4px solid var(--color-success);
  outline-offset: 2px;
  animation: correctPulse 1.5s ease-in-out infinite;
}

.option-display .option-letter {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.option-display.correct .option-letter {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.option-display .option-text {
  font-family: var(--font-body-zh), sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 1.6vw, 1.6rem);
  color: white;
  text-align: left;
  line-height: 1.3;
}

.no-question-display {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* 主持人最終排名 */
.host-final-rankings {
  text-align: center;
  color: white;
  width: 100%;
  max-width: 900px;
}

.host-final-rankings h1 {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15);
  margin-bottom: 40px;
  animation: neonGlow 3s ease-in-out infinite;
}

.host-final-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.host-final-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

/* 前三名特殊樣式 */
.host-final-item.top-1 {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.35);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.12);
  padding: 28px 32px;
}

.host-final-item.top-2 {
  background: rgba(192, 192, 192, 0.08);
  border-color: rgba(192, 192, 192, 0.25);
  box-shadow: 0 0 16px rgba(192, 192, 192, 0.08);
  padding: 24px 32px;
}

.host-final-item.top-3 {
  background: rgba(205, 127, 50, 0.08);
  border-color: rgba(205, 127, 50, 0.25);
  box-shadow: 0 0 16px rgba(205, 127, 50, 0.08);
}

.host-final-rank {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  min-width: 64px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
}

.host-final-item.top-1 .host-final-rank {
  font-size: 2.5rem;
  color: #ffd700;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
}

.host-final-item.top-2 .host-final-rank {
  font-size: 2.2rem;
  color: #c0c0c0;
  text-shadow: 0 0 12px rgba(192, 192, 192, 0.4);
}

.host-final-item.top-3 .host-final-rank {
  color: #cd7f32;
  text-shadow: 0 0 12px rgba(205, 127, 50, 0.4);
}

.host-final-info {
  flex: 1;
  text-align: left;
}

.host-final-name {
  font-family: var(--font-body-zh), sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  margin-bottom: 6px;
}

.host-final-item.top-1 .host-final-name {
  font-size: 2rem;
}

.host-final-item.top-2 .host-final-name {
  font-size: 1.8rem;
}

.host-final-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.host-final-details span {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.host-final-score {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
  min-width: 60px;
  text-align: right;
}

.host-final-item.top-1 .host-final-score {
  font-size: 2.8rem;
}

.host-final-item.top-2 .host-final-score {
  font-size: 2.4rem;
}

.host-final-thanks {
  margin-top: 36px;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

/* 4J: 等待畫面 neon 風格 */
.waiting-content {
  text-align: center;
  color: white;
}

.waiting-content h1 {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--neon-cyan);
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15);
  animation: neonGlow 3s ease-in-out infinite;
}

.waiting-content p {
  font-size: 1.5rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

/* =============================================================================
   主持人大廳 (pre-game) — 兩欄式佈局：PIN 卡 + 玩家名牌牆
   ============================================================================= */

/* 大廳模式：隱藏浮動面板，並讓主區域延伸至 top bar 下方 */
.host-interface-fullscreen.is-lobby .floating-panels {
  display: none;
}
.host-interface-fullscreen.is-lobby .main-question-area {
  top: 80px;
  padding: 32px 60px;
  align-items: stretch;
  justify-content: center;
}
.host-interface-fullscreen.is-lobby .no-question-display {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
}
.host-interface-fullscreen.is-lobby .no-question-display .waiting-content {
  width: 100%;
  text-align: left;
}

/* =============================================================================
   主持人結算 (is-finished) — 全螢幕 Podium，隱藏浮動面板
   ============================================================================= */
.host-interface-fullscreen.is-finished .floating-panels {
  display: none;
}
.host-interface-fullscreen.is-finished .main-question-area {
  top: 80px;
  padding: 28px 60px 36px;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
.host-interface-fullscreen.is-finished .no-question-display {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
}
.host-interface-fullscreen.is-finished .no-question-display .waiting-content {
  width: 100%;
  text-align: left;
}

/* =============================================================================
   進行中（is-playing）：移除上方資訊欄與浮動統計卡，讓題目佔滿版面
   ============================================================================= */
.host-interface-fullscreen.is-playing .host-info-bar {
  display: none;
}
.host-interface-fullscreen.is-playing .floating-panels {
  display: none;
}
.host-interface-fullscreen.is-playing .main-question-area {
  top: 80px;
  padding: 28px 360px 36px 56px;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}
.host-interface-fullscreen.is-playing .question-display {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
}
.host-interface-fullscreen.is-playing .question-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}
.host-interface-fullscreen.is-playing .main-question-text {
  margin-bottom: 0;
}

/* 題目頂部資訊列：左 = 題號膠囊；右 = 已作答 / 公布徽章 / 計時器 */
.host-interface-fullscreen.is-playing .question-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
  padding: 0 4px;
}
.host-interface-fullscreen.is-playing .question-number {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.22);
  border-radius: var(--radius-full);
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}
.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.host-interface-fullscreen.is-playing .question-timer {
  position: static;
  transform: none;
  z-index: auto;
}

/* 已作答進度膠囊 */
.answered-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(10px);
}
.answered-pill-icon {
  font-size: 14px;
  align-self: center;
  margin-right: 2px;
}
.answered-pill-count {
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}
.answered-pill-sep {
  color: rgba(255, 255, 255, 0.4);
  margin: 0 1px;
}
.answered-pill-total {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.answered-pill-label {
  margin-left: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 公布答案徽章 */
.reveal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(38, 137, 12, 0.18);
  border: 1px solid rgba(38, 137, 12, 0.45);
  border-radius: var(--radius-full);
  color: #7be086;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(38, 137, 12, 0.4);
}

/* 答案公布後選項上的票數膠囊 */
.option-vote-chip {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 44px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.32);
  color: white;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  animation: voteChipIn 0.45s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes voteChipIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* 公布答案後，非正解選項淡出讓正解醒目 */
.option-display.dim {
  opacity: 0.42;
  filter: grayscale(0.4);
  transition: opacity var(--transition-normal), filter var(--transition-normal);
}

/* =============================================================================
   進行中右側即時作答排行榜（玻璃面板，固定不擋題目）
   ============================================================================= */
.live-rank-side {
  position: fixed;
  top: 96px;
  right: 24px;
  width: 300px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 240, 255, 0.06);
  z-index: 60;
  animation: liveRankIn 0.45s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes liveRankIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.live-rank-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.12);
}
.live-rank-icon {
  font-size: 18px;
}
.live-rank-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.live-rank-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  text-shadow: none;
}

.live-rank-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.live-rank-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}
.live-rank-stat .num {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
  font-variant-numeric: tabular-nums;
}
.live-rank-stat .lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
}

.live-rank-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 2px;
}
.live-rank-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: white;
  animation: liveRankRowIn 0.3s ease both;
}
@keyframes liveRankRowIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.live-rank-row.correct {
  background: rgba(38, 137, 12, 0.16);
  border-color: rgba(38, 137, 12, 0.42);
}
.live-rank-rk {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--neon-cyan);
  min-width: 32px;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}
.live-rank-row.correct .live-rank-rk {
  color: #7be086;
  text-shadow: 0 0 8px rgba(38, 137, 12, 0.4);
}
.live-rank-name {
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-rank-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;
}
.live-rank-flag {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  border-radius: 50%;
}
.live-rank-flag.correct {
  background: rgba(38, 137, 12, 0.32);
  color: #b6f0bf;
}
.live-rank-flag.pending {
  color: rgba(255, 255, 255, 0.45);
}
.live-rank-empty {
  text-align: center;
  padding: 28px 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.05rem;
}

/* is-playing 響應式：較窄視窗下將排行榜貼底，題目佔滿寬度 */
@media (max-width: 1280px) {
  .host-interface-fullscreen.is-playing .main-question-area {
    padding: 28px 24px 280px;
  }
  .live-rank-side {
    top: auto;
    right: 24px;
    left: 24px;
    bottom: 16px;
    width: auto;
    max-height: 240px;
  }
  .live-rank-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .live-rank-row {
    flex: 0 0 auto;
    min-width: 220px;
  }
}

@media (max-width: 900px) {
  .host-interface-fullscreen.is-playing .main-question-area {
    padding: 16px 16px 240px;
  }
  .answered-pill-label,
  .reveal-pill {
    display: none;
  }
}

.host-lobby {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 36px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  height: 100%;
  align-items: stretch;
}

/* PIN 卡片：白底亮卡，反差於深色 host bg，吸引手機視線 */
.host-lobby-pin-card {
  background: #ffffff;
  color: var(--player-text);
  border-radius: var(--radius-xl);
  padding: 26px 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 240, 255, 0.16),
    0 0 32px rgba(0, 240, 255, 0.06);
  animation: lobbyCardIn 0.55s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes lobbyCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lobby-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: var(--player-text-secondary);
}
.lobby-card-eyebrow {
  letter-spacing: 0.02em;
}
.lobby-card-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-success);
  font-weight: 700;
}
.lobby-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
  animation: lobbyOnlinePulse 2s ease-in-out infinite;
}
@keyframes lobbyOnlinePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.06); }
}

.lobby-url-strip {
  background: var(--player-bg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lobby-url-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--player-text-secondary);
}
.lobby-url-host {
  font-size: 20px;
  font-weight: 700;
  color: var(--player-text);
  letter-spacing: -0.005em;
  word-break: break-all;
}

.lobby-pin-row {
  display: flex;
  align-items: stretch;
  gap: 16px;
}
.lobby-pin-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lobby-pin-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--player-text-secondary);
  margin-bottom: 8px;
}
.lobby-pin-code {
  font-family: var(--font-display), var(--font-body-en);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--player-text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.lobby-qr {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--player-border);
  padding: 6px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.lobby-hint {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--player-text-secondary);
  border-top: 1px dashed var(--player-border);
  padding-top: 14px;
}

/* 右側：玩家名牌牆 */
.host-lobby-players {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}
.lobby-players-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.lobby-players-count {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: white;
}
.lobby-players-count .num {
  font-family: var(--font-display);
  font-size: clamp(3.6rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--neon-cyan);
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.45), 0 0 48px rgba(0, 240, 255, 0.18);
  font-variant-numeric: tabular-nums;
}
.lobby-players-count .label {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.02em;
}

.lobby-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-content: start;
  overflow-y: auto;
  padding: 4px 6px 4px 0;
}
.lobby-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.14);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  color: white;
  animation: lobbyChipIn 0.35s cubic-bezier(.2,.9,.3,1.4);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.lobby-chip:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.3);
  transform: translateY(-1px);
}
.lobby-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
@keyframes lobbyChipIn {
  from { opacity: 0; transform: scale(.6) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.lobby-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lobby-grid-empty-dots {
  display: inline-flex;
  gap: 8px;
}
.lobby-grid-empty-dots span {
  width: 9px;
  height: 9px;
  background: var(--neon-cyan);
  border-radius: 50%;
  opacity: 0.4;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.45);
  animation: lobbyDot 1.2s ease-in-out infinite;
}
.lobby-grid-empty-dots span:nth-child(2) { animation-delay: 0.15s; }
.lobby-grid-empty-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes lobbyDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-4px); }
}

/* 玩家頭像（大廳 chip 用）— Kahoot 四色與柔和點綴色 */
.lobby-av {
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  line-height: 1;
}
.lobby-av-1 { background: #FF8FA3; }
.lobby-av-2 { background: #6BCB77; }
.lobby-av-3 { background: #4D96FF; }
.lobby-av-4 { background: #FFD93D; color: #573a00; }
.lobby-av-5 { background: #C780FA; }
.lobby-av-6 { background: #FF9F45; }
.lobby-av-7 { background: #00C2A8; }
.lobby-av-8 { background: #F76E11; }
.lobby-av.lobby-av-img {
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
}

/* 響應式：較窄視窗時改為單欄堆疊 */
@media (max-width: 1024px) {
  .host-lobby {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .host-lobby-pin-card {
    align-self: stretch;
  }
}
@media (max-width: 768px) {
  .host-interface-fullscreen.is-lobby .main-question-area {
    top: 60px;
    padding: 16px;
  }
  .lobby-pin-row {
    flex-direction: column;
    align-items: stretch;
  }
  .lobby-qr {
    align-self: center;
  }
  .lobby-players-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

/* 4E: 浮動面板 — 深色玻璃 */
.floating-panels {
  position: fixed;
  top: 100px;
  left: 60px;
  right: 60px;
  height: 320px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  pointer-events: none;
  z-index: 50;
}

.stats-panel-float {
  grid-column: 1;
  max-height: 320px;
  overflow-y: auto;
  pointer-events: auto;
}

.live-rankings-panel-float {
  grid-column: 2;
  max-height: 320px;
  overflow-y: auto;
  pointer-events: auto;
}

.rankings-panel-float {
  grid-column: 3;
  max-height: 320px;
  overflow-y: auto;
  pointer-events: auto;
}

/* 深色玻璃面板 */
.floating-panels .card {
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 240, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: white;
}

.floating-panels .card:hover {
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 240, 255, 0.05);
}

.floating-panels .card h3,
.floating-panels .card h4 {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
  font-size: 1.55rem;
  font-weight: 800;
}

/* 主持人面板按鈕: 深色透明 + neon 邊框 */
.floating-panels .card .btn {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: white;
}

.floating-panels .card .btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.floating-panels .card .btn-success {
  background: rgba(38, 137, 12, 0.3);
  border-color: rgba(38, 137, 12, 0.5);
}
.floating-panels .card .btn-success:hover {
  background: rgba(38, 137, 12, 0.5);
  border-color: var(--kahoot-green);
}

.floating-panels .card .btn-danger {
  background: rgba(226, 27, 60, 0.2);
  border-color: rgba(226, 27, 60, 0.4);
}
.floating-panels .card .btn-danger:hover {
  background: rgba(226, 27, 60, 0.4);
  border-color: var(--kahoot-red);
}

.floating-panels .card .btn-primary {
  background: rgba(19, 104, 206, 0.2);
  border-color: rgba(19, 104, 206, 0.4);
}
.floating-panels .card .btn-primary:hover {
  background: rgba(19, 104, 206, 0.4);
  border-color: var(--kahoot-blue);
}

.host-layout {
  display: grid;
  grid-template-columns: minmax(500px, 2fr) minmax(320px, 1fr) minmax(380px, 1fr);
  gap: 24px;
  width: 100%;
  align-items: start;
  height: calc(100vh - 120px);
}

.host-left-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.host-middle-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) transparent;
}

.host-right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) transparent;
}

.current-question h3 {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.question-content .question-text {
  font-family: var(--font-body-zh), sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--player-text);
  line-height: 1.3;
}

.question-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.question-options .option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 2px solid var(--player-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 60px;
}

.question-options .option.correct {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--color-success);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f7fafc;
  border: 2px solid var(--player-border);
  border-radius: 50%;
  font-weight: 700;
  font-size: 16px;
  color: var(--player-text-secondary);
  flex-shrink: 0;
}

.question-options .option.correct .option-letter {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.option-text {
  font-weight: 500;
  font-size: 16px;
  color: var(--player-text-secondary);
  line-height: 1.4;
}

.live-stats h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.answer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: rgba(0, 240, 255, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 240, 255, 0.1);
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 4I: 答案統計 — Kahoot 色進度條 */
.answer-distribution {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  transition: all var(--transition-normal);
}

.option-label {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
}

/* Kahoot 色答案統計標籤 */
.option-stat[data-option="0"] .option-label { background: var(--kahoot-red); }
.option-stat[data-option="1"] .option-label { background: var(--kahoot-blue); }
.option-stat[data-option="2"] .option-label { background: var(--kahoot-yellow); }
.option-stat[data-option="3"] .option-label { background: var(--kahoot-green); }

.option-stat:not([data-option]) .option-label {
  background: rgba(255, 255, 255, 0.2);
}

.option-bar {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.option-progress {
  height: 100%;
  transition: width var(--transition-normal);
  border-radius: var(--radius-full);
}

/* Kahoot 色進度條 */
.option-stat[data-option="0"] .option-progress { background: var(--kahoot-red); }
.option-stat[data-option="1"] .option-progress { background: var(--kahoot-blue); }
.option-stat[data-option="2"] .option-progress { background: var(--kahoot-yellow); }
.option-stat[data-option="3"] .option-progress { background: var(--kahoot-green); }

.option-stat:not([data-option]) .option-progress {
  background: rgba(255, 255, 255, 0.5);
}

.option-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: white;
  min-width: 28px;
  text-align: center;
}

/* 即時答案統計的占位符樣式 */
.no-question-stats {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-placeholder {
  text-align: center;
  color: white;
}

.placeholder-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.9;
}

.placeholder-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  max-width: 200px;
  line-height: 1.4;
}

/* 答案統計中正確答案的樣式 */
.option-stat.correct-option {
  background: rgba(34, 197, 94, 0.1);
  border: 2px solid var(--color-success);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 4px 0;
}

.option-stat.correct-option .option-progress {
  background: var(--color-success) !important;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.correct-indicator {
  color: var(--color-success);
  font-weight: 700;
  font-size: 16px;
  margin-left: 8px;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.stats-summary {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 240, 255, 0.06);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--neon-cyan);
}

.summary-text {
  font-size: 14px;
  font-weight: 600;
  color: white;
  text-align: center;
}

/* 4H: 排行榜 — 前三名發光 (金/銀/銅) */
.rankings h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-fast);
}

.ranking-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* 前三名特殊發光 */
.ranking-item:nth-child(1) {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.25);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.1);
}

.ranking-item:nth-child(2) {
  background: rgba(192, 192, 192, 0.06);
  border-color: rgba(192, 192, 192, 0.2);
  box-shadow: 0 0 12px rgba(192, 192, 192, 0.08);
}

.ranking-item:nth-child(3) {
  background: rgba(205, 127, 50, 0.06);
  border-color: rgba(205, 127, 50, 0.2);
  box-shadow: 0 0 12px rgba(205, 127, 50, 0.08);
}

.ranking-item .rank-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: white;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  text-align: center;
}

/* 前三名金銀銅色數字 */
.ranking-item:nth-child(1) .rank-number { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.ranking-item:nth-child(2) .rank-number { color: #c0c0c0; text-shadow: 0 0 10px rgba(192, 192, 192, 0.4); }
.ranking-item:nth-child(3) .rank-number { color: #cd7f32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.4); }

.player-info {
  flex: 1;
}

.player-name {
  font-weight: 600;
  font-size: 16px;
  color: white;
  display: block;
  margin-bottom: 4px;
}

.player-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.player-stats span {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* 強化最終排名列表內的數據可見性 */
.ranking-item .player-stats {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.ranking-item .player-stats .score,
.ranking-item .player-stats .answers {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(0, 240, 255, 0.08);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

/* 即時排行榜樣式 */
.live-time-rankings {
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  margin-top: 12px;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-fast);
}

.ranking-row:hover {
  background: rgba(0, 240, 255, 0.04);
}

.ranking-row:last-child {
  border-bottom: none;
}

.ranking-row.correct {
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid var(--color-success);
}

.ranking-row .rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--neon-cyan);
  min-width: 24px;
}

.ranking-row .name {
  flex: 1;
  font-weight: 600;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-row .time {
  font-family: var(--font-display);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.ranking-row .flag {
  font-size: 16px;
}

.ranking-row .flag.correct {
  color: var(--color-success);
}

.ranking-row .flag.pending {
  color: rgba(255, 255, 255, 0.3);
}

.empty {
  text-align: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* 狀態占位符樣式 */
.game-status-placeholder {
  text-align: center;
  padding: 32px 16px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: white;
}

.status-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.status-text {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.status-detail {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  max-width: 280px;
  line-height: 1.4;
}

/* =============================================================================
   玩家介面 — 簡潔明亮白底
   ============================================================================= */

/* 5A: 容器 */
.player-interface {
  height: 100vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--player-bg);
}

/* 5B: Header */
.player-header {
  margin-bottom: 24px;
  padding: 0 8px;
}

.player-header .interface-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.player-title {
  font-family: var(--font-body-zh), sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--player-text);
  margin: 0;
  text-align: center;
}

.player-info-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: var(--player-surface);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  border: 1px solid var(--player-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
}

/* 玩家端 info-item 覆寫 */
.player-interface .info-item {
  color: var(--player-text);
  border-color: var(--player-border);
  padding: 4px 10px;
}

.player-interface .info-item:hover {
  background: rgba(19, 104, 206, 0.04);
  border-color: var(--kahoot-blue);
}

.player-interface .info-label {
  color: var(--player-text-secondary);
}

.player-interface .info-value {
  color: var(--player-text);
}

.player-interface .title-logo {
  filter: none;
}

.player-content {
  max-width: 800px;
  margin: 0 auto;
}

.waiting-room, .game-starting, .question-card, .game-finished {
  max-width: 700px;
  margin: 0 auto;
}

/* 5C: 題目卡片 */
.question-card {
  padding: 32px;
}

.player-interface .card {
  background: var(--player-surface);
  border: 1px solid var(--player-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.player-interface .card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.waiting-content, .starting-content, .finished-content {
  text-align: center;
}

/* 結算頁的排名列表保持左對齊；外層的置中只用於標題 / 分數區塊，列表本身各 row 需要靠左 */
.finished-content .ranking-list,
.finished-content .ranking-item,
.finished-content .ranking-item .player-info {
  text-align: left;
}

.player-interface .waiting-content h2,
.player-interface .starting-content h2 {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--player-text);
  text-shadow: none;
}

.player-interface .finished-content h2 {
  color: var(--player-text);
  text-shadow: none;
}

.player-interface .waiting-content p,
.player-interface .starting-content p {
  font-size: 1.1rem;
  color: var(--player-text-secondary);
  margin-bottom: 24px;
  text-shadow: none;
}

/* 主持人端等待/開始樣式保持 */
.waiting-content h2, .starting-content h2, .finished-content h2 {
  font-size: 2rem;
  margin-bottom: 16px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.waiting-content p, .starting-content p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--player-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--player-border);
}

.player-item .player-name {
  font-weight: 600;
  color: var(--player-text);
  text-align: left;
}

.player-item .host-badge {
  margin-left: auto;
}

.host-badge {
  background: var(--kahoot-blue);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-interface .question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.player-interface .question-number {
  font-weight: 600;
  color: var(--player-text-secondary);
  background: var(--player-bg);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--player-border);
}

/* 5C 題目文字 */
.question-text {
  font-family: var(--font-body-zh), sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--player-text);
  text-align: center;
  line-height: 1.4;
}

/* 參與者介面的題目圖片樣式 */
.player-interface .question-image-container {
  margin-bottom: 40px;
  padding: 0 16px;
}

.player-interface .question-image {
  max-height: 350px;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  border: 2px solid var(--player-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  object-fit: contain;
  transition: all var(--transition-normal);
}

.player-interface .question-image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-color: var(--kahoot-blue);
}

/* 5D: 選項按鈕 — Kahoot 四色全填色 + push-button */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.options-grid .option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 20px 32px;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 80px;
  text-align: left;
  position: relative;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Kahoot 四色選項 — 玩家端 */
.options-grid .option[data-option="0"] { background: var(--kahoot-red); }
.options-grid .option[data-option="1"] { background: var(--kahoot-blue); }
.options-grid .option[data-option="2"] { background: var(--kahoot-yellow); }
.options-grid .option[data-option="3"] { background: var(--kahoot-green); }

/* 沒有 data-option 的後備 */
.options-grid .option:not([data-option]) {
  background: var(--player-text-secondary);
}

.options-grid .option:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.options-grid .option:active {
  transform: translateY(0);
}

.options-grid .option.selected {
  outline: 4px solid white;
  outline-offset: -4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(255, 255, 255, 0.35);
}

/* 5F: 結果回饋 — 對齊主持端：保留 Kahoot 底色，以發光描邊顯示正確 */
.options-grid .option.correct {
  outline: 4px solid var(--color-success);
  outline-offset: 2px;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.6), inset 0 0 20px rgba(34, 197, 94, 0.2);
  animation: correctPulse 1.5s ease-in-out infinite;
}

.options-grid .option.wrong {
  opacity: 0.4;
  filter: saturate(0.6);
}

.options-grid.answered .option {
  pointer-events: none;
}

.options-grid.answered .option:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.options-grid .option .option-letter {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.options-grid .option.correct .option-letter {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.options-grid .option .option-text {
  font-family: var(--font-body-zh), sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 1.5vw, 1.4rem);
  color: white;
  line-height: 1.3;
}

.answer-actions {
  text-align: center;
}

.submit-answer {
  min-width: 200px;
  padding: 16px 32px;
  font-size: 16px;
}

.answer-submitted {
  text-align: center;
  padding: 24px;
  background: rgba(34, 197, 94, 0.06);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-success);
}

.submitted-message {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-success);
}

.answer-result {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius-md);
  margin-top: 24px;
}

.result-message {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-message.correct {
  color: var(--color-success);
}

.result-message.wrong {
  color: var(--color-error);
}

.result-details {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}

.result-details span {
  background: var(--player-bg);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--player-text);
  font-weight: 500;
  border: 1px solid var(--player-border);
}

/* 5G: 結束畫面 */
.final-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 32px 0;
}

.score-info, .rank-info {
  text-align: center;
  padding: 24px;
  background: var(--player-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--player-border);
}

.final-score .score-number, .final-score .rank-number {
  display: block;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.player-interface .final-score .score-number,
.player-interface .final-score .rank-number {
  color: var(--player-text);
}

.score-label, .rank-label {
  font-size: 1rem;
  color: var(--player-text-secondary);
}

.player-interface .score-label,
.player-interface .rank-label {
  color: var(--player-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.game-stats .stat-item {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-sm);
}

.player-interface .game-stats .stat-item {
  background: var(--player-bg);
  border: 1px solid var(--player-border);
}

.game-stats .stat-number {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.player-interface .game-stats .stat-number {
  color: var(--player-text);
  text-shadow: none;
}

.game-stats .stat-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-interface .game-stats .stat-label {
  color: var(--player-text-secondary);
  text-shadow: none;
}

/* 玩家端最終排名列表 */
.player-interface .ranking-item {
  background: var(--player-bg);
  border: 1px solid var(--player-border);
}

.player-interface .ranking-item:hover {
  background: var(--player-bg);
}

.player-interface .ranking-item .rank-number {
  font-family: var(--font-display);
  color: var(--player-text);
}

.player-interface .ranking-item .player-name {
  color: var(--player-text);
}

.player-interface .ranking-item .player-stats span {
  background: var(--player-bg);
  color: var(--player-text-secondary);
  border: 1px solid var(--player-border);
}

/* 玩家端前三名 */
.player-interface .ranking-item:nth-child(1) {
  background: rgba(255, 215, 0, 0.06);
  border-color: rgba(255, 215, 0, 0.3);
}
.player-interface .ranking-item:nth-child(1) .rank-number { color: #b8860b; }

.player-interface .ranking-item:nth-child(2) {
  background: rgba(192, 192, 192, 0.06);
  border-color: rgba(192, 192, 192, 0.3);
}
.player-interface .ranking-item:nth-child(2) .rank-number { color: #808080; }

.player-interface .ranking-item:nth-child(3) {
  background: rgba(205, 127, 50, 0.06);
  border-color: rgba(205, 127, 50, 0.3);
}
.player-interface .ranking-item:nth-child(3) .rank-number { color: #8b4513; }

/* =============================================================================
   動畫 (Step 9)
   ============================================================================= */

@keyframes neonGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.15);
  }
  50% {
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.6), 0 0 60px rgba(0, 240, 255, 0.25), 0 0 80px rgba(0, 240, 255, 0.1);
  }
}

@keyframes urgentPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
  }
}

@keyframes correctPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.6), 0 0 60px rgba(34, 197, 94, 0.2);
  }
}

@keyframes correctBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  60% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card, .btn, .option {
  animation: slideIn 0.3s ease;
}

.quiz-app {
  animation: fadeIn 0.5s ease;
}

/* =============================================================================
   響應式設計 (Step 10)
   ============================================================================= */

/* 主持人 1920px+ 大螢幕 */
@media (min-width: 1920px) {
  .main-question-text {
    font-size: 5.5rem;
  }

  .option-display .option-text {
    font-size: 2.2rem;
  }
}

@media (max-width: 1400px) {
  .host-layout {
    grid-template-columns: minmax(450px, 2fr) minmax(300px, 1fr) minmax(350px, 1fr);
  }
}

@media (max-width: 1200px) {
  .host-layout {
    grid-template-columns: minmax(400px, 1fr) minmax(300px, 1fr);
    height: auto;
  }

  .host-middle-panel {
    order: -1;
    max-height: 60vh;
  }

  .host-right-panel {
    grid-column: 1 / -1;
    margin-top: 12px;
    max-height: 50vh;
  }
}

@media (max-width: 1024px) {
  .host-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .host-middle-panel,
  .host-right-panel {
    order: -1;
    max-height: 50vh;
  }

  .host-info-bar, .player-info-bar {
    gap: 12px;
  }

  .info-item {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .host-interface, .player-interface {
    padding: 16px;
  }

  .host-title {
    font-size: 1.3rem;
  }

  .player-title {
    font-size: 1.4rem;
  }

  .host-info-bar, .player-info-bar {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px 14px;
  }

  .info-item {
    min-width: 70px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .loading-content {
    padding: 32px 24px;
    width: 95vw;
  }

  .loading-title-icon {
    width: 40px;
    height: 40px;
  }

  .loading-title {
    font-size: 2rem;
  }

  .loading-logo {
    width: 48px;
    height: 48px;
  }

  .title-logo {
    width: 28px;
    height: 28px;
  }

  .options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .question-options {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .final-score, .game-stats {
    grid-template-columns: 1fr;
  }

  .result-details {
    flex-direction: column;
    align-items: center;
  }

  .homepage-logo {
    width: 40px;
    height: 40px;
  }

  .selector-content h1 {
    font-size: 2.5rem;
  }

  .selector-content p {
    font-size: 1.2rem;
  }

  .selector-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .question-text {
    font-size: 1.3rem;
  }

  .player-title {
    font-size: 1.4rem;
  }

  .player-interface .question-image {
    max-height: 250px;
  }

  /* 保持 2x2 格局但縮小尺寸 */
  .options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .options-grid .option {
    min-height: 64px;
    padding: 14px 16px;
    gap: 14px;
  }

  .options-grid .option .option-letter {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .options-grid .option .option-text {
    font-size: 0.85rem;
  }

  .question-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .score-number, .rank-number {
    font-size: 2rem;
  }

  .homepage-logo {
    width: 32px;
    height: 32px;
  }

  .loading-content {
    padding: 24px 16px;
  }

  .loading-logo {
    width: 40px;
    height: 40px;
  }

  .loading-title-container {
    gap: 12px;
  }

  .loading-title-icon {
    width: 32px;
    height: 32px;
  }

  .loading-title {
    font-size: 1.8rem;
  }

  .title-logo {
    width: 24px;
    height: 24px;
  }

  .loading-steps {
    gap: 12px;
  }

  .step {
    padding: 10px 16px;
  }

  /* 全屏主持人介面響應式 */
  .host-top-bar {
    height: 60px;
    padding: 0 16px;
  }

  .main-question-area {
    top: 55%;
    padding: 20px;
  }

  .main-question-text {
    font-size: 3.2rem;
    margin-bottom: 50px;
  }

  .question-options-display {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .option-display {
    padding: 22px;
    min-height: 90px;
  }

  .option-display .option-text {
    font-size: 1.2rem;
  }

  .floating-panels {
    top: 70px;
    left: 10px;
    right: 10px;
    height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stats-panel-float,
  .live-rankings-panel-float,
  .rankings-panel-float {
    grid-column: auto;
    max-height: 20vh;
  }

  .top-bar-controls {
    gap: 6px;
  }

  .top-bar-question-set {
    max-width: 140px;
    font-size: 12px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .waiting-content h1 {
    font-size: 3rem;
  }

  .waiting-content p {
    font-size: 1.2rem;
  }
}

/* =============================================================================
   自定義滾動條
   ============================================================================= */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.3);
}

/* 玩家端滾動條 */
.player-interface ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

.player-interface ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* =============================================================================
   舊版聊天樣式 (向後相容)
   ============================================================================= */

.chat {
  padding-top: 40px;
}

.message {
  margin-bottom: 10px;
}

.message .user {
  font-weight: bold;
  text-align: right;
}

.message .remove {
  position: absolute;
  width: 22px;
  height: 20px;
  left: -60px;
  display: none;
  padding: 0;
  line-height: 18px;
  border: none;
}

.send-message {
  padding: 0;
}

.my-input-text::placeholder {
  color: #ccc;
}

/* =============================================================================
   主持人結算頒獎台 (Podium)
   ============================================================================= */
.podium {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 32px;
  overflow: hidden;
}

.podium-stage {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 32px;
  padding: 0 40px;
  min-height: 0;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  animation: podiumUp 0.8s cubic-bezier(.2, .7, .2, 1) backwards;
}
.podium-col.p1 { animation-delay: 0.5s; }
.podium-col.p2 { animation-delay: 0.2s; }
.podium-col.p3 { animation-delay: 0s; }

@keyframes podiumUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.podium-crown {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(255, 214, 107, 0.5));
  animation: podiumCrownBob 2.4s ease-in-out infinite;
}

@keyframes podiumCrownBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-4px) rotate(3deg); }
}

.podium-av {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 52px;
  line-height: 1;
  color: white;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.3),
    0 18px 36px rgba(0, 0, 0, 0.32);
}

.podium-col.p1 .podium-av {
  background: linear-gradient(135deg, #FFE48F 0%, #E0A21A 100%);
}
.podium-col.p2 .podium-av {
  background: linear-gradient(135deg, #E8ECF2 0%, #8A94A6 100%);
}
.podium-col.p3 .podium-av {
  background: linear-gradient(135deg, #F0BD92 0%, #B26A3A 100%);
}

.podium-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.65rem;
  color: white;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
}

.podium-score {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
}

.podium-bar {
  width: 100%;
  border-radius: 16px 16px 0 0;
  padding: 14px 12px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

.podium-col.p1 .podium-bar {
  height: clamp(180px, 32vh, 280px);
  background: linear-gradient(180deg, #FFEFA0 0%, #FFD66B 100%);
  color: #6b4e08;
}
.podium-col.p2 .podium-bar {
  height: clamp(130px, 24vh, 200px);
  background: linear-gradient(180deg, #F4F6FA 0%, #C9CFD9 100%);
  color: #2e3441;
}
.podium-col.p3 .podium-bar {
  height: clamp(90px, 18vh, 145px);
  background: linear-gradient(180deg, #F8C8A0 0%, #D38A56 100%);
  color: #5b2d0d;
}

.podium-foot {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}

.podium-foot-h {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 28px rgba(0, 240, 255, 0.45), 0 0 56px rgba(0, 240, 255, 0.18);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.podium-foot-s {
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.02em;
}

/* Confetti */
.podium-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.podium-confetti span {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  top: -20px;
  animation: podiumConfettiFall linear forwards;
}
@keyframes podiumConfettiFall {
  to { transform: translateY(110vh) rotate(720deg); }
}

/* 響應式：較窄視窗下調整 podium 比例 */
@media (max-width: 768px) {
  .podium-stage {
    padding: 0 16px;
    gap: 16px;
  }
  .podium-av {
    width: 72px;
    height: 72px;
    font-size: 38px;
  }
  .podium-name {
    font-size: 1rem;
  }
  .podium-bar {
    font-size: 2rem;
    padding: 10px 8px;
  }
}


/* =============================================================================
   題目編輯器 modal
   ============================================================================= */
.question-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: qeFadeIn 0.18s ease;
}

@keyframes qeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.question-editor-modal {
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--host-bg-secondary);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 32px rgba(0, 240, 255, 0.08);
  color: white;
  overflow: hidden;
}

.question-editor-modal.qe-create-modal {
  max-width: 480px;
}

.question-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 240, 255, 0.04);
}

.qe-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qe-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

.qe-set-name {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.qe-error {
  margin: 12px 24px 0;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  color: #fecaca;
  font-size: 14px;
}

.qe-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  flex: 1;
}

.qe-loading,
.qe-empty {
  text-align: center;
  padding: 40px 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
}

.qe-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qe-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.qe-item:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.qe-item-new {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.04);
}

.qe-item-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--neon-cyan);
  flex-shrink: 0;
  min-width: 36px;
}

.qe-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.qe-item-text {
  font-size: 16px;
  font-weight: 600;
  color: white;
  line-height: 1.4;
  word-break: break-word;
}

.qe-item-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.qe-item-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.qe-item-opt-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.qe-item-opt.qe-option-0 .qe-item-opt-letter { background: var(--kahoot-red); color: white; }
.qe-item-opt.qe-option-1 .qe-item-opt-letter { background: var(--kahoot-blue); color: white; }
.qe-item-opt.qe-option-2 .qe-item-opt-letter { background: var(--kahoot-yellow); color: white; }
.qe-item-opt.qe-option-3 .qe-item-opt-letter { background: var(--kahoot-green); color: white; }

.qe-item-opt-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qe-item-opt.is-correct {
  background: rgba(34, 197, 94, 0.12);
  outline: 1px solid rgba(34, 197, 94, 0.4);
  color: white;
}

.qe-item-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  gap: 12px;
  align-items: center;
}

.qe-item-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
}

/* 表單裡的圖片區塊 */
.qe-image-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qe-image-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
}

.qe-image-preview img {
  max-width: 200px;
  max-height: 140px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.4);
}

.qe-image-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qe-image-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-sm);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.qe-image-btn:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.16);
  border-color: var(--neon-cyan);
}

.qe-image-btn input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.qe-image-btn-danger {
  background: rgba(226, 27, 60, 0.12);
  border-color: rgba(226, 27, 60, 0.4);
  color: #ffb3bf;
}

.qe-image-btn-danger:hover:not(:disabled) {
  background: rgba(226, 27, 60, 0.25);
  border-color: var(--kahoot-red);
  color: white;
}

.qe-image-upload-empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.qe-image-upload-empty:hover {
  background: rgba(0, 240, 255, 0.04);
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--neon-cyan);
}

.qe-image-upload-empty input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.qe-image-upload-icon {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

.qe-image-alt {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: white;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
}

.qe-image-alt:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18);
}

.qe-image-alt::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.qe-item-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
}

.qe-add-btn {
  margin-top: 16px;
  width: 100%;
  height: auto;
  padding: 14px;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  background: rgba(0, 240, 255, 0.06);
  border: 1px dashed rgba(0, 240, 255, 0.4);
  border-radius: var(--radius-md);
  color: var(--neon-cyan);
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.qe-add-btn:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--neon-cyan);
}

/* 編輯表單 */
.qe-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.qe-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qe-field-inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.qe-field-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qe-form textarea,
.qe-form input[type="text"],
.qe-form input[type="number"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: white;
  padding: 10px 12px;
  font-family: var(--font-body-zh), var(--font-body-en), sans-serif;
  font-size: 14px;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.qe-form textarea {
  resize: vertical;
  min-height: 60px;
}

.qe-form input[type="number"] {
  width: 100px;
}

.qe-form textarea:focus,
.qe-form input[type="text"]:focus,
.qe-form input[type="number"]:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18);
}

.qe-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qe-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.qe-option-row input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.qe-option-row input[type="radio"]:checked {
  border-color: var(--color-success);
}

.qe-option-row input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--color-success);
  border-radius: 50%;
}

.qe-option-row input[type="text"] {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  color: white;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

.qe-option-row input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.qe-option-row input[type="text"]:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.18);
}

.qe-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.qe-option-row.qe-option-0 .qe-option-letter { background: var(--kahoot-red); }
.qe-option-row.qe-option-1 .qe-option-letter { background: var(--kahoot-blue); }
.qe-option-row.qe-option-2 .qe-option-letter { background: var(--kahoot-yellow); }
.qe-option-row.qe-option-3 .qe-option-letter { background: var(--kahoot-green); }

.qe-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .question-editor-overlay {
    padding: 12px;
  }
  .qe-item {
    flex-direction: column;
    gap: 12px;
  }
  .qe-item-actions {
    align-self: flex-end;
  }
  .qe-item-options,
  .qe-options-grid {
    grid-template-columns: 1fr;
  }
}
