@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-gradient: radial-gradient(circle at 50% 50%, #151a30 0%, #0a0d1a 100%);
  --panel-bg: rgba(25, 30, 56, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  /* Vibrant Option Colors */
  --color-red: #ff4b72;
  --color-red-glow: rgba(255, 75, 114, 0.4);
  --color-blue: #3b82f6;
  --color-blue-glow: rgba(59, 130, 246, 0.4);
  --color-yellow: #f59e0b;
  --color-yellow-glow: rgba(245, 158, 11, 0.4);
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.4);
  
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --glow-accent: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Glassmorphism Containers */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 2.5rem;
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-premium), var(--glow-accent);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeIn 0.6s ease-out;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-premium), 0 0 30px rgba(99, 102, 241, 0.25);
}

/* Typography & Layout */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
}

p {
  color: var(--text-muted);
}

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

.muted-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Inputs & Form Elements */
input[type="text"] {
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  outline: none;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  text-align: center;
}

input[type="text"]:focus {
  border-color: #6366f1;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
  background: rgba(0, 0, 0, 0.35);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  gap: 0.5rem;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.5), 0 0 15px rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, #818cf8 0%, #5a4ff5 100%);
}

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

.btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #f87171 0%, #e11d48 100%);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.5);
}

/* Quiz Options Layout */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .options-grid.grid-cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.option-btn {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  gap: 1rem;
}

.option-icon {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

/* Option Colors & Styling */
.option-btn.opt-A { border-left: 6px solid var(--color-red); }
.option-btn.opt-B { border-left: 6px solid var(--color-blue); }
.option-btn.opt-C { border-left: 6px solid var(--color-yellow); }
.option-btn.opt-D { border-left: 6px solid var(--color-green); }

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.option-btn:hover:not(:disabled) .option-icon {
  transform: scale(1.25);
}

.option-btn.opt-A:hover:not(:disabled) { box-shadow: 0 5px 15px var(--color-red-glow); }
.option-btn.opt-B:hover:not(:disabled) { box-shadow: 0 5px 15px var(--color-blue-glow); }
.option-btn.opt-C:hover:not(:disabled) { box-shadow: 0 5px 15px var(--color-yellow-glow); }
.option-btn.opt-D:hover:not(:disabled) { box-shadow: 0 5px 15px var(--color-green-glow); }

/* Option Selection states */
.option-btn.selected {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}
.option-btn.selected.opt-A { box-shadow: 0 0 25px var(--color-red), inset 0 0 15px var(--color-red-glow); }
.option-btn.selected.opt-B { box-shadow: 0 0 25px var(--color-blue), inset 0 0 15px var(--color-blue-glow); }
.option-btn.selected.opt-C { box-shadow: 0 0 25px var(--color-yellow), inset 0 0 15px var(--color-yellow-glow); }
.option-btn.selected.opt-D { box-shadow: 0 0 25px var(--color-green), inset 0 0 15px var(--color-green-glow); }

/* Feedback states (correct/incorrect) */
.option-btn.correct-reveal {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--color-green) !important;
  box-shadow: 0 0 20px var(--color-green-glow) !important;
  animation: pulseGreen 1.5s infinite;
}

.option-btn.incorrect-reveal {
  opacity: 0.35;
  filter: grayscale(80%);
}

/* Timer Ring & Progress */
.timer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  position: relative;
}

.timer-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  border: 4px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  transition: all 0.3s ease;
  z-index: 2;
}

.timer-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1rem;
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  width: 100%;
  transition: width 1s linear;
}

/* Leaderboard List */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  transition: all 0.3s ease;
  animation: slideIn 0.4s ease-out;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(3px);
}

.leaderboard-rank {
  font-size: 1.2rem;
  font-weight: 800;
  width: 35px;
  color: var(--text-muted);
}

.leaderboard-item:nth-child(1) .leaderboard-rank { color: #f59e0b; font-size: 1.5rem; } /* Gold */
.leaderboard-item:nth-child(2) .leaderboard-rank { color: #94a3b8; font-size: 1.35rem; } /* Silver */
.leaderboard-item:nth-child(3) .leaderboard-rank { color: #b45309; font-size: 1.25rem; } /* Bronze */

.leaderboard-item:nth-child(1) {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.05);
}

.leaderboard-name {
  flex-grow: 1;
  font-weight: 600;
  font-size: 1.1rem;
}

.leaderboard-score {
  font-weight: 800;
  font-size: 1.2rem;
  color: #818cf8;
}

.offline-player {
  opacity: 0.5;
}

/* Status Cards & Banners */
.result-banner {
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-banner.correct {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--color-green);
  color: #34d399;
}

.result-banner.incorrect {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--color-red);
  color: #f87171;
}

.points-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

/* Admin Grid System */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 95%;
  max-width: 1200px;
  margin: 2rem auto;
}

@media (min-width: 900px) {
  .admin-layout {
    grid-template-columns: 3fr 2fr;
  }
}

.admin-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  padding: 1.5rem 2.5rem;
  border-radius: 20px;
}

.admin-controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.admin-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-player-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
}

.admin-player-card.voted {
  border-color: var(--color-blue);
  background: rgba(59, 130, 246, 0.1);
}

.admin-player-card.correct-card {
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.15);
}

.admin-player-card.incorrect-card {
  border-color: var(--color-red);
  background: rgba(255, 75, 114, 0.1);
}

.admin-player-card .kick-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 0.9rem;
}

.admin-player-card:hover .kick-btn {
  opacity: 1;
}

.admin-player-card .kick-btn:hover {
  color: var(--color-red);
}

/* Big Screen Elements */
.screen-layout {
  width: 95%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 90vh;
}

.screen-question {
  font-size: 2.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.3;
}

/* Big Screen Bar Chart */
.chart-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 350px;
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  border-bottom: 3px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
}

.chart-bar {
  width: 100%;
  border-radius: 12px 12px 0 0;
  min-height: 20px;
  transition: height 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10px;
}

.chart-bar.bar-A { background: var(--color-red); box-shadow: 0 0 20px var(--color-red-glow); }
.chart-bar.bar-B { background: var(--color-blue); box-shadow: 0 0 20px var(--color-blue-glow); }
.chart-bar.bar-C { background: var(--color-yellow); box-shadow: 0 0 20px var(--color-yellow-glow); }
.chart-bar.bar-D { background: var(--color-green); box-shadow: 0 0 20px var(--color-green-glow); }

.chart-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
}

.chart-label {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-label.lbl-A { border: 2px solid var(--color-red); color: var(--color-red); }
.chart-label.lbl-B { border: 2px solid var(--color-blue); color: var(--color-blue); }
.chart-label.lbl-C { border: 2px solid var(--color-yellow); color: var(--color-yellow); }
.chart-label.lbl-D { border: 2px solid var(--color-green); color: var(--color-green); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 0.9; transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
