@font-face {
  font-family: "Palatino Local";
  src: local("Palatino"), local("Palatino Linotype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
  background: #101725;
  color: #f5ebd5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body { min-width: 280px; min-height: 100vh; margin: 0; }

button { font: inherit; }

button:focus-visible { outline: 3px solid #e8c77c; outline-offset: 5px; }

.experience {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding: 29px 20px 25px;
  background:
    radial-gradient(circle at 50% 24%, rgba(124, 83, 64, .23), transparent 36%),
    radial-gradient(circle at 80% 85%, rgba(48, 81, 95, .24), transparent 43%),
    #101725;
}

.experience.music-visible { padding-bottom: 315px; }

.experience::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 12px;
  border: 1px solid rgba(216, 174, 105, .18);
  pointer-events: none;
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.ambient-one { top: 12%; left: -170px; background: rgba(143, 92, 69, .20); }
.ambient-two { right: -190px; bottom: 8%; background: rgba(139, 110, 59, .14); }

.masthead {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #d5b779;
  font-size: .69rem;
  letter-spacing: .15em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

.masthead-symbol { font-size: 1rem; }

.screen {
  width: min(100%, 610px);
  margin: auto 0;
  padding: 45px 0;
  text-align: center;
  animation: appear .7s ease both;
}

.screen[hidden], [hidden] { display: none !important; }

.seal {
  display: grid;
  place-items: center;
  width: 98px;
  height: 98px;
  margin: 0 auto 36px;
  border: 1px solid #b58a50;
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(181, 138, 80, .10), 0 0 45px rgba(207, 155, 71, .13);
  color: #e1bf77;
  font-size: 3.2rem;
  transform: rotate(-12deg);
}

.eyebrow {
  margin: 0 0 14px;
  color: #d7b77a;
  font-size: .73rem;
  font-weight: bold;
  letter-spacing: .19em;
  line-height: 1.5;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Palatino Local", "Book Antiqua", Georgia, serif;
  font-size: clamp(2.75rem, 10vw, 5rem);
  font-weight: normal;
  letter-spacing: -.035em;
  line-height: 1.04;
}

h1 em { color: #e9cb91; font-style: normal; }

.lead, .screen-description, .clue-instruction {
  max-width: 390px;
  margin: 25px auto 0;
  color: #d5ccbd;
  font-size: 1.06rem;
  line-height: 1.7;
}

.primary-button, .secondary-button {
  min-height: 54px;
  border: 1px solid #e9ca87;
  border-radius: 3px;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.primary-button {
  width: min(100%, 320px);
  margin-top: 39px;
  padding: 12px 22px;
  background: linear-gradient(120deg, #cba765, #f0d99a, #c99f5c);
  box-shadow: 0 10px 35px rgba(0, 0, 0, .22);
  color: #262018;
  font-size: 1rem;
  font-weight: bold;
}

.primary-button span { margin-left: 13px; font-size: 1.25rem; }

.primary-button:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(0, 0, 0, .3); }

.helper { margin: 15px 0 0; color: #aaa496; font-size: .86rem; }

.video-screen h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); }
.screen-description { margin-top: 15px; }

.video-frame {
  margin-top: 30px;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 124, .65);
  border-radius: 5px;
  background: #05070b;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .45);
}

video { display: block; width: 100%; max-height: 65svh; }

.video-status { min-height: 1.6em; margin: 16px 0 0; color: #e8c77c; line-height: 1.5; }

.secondary-button { padding: 10px 18px; background: transparent; color: #f5ebd5; }
.secondary-button:hover { background: rgba(232, 199, 124, .12); }

.progress { margin: 0 auto 28px; }
.progress-label { color: #c6bcae; font-size: .73rem; letter-spacing: .15em; text-transform: uppercase; }
.code-slots { display: flex; justify-content: center; gap: 8px; margin-top: 13px; }
.code-slots span {
  display: grid;
  place-items: center;
  width: 39px;
  height: 48px;
  border: 1px solid rgba(220, 185, 117, .5);
  color: #e7d09e;
  font-size: 1.3rem;
}

.code-slots span.discovered {
  border-color: #e8c77c;
  background: rgba(232, 199, 124, .16);
  box-shadow: 0 0 20px rgba(232, 199, 124, .16);
}

.clue-card {
  padding: 37px 25px 42px;
  border: 1px solid rgba(130, 91, 53, .6);
  outline: 1px solid rgba(130, 91, 53, .25);
  outline-offset: 5px;
  background: linear-gradient(145deg, #eee0be, #d9c69e);
  box-shadow: 0 25px 65px rgba(0, 0, 0, .36);
  color: #302b24;
}

.clue-card .eyebrow { color: #755631; }
.clue-card h1 { font-size: clamp(2rem, 7vw, 3rem); }
.ornament { margin: 20px 0; color: #966d3e; }
.riddle { margin: 0; font-size: clamp(1rem, 3.7vw, 1.2rem); line-height: 1.8; white-space: pre-line; }
.clue-instruction { margin-top: 30px; font-size: .96rem; }
.answer-form { max-width: 380px; margin: 27px auto 0; }
.answer-label { display: block; margin-bottom: 12px; color: #f5ebd5; font-size: 1rem; }
.answer-controls, .final-answer-controls { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
.answer-controls input, .final-answer-controls input {
  width: 100%;
  min-height: 54px;
  border: 1px solid #b69b70;
  border-radius: 3px;
  background: rgba(245, 235, 213, .09);
  color: #f5ebd5;
  font: 1.5rem Georgia, serif;
  text-align: center;
}
.answer-controls input:focus-visible, .final-answer-controls input:focus-visible { outline: 3px solid #e8c77c; outline-offset: 3px; }
.answer-button { width: 100%; min-width: 0; margin: 0; padding-inline: 10px; font-size: .94rem; }
.answer-controls input:disabled, .final-answer-controls input:disabled, .answer-button:disabled { cursor: not-allowed; opacity: .52; }
.answer-feedback { min-height: 1.5em; margin: 12px 0 0; color: #e8c77c; font-size: .93rem; line-height: 1.5; }
.lock-notice {
  display: grid;
  gap: 6px;
  margin-top: 13px;
  padding: 15px;
  border: 1px solid rgba(219, 112, 106, .55);
  background: rgba(105, 39, 43, .25);
  color: #f1c5bf;
  font-size: .92rem;
  line-height: 1.45;
}
.lock-notice time { font-variant-numeric: tabular-nums; font-weight: bold; }
.clue-card.is-error { animation: spell-failed .48s ease; border-color: #b85b59; }
.clue-card.is-success { animation: spell-success 1.5s ease; border-color: #bf9c5e; }
.reveal-screen h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); }
.reveal-code { display: flex; justify-content: center; gap: clamp(6px, 2vw, 13px); margin: 32px 0 25px; }
.reveal-code span {
  display: grid;
  place-items: center;
  width: clamp(45px, 13vw, 65px);
  height: clamp(58px, 16vw, 82px);
  border: 1px solid #d9b778;
  background: rgba(232, 199, 124, .15);
  color: #f2d99e;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  opacity: .2;
  animation: reveal-digit .4s ease forwards;
}
.reveal-code span:nth-child(2) { animation-delay: .23s; }
.reveal-code span:nth-child(3) { animation-delay: .46s; }
.reveal-code span:nth-child(4) { animation-delay: .69s; }
.reveal-code span:nth-child(5) { animation-delay: .92s; }
.suspense { margin: 0; color: #e9cb91; font-size: 1.12rem; line-height: 1.5; opacity: 0; animation: reveal-suspense .5s ease 1.35s forwards; }
.final-screen .eyebrow { margin-bottom: 16px; }
.final-screen .video-frame { margin-top: 27px; }
.final-answer-form { margin-top: 26px; }
.final-answer-controls { grid-template-columns: minmax(0, 1fr) minmax(145px, .85fr); }
.final-answer-controls input { padding-inline: 12px; font-size: 1.1rem; text-align: left; }
.final-answer-form.is-error { animation: spell-failed .48s ease; }
.closing-panel {
  position: relative;
  margin: 32px auto 0;
  padding: 36px 24px;
  border: 1px solid rgba(232, 199, 124, .65);
  background: radial-gradient(circle at 50% 0%, rgba(232, 199, 124, .19), transparent 62%), rgba(24, 32, 43, .8);
  box-shadow: 0 0 50px rgba(232, 199, 124, .22);
  animation: closing-glow 2.3s ease both;
}
.closing-panel h2 { margin: 0; color: #f2d99e; font-size: clamp(2rem, 7vw, 3.1rem); font-weight: normal; }
.closing-panel p:last-child { margin: 17px 0 0; color: #e8dfce; line-height: 1.6; }
.closing-stars { display: flex; justify-content: space-around; margin-bottom: 21px; color: #e8c77c; font-size: 1.5rem; }
.closing-stars span { animation: star-twinkle 1.5s ease-in-out infinite alternate; }
.closing-stars span:nth-child(2), .closing-stars span:nth-child(4) { animation-delay: .5s; }
.closing-stars span:nth-child(3) { animation-delay: 1s; }
.music-dock {
  position: fixed;
  z-index: 5;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(280px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid rgba(232, 199, 124, .65);
  border-radius: 5px;
  background: #18202d;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .55);
}
.music-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: #e9cb91; font-size: .82rem; }
.music-toggle { min-height: 36px; padding: 5px 8px; border: 1px solid #d7b77a; border-radius: 3px; background: transparent; color: #f5ebd5; cursor: pointer; font-size: .75rem; }
.music-toggle:hover { background: rgba(232, 199, 124, .12); }
.music-toggle:focus-visible { outline: 3px solid #e8c77c; outline-offset: 2px; }
.music-player { display: grid; place-items: center; width: 100%; height: 200px; background: #05070b; }
.music-player iframe, iframe.music-player { display: block; width: 100%; height: 200px; border: 0; }
.music-player p { padding: 15px; color: #d5ccbd; font-size: .9rem; line-height: 1.5; text-align: center; }
.music-status { min-height: 1.2em; margin: 7px 0 0; color: #e8c77c; font-size: .72rem; line-height: 1.3; }
.music-link { display: inline-block; margin-top: 5px; color: #d5ccbd; font-size: .72rem; }
.page-footer { color: rgba(213, 183, 121, .6); letter-spacing: .5em; }

@keyframes appear { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes reveal-digit { to { opacity: 1; box-shadow: 0 0 28px rgba(232, 199, 124, .3); } }
@keyframes reveal-suspense { to { opacity: 1; } }
@keyframes closing-glow { from { opacity: 0; transform: scale(.96); box-shadow: 0 0 8px rgba(232, 199, 124, .12); } to { opacity: 1; transform: scale(1); box-shadow: 0 0 50px rgba(232, 199, 124, .22); } }
@keyframes star-twinkle { from { opacity: .35; transform: translateY(3px) scale(.8); } to { opacity: 1; transform: translateY(-3px) scale(1.15); } }
@keyframes spell-failed {
  0%, 100% { transform: translateX(0); box-shadow: 0 25px 65px rgba(0, 0, 0, .36); }
  20%, 60% { transform: translateX(-5px); box-shadow: 0 0 35px rgba(184, 67, 67, .38); }
  40%, 80% { transform: translateX(5px); }
}
@keyframes spell-success {
  0% { box-shadow: 0 25px 65px rgba(0, 0, 0, .36); }
  45% { box-shadow: 0 0 55px rgba(232, 199, 124, .68); }
  100% { box-shadow: 0 25px 65px rgba(0, 0, 0, .36); }
}

@media (max-width: 390px) {
  .experience { padding-inline: 19px; }
  .screen { padding-block: 35px; }
  .clue-card { padding-inline: 17px; }
  .answer-button { font-size: .83rem; }
  .final-answer-controls { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .experience.music-visible { padding-bottom: 25px; }
  .music-dock { position: relative; right: auto; bottom: auto; margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
