:root {
  --color-bg: #010101;
  --color-surface: #0f0f0f;
  --color-surface-alt: #1a1a1a;
  --color-border: #1c1a1a;
  --color-primary: #0082f3;
  --color-primary-hover: #2895f7;
  --color-secondary: #ea384c;
  --color-accent: #a9ddd3;
  --color-text: #efefef;
  --color-text-muted: #758696;
  --color-text-soft: #cfcabe;
  --color-shadow: rgba(0, 0, 0, 0.35);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --font-heading: "Inter", "Poppins", "Segoe UI", Arial, sans-serif;
  --font-body: "Inter", "Poppins", "Segoe UI", Arial, sans-serif;
  --transition-base: 200ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('bg.jpeg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  display: flex;
  justify-content: center;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.glow {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 130, 243, 0.16), rgba(234, 56, 76, 0.1));
  filter: blur(120px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  padding: 48px 32px 80px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 48px;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-accent);
  margin-bottom: 12px;
}

h1,
h2 {
  margin: 0 0 16px;
  font-family: var(--font-heading);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.2;
}

.lead {
  color: var(--color-text-soft);
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--transition-base), box-shadow var(--transition-base),
    background var(--transition-base);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  box-shadow: 0 12px 24px rgba(0, 130, 243, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(0, 130, 243, 0.35);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--color-secondary), #ff8c79);
  color: #fff;
  box-shadow: 0 12px 22px rgba(234, 56, 76, 0.25);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(234, 56, 76, 0.35);
}

.btn-ghost {
  background: rgba(117, 134, 150, 0.1);
  color: var(--color-text);
  border: 1px solid rgba(117, 134, 150, 0.35);
}

.btn-ghost:hover {
  background: rgba(117, 134, 150, 0.2);
}

.btn-full {
  width: 100%;
}

.profile-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: rgba(26, 26, 26, 0.75);
  border: 1px solid rgba(117, 134, 150, 0.18);
  backdrop-filter: blur(12px);
  min-width: 220px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(169, 221, 211, 0.5);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  font-weight: 600;
}

.profile-handle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.edit-profile {
  align-self: flex-start;
  background: none;
  color: var(--color-primary-hover);
  border: none;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
}

.edit-profile:hover {
  text-decoration: underline;
}

.quiz-area {
  display: grid;
  gap: 28px;
  flex-grow: 1;
}

.panel {
  border-radius: var(--radius-lg);
  background: rgba(15, 15, 15, 0.92);
  border: 1px solid rgba(117, 134, 150, 0.18);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
  display: none;
}

.panel.active {
  display: block;
  animation: panelIn 350ms ease-out;
}

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

.panel-body {
  padding: 40px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  gap: 12px;
}

.feature-list li {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(28, 26, 26, 0.8);
  border: 1px solid rgba(117, 134, 150, 0.15);
}

.tip {
  color: var(--color-text-muted);
}

.tip kbd {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  background: rgba(117, 134, 150, 0.18);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.quiz-progress {
  margin-bottom: 32px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(117, 134, 150, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e9e3d5, #a9ddd3);
  border-radius: inherit;
  transition: width 250ms ease-out;
}

.question-card {
  background: rgba(26, 26, 26, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid rgba(117, 134, 150, 0.15);
  padding: 32px;
  margin-bottom: 32px;
}

#questionText {
  margin-bottom: 24px;
}

.answers {
  display: grid;
  gap: 16px;
}

.answer-option {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(117, 134, 150, 0.2);
  text-align: left;
  font-weight: 500;
  color: var(--color-text);
  transition: border var(--transition-base), transform var(--transition-base),
    background var(--transition-base);
}

.answer-option:hover {
  border-color: rgba(0, 130, 243, 0.6);
  transform: translateY(-1px);
}

.answer-option.selected {
  border-color: var(--color-primary);
  background: rgba(0, 130, 243, 0.12);
}

.answer-option.correct {
  border-color: var(--color-accent);
  background: rgba(169, 221, 211, 0.12);
}

.answer-option.incorrect {
  border-color: rgba(234, 56, 76, 0.7);
  background: rgba(234, 56, 76, 0.12);
}

.answer-option:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
}

.panel-actions .btn {
  min-width: 150px;
}

.result-body {
  display: grid;
  gap: 32px;
  text-align: center;
}

.score-summary p {
  color: var(--color-text-soft);
  margin: 8px 0 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.score-canvas {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(1, 1, 1, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  z-index: 10;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  width: min(420px, 100%);
  padding: 36px;
  border-radius: var(--radius-lg);
  background: rgba(15, 15, 15, 0.96);
  border: 1px solid rgba(117, 134, 150, 0.2);
  box-shadow: 0 30px 45px rgba(0, 0, 0, 0.55);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.profile-form {
  display: grid;
  gap: 18px;
}

.profile-form label {
  font-weight: 600;
  font-size: 0.95rem;
}

.profile-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(117, 134, 150, 0.35);
  background: rgba(26, 26, 26, 0.8);
  color: var(--color-text);
}

.profile-form input:focus {
  outline: 2px solid rgba(0, 130, 243, 0.5);
  outline-offset: 2px;
}

.handle-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.handle-field span {
  position: absolute;
  left: 14px;
  color: var(--color-text-muted);
}

.handle-field input {
  padding-left: 28px;
}

.helper-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

@media (max-width: 960px) {
  .app-shell {
    padding: 32px 20px 72px;
  }

  .panel-body {
    padding: 32px;
  }
}

@media (max-width: 720px) {
  body {
    padding: 24px 0;
  }

  .hero {
    flex-direction: column;
  }

  .profile-display {
    width: 100%;
  }

  .panel {
    border-radius: var(--radius-md);
  }

  .panel-body {
    padding: 28px 24px;
  }

  .question-card {
    padding: 24px;
  }

  .result-actions {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 24px 16px 64px;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
  }

  .btn,
  .panel-actions .btn {
    width: 100%;
  }

  .profile-display {
    flex-direction: column;
    align-items: flex-start;
  }
}

.main-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 48px;
  color: var(--color-text-muted);
}

.footer-logo {
  margin-bottom: 16px;
}

.main-footer a {
  color: var(--color-text-soft);
  text-decoration: none;
  transition: color var(--transition-base);
}

.main-footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.btn-custom {
  background-color: #e9e3d5;
  color: #141414;
  box-shadow: 0 12px 24px rgba(233, 227, 213, 0.25);
}

.btn-custom:hover {
  background-color: #dcd5c7;
  box-shadow: 0 18px 32px rgba(233, 227, 213, 0.35);
  transform: translateY(-1px);
}
#countdown {
  text-align: center;
}

#countdownText {
  font-size: 4rem;
  margin: 0;
  animation: countdownPulse 1s ease-in-out infinite;
}

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

.timer {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  margin-top: 16px;
  border-radius: 999px;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background-color: var(--color-accent);
  border-radius: inherit;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.timer-fill.warning {
  background-color: #f0c040;
}

.timer-fill.danger {
  background-color: var(--color-secondary);
}

/* Streak counter */
.streak-counter {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-accent);
  transition: opacity var(--transition-base);
}

.streak-counter:empty {
  display: none;
}

/* Answer number badges */
.answer-option {
  display: flex;
  align-items: center;
  gap: 14px;
}

.answer-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(117, 134, 150, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  transition: background var(--transition-base), color var(--transition-base);
}

.answer-option.selected .answer-badge {
  background: var(--color-primary);
  color: #fff;
}

.answer-option.correct .answer-badge {
  background: var(--color-accent);
  color: #111;
}

.answer-option.incorrect .answer-badge {
  background: var(--color-secondary);
  color: #fff;
}

/* Answer option entrance */
@keyframes answerSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.answer-option {
  animation: answerSlideIn 250ms ease-out both;
}

.answer-option:nth-child(2) { animation-delay: 40ms; }
.answer-option:nth-child(3) { animation-delay: 80ms; }
.answer-option:nth-child(4) { animation-delay: 120ms; }

/* Score stats chips */
.score-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(117, 134, 150, 0.1);
  border: 1px solid rgba(117, 134, 150, 0.15);
}

.stat-chip.correct { color: var(--color-accent); }
.stat-chip.incorrect { color: var(--color-secondary); }
.stat-chip.streak { color: #f0c040; }

/* Answer review */
.answer-review {
  text-align: left;
  width: 100%;
}

.answer-review summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 0;
  color: var(--color-text-muted);
  transition: color var(--transition-base);
}

.answer-review summary:hover {
  color: var(--color-text);
}

.answer-review-list {
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
  display: grid;
  gap: 8px;
  counter-reset: review;
}

.review-item {
  counter-increment: review;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(28, 26, 26, 0.8);
  border-left: 3px solid var(--color-accent);
  font-size: 0.9rem;
}

.review-item.wrong {
  border-left-color: var(--color-secondary);
}

.review-item .review-q {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
}

.review-item .review-a {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.review-item .review-a span {
  font-weight: 600;
}

.review-correct {
  color: var(--color-accent);
}

.review-wrong {
  color: var(--color-secondary);
}

/* Button active press state */
.btn:active {
  transform: translateY(1px) !important;
}