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

:root {
  --theme: #8b5cf6;
  --theme-text: #fff;
  --dark-950: #0b0f1a;
  --dark-900: #0f172a;
  --dark-800: #1e293b;
  --glass: rgba(30, 41, 59, 0.72);
}

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

html, body {
  min-height: 100dvh;
  font-family: 'Inter', 'Outfit', sans-serif;
  background: var(--dark-900);
  color: #f1f5f9;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  background-image: radial-gradient(circle at 100% 0, #1e293b 0%, #0f172a 100%);
  background-attachment: fixed;
}

#app {
  min-height: 100dvh;
  position: relative;
}

.screen {
  min-height: 100dvh;
  display: none;
  opacity: 0;
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.screen.active {
  display: flex;
  opacity: 1;
}

.screen.leaving {
  opacity: 0;
  pointer-events: none;
}

/* Landing */
#screen-start {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem 2rem;
  position: relative;
  overflow: hidden;
}

.glow-blob {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 64rem);
  height: 600px;
  filter: blur(160px);
  opacity: 0.25;
  pointer-events: none;
  background: var(--theme);
}

.start-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 42rem;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.cover-wrap {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  aspect-ratio: 16 / 9;
  border-radius: 2rem;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s ease;
}

.cover-wrap:hover img { transform: scale(1.05); }

.cover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,15,26,0.8), transparent 50%);
  pointer-events: none;
}

.live-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--theme);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.start-title {
  text-align: center;
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem 0.5rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(16px);
  transition: background 0.2s;
}

.stat-pill:hover { background: rgba(255,255,255,0.1); }

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: 900;
  font-size: 0.9rem;
}

.stat-icon img { width: 1.25rem; height: 1.25rem; object-fit: contain; }

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cbd5e1;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 800;
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  color: var(--theme-text);
  background: var(--theme);
  box-shadow: 0 0 20px color-mix(in srgb, var(--theme) 60%, transparent);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover { transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }

.btn-primary .shine {
  position: absolute;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: width 0.5s, height 0.5s;
}

.btn-primary:hover .shine {
  width: 40rem;
  height: 40rem;
}

/* Quiz */
#screen-quiz {
  flex-direction: column;
  padding: 1rem 1rem 1.5rem;
  max-width: 42rem;
  margin: 0 auto;
  width: 100%;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  animation: fadeDown 0.4s ease both;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 1rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--theme), color-mix(in srgb, var(--theme) 70%, #fff));
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px color-mix(in srgb, var(--theme) 50%, transparent);
}

.coins-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  font-weight: 800;
  color: var(--theme);
  min-width: 5rem;
  justify-content: center;
}

.coins-badge img { width: 1.1rem; height: 1.1rem; }

.coins-badge.bump { animation: coinBump 0.35s ease; }

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

.question-card {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.5rem;
  padding: 1.25rem 1rem 1.5rem;
  margin-bottom: 1rem;
  min-height: 140px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  overflow: hidden;
}

.question-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
  pointer-events: none;
}

.timer-ring {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 44px;
  height: 44px;
  transform: scale(0.8);
  transform-origin: top right;
}

.timer-ring svg { transform: rotate(-90deg); }

.timer-ring circle.bg { stroke: rgba(255,255,255,0.1); }
.timer-ring circle.fg {
  stroke: var(--theme);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s linear;
}

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.question-text {
  text-align: center;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 800;
  line-height: 1.35;
  padding: 1.5rem 0.5rem 0.5rem;
  background: linear-gradient(to bottom right, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.options-grid {
  display: grid;
  gap: 0.65rem;
}

.option-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.9rem 1.1rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.option-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.option-btn.selected {
  border: 2px solid var(--theme);
  background: color-mix(in srgb, var(--theme) 12%, transparent);
  color: #fff;
  box-shadow: 0 0 15px color-mix(in srgb, var(--theme) 25%, transparent);
}

.option-btn.correct {
  background: rgba(34,197,94,0.2);
  border: 2px solid rgba(34,197,94,0.5);
  color: #86efac;
  box-shadow: 0 0 15px rgba(34,197,94,0.3);
}

.option-btn.wrong {
  background: rgba(239,68,68,0.2);
  border: 2px solid rgba(239,68,68,0.5);
  color: #fca5a5;
  box-shadow: 0 0 15px rgba(239,68,68,0.3);
}

.option-btn.dimmed { opacity: 0.45; transform: none; }

.option-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.option-dot.green { background: #22c55e; box-shadow: 0 0 10px rgba(34,197,94,0.8); }
.option-dot.red { background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,0.8); }

.question-enter {
  animation: qEnter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes qEnter {
  from { opacity: 0; transform: scale(0.98) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Results */
#screen-results {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}

.results-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.2;
  background: var(--theme);
  pointer-events: none;
}

.results-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 42rem;
  padding: 2rem 1.5rem;
  border-radius: 2rem;
  background: rgba(30,41,59,0.8);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  text-align: center;
  animation: popIn 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

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

.results-icon {
  width: 6rem;
  height: 6rem;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 0 15px color-mix(in srgb, var(--theme) 50%, transparent));
}

.results-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.results-sub {
  color: #94a3b8;
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.result-stat {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(255,255,255,0.05);
}

.result-stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.result-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
}

.result-stat-value.earned {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--theme);
}

.result-stat-value.earned img { width: 1.75rem; height: 1.75rem; }

/* Wheel section wrapper */
#screen-wheel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.6s ease;
  overflow-y: auto;
  background-color: #0b0c10;
  background-image: radial-gradient(ellipse at 50% 30%, #1f1b2e 0%, #0d0c14 70%, #050508 100%);
}

#screen-wheel.active {
  display: block;
  opacity: 1;
}

#screen-wheel .wheel-inner {
  min-height: 100dvh;
}

#screen-wheel .wheel-inner body-styles {
  all: initial;
}

@media (max-width: 380px) {
  .cover-wrap { border-radius: 1.5rem; }
  .option-btn { font-size: 0.875rem; padding: 0.75rem 0.9rem; }
}
