:root {
  color-scheme: light;
  --ink: #17201f;
  --muted: #66706d;
  --paper: #fbfaf6;
  --surface: #ffffff;
  --line: #d8ddd4;
  --teal: #137c75;
  --coral: #d95f42;
  --gold: #d99b2b;
  --green: #2f7d4c;
  --charcoal: #263232;
  --shadow: 0 18px 50px rgb(23 32 31 / 12%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    "Prompt",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-weight: 300;
  background:
    linear-gradient(135deg, rgb(19 124 117 / 10%), transparent 32%),
    linear-gradient(225deg, rgb(217 95 66 / 12%), transparent 34%),
    var(--paper);
}

button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 28px;
  align-items: center;
  min-height: 218px;
  padding: 8px 0 28px;
}

.masthead-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.9rem;
  font-weight: 500;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.1rem, 5vw, 4.85rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
}

.site-credit {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  font-weight: 300;
}

.site-credit p {
  margin: 0;
}

.site-credit p + p {
  margin-top: 4px;
}

.masthead-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgb(23 32 31 / 10%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quiz-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-top: 10px;
}

.category-panel {
  position: sticky;
  top: 20px;
  min-width: 0;
}

.category-panel h2 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.category-list {
  display: grid;
  gap: 10px;
}

.category-button {
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgb(255 255 255 / 72%);
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.category-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), var(--line) 45%);
  background: var(--surface);
  box-shadow: 0 12px 28px rgb(23 32 31 / 8%);
}

.category-button[aria-pressed="true"] {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent), white 86%), transparent),
    var(--surface);
  box-shadow: inset 4px 0 0 var(--accent);
}

.category-name {
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}

.category-size {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.category-page {
  padding-top: 10px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.category-card {
  display: grid;
  align-content: space-between;
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), white 86%), transparent),
    var(--surface);
  box-shadow: 0 12px 32px rgb(23 32 31 / 8%);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 18px 44px rgb(23 32 31 / 12%);
}

.category-card .category-name {
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.35;
}

.category-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  margin-top: 18px;
  padding: 0 11px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--charcoal);
  font-size: 0.86rem;
  font-weight: 400;
}

.quiz-stage {
  min-width: 0;
}

.quiz-page {
  width: min(920px, calc(100vw - 32px));
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding-top: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--charcoal);
  font-weight: 400;
}

.quiz-credit {
  flex: 1;
  margin: 0;
  text-align: center;
}

.quiz-meta {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 400;
}

.active-category {
  color: var(--teal);
}

.question-card {
  display: grid;
  align-content: start;
  min-height: 360px;
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-text {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.45rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
}

.answer-panel {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.answer-panel h2 {
  margin-bottom: 8px;
  color: var(--coral);
  font-size: 0.95rem;
}

.answer-panel p {
  margin-bottom: 0;
  color: #30413e;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.button {
  padding: 0 18px;
  border: 1px solid transparent;
}

.button span,
.icon-button span {
  display: grid;
  place-items: center;
  width: 1.2em;
  height: 1.2em;
  font-weight: 500;
  line-height: 1;
}

.button-primary {
  color: #ffffff;
  background: var(--charcoal);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.icon-button {
  width: 46px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--teal);
  background: var(--surface);
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgb(23 32 31 / 12%);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 22px 0;
  }

  .masthead {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: 0;
    padding-bottom: 22px;
  }

  .masthead-image {
    max-height: 210px;
  }

  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .category-panel {
    position: static;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-button {
    min-height: 74px;
  }

  .question-card {
    min-height: 330px;
  }
}

@media (max-width: 520px) {
  .category-list {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .quiz-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .quiz-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-credit {
    text-align: left;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
  }

  .button {
    padding-inline: 12px;
  }
}
