:root {
  color-scheme: light;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  --bg: #070b1a;
  --bg-card: rgba(255, 255, 255, 0.08);
  --card-blur: blur(26px);
  --text: #f4f5ff;
  --text-muted: rgba(244, 245, 255, 0.7);
  --pill-bg: rgba(255, 255, 255, 0.08);
  --pill-border: rgba(255, 255, 255, 0.22);
  --accent: #63f5b0;
  --accent-strong: #6f78ff;
  --danger: #ff6f91;
  --success: #8df7a5;
  --choice-bg: rgba(255, 255, 255, 0.05);
  --choice-hover: rgba(255, 255, 255, 0.12);
  --choice-selected: rgba(99, 245, 176, 0.2);
  --shadow: 0 20px 60px rgba(6, 9, 26, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #151b3c, #070b1a 60%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

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

button {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  background: var(--pill-bg);
  color: var(--text);
  transition: transform 120ms ease, background 120ms ease;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #041120;
  font-weight: 600;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--pill-border);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

.app {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
}

.app__header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

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

.scoreboard {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-weight: 600;
}

.card {
  background: var(--bg-card);
  backdrop-filter: var(--card-blur);
  border-radius: 32px;
  padding: clamp(1.2rem, 4vw, 2.2rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  transition: width 200ms ease;
}

.pill {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  font-weight: 500;
}

.pill--ghost {
  border-style: dashed;
}

.card__images {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card__image-frame {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.card__images img {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  object-fit: contain;
  max-height: 480px;
}

.card__image-frame figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.card__prompt {
  white-space: pre-line;
  font-size: 1rem;
}

.choices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice {
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  background: var(--choice-bg);
  border: 1px solid transparent;
  display: flex;
  gap: 0.85rem;
  align-items: center;
  transition: background 120ms ease, border 120ms ease, transform 120ms ease;
}

.choice:hover {
  background: var(--choice-hover);
}

.choice__label {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-weight: 600;
}

.choice--selected {
  background: var(--choice-selected);
  border-color: rgba(99, 245, 176, 0.5);
}

.choice--correct {
  border-color: var(--success);
  background: rgba(141, 247, 165, 0.15);
}

.choice--incorrect {
  border-color: var(--danger);
  background: rgba(255, 111, 145, 0.18);
}

.answer-details {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
}

.answer-details summary {
  cursor: pointer;
  font-weight: 600;
}

.answer-details[open] {
  animation: fadeIn 180ms ease;
}

#answer-text {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  white-space: pre-line;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.controls__nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

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

@media (min-width: 640px) {
  body {
    padding: 2.5rem;
  }

  .controls {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .controls__nav {
    width: 60%;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }

  .card__images img {
    max-height: min(55vh, 360px);
  }

  .controls {
    position: sticky;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
    background: linear-gradient(180deg, rgba(7, 11, 26, 0), rgba(7, 11, 26, 0.92));
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 28px;
    padding: 1rem;
    box-shadow: 0 -10px 30px rgba(4, 8, 20, 0.45);
  }

  .controls__nav {
    width: 100%;
  }
}

