@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%, #0f1016 0%, #050608 100%);
  --panel-bg: rgba(255, 255, 255, 0.025);
  --panel-border: rgba(255, 255, 255, 0.07);
  --accent-color: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
  --btn-gradient: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --success-color: #10b981;
  --error-color: #ef4444;
  --glow-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Ambient glow nodes */
.ambient-glow-1 {
  position: absolute;
  top: 5%;
  left: 10%;
  width: 450px;
  height: 450px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

.ambient-glow-2 {
  position: absolute;
  bottom: 5%;
  right: 10%;
  width: 450px;
  height: 450px;
  background: rgba(168, 85, 247, 0.06);
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 760px;
  z-index: 1;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-area {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 300;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.4;
}

/* Panel Design */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  font-weight: 300;
}

/* Game Meta Info */
.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.question-tracker {
  color: var(--text-secondary);
}

.question-tracker strong, .timer-display strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.3s ease;
}

/* Quiz Content */
.quiz-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .answers-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.answer-btn {
  background: var(--btn-gradient);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 1.1rem 1.4rem;
  border-radius: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.answer-btn:active {
  transform: translateY(0);
}

/* Feedback Messages */
.feedback-msg {
  display: none;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  margin-top: 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-msg.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.feedback-msg.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #a7f3d0;
}

/* Submit Actions */
.action-btn {
  width: 100%;
  padding: 1.1rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 16px;
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.action-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input {
  width: 100%;
  padding: 1.1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: var(--glow-shadow);
  background: rgba(0, 0, 0, 0.4);
}

.final-score-text {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

.final-score-text strong {
  font-size: 1.5rem;
  color: var(--accent-color);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Leaderboard */
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--success-color);
  font-weight: 500;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success-color);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--panel-border);
  letter-spacing: 0.05em;
}

td {
  padding: 1rem;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

.rank-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

tr:nth-child(1) .rank-badge {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

tr:nth-child(2) .rank-badge {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

tr:nth-child(3) .rank-badge {
  background: rgba(217, 119, 6, 0.15);
  color: #d97706;
}

.loading-state {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2rem 0;
}

/* Status Alert Elements */
.status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.9rem;
  display: none;
}

.status.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.status.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Keyframes */
@keyframes pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.5;
  }
}

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