.modal-bg { backdrop-filter: blur(2px); }
.hidden { display:none!important; }

/* ========================================================
   玩家卡片樣式 (Player Card & Grid)
   ======================================================== */
.player-list-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 480px) {
  .player-list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .player-list-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .player-list-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.player-card {
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: all 0.2s ease;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.player-card.eliminated { background: #fef2f2 !important; border-color: #fecaca !important; color:#b91c1c; }
.player-card.ghost { background: #faf5ff !important; border-color: #d8b4fe !important; color: #7e22ce !important; }

.player-card .circle-icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ef;
  flex-shrink: 0;
}

.player-card .player-nick { 
  font-weight: 700; 
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.3;
}

.copy-btn {
  font-size: .9rem;
  border-radius: .4rem;
  border: 1px solid #dbeafe;
  background: #f0f4f8;
  padding: 0.25rem .75rem;
  color: #2563eb;
  cursor: pointer;
  transition: background 0.2s, color 0.15s;
}
.copy-btn:hover { background: #dbebfa; color: #1e3a8a; }

/* ========================================================
   學生端 O / X 作答按鈕樣式（選中高亮 / 未選變暗）
   ======================================================== */
.answer-btn-o.selected {
  background-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 0 0 4px #93c5fd !important;
  transform: scale(1.05);
  opacity: 1 !important;
}

.answer-btn-x.selected {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.5), 0 0 0 4px #fca5a5 !important;
  transform: scale(1.05);
  opacity: 1 !important;
}

.answer-btn-o.grayed, .answer-btn-x.grayed {
  background-color: #cbd5e1 !important;
  color: #94a3b8 !important;
  border: 1px solid #cbd5e1 !important;
  opacity: 0.25 !important;
  transform: scale(0.92);
  box-shadow: none !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

footer { background: rgba(255,255,255,0.35); border-top: 1px solid #e5e7eb; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: auto; }
input[type=number] { -moz-appearance: auto; }

/* lucky draw 標註與動畫 */
.lucky-draw-badge {
  display: inline-block;
  background: #fcd34d;
  color: #92400e;
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 0.1em .45em;
  font-weight: 700;
  border: 1px solid #fbbf24;
  vertical-align: middle;
}
@keyframes luckyDrawBlink {
  0%   { box-shadow: 0 0 0 0 #d97706, 0 0 0 4px #fde68a; }
  40%  { box-shadow: 0 0 10px 2px #f59e42, 0 0 0 3.5px #fde68a; }
  80%,100% { box-shadow: 0 0 0 0 #fde68a; }
}
.player-card.highlight-draw {
  border: 3px solid #fbbf24 !important;
  background: #fefce8 !important;
  animation: luckyDrawBlink 0.36s linear infinite;
  transition: border 0.2s;
  position: relative;
  z-index: 2;
}

/* ========================================================
   簡報嵌入與版面切換樣式 (Presentation & Layout Switcher)
   ======================================================== */
.presentation-card {
  background: #1e293b;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  border: 1px solid #334155;
  transition: all 0.3s ease;
}

.presentation-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 比例 */
  height: 0;
  overflow: hidden;
  background: #0f172a;
}

.presentation-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.presentation-toolbar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.layout-btn-group {
  display: inline-flex;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.layout-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #ffffff;
  color: #475569;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layout-btn:not(:last-child) {
  border-right: 1px solid #cbd5e1;
}

.layout-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.layout-btn.active {
  background: #2563eb;
  color: #ffffff;
}

/* 雙欄排版 (Split View) */
.layout-split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .layout-split-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.player-list-scroll {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* ========================================================
   倒數計時進度條 (Countdown Timer Progress Bar)
   ======================================================== */
.timer-wrapper {
  margin: 0.5rem 0 0.75rem 0;
}

.timer-bar-track {
  width: 100%;
  height: 0.65rem;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 9999px;
  transition: width 0.4s linear, background-color 0.3s ease;
}

.timer-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
}

.timer-bar-fill.danger {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
  animation: timerPulse 0.6s infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 1; }
  to { opacity: 0.6; }
}

/* ========================================================
   即時作答分佈條 (Live Answer Distribution Bar)
   ======================================================== */
.dist-bar-track {
  display: flex;
  width: 100%;
  height: 1.25rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dist-bar-o {
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease;
  overflow: hidden;
}

.dist-bar-x {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease;
  overflow: hidden;
}

/* ========================================================
   天使復活題金色光芒標籤 (Revive Round Badge)
   ======================================================== */
@keyframes reviveGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.4), inset 0 0 8px rgba(254, 240, 138, 0.6); }
  50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.8), inset 0 0 12px rgba(254, 240, 138, 0.9); }
}

.revive-round-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: 1px solid #fde68a;
  border-radius: 9999px;
  padding: 0.25rem 0.85rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  animation: reviveGlow 1.8s infinite;
}

/* ========================================================
   QR Code 容器卡片
   ======================================================== */
.qrcode-box {
  background: #ffffff;
  padding: 0.75rem;
  border-radius: 0.75rem;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid #e2e8f0;
}

.qrcode-box canvas, .qrcode-box img {
  display: block;
  margin: 0 auto;
}

/* ========================================================
   獲勝通關全螢幕光效 (Victory Celebration Overlay)
   ======================================================== */
.victory-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(254, 240, 138, 0.95) 0%, rgba(250, 204, 21, 0.9) 70%, rgba(202, 138, 4, 0.95) 100%);
  z-index: 100;
  display: flex;
  flex-col;
  align-items: center;
  justify-content: center;
  animation: victoryFadeIn 0.5s ease-out forwards;
}

@keyframes victoryFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.trophy-bounce {
  animation: trophyBounce 1.2s infinite ease-in-out;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.1); }
}

.hotkey-badge {
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.18);
  color: #ffffff;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: monospace;
  margin-left: 0.25rem;
}