:root {
  color-scheme: dark;
  --sky-top: #140b2e;
  --sky-mid: #241044;
  --sky-low: #382056;
  --ink: #fff8e8;
  --muted: #eadcbf;
  --stone: #d9d2c4;
  --stone-dark: #7c7180;
  --stone-ink: #271f35;
  --gold: #f7bd4a;
  --orange: #e87d2d;
  --leaf: #b94e28;
  --moss: #6fb77a;
  --correct: #66d58c;
  --wrong: #ffb07a;
  --focus: #ffe18a;
  --panel: rgba(34, 19, 57, 0.88);
  --panel-strong: rgba(20, 11, 46, 0.94);
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(247, 189, 74, 0.18), transparent 18rem),
    radial-gradient(circle at 82% 12%, rgba(232, 125, 45, 0.16), transparent 17rem),
    linear-gradient(180deg, var(--sky-top), var(--sky-mid) 58%, var(--sky-low));
}

body::before,
body::after {
  position: fixed;
  inset: auto 0 0;
  height: 18vh;
  content: "";
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(80% 90% at 12% 100%, rgba(111, 183, 122, 0.18), transparent 54%),
    radial-gradient(80% 90% at 88% 100%, rgba(247, 189, 74, 0.13), transparent 54%),
    linear-gradient(180deg, transparent, rgba(11, 9, 23, 0.6));
}

body::after {
  height: 9vh;
  background: #171226;
  clip-path: polygon(0 64%, 8% 58%, 16% 66%, 28% 55%, 41% 64%, 55% 52%, 71% 61%, 84% 54%, 100% 63%, 100% 100%, 0 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 10px 14px;
  color: var(--stone-ink);
  background: var(--focus);
  border-radius: 6px;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(14px, 3vw, 36px);
  background: rgba(20, 11, 46, 0.92);
  border-bottom: 1px solid rgba(247, 189, 74, 0.34);
  backdrop-filter: blur(14px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #271f35;
  background: linear-gradient(135deg, var(--gold), #ffd98a);
  border-radius: 50%;
  font-weight: 900;
  box-shadow: 0 0 22px rgba(247, 189, 74, 0.36);
}

.progress-wrap {
  min-width: 0;
}

.progress-title,
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.meter {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 248, 232, 0.12);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  border-radius: inherit;
  transition: width 220ms ease;
}

main {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(30px, 6vw, 70px) 0 80px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.welcome-screen {
  position: relative;
  min-height: calc(100vh - 150px);
  padding: clamp(34px, 8vw, 88px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(20, 11, 46, 0.9), rgba(20, 11, 46, 0.74) 46%, rgba(20, 11, 46, 0.28)),
    url("images/graveyard-scene.png"),
    radial-gradient(circle at 72% 22%, rgba(247, 189, 74, 0.2), transparent 11rem);
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(247, 189, 74, 0.26);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.welcome-screen::before,
.welcome-screen::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.welcome-screen::before {
  right: min(12vw, 120px);
  bottom: 0;
  width: clamp(170px, 24vw, 300px);
  height: clamp(210px, 30vw, 360px);
  background: linear-gradient(180deg, #d9d2c4, #9d94a2);
  border-radius: 50% 50% 8px 8px;
  box-shadow:
    inset 0 8px 0 rgba(255, 255, 255, 0.28),
    0 0 26px rgba(247, 189, 74, 0.2);
  opacity: 0.18;
}

.welcome-screen::after {
  right: calc(min(12vw, 120px) + clamp(34px, 7vw, 82px));
  bottom: clamp(80px, 13vw, 152px);
  width: clamp(72px, 11vw, 130px);
  height: 9px;
  background: #6a6070;
  box-shadow: 0 38px 0 #6a6070;
  opacity: 0.16;
}

.sky-glow {
  position: absolute;
  inset: 20% 10% auto auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(247, 189, 74, 0.34), transparent 66%);
}

.leaf,
.leaf::before,
.leaf::after {
  position: absolute;
  width: 28px;
  height: 18px;
  background: var(--leaf);
  border-radius: 100% 0 100% 0;
  transform: rotate(-18deg);
}

.leaf::before,
.leaf::after {
  content: "";
}

.leaf::before {
  transform: translate(28px, 12px) rotate(34deg);
  background: var(--orange);
}

.leaf::after {
  transform: translate(-20px, 28px) rotate(-36deg);
  background: #d78f32;
}

.leaf-one {
  top: 14%;
  left: 8%;
}

.leaf-two {
  right: 18%;
  bottom: 16%;
  transform: scale(0.9) rotate(24deg);
}

.welcome-copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 760px;
  margin: 12px 0;
  font-size: clamp(3rem, 9vw, 6.7rem);
  line-height: 0.96;
  text-shadow: 0 0 24px rgba(247, 189, 74, 0.22);
}

h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.02;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.28rem;
}

p {
  line-height: 1.6;
}

.subtitle {
  max-width: 720px;
  margin: 0 0 18px;
  color: #ffd98a;
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}

.primary-button,
.secondary-button,
.ghost-button,
.back-button {
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.primary-button {
  color: #241044;
  background: linear-gradient(135deg, var(--gold), #ffd98a);
  box-shadow: 0 0 24px rgba(247, 189, 74, 0.28);
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 248, 232, 0.14);
  border: 1px solid rgba(255, 248, 232, 0.34);
}

.ghost-button,
.back-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(247, 189, 74, 0.46);
}

.content-panel {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 50px);
  background: var(--panel);
  border: 1px solid rgba(247, 189, 74, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.direction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.direction-grid > div {
  padding: 20px;
  background: rgba(255, 248, 232, 0.1);
  border: 1px solid rgba(255, 248, 232, 0.18);
  border-radius: 8px;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  color: #241044;
  background: var(--gold);
  border-radius: 50%;
  font-weight: 900;
}

.section-heading {
  max-width: 800px;
  margin-bottom: 26px;
}

.graveyard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.tombstone-card {
  display: grid;
  min-height: 250px;
  padding: 30px 22px 22px;
  color: var(--stone-ink);
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.45), transparent 24%),
    linear-gradient(180deg, #e1dbcf, #aaa0ad);
  border: 0;
  border-radius: 48% 48% 8px 8px;
  box-shadow:
    inset 0 8px 0 rgba(255, 255, 255, 0.24),
    0 16px 32px rgba(0, 0, 0, 0.24);
  text-align: center;
}

.tombstone-card:hover {
  transform: translateY(-2px);
}

.tombstone-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.55rem;
}

.tombstone-card span {
  display: block;
  color: #4f4457;
}

.status-pill {
  justify-self: center;
  align-self: end;
  margin-top: 18px;
  padding: 8px 12px;
  color: #241044;
  background: #ffd98a;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 900;
}

.finish-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
}

.back-button {
  margin-bottom: 18px;
}

.exhibit-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 22px;
  align-items: start;
}

.relic-visual,
.question-panel {
  background: var(--panel);
  border: 1px solid rgba(247, 189, 74, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.relic-visual {
  overflow: hidden;
}

.image-frame {
  position: relative;
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(247, 189, 74, 0.15), rgba(255, 255, 255, 0.04)),
    rgba(255, 248, 232, 0.08);
}

.image-frame img {
  display: none;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.image-frame.has-image img {
  display: block;
}

.image-frame.has-image .image-placeholder {
  display: none;
}

.image-placeholder {
  display: grid;
  gap: 8px;
  place-items: center;
  width: min(100%, 360px);
  min-height: 210px;
  padding: 22px;
  color: var(--stone-ink);
  background: repeating-linear-gradient(135deg, #f7e2b1, #f7e2b1 12px, #f0c879 12px, #f0c879 24px);
  border: 3px dashed #5a4664;
  border-radius: 8px;
  text-align: center;
}

.image-placeholder span {
  font-size: 1.25rem;
  font-weight: 900;
}

.image-placeholder small {
  color: #3c3148;
  font-size: 0.9rem;
  font-weight: 800;
}

.clue-box,
.question-panel {
  padding: clamp(20px, 4vw, 32px);
}

#clue-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 24px;
}

.question-panel {
  display: grid;
  gap: 22px;
}

.question-group {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 248, 232, 0.16);
}

.question-group legend {
  margin-bottom: 12px;
  color: #ffd98a;
  font-size: 1.16rem;
  font-weight: 900;
}

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

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 248, 232, 0.1);
  border: 1px solid rgba(255, 248, 232, 0.18);
  border-radius: 8px;
}

.choice input {
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.18em;
  accent-color: var(--gold);
}

.choice.correct-choice {
  border-color: rgba(102, 213, 140, 0.95);
  box-shadow: inset 5px 0 0 var(--correct);
}

.choice.needs-look {
  border-color: rgba(255, 176, 122, 0.95);
  box-shadow: inset 5px 0 0 var(--wrong);
}

.feedback-box,
.reveal-box {
  display: none;
  padding: 18px;
  background: rgba(255, 248, 232, 0.1);
  border: 1px solid rgba(255, 248, 232, 0.2);
  border-radius: 8px;
}

.feedback-box.active,
.reveal-box.active {
  display: block;
}

.feedback-box ul,
.reveal-box dl {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
}

.feedback-box li {
  list-style: none;
}

.reveal-box dl {
  grid-template-columns: max-content 1fr;
}

.reveal-box dt {
  color: #ffd98a;
  font-weight: 900;
}

.reveal-box dd {
  margin: 0;
}

.action-row,
.score-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hidden {
  display: none;
}

.score-panel,
.reflection-panel {
  max-width: 920px;
}

.score-badge {
  display: inline-grid;
  place-items: center;
  min-height: 120px;
  margin: 18px 0 8px;
  padding: 24px;
  color: #241044;
  background: linear-gradient(135deg, var(--gold), #ffd98a);
  border-radius: 8px;
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 900;
  text-align: center;
}

#reflection-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

#reflection-form label {
  display: grid;
  gap: 8px;
  color: #ffd98a;
  font-weight: 900;
}

#reflection-form select,
#reflection-form textarea {
  width: 100%;
  color: #211630;
  background: #fff8e8;
  border: 3px solid transparent;
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.print-page {
  display: none;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .topbar .ghost-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .graveyard-grid,
  .direction-grid,
  .exhibit-layout {
    grid-template-columns: 1fr;
  }

  .welcome-screen::before,
  .welcome-screen::after {
    opacity: 0.26;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 16px;
  }

  main {
    width: min(100% - 22px, 520px);
    padding-top: 24px;
  }

  .topbar {
    align-items: start;
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .progress-stats,
  .action-row,
  .score-actions,
  .finish-row {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .back-button {
    width: 100%;
  }

  .welcome-screen {
    padding: 28px;
  }

  .reveal-box dl {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  @page {
    margin: 0.6in;
  }

  * {
    color: #111 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body::before,
  body::after,
  .topbar,
  main {
    display: none !important;
  }

  body {
    min-height: 0;
    font: 12pt Georgia, "Times New Roman", serif;
  }

  .print-page {
    display: block;
  }

  .print-page h1 {
    margin: 0 0 8px;
    font-size: 24pt;
    line-height: 1.1;
    text-shadow: none;
  }

  .print-page h2 {
    margin-top: 22px;
    font-size: 16pt;
  }

  .print-page dt {
    margin-top: 14px;
    font-weight: 700;
  }

  .print-page dd {
    margin: 4px 0 0;
    white-space: pre-wrap;
  }
}
