:root {
  color-scheme: light;
  --ink: #281139;
  --purple: #3e1a59;
  --paper: #fff5de;
  --gold: #ffce45;
  font: 1rem/1.55 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.wrap { width: min(100% - 36px, 1050px); margin-inline: auto; }
.cover {
  padding: clamp(2rem, 6vw, 4.5rem) 0;
  color: var(--paper);
  background: var(--purple);
  border-bottom: 7px solid var(--gold);
}
.intro, .grid, .finale { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.intro { align-items: center; }
.intro img {
  width: 100%;
  height: auto;
  display: block;
  border: 4px solid var(--gold);
  border-radius: 10px;
  box-shadow: 7px 7px #220c34;
}
.edition { color: var(--gold); font-weight: 750; }
h1, h2, h3 { font-family: Georgia, serif; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(2.65rem, 6vw, 4.75rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-bottom: 16px; }
h3 { font-size: 1.55rem; }
button, .button {
  display: inline-block;
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: .65rem .9rem;
  font: inherit;
  font-weight: 750;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: #ffe379; }
button:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 3px solid #9052bc; outline-offset: 3px; }
main { padding-top: 24px; }
section { margin: 30px 0; }
.clues {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--purple);
  color: var(--paper);
}
.clues ol { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.clues li {
  display: grid;
  place-items: center;
  width: 34px;
  height: 36px;
  border: 2px solid var(--gold);
  border-radius: 5px;
  color: var(--gold);
  font-weight: 800;
}
article {
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vw, 24px);
  border: 2px solid #8b609f;
  border-radius: 10px;
  background: #fffaf0;
  box-shadow: 3px 3px #dbc1e5;
}
article form { margin-top: auto; }
.boxes { margin: 0 0 16px; padding-left: 1.5rem; font-weight: 650; }
.rebus { display: block; width: 100%; height: auto; margin: 14px 0; border-radius: 6px; }
label { display: block; margin-bottom: 4px; font-weight: 700; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
input {
  flex: 1;
  min-width: 110px;
  width: 100%;
  border: 2px solid #8b609f;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: .6rem .75rem;
  font: inherit;
}
.feedback { min-height: 1.55em; margin: 8px 0 0; font-weight: 700; }
[data-result="correct"] { color: #156638; }
[data-result="incorrect"] { color: #a12837; }
.finale {
  align-items: center;
  padding: clamp(16px, 4vw, 38px);
  background: #edddf2;
  border: 3px solid var(--purple);
  border-radius: 14px;
}
.safe {
  position: relative;
  isolation: isolate;
  width: min(100%, 320px);
  min-height: 240px;
  margin-inline: auto;
  border: 7px solid var(--ink);
  border-radius: 16px;
  background: #241332;
  box-shadow: 5px 7px #ba97ca;
  perspective: 800px;
}
.door {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
  border-radius: 8px;
  border: 10px ridge #e5a528;
  background: #ffce45;
  transform-origin: right;
  transition: transform .65s ease-in-out;
  z-index: 1;
}
.open .door { transform: rotateY(96deg); pointer-events: none; }
.dial {
  width: 86px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid var(--ink);
  background: radial-gradient(circle, #e8ae30 35%, var(--ink) 36% 43%, transparent 44%),
    repeating-conic-gradient(var(--ink) 0 4deg, #ffdd70 4deg 30deg);
}
#surprise { text-align: center; color: white; padding: 14px; }
#surprise img { display: block; width: 100%; height: auto; margin: auto; }
#message {
  position: relative;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
}
#message::after {
  position: absolute;
  top: calc(100% - 1px);
  left: calc(50% - 8px);
  border: 8px solid transparent;
  border-top-color: var(--paper);
  content: "";
}
footer { padding: 0 0 30px; }
footer a { color: var(--purple); }
@media (max-width: 680px) {
  .intro, .grid, .finale { grid-template-columns: minmax(0, 1fr); }
  .open .door { transform: rotateY(90deg); }
}
@media (prefers-reduced-motion: reduce) { .door { transition: none; } }
