/* ══════════════════════════════════════
   KNOWLEDGE MOUNTAIN - Master Stylesheet
   ══════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --sky-top: #4CA1FF;
  --sky-mid: #87CEEB;
  --sky-bot: #B8E4F0;
  --mountain: #6B8E4E;
  --grass: #4CAF50;
  --rock: #8D7B68;
  --snow: #F5F5F5;
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
  --common-bg: #e8e8e8;
  --rare-bg: #d4e8ff;
  --epic-bg: #e8d4ff;
  --legendary-bg: #fff3d4;
  --common-border: #a0a0a0;
  --rare-border: #007bff;
  --epic-border: #6f42c1;
  --legendary-border: #ffc107;
}

body { font-family: 'Segoe UI', 'Roboto', 'Noto Sans', Tahoma, Arial, sans-serif; overflow: hidden; }

.hidden { display: none !important; }

/* ══════════════════════════════════════
   PROJECTOR SCREEN (Canvas Mountain)
   ══════════════════════════════════════ */

.projector-body {
  background: #050e1f;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  margin: 0;
}

#projector {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#mountainCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ── HUD ── */
.proj-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  padding: 12px 0 0;
  z-index: 10;
  pointer-events: none;
}

.proj-title-bar {
  font-size: 3.5vw;
  font-weight: 900;
  background: linear-gradient(180deg, #fff 0%, #ffd700 50%, #f0a030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6)) drop-shadow(0 0 20px rgba(255,215,0,0.25));
  letter-spacing: 5px;
}

.proj-status {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 30px;
  border-radius: 30px;
  font-size: 1.6vw;
  font-weight: 800;
  letter-spacing: 2px;
  backdrop-filter: blur(6px);
}

.proj-status.waiting { background: rgba(255,255,255,0.15); color: #aaa; }
.proj-status.playing { background: rgba(46,204,113,0.25); color: #2ecc71; border: 1px solid rgba(46,204,113,0.4); }
.proj-status.paused { background: rgba(241,196,15,0.25); color: #f1c40f; border: 1px solid rgba(241,196,15,0.4); }
.proj-status.finished { background: rgba(255,215,0,0.3); color: #FFD700; border: 1px solid rgba(255,215,0,0.5); animation: finishGlow 1s ease-in-out infinite; }

@keyframes finishGlow {
  0%,100% { box-shadow: 0 0 10px rgba(255,215,0,0.3); }
  50% { box-shadow: 0 0 25px rgba(255,215,0,0.6); }
}

/* ── Scoreboard (bottom) ── */
.proj-scoreboard {
  position: absolute;
  top: 80px;
  left: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  max-width: 260px;
}

.proj-sb-item {
  background: rgba(10,20,40,0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid;
  border-radius: 10px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: visible;
}

.proj-sb-rank { font-size: 1.3vw; font-weight: 900; color: #FFD700; min-width: 26px; text-align: center; flex-shrink: 0; }
.proj-sb-name { font-size: 1.15vw; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; flex: 1 1 0; min-width: 0; }
.proj-sb-pos { font-size: 1.15vw; font-weight: 700; color: rgba(255,255,255,0.85); margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.proj-sb-bar { width: 40px; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.proj-sb-bar > div { height: 100%; border-radius: 3px; transition: width 0.8s ease; }

.proj-sb-streak {
  position: absolute;
  right: -8px;
  top: -8px;
  font-size: 0.85vw;
  background: #e74c3c;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(231,76,60,0.6);
  z-index: 5;
  white-space: nowrap;
  animation: streakBadgePop 0.4s ease;
}

@keyframes streakBadgePop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.proj-sb-bounty {
  margin-right: 3px;
  font-size: 1.1vw;
}

.proj-sb-bounty-item {
  border-color: #FFD700 !important;
  box-shadow: 0 0 12px rgba(255,215,0,0.3);
}

/* ── Toast Notifications ── */
.proj-toasts {
  position: absolute;
  bottom: 70px;
  right: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 480px;
}

.proj-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1.3vw;
  font-weight: 800;
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.5);
  animation: toastIn 0.4s ease-out;
  border-left: 5px solid;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.proj-toast-icon { font-size: 1.8vw; flex-shrink: 0; }
.proj-toast-msg { line-height: 1.3; }

/* Type colors */
.proj-toast.movement  { background: rgba(39,174,96,0.85); border-color: #2ecc71; }
.proj-toast.tactical  { background: rgba(231,76,60,0.85); border-color: #e74c3c; }
.proj-toast.defense   { background: rgba(52,152,219,0.85); border-color: #3498db; }
.proj-toast.trap      { background: rgba(230,126,34,0.85); border-color: #e67e22; }
.proj-toast.gameChanger { background: rgba(241,196,15,0.85); border-color: #f1c40f; color: #1a1a2e; text-shadow: none; }
.proj-toast.system    { background: rgba(255,215,0,0.85); border-color: #FFD700; color: #1a1a2e; text-shadow: none; }
.proj-toast.challenge { background: rgba(155,89,182,0.85); border-color: #9b59b6; }
.proj-toast.admin     { background: rgba(46,204,113,0.8); border-color: #27ae60; }

@keyframes toastIn {
  0% { transform: translateX(100px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

.proj-toast-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100px); opacity: 0; }
}

/* ── Finish Overlay ── */
.proj-finish-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 1s;
}

.proj-finish-box {
  text-align: center;
}

.proj-finish-title {
  font-size: 5vw;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 0 40px rgba(255,215,0,0.5);
  margin-bottom: 30px;
  animation: finishBounce 1s ease-in-out infinite;
}

.proj-finish-rank-item {
  font-size: 2.5vw;
  font-weight: 800;
  color: #fff;
  margin: 12px 0;
  animation: popIn 0.5s ease-out both;
}

.proj-finish-medal { font-size: 3vw; margin-right: 10px; }
.proj-finish-pos { font-size: 1.8vw; color: rgba(255,255,255,0.6); margin-left: 10px; }

@keyframes finishBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

/* ══════════════════════════════════════
   ADMIN SCREEN
   ══════════════════════════════════════ */

.admin-body {
  background: #1a1a2e;
  color: #eee;
  height: 100vh;
  overflow-y: auto;
}

#admin {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.admin-title {
  text-align: center;
  font-size: 24px;
  color: #FFD700;
  margin-bottom: 20px;
}

.admin-section {
  background: #16213e;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.admin-section h2 {
  font-size: 16px;
  color: #87CEEB;
  margin-bottom: 12px;
  border-bottom: 1px solid #2a3a5e;
  padding-bottom: 6px;
}

.control-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.95); }

.btn-start { background: #27ae60; color: #fff; }
.btn-start:hover { background: #2ecc71; box-shadow: 0 0 15px rgba(46,204,113,0.5); }

.btn-pause { background: #f39c12; color: #fff; }
.btn-pause:hover { background: #e67e22; box-shadow: 0 0 15px rgba(243,156,18,0.5); }

.btn-reset { background: #e74c3c; color: #fff; }
.btn-reset:hover { background: #c0392b; box-shadow: 0 0 15px rgba(231,76,60,0.5); }

.btn-mode-active { background: #8e44ad; color: #fff; box-shadow: 0 0 12px rgba(142,68,173,0.5); }
.btn-mode-inactive { background: #4a4a6a; color: #aaa; }
.btn-mode-inactive:hover { background: #6c5ce7; color: #fff; }

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  background: #3498db;
  color: #fff;
  border-radius: 6px;
}

.game-status {
  margin-top: 10px;
  font-size: 14px;
  color: #aaa;
}

/* Team Table */
.team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.team-table th {
  background: #2a3a5e;
  padding: 8px;
  text-align: center;
}

.team-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid #2a3a5e;
}

.team-table tr:hover { background: rgba(255,255,255,0.05); }

.team-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.online-dot { color: #27ae60; }
.offline-dot { color: #e74c3c; }

.adjust-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin: 0 2px;
  color: #fff;
}

.adjust-btn.plus { background: #27ae60; }
.adjust-btn.minus { background: #e74c3c; }

/* Name Editor */
.name-editor {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-select, .admin-input {
  padding: 8px 12px;
  border: 1px solid #2a3a5e;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 14px;
}

.admin-input { flex: 1; }

/* Admin Event Log */
.admin-event-log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.admin-event-log .event-item { color: #ccc; padding: 2px 0; }

/* ══════════════════════════════════════
   PLAYER SCREEN — Colorful Quiz Game Style
   ══════════════════════════════════════ */

.player-body {
  background: radial-gradient(ellipse at 50% 0%, #1b3a6b 0%, #0f1f3d 50%, #0a1628 100%);
  color: #fff;
  min-height: 100vh;
  overflow-y: auto;
}

#player {
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 14px 24px;
  min-height: 100vh;
}

.screen { animation: fadeIn 0.3s; }

/* ── Banner (header bars) ── */
.p-banner {
  text-align: center;
  background: linear-gradient(180deg, #1e5dab, #1a3f7a);
  border: 3px solid #4ba3ff;
  border-radius: 50px;
  padding: 10px 20px 6px;
  margin: 0 auto 12px;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(75,163,255,0.35);
}

.p-banner-text {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.p-banner-sub {
  font-size: 13px;
  font-weight: 700;
  color: #ffd700;
  letter-spacing: 2px;
  margin-top: 2px;
}

.p-banner-correct { background: linear-gradient(180deg, #2d8c4e, #1a6b35); border-color: #4ae07a; box-shadow: 0 4px 20px rgba(74,224,122,0.3); }
.p-banner-target { background: linear-gradient(180deg, #c0392b, #962d22); border-color: #ff6b6b; box-shadow: 0 4px 20px rgba(255,107,107,0.3); }
.p-banner-challenge { background: linear-gradient(180deg, #8e44ad, #6c3483); border-color: #d2a8ff; box-shadow: 0 4px 20px rgba(210,168,255,0.3); }
.p-banner-finish { background: linear-gradient(180deg, #d4a017, #b8860b); border-color: #ffe066; box-shadow: 0 0 30px rgba(255,215,0,0.4); }

.p-subtitle {
  text-align: center;
  color: #8ab4f8;
  font-size: 15px;
  margin-bottom: 14px;
}

/* ── Team Selection ── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ── Individual join form ── */
.individual-join-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 0 20px;
}
.individual-name-input {
  width: 100%;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}
.individual-name-input:focus {
  border-color: #8e44ad;
  box-shadow: 0 0 14px rgba(142,68,173,0.5);
}
.individual-join-btn {
  width: 100%;
  max-width: 360px;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #8e44ad, #6c3483);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(142,68,173,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.individual-join-btn:hover { transform: scale(1.03); box-shadow: 0 6px 20px rgba(142,68,173,0.6); }
.individual-join-error {
  color: #e74c3c;
  font-size: 14px;
  font-weight: 600;
}

.team-select-btn {
  padding: 14px 8px;
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.team-select-btn:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.12);
}

.team-select-btn.connected {
  opacity: 0.35;
  cursor: not-allowed;
}

.team-join-error {
  background: rgba(231,76,60,0.25);
  border: 2px solid #e74c3c;
  color: #f5b7b1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  animation: fadeInShake 0.4s ease;
}

@keyframes fadeInShake {
  0% { opacity: 0; transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  70% { transform: translateX(-3px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ── Top Bar ── */
.p-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 6px;
}

.p-team-badge {
  font-size: 18px;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-streak-badge {
  background: linear-gradient(135deg, #ff6b35, #e74c3c);
  padding: 3px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,107,53,0.5);
  white-space: nowrap;
}

.streak-pulse {
  animation: streakPop 0.5s ease;
}

@keyframes streakPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.p-bounty-warning {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  padding: 6px 14px;
  border-radius: 8px;
  text-align: center;
  font-weight: 900;
  font-size: 13px;
  color: #fff;
  animation: bountyFlash 1.5s ease-in-out infinite;
  margin-bottom: 6px;
  box-shadow: 0 2px 12px rgba(212,160,23,0.5);
}

@keyframes bountyFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; box-shadow: 0 2px 20px rgba(255,215,0,0.8); }
}

.bounty-target {
  border-color: #FFD700 !important;
  box-shadow: 0 0 12px rgba(255,215,0,0.5);
  position: relative;
}

.p-result-main {
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.p-position-pill {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(243,156,18,0.4);
}

.p-progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
}

.p-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
  background: linear-gradient(90deg, #f39c12, #e74c3c, #e74c3c);
}

/* ── Effects ── */
.p-effects {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.p-effects-list { display: flex; gap: 4px; flex-wrap: wrap; }

.effect-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.effect-badge.shield { background: rgba(52,152,219,0.3); border: 2px solid #5dade2; color: #aed6f1; }
.effect-badge.trap { background: rgba(231,76,60,0.3); border: 2px solid #e74c3c; color: #f5b7b1; }

/* ── Get Question Button ── */
.p-action { text-align: center; margin: 14px 0; }

.p-btn-get-question {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #3498db 0%, #2471a3 100%);
  color: #fff;
  border: 3px solid #5dade2;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(52,152,219,0.4), inset 0 2px 0 rgba(255,255,255,0.15);
  transition: all 0.15s;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.p-btn-get-question:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 25px rgba(52,152,219,0.6), inset 0 2px 0 rgba(255,255,255,0.15);
}

.p-btn-get-question:active { transform: translateY(1px); }

.p-btn-get-question:disabled {
  background: linear-gradient(180deg, #5d6d7e, #4a5568);
  border-color: #7f8c8d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Question Card ── */
.p-question-area { margin: 12px 0; }

/* Speed Timer */
.p-speed-timer {
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.p-speed-timer.speed-active {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  box-shadow: 0 2px 10px rgba(46,204,113,0.5);
}

.p-speed-timer.speed-warning {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  animation: speedPulse 0.3s ease infinite;
}

.p-speed-timer.speed-expired {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
}

@keyframes speedPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Crit answer result */
.p-answer-result.crit {
  border: 3px solid #FFD700 !important;
  box-shadow: 0 0 30px rgba(255,215,0,0.6);
  animation: critFlash 0.5s ease;
}

@keyframes critFlash {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.p-question-card {
  background: linear-gradient(180deg, #eaf2fb, #d4e6f6);
  border: 3px solid #85c1e9;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.p-question-text {
  font-size: 18px;
  font-weight: 700;
  color: #1a3a5c;
  line-height: 1.5;
  text-align: center;
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', Tahoma, Arial, sans-serif;
}

/* ── Answer Options (colorful pill buttons) ── */
.p-options { display: flex; flex-direction: column; gap: 10px; }

.p-option-btn {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border: none;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25), inset 0 2px 0 rgba(255,255,255,0.2);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  position: relative;
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', Tahoma, Arial, sans-serif;
}

.p-option-btn .opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  font-size: 15px;
  font-weight: 900;
  margin-right: 12px;
  flex-shrink: 0;
}

.p-option-btn:nth-of-type(1) { background: linear-gradient(180deg, #f5a623, #e08e0b); }
.p-option-btn:nth-of-type(2) { background: linear-gradient(180deg, #4cd964, #36b24a); }
.p-option-btn:nth-of-type(3) { background: linear-gradient(180deg, #5ac8fa, #3a9fd8); }
.p-option-btn:nth-of-type(4) { background: linear-gradient(180deg, #af52de, #8b3fb8); }

.p-option-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.p-option-btn:active { transform: translateY(1px); filter: brightness(0.95); }
.p-option-btn:disabled { filter: brightness(0.5); cursor: not-allowed; transform: none; }

/* ── Answer Result ── */
.p-answer-result {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  padding: 14px;
  border-radius: 16px;
  margin: 12px 0;
  animation: popIn 0.4s ease-out;
  text-transform: uppercase;
}

.p-answer-result.correct {
  background: linear-gradient(135deg, rgba(46,204,113,0.25), rgba(39,174,96,0.15));
  color: #2ecc71;
  border: 3px solid #27ae60;
  box-shadow: 0 0 20px rgba(46,204,113,0.3);
}

.p-answer-result.wrong {
  background: linear-gradient(135deg, rgba(231,76,60,0.25), rgba(192,57,43,0.15));
  color: #e74c3c;
  border: 3px solid #c0392b;
  box-shadow: 0 0 20px rgba(231,76,60,0.3);
}

/* ── Perk Display ── */
.p-perk-display {
  margin: 12px 0;
  animation: fadeIn 0.3s;
}

/* ── Card Hand (vertical stack) ── */
.p-card-hand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 8px;
}

/* ── Horizontal Card ── */
.p-hcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 14px;
  border: 3px solid;
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
  animation: hcardSlide 0.4s ease-out both;
  box-shadow: 0 4px 16px var(--glow-color, rgba(0,0,0,0.3)),
              inset 0 1px 0 rgba(255,255,255,0.2);
}

.p-hcard:nth-child(1) { animation-delay: 0.1s; }
.p-hcard:nth-child(2) { animation-delay: 0.25s; }
.p-hcard:nth-child(3) { animation-delay: 0.4s; }

@keyframes hcardSlide {
  0% { transform: translateX(-40px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ── Rarity visual tiers ── */
.p-hcard.rarity-common { border-width: 2px; }
.p-hcard.rarity-uncommon { border-width: 2px; }
.p-hcard.rarity-rare { border-width: 3px; }
.p-hcard.rarity-epic {
  border-width: 3px;
  animation: hcardSlide 0.4s ease-out both, epicPulse 2s ease-in-out infinite;
}
.p-hcard.rarity-legendary {
  border-width: 4px;
  animation: hcardSlide 0.4s ease-out both, legendShimmer 1.5s ease-in-out infinite;
}

@keyframes epicPulse {
  0%, 100% { box-shadow: 0 4px 16px var(--glow-color), inset 0 1px 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 4px 28px var(--glow-color), 0 0 12px var(--glow-color), inset 0 1px 0 rgba(255,255,255,0.3); }
}

@keyframes legendShimmer {
  0%, 100% { box-shadow: 0 4px 20px var(--glow-color), inset 0 1px 0 rgba(255,255,255,0.25); filter: brightness(1); }
  50% { box-shadow: 0 4px 40px var(--glow-color), 0 0 20px var(--glow-color), inset 0 1px 0 rgba(255,255,255,0.4); filter: brightness(1.12); }
}

.p-hcard:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px var(--glow-color, rgba(0,0,0,0.4)),
              inset 0 1px 0 rgba(255,255,255,0.25);
  filter: brightness(1.08);
}

.p-hcard:active { transform: scale(0.98); }

.p-hcard.chosen {
  transform: scale(1.03);
  box-shadow: 0 0 30px var(--glow-color, rgba(255,255,255,0.4)),
              0 0 60px var(--glow-color, rgba(255,255,255,0.15));
}

/* Letter badge */
.p-hcard-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Icon */
.p-hcard-icon {
  font-size: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
  line-height: 1;
}

/* Info block */
.p-hcard-info {
  flex: 1;
  min-width: 0;
}

.p-hcard-name {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  line-height: 1.2;
  margin-bottom: 3px;
}

.p-hcard-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.88);
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Rarity tag */
.p-hcard-rarity {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 9px;
  font-weight: 900;
  color: rgba(255,255,255,0.45);
  letter-spacing: 1px;
}

/* Card header (letter + type) */
.p-hcard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.p-hcard-type {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Star rating */
.p-hcard-stars {
  font-size: 10px;
  color: #FFD700;
  letter-spacing: 1px;
  position: absolute;
  top: 6px;
  left: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Extra info tags */
.p-hcard-condition, .p-hcard-cost, .p-hcard-pierce {
  display: inline-block;
  margin-top: 4px;
  margin-right: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.p-hcard-condition {
  background: rgba(241,196,15,0.25);
  color: #f1c40f;
  border: 1px solid rgba(241,196,15,0.4);
}

.p-hcard-cost {
  background: rgba(231,76,60,0.25);
  color: #e74c3c;
  border: 1px solid rgba(231,76,60,0.4);
}

.p-hcard-pierce {
  background: rgba(52,152,219,0.25);
  color: #3498db;
  border: 1px solid rgba(52,152,219,0.4);
}

/* ── Perk Used Summary ── */
.p-perk-summary {
  margin: 12px 0;
  padding: 14px 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: popIn 0.3s ease-out;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3), inset 0 2px 0 rgba(255,255,255,0.15);
}

.p-perk-summary.movement { background: linear-gradient(135deg, #4cd964, #36b24a); }
.p-perk-summary.tactical { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.p-perk-summary.defense { background: linear-gradient(135deg, #5ac8fa, #3a9fd8); }
.p-perk-summary.gameChanger { background: linear-gradient(135deg, #f5a623, #e08e0b); }

.p-perk-summary-icon { font-size: 28px; flex-shrink: 0; }
.p-perk-summary-text { flex: 1; }

/* ── Target Selection Popup ── */
.p-target-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: fadeIn 0.2s;
  padding: 16px;
}

.p-target-popup {
  background: radial-gradient(ellipse at 50% 0%, #2a1040 0%, #150820 100%);
  border: 3px solid #e74c3c;
  border-radius: 24px;
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 40px rgba(231,76,60,0.3);
  animation: popIn 0.3s ease-out;
}

.p-target-header {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  color: #ff6b6b;
  margin-bottom: 16px;
  line-height: 1.4;
}

.p-target-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.p-target-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.p-target-btn:hover {
  transform: scale(1.04);
  background: rgba(231,76,60,0.2);
  border-color: #e74c3c;
}

.p-target-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.p-target-pos {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.6;
}

.p-target-cancel {
  display: block;
  width: 100%;
  padding: 10px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  background: transparent;
  color: #aaa;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.p-target-cancel:hover { border-color: #fff; color: #fff; }

/* ── Challenge Overlay ── */
.p-challenge-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
  padding: 16px;
}

.p-challenge-box {
  background: radial-gradient(ellipse at 50% 0%, #2c1a4a 0%, #1a0e30 100%);
  border: 3px solid #d2a8ff;
  border-radius: 24px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 0 40px rgba(210,168,255,0.25);
  animation: popIn 0.4s ease-out;
}

.p-challenge-from { text-align: center; font-size: 13px; color: #bb8fce; margin: 8px 0; }
.p-challenge-penalty { text-align: center; font-size: 14px; color: #ff6b6b; font-weight: 800; margin-bottom: 12px; }

.p-challenge-question-card {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.p-challenge-options { display: flex; flex-direction: column; gap: 8px; }

.p-challenge-opt-btn {
  padding: 12px 16px;
  border: 2px solid rgba(210,168,255,0.3);
  border-radius: 50px;
  background: rgba(255,255,255,0.05);
  color: #eee;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans', Tahoma, Arial, sans-serif;
}

.p-challenge-opt-btn:hover { border-color: #d2a8ff; background: rgba(210,168,255,0.15); transform: translateY(-1px); }
.p-challenge-opt-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Event ticker ── */
.p-events {
  margin-top: 12px;
  max-height: 80px;
  overflow-y: auto;
  font-size: 11px;
  color: #6B7B8D;
  padding: 6px 10px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
}

.p-events .event-item {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
  color: #7f8c9b;
}

/* ── Finished ── */
#finishedScreen { text-align: center; padding-top: 25vh; }

.p-finish-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 20px;
}

.p-finish-info {
  text-align: center;
  color: #fff;
}

.finish-medal {
  font-size: 80px;
  animation: finishMedalDrop 0.8s ease-out;
  filter: drop-shadow(0 4px 20px rgba(255,215,0,0.5));
}

.finish-rank {
  font-size: 28px;
  font-weight: 900;
  margin: 8px 0;
  letter-spacing: 3px;
  animation: finishSlideUp 0.6s ease 0.3s both;
}

.finish-team {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  animation: finishSlideUp 0.6s ease 0.5s both;
}

.finish-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  animation: finishSlideUp 0.6s ease 0.7s both;
}

.finish-stats span {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}

@keyframes finishMedalDrop {
  0% { transform: translateY(-60px) scale(0.3); opacity: 0; }
  60% { transform: translateY(10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

@keyframes finishSlideUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ══════════════════════════════════════
   CONFETTI
   ══════════════════════════════════════ */

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall linear forwards;
  z-index: 999;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

@media (max-width: 600px) {
  .p-hcard { padding: 12px 10px; gap: 10px; }
  .p-hcard-icon { font-size: 32px; }
  .p-hcard-name { font-size: 14px; }
  .p-hcard-desc { font-size: 12px; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .p-target-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════
   CASINO FX — Gambling/Casino Visual Effects
   ══════════════════════════════════════════════ */

/* FX Layers */
.casino-fx-layer, .coin-rain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
  contain: layout style;
}

/* ── Slot Machine Overlay ── */
.casino-slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: casinoFadeIn 0.3s ease;
}

.casino-slot-machine {
  background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
  border: 4px solid #f1c40f;
  border-radius: 24px;
  padding: 24px 32px;
  text-align: center;
  box-shadow: 0 0 30px rgba(241,196,15,0.2);
  max-width: 90vw;
}

.casino-slot-header {
  font-size: 28px;
  font-weight: 900;
  color: #f1c40f;
  text-shadow: 0 0 20px rgba(241,196,15,0.5);
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.casino-slot-reels {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.casino-reel {
  width: 70px;
  height: 60px;
  background: #111;
  border: 3px solid #e67e22;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.casino-reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.casino-reel-item {
  width: 70px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.casino-reel-final {
  background: rgba(241,196,15,0.1);
}

.casino-slot-lever {
  color: #e74c3c;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  animation: casinoBounce 0.6s ease infinite;
}

.casino-slot-flash {
  animation: casinoFlashOut 0.5s ease forwards;
}

/* ── Coin Shower ── */
.casino-coin {
  position: absolute;
  top: -50px;
  animation: casinoCoinFall linear forwards;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes casinoCoinFall {
  0% { top: -50px; opacity: 1; transform: translate3d(0,0,0) rotate(0deg) scale(1); }
  80% { opacity: 1; }
  100% { top: 110vh; opacity: 0; transform: translate3d(0,0,0) rotate(720deg) scale(0.5); }
}

/* ── Screen Flash ── */
.casino-screen-flash {
  position: absolute;
  inset: 0;
  opacity: 0.6;
  animation: casinoFlashPulse forwards;
}

@keyframes casinoFlashPulse {
  0% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ── Sparkle Burst ── */
.casino-sparkle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: casinoSparkle 0.6s ease-out forwards;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes casinoSparkle {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% {
    transform: translate(
      calc(cos(var(--angle)) * var(--dist)),
      calc(sin(var(--angle)) * var(--dist))
    ) scale(0);
    opacity: 0;
  }
}

/* ── Dice Roll ── */
.casino-dice {
  position: fixed;
  font-size: 48px;
  transform: translate(-50%, -50%);
  animation: casinoDiceRoll 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes casinoDiceRoll {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.5); opacity: 1; }
  50% { transform: translate(-50%, -50%) rotate(540deg) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -80px) rotate(720deg) scale(0); opacity: 0; }
}

/* ── Big Text Pop ── */
.casino-big-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: clamp(32px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: 4px;
  white-space: nowrap;
  animation: casinoBigPop 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 10001;
}

@keyframes casinoBigPop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-10deg); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.3) rotate(3deg); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1) rotate(-1deg); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* ── Shield Bubble ── */
.casino-shield-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  border: 4px solid rgba(52,152,219,0.6);
  background: rgba(52,152,219,0.1);
  transform: translate(-50%, -50%);
  animation: casinoShieldExpand 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes casinoShieldExpand {
  0% { width: 0; height: 0; opacity: 1; border-width: 4px; }
  70% { width: 200px; height: 200px; opacity: 0.6; border-width: 2px; }
  100% { width: 300px; height: 300px; opacity: 0; border-width: 1px; }
}

/* ── Confetti ── */
.casino-confetti {
  position: fixed;
  top: -20px;
  animation: casinoConfettiFall linear forwards;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes casinoConfettiFall {
  0% { top: -20px; opacity: 1; transform: translate3d(0,0,0) rotate(0deg); }
  50% { transform: translate3d(20px,0,0) rotate(360deg); }
  100% { top: 105vh; opacity: 0; transform: translate3d(-10px,0,0) rotate(720deg); }
}

/* ── Screen Shake ── */
.casino-shake {
  animation: casinoShake 0.4s ease !important;
}

@keyframes casinoShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px) rotate(-0.5deg); }
  30% { transform: translateX(8px) rotate(0.5deg); }
  50% { transform: translateX(-6px); }
  70% { transform: translateX(6px); }
  90% { transform: translateX(-3px); }
}

/* ── Card Flip ── */
.casino-card-flip {
  animation: casinoCardFlip 0.6s ease forwards;
  transform-style: preserve-3d;
}

@keyframes casinoCardFlip {
  0% { transform: rotateY(180deg) scale(0.8); opacity: 0.5; }
  50% { transform: rotateY(90deg) scale(1.05); }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

/* ── Helper Animations ── */
@keyframes casinoFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes casinoFlashOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

@keyframes casinoNeonPulse {
  0%, 100% { text-shadow: 0 0 10px rgba(241,196,15,0.5); }
  50% { text-shadow: 0 0 30px rgba(241,196,15,0.8), 0 0 60px rgba(241,196,15,0.3); }
}

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