.overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: none;
  place-items: center;
  padding: max(16px, var(--safe-top)) max(16px, var(--safe-right)) max(16px, var(--safe-bottom)) max(16px, var(--safe-left));
  background: #173b367a;
  backdrop-filter: blur(5px) saturate(.85);
}

.overlay.open { display: grid; }

.panel {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 28px;
  text-align: center;
  background: var(--cream);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 0 0 4px var(--gold), 10px 10px 0 #172e35b8;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--aqua);
  border: 3px solid var(--ink);
  border-radius: 3px;
}
.panel::before { top: 9px; left: 9px; }
.panel::after { right: 9px; bottom: 9px; }

.scene-badge {
  position: relative;
  width: 112px;
  height: 58px;
  margin: 0 auto 8px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: linear-gradient(#75d7cb 0 62%, #65b961 62%);
  box-shadow: inset 0 -7px #3d9259;
  overflow: hidden;
}

.scene-ranger {
  position: absolute;
  left: 50px;
  bottom: 8px;
  width: 16px;
  height: 20px;
  border: 2px solid var(--ink);
  background: var(--gold);
}
.scene-ranger::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -10px;
  width: 18px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #9b5e3c;
}
.scene-mushroom {
  position: absolute;
  left: 16px;
  bottom: 9px;
  width: 7px;
  height: 13px;
  border: 2px solid var(--ink);
  background: var(--cream);
}
.scene-mushroom::before {
  content: "";
  position: absolute;
  left: -7px;
  top: -7px;
  width: 17px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 2px 2px;
  background: var(--coral);
}
.scene-spark { position: absolute; top: 8px; right: 17px; color: var(--gold); font-size: 20px; text-shadow: 1px 1px var(--ink); }

.eyebrow {
  margin: 10px 0 8px;
  color: var(--coral-dark);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .16em;
}

.panel h1,
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
}
.panel h1 { font-size: 39px; line-height: .95; letter-spacing: -.05em; }
.panel h1 em { display: block; color: var(--leaf); font-style: normal; text-shadow: 2px 2px 0 var(--paper-dark); }
.panel h2 { font-size: 24px; line-height: 1.1; }

.lede {
  max-width: 370px;
  margin: 16px auto;
  color: #51485d;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.45;
}

.instructions {
  display: grid;
  gap: 7px;
  margin: 16px 0 19px;
  padding: 12px;
  text-align: left;
  background: var(--paper);
  border: 2px dashed #a98267;
  border-radius: 8px;
  font-size: 9px;
}
.instructions div { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 9px; }
.instructions kbd { justify-self: start; min-width: 58px; }

.primary {
  width: 100%;
  padding: 13px 16px;
  color: #fff;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 7px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.primary:hover { background: #f47772; transform: translateY(-1px); }
.primary span { float: right; }

.quiz-art {
  display: grid;
  place-items: center;
  width: 100%;
  height: 88px;
  margin: 9px auto 17px;
  color: var(--cream);
  background: linear-gradient(#65cec3 0 60%, #4aa366 60%);
  border: 3px solid var(--ink);
  border-radius: 7px;
  box-shadow: inset 0 -12px #358459;
  font: 900 42px var(--font-display);
  text-shadow: 3px 3px 0 var(--ink);
}

.quiz-art-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  margin: 9px auto 17px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 4px 0 #358459;
  display: block;
}

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.answer {
  min-height: 44px;
  padding: 9px 7px;
  color: var(--ink);
  background: #fffdf4;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 2px 2px var(--ink);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}
.answer:hover { background: var(--gold); transform: translateY(-1px); }
.answer:disabled { cursor: default; }
.answer.correct { background: #72c979; }
.answer.wrong { color: #fff; background: var(--coral); }

.journal-list { display: grid; gap: 8px; margin: 15px 0; text-align: left; }
.journal-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-size: 9px;
  line-height: 1.4;
}
.journal-row i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--aqua);
  border: 2px solid var(--ink);
  border-radius: 5px;
  font-size: 16px;
  font-style: normal;
}
.journal-row.locked { opacity: .46; filter: grayscale(1); }
.close { margin-top: 7px; }

@media (max-width: 620px) {
  .overlay { align-items: center; padding: 14px; }
  .panel { width: min(390px, 100%); padding: 22px 18px; border-radius: 12px; }
  .panel h1 { font-size: 34px; }
  .panel h2 { font-size: 21px; }
  .scene-badge { height: 52px; }
  .lede { margin: 12px auto; font-size: 12px; }
  .instructions { margin: 12px 0 16px; padding: 10px; }
  .answers { gap: 7px; }
}

@media (max-height: 590px) {
  .scene-badge { display: none; }
  .panel { padding-block: 18px; }
  .lede { margin-block: 9px; }
  .instructions { margin-block: 9px 12px; }
}
