:root {
  color-scheme: light;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.5;
  --surface: #ffffff;
  --surface-muted: #f6f6f8;
  --border: #e0e3ea;
  --primary: #2878ff;
  --primary-dark: #125ee2;
  --text: #1c1f2a;
  --text-muted: #5b6473;
  --success: #1f9d55;
  --danger: #e5534b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface-muted);
  color: var(--text);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 960px;
  width: clamp(320px, 100%, 960px);
  box-shadow: 0 24px 40px -32px rgba(24, 32, 56, 0.32);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card h1,
.card h2 {
  margin: 0 0 0.5rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
}

.quiz-picker header {
  text-align: center;
}

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

.quiz-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-muted);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
}

button.primary {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  transition: background 150ms ease;
}

button.primary:disabled {
  background: #9fa7ba;
  cursor: not-allowed;
}

button.primary:not(:disabled):hover,
button.primary:not(:disabled):focus-visible {
  background: var(--primary-dark);
}

button.link {
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-weight: 500;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-body {
  display: grid;
  grid-template-columns: minmax(280px, 40%) 1fr;
  gap: 1.75rem;
}

.question-body figure {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 3 / 2;
  display: flex;
  flex-direction: column;
}

.question-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-placeholder {
  flex: 1;
  display: grid;
  place-items: center;
  color: #fff;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08) 10px, rgba(0, 0, 0, 0.08) 10px, rgba(0, 0, 0, 0.08) 20px);
}

.question-body figcaption {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  background: rgba(12, 16, 35, 0.72);
  color: #ecf1ff;
}

.question-body figcaption a {
  color: inherit;
  text-decoration: underline;
}

.question-content h2 {
  margin-top: 0;
}

.options {
  display: grid;
  gap: 0.75rem;
}

.option {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border 120ms ease, transform 120ms ease;
}

.option:not(:disabled):hover,
.option:not(:disabled):focus-visible {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.option .common-name {
  font-weight: 600;
  color: var(--text);
}

.option .scientific-name {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.option.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(40, 120, 255, 0.15);
}

.option.is-correct {
  border-color: var(--success);
}

.option.is-incorrect {
  border-color: var(--danger);
}

.question-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.feedback em {
  font-style: italic;
  color: var(--text);
}

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

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

.results-list article {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  background: var(--surface-muted);
}

.results-list header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.pill.is-correct {
  background: rgba(31, 157, 85, 0.15);
  color: var(--success);
}

.pill.is-incorrect {
  background: rgba(229, 83, 75, 0.15);
  color: var(--danger);
}

.pill.is-neutral {
  background: rgba(91, 100, 115, 0.18);
  color: var(--text-muted);
}

.last-result {
  align-self: center;
  background: var(--surface-muted);
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.card.error {
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 900px) {
  #app {
    padding: 2rem 1rem;
  }

  .question-body {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #121623;
    --surface-muted: #0d111a;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f7f9ff;
    --text-muted: #b3bdd2;
    --primary: #5a8dff;
    --primary-dark: #346af7;
  }

  body {
    background: var(--surface-muted);
  }

  .card {
    box-shadow: 0 32px 48px -36px rgba(0, 0, 0, 0.75);
  }

  .option {
    background: rgba(255, 255, 255, 0.03);
  }

  .results-list article {
    background: rgba(255, 255, 255, 0.04);
  }
}
