@font-face {
  font-family: Baloo;
  src: url('/assets/baloo-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #1b1034;
  --berry: #4d1947;
  --plum: #351c41;
  --ink: #44213d;
  --snow: #fff7ec;
  --gold: #ffda92;
  --rose: #ffb1db;
  --display: 'Luckiest Guy', Baloo, 'Trebuchet MS', sans-serif;
  font-family: Baloo, 'Trebuchet MS', sans-serif;
  background: var(--night);
  color: var(--snow);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 66% 0, #382460, transparent 58rem), var(--night); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button[disabled] { cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid #57e3fb; outline-offset: 3px; }
img { display: block; width: 100%; height: auto; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }

.top { background: #190f2d; border-bottom: 1px solid #553557; }
.top-inner, .shell { width: min(100% - 2rem, 77rem); margin-inline: auto; }
.top-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 3.6rem; }
.top-control, .back {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .48rem;
  min-height: 3rem;
  border: 0;
  padding: .25rem .65rem;
  border-radius: .6rem;
  background: transparent;
  color: var(--snow);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.top-control:hover, .back:hover { background: #ffffff18; }
.top-control span, .back span { color: var(--gold); font-size: 1.65rem; line-height: 1; }
#portal { justify-self: start; }
.top-tools { display: flex; align-items: center; justify-self: end; gap: .35rem; }
#sound[aria-pressed='false'] { color: #dccde5; }
#sound[aria-pressed='false'] span { color: #bfaacb; }
.wordmark { color: var(--rose); font-size: clamp(1rem, 3.8vw, 1.5rem); text-shadow: 0 3px #682448; line-height: 1; }
.wordmark span { color: var(--gold); }
.shell { padding-block: 1.2rem 2.5rem; }

.entrance {
  isolation: isolate;
  min-height: 28rem;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.6fr);
  border: 1px solid #a7687d;
  border-radius: 1.45rem;
  overflow: hidden;
  background: #3c1946;
  box-shadow: 0 15px 50px #10071d6b;
}
.entrance-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: .9rem;
  position: relative;
  z-index: 1;
  padding: clamp(1.6rem, 4.3vw, 3.85rem);
  background: radial-gradient(ellipse at 0 0, #6d2355, transparent 74%), linear-gradient(140deg, #391842, #281842);
}
.entrance-copy::before {
  content: '';
  position: absolute;
  inset: .65rem 0 .65rem .65rem;
  border: 1px solid #ffca9b53;
  border-right: 0;
  border-radius: .96rem 0 0 .96rem;
  pointer-events: none;
}
.entrance-art { height: 100%; min-height: 0; object-fit: cover; object-position: 50% 54%; }
.location { color: var(--gold); font-weight: 800; text-transform: uppercase; font-size: .84rem; letter-spacing: .105em; }
.location span { margin-inline-end: .3rem; }
.entrance h1 {
  color: var(--snow);
  font-size: clamp(2.55rem, 5.1vw, 5rem);
  line-height: .99;
  letter-spacing: -.025em;
  text-shadow: 0 .075em #562049, 0 .115em #20112d;
  text-wrap: initial;
}
.entrance h1 em { display: block; font-style: normal; color: var(--gold); }
.entrance-copy > p:not(.location) { color: #fbdfec; font-size: 1.05rem; line-height: 1.42; max-width: 29ch; }
.primary {
  min-height: 3.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  border: 2px solid #fdafd4;
  border-radius: .85rem;
  background: linear-gradient(#df397f, #a71056);
  color: #fff9f2;
  padding: .53rem 1.15rem .4rem;
  box-shadow: 0 4px #731040, inset 0 1px #ffcee5;
  font-weight: 800;
  line-height: 1.15;
}
.primary:hover { background: linear-gradient(#e64a8f, #ab165b); }
.primary:active { transform: translateY(2px); box-shadow: 0 2px #731040; }
#start { min-height: 3.65rem; padding-inline: 1.55rem; margin-top: .3rem; font: 400 1.47rem var(--display); text-shadow: 0 2px #7e104d; }
#start span { color: #ffedbb; font-size: 1.15rem; }

.passport {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-block: .95rem 1.2rem;
  border: 1px solid #795276;
  border-radius: 1rem;
  background: #321b46;
}
.passport button {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-align: start;
  min-width: 0;
  min-height: 3.65rem;
  padding: .4rem clamp(.65rem, 1.6vw, 1.2rem);
  border: 0;
  border-radius: .85rem;
  background: transparent;
  font-weight: 700;
  line-height: 1.15;
}
.passport button + button { box-shadow: -1px 0 #65436a; }
.passport button:hover { background: #542957; }
.passport-icon { flex: none; font-size: clamp(1.28rem, 3.6vw, 1.65rem); }
.passport b { white-space: nowrap; color: var(--gold); display: block; margin-top: .12rem; font-variant-numeric: tabular-nums; }

.hall {
  position: relative;
  min-height: 16rem;
  display: flex;
  align-items: end;
  border-radius: 1.3rem;
  border: 1px solid #926270;
  overflow: hidden;
  background: linear-gradient(0deg, #24112aba, transparent 65%), linear-gradient(90deg, #24112af7, #24112a80 48%, #24112a10 75%), url('./art/vestibulo.webp') right 43% / min(100%, 48rem) auto no-repeat #24112a;
}
.hall-copy { padding: clamp(1rem, 4vw, 2.5rem); }
.hall .back { margin-left: -.65rem; }
.hall h1, .room-copy h1, .reward h1 { font-size: clamp(2rem, 4.45vw, 3.65rem); line-height: 1.05; }
.hall p { margin-top: .45rem; max-width: 36ch; color: #fff1de; line-height: 1.35; }
#hall-chest { margin-top: .7rem; }

.route { padding-top: 1rem; }
.route h2 { margin-bottom: .65rem; font-size: clamp(1.4rem, 3vw, 1.95rem); letter-spacing: -.015em; }
.route h2 span { font-family: Baloo, sans-serif; font-size: .8em; color: var(--gold); }
.doors { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; padding: 0; margin: 0; }
.doors > li { display: flex; min-width: 0; }
.door {
  width: 100%;
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(135deg, #55284e, #351d44);
  color: var(--snow);
  border: 1px solid #936676;
  border-radius: .9rem;
  text-align: start;
  overflow: hidden;
}
.door:not([aria-disabled='true']):hover { background: #71325f; border-color: var(--gold); }
.door[data-state='Abierta'] { border-color: #ffce83; }
.door-picture { position: relative; aspect-ratio: 1.72; overflow: hidden; background: #34233f; }
.door-picture img { height: 100%; object-fit: cover; object-position: center 55%; }
.door[aria-disabled='true'] img { filter: saturate(.72) brightness(.68); }
.door[aria-disabled='true'][data-room='taller'] img { filter: saturate(.35) brightness(.36); }
.door-medallion {
  display: grid;
  place-items: center;
  position: absolute;
  bottom: .38rem;
  left: .53rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid #ffe2ae;
  border-radius: 50%;
  background: #401f45;
  font-size: 1rem;
}
.door-copy { display: grid; align-content: space-between; gap: .2rem; padding: .48rem .6rem .6rem; }
.door-title { font-size: 1rem; font-weight: 800; line-height: 1.13; }
.door-state { color: var(--gold); line-height: 1.2; font-weight: 700; font-size: .82rem; }
.door[data-state='Cerrada'] .door-state { color: #e6cddf; }
.door[data-state='Completada'] .door-state { color: #bbf1c9; }
.door-note { margin-top: .55rem; color: var(--gold); }
.door-note:empty { margin: 0; }

.shell:has(#room:not([hidden])) { display: flex; flex-direction: column; }
.shell:has(#room:not([hidden])) #passport { order: 1; }
.room-nav { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.room-nav .back { margin-left: -.55rem; }
.room-copy { margin: .1rem 0 .8rem; }
.room-copy p { margin-top: .2rem; color: #f4dce8; line-height: 1.32; }
.room-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(17rem, 1fr); align-items: start; gap: 1rem; }
.room-viewer {
  width: 100%; overflow: hidden; border: 1px solid #ad7e78; border-radius: 1.15rem;
  background: #38203c; color: var(--snow); box-shadow: 0 8px 30px #130b2260;
}
.room-viewport {
  position: relative; overflow: clip; isolation: isolate; height: clamp(21rem, 48vh, 34rem);
  touch-action: none; user-select: none; cursor: grab; background: #2c1928;
}
.room-viewport:active { cursor: grabbing; }
.room-viewport:focus-visible { outline: 3px solid #57e3fb; outline-offset: -4px; }
#room-art, #room-spots { position: absolute; inset: 0; pointer-events: none; }
#room-art { background-repeat: repeat-x; }
.scene-spot {
  position: absolute; display: grid; place-items: center; min-width: 3rem; min-height: 3rem; padding: 0;
  transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: transparent;
  color: #fff9d3; touch-action: none; pointer-events: auto;
}
.spot-gem {
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem; line-height: 1;
  border: 2px solid #fff2bd; border-radius: 50%; background: #6a2c4fe6; font: 800 1.18rem Baloo, sans-serif;
  box-shadow: 0 0 0 3px #ffc85d99, 0 2px 8px #32182a;
}
.scene-spot[aria-disabled="true"] .spot-gem { background: #284936d9; color: #fff; box-shadow: 0 1px 4px #21122b; }
.scene-spot:is(:hover,:focus-visible) { z-index: 1; }
.scene-spot:is(:hover,:focus-visible) .spot-gem { background: #73274e; }
.spot-label {
  display: none; position: absolute; bottom: calc(100% - .1rem); white-space: nowrap;
  padding: .16rem .55rem; border-radius: .45rem; color: #fff7df; background: #311832f5; font-weight: 700;
}
.scene-spot:focus-visible .spot-label { display: block; }
@media (hover: hover) { .scene-spot:hover .spot-label { display: block; } }
.scene-controls, .scene-control-group { display: flex; align-items: center; }
.scene-controls { justify-content: space-between; gap: .3rem; padding: .25rem .55rem; border-top: 1px solid #a47469; }
.scene-control-group { gap: .15rem; }
.scene-control-group span { min-width: 2.35rem; text-align: center; color: var(--gold); font-weight: 800; font-variant-numeric: tabular-nums; }
.scene-controls button {
  min-width: 3rem; min-height: 3rem; padding: 0; line-height: 1; border: 0; border-radius: .55rem;
  background: #502a48; color: #fff5d7; font: 600 1.7rem/1 Baloo, sans-serif;
}
.scene-controls button:hover { background: #77435a; }
.scene-controls button:disabled { opacity: .5; cursor: default; }
#scene-help, #scene-count, #scene-message { padding: 0 .8rem .45rem; line-height: 1.25; font-size: .92rem; }
#scene-help { color: #f4dae5; }
#scene-count, #scene-message { color: #ffdf99; font-weight: 750; }
#scene-count:empty, #scene-message:empty { display: none; }
.scene-inventory { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .2rem; }
.scene-inventory li { border-bottom: 1px solid #e4c9b7; padding: .25rem 0; }
.scene-inventory li span { display: inline-block; width: 1.9em; }
.scene-inventory .found { color: #256146; }
#scene-dialog {
  padding: 0; border: 0; margin: auto; color: var(--snow); background: #29172d;
  width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden;
}
#scene-dialog::backdrop { background: #190e21; }
body:has(#scene-dialog[open]) { overflow: hidden; }
#scene-dialog .room-viewer {
  height: 100%; display: flex; flex-direction: column; border: 0; border-radius: 0;
  padding-bottom: env(safe-area-inset-bottom); padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}
#scene-dialog .room-viewport { flex: 1; min-height: 0; }
#scene-dialog .scene-controls { justify-content: center; gap: clamp(.3rem, 5vw, 3rem); }
#scene-dialog :is(#scene-help, #scene-count, #scene-message) { text-align: center; }
.worktable {
  background: #fff4e6;
  color-scheme: light;
  color: var(--ink);
  border: 2px solid #e5a797;
  border-radius: 1.25rem;
  min-width: 0;
  padding: clamp(.85rem, 3.3vw, 2.35rem);
}
#board { display: grid; gap: .65rem; }
.challenge-title { font: 400 clamp(1.35rem, 2.8vw, 1.92rem)/1.05 var(--display); color: #821b56; }
.challenge-note { line-height: 1.32; }
.play-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.play-option, .play-tray, .play-action {
  border: 1px solid #bd7a92;
  padding: .5rem;
  border-radius: .65rem;
  min-height: 3rem;
  color: #4a2040;
  font-weight: 700;
  line-height: 1.13;
  overflow-wrap: anywhere;
}
.play-option { display: grid; justify-items: center; align-content: center; gap: .25rem; background: #ffe5ed; }
.play-option:hover, button.play-tray:hover { background: #ffe2b1; }
.play-action { border-color: #9d2b58; background: #9e225e; color: #fff9f4; padding-inline: .9rem; }
.play-action:hover { background: #831349; }
.play-action[disabled] { cursor: default; background: #efd6de; color: #5c3e53; border-color: #b5879b; }
.play-tray { align-content: center; background: #ffedc8; border-color: #c78f51; }
.worktable :focus-visible { outline-color: #235683; }
.is-selected { border-color: #924708; background: #ffda8a; }
.is-solved { color: #1b573e; background: #d8f0d9; border-color: #5c926e; }
.is-searched { background: #efdedf; border-color: #a98f9b; }
.feedback { margin-top: .7rem; font-weight: 700; line-height: 1.2; }
.feedback:empty { margin: 0; }
.feedback[data-tone='good'] { color: #276044; }
.feedback[data-tone='error'] { color: #9d224b; }
.play-icon { font-size: 1.55rem; line-height: 1.15; }
.mystery-grid .play-option { min-height: 4.15rem; }
.mystery-actions, .mystery-counter, .mystery-sequence { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.mystery-counter { justify-content: space-between; }
.key-lights { display: flex; gap: .24rem; margin-top: .3rem; }
.key-lights i {
  width: .56rem;
  height: .56rem;
  border-radius: 50%;
  background: #9d795f;
  box-shadow: inset 0 1px 2px #5f394d;
}
.key-lights .is-lit { background: #ffd45f; box-shadow: inset 0 0 0 1px #a26026, 0 0 .25rem #dfa339; }
.unlocked-chest .key-lights { justify-content: center; }
.mystery-counter:has(.is-lit:nth-child(4)), .unlocked-chest { border-color: #a5652e; background: #ffe0a0; }
.mystery-sequence { justify-content: center; }
.star-reveal {
  display: grid;
  place-items: center;
  gap: .46rem;
  padding: .85rem;
  border-color: #b17742;
  background: radial-gradient(ellipse at 50% 30%, #795064, #452546 72%);
  color: #fff4d0;
  box-shadow: inset 0 0 0 3px #ffda9224;
}
.star-reveal:hover { background: radial-gradient(ellipse at 50% 30%, #8b5a69, #512947 72%); }
.star-jewel {
  display: block;
  width: 3.2rem;
  aspect-ratio: 1;
  filter: drop-shadow(0 0 .45rem #ffcf61bd);
}
.star-jewel::before {
  content: '';
  display: block;
  height: 100%;
  clip-path: polygon(50% 0, 63% 33%, 100% 38%, 72% 63%, 80% 100%, 50% 81%, 20% 100%, 28% 63%, 0 38%, 37% 33%);
  background: linear-gradient(145deg, #fff8b775, transparent 55%, #cb6a1555),
    repeating-conic-gradient(at 50% 54%, #fff4ae 0deg 36deg, #ffba46 36deg 72deg);
}
#room[data-location='taller'] #room-art { filter: brightness(var(--starlight, .55)) saturate(var(--starlight, .55)); }
#room:has([data-code][data-entered='1']) { --starlight: .72; }
#room:has([data-code][data-entered='2']) { --starlight: .88; }
#room:has(.star-reveal) { --starlight: 1; }
.mystery-hint { line-height: 1.3; }
.mystery-hint summary { cursor: pointer; font-weight: 800; }

.reward {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid #c48a89;
  border-radius: 1.25rem;
  overflow: hidden;
  background: linear-gradient(140deg, #5f214e, #2d1b47 65%);
}
.reward-art { height: 100%; object-fit: cover; }
.reward-copy { align-self: center; padding: clamp(1.2rem, 4vw, 3rem); }
.reward-copy h1 { color: var(--gold); margin-block: .2rem .35rem; }
.reward-copy > p { line-height: 1.35; }
.reward-icon { font-size: 2rem; }
.reward-icon.key-reward {
  display: inline-grid;
  place-items: center;
  width: 2.8rem;
  aspect-ratio: 1;
  border: 1px solid #eec28a;
  border-radius: 50%;
  background: radial-gradient(at 35% 25%, #864e51, #502740);
  box-shadow: inset 0 0 0 3px #ffda9229;
  font-size: 1.65rem;
}
.reward-items, .journal-list { list-style: none; margin: .7rem 0 1rem; padding: 0; }
.reward-items li { padding: .32rem .5rem; border-bottom: 1px solid #8a617f; font-weight: 700; }

#journal {
  color-scheme: light;
  width: min(30rem, 100% - 1.5rem);
  padding: .85rem 1.1rem 1rem;
  max-height: calc(100% - 1.5rem);
  color: var(--ink);
  background: var(--snow);
  border: 2px solid #e4a8a1;
  border-radius: 1.15rem;
  box-shadow: 0 12px 55px #1b102c99;
}
#journal::backdrop { background: #170d2bc7; }
#journal :focus-visible { outline-color: #235683; }
.journal-top { display: flex; justify-content: space-between; align-items: center; gap: .55rem; margin-bottom: .65rem; }
.journal-top h2 { color: #861d58; font-size: clamp(1.28rem, 5vw, 1.9rem); text-wrap: initial; line-height: 1.05; }
.close { flex: none; border-radius: .65rem; border: 1px solid #cb90a9; background: #ffe1eb; color: #632149; font-size: 1.6rem; min-width: 3rem; min-height: 3rem; line-height: 1; }
.journal-list { margin-bottom: .45rem; }
.journal-list li { border-top: 1px solid #e6c4ce; padding: .45rem .2rem; line-height: 1.2; }
#journal-content h3 { margin-top: .7rem; }
.mission-list li { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem; }
.mission-list li span { color: #75345e; text-align: end; }
.star-row { display: flex; gap: .28rem; color: #a25805; font-size: clamp(1.7rem, 8vw, 3rem); }
.clue { padding: .55rem .7rem; background: #ffedc8; border-radius: .5rem; }

@media (max-width: 760px) {
  .entrance { min-height: 22rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.26fr); }
  .entrance-copy { padding: 1.35rem; }
  .room-layout { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .doors { gap: .55rem; }
  .passport button { font-size: .92rem; }
}

@media (max-width: 570px) {
  .top-inner, .shell { width: calc(100% - 1.1rem); }
  .top-inner { min-height: 3.3rem; }
  .top-control { padding-inline: .35rem; gap: .28rem; font-size: .95rem; }
  #sound { width: 44px; font-size: 0; gap: 0; }
  .shell { padding-top: .65rem; }
  .entrance { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; border-radius: 1rem; }
  .entrance-art { grid-row: 1; aspect-ratio: 1.71; height: auto; object-position: 50% 63%; }
  .entrance-copy { justify-items: center; text-align: center; padding: .95rem 1rem 1.2rem; gap: .5rem; }
  .entrance-copy::before { inset: 0 .38rem .38rem; border: 1px solid #ffca9b53; border-top: 0; border-radius: 0 0 .69rem .69rem; }
  .entrance h1 { font-size: clamp(2.05rem, 8.65vw, 3.1rem); }
  .entrance h1 br { display: none; }
  .entrance-copy > p:not(.location) { font-size: .98rem; max-width: 31ch; }
  #start { min-height: 3.15rem; padding-top: .2rem; }
  .passport { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: .7rem; }
  .passport button { min-height: 3rem; gap: .38rem; padding: .28rem .38rem; }
  .passport button + button { box-shadow: none; }
  .passport button:nth-child(even) { box-shadow: -1px 0 #65436a; }
  .passport button:nth-child(n + 3) { border-top: 1px solid #65436a; }
  .passport b { margin-top: .05rem; }
  .route { padding-top: .65rem; }
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hall { background-size: 100% auto; min-height: 13.5rem; }
  .hall h1, .room-copy h1 { font-size: 1.85rem; }
  .room-layout, .reward { grid-template-columns: minmax(0, 1fr); gap: .55rem; }
  .room-viewport { height: clamp(16rem, 43svh, 26rem); }
  .room-nav .location { font-size: .72rem; letter-spacing: .04em; }
  .scene-controls { padding-inline: .25rem; gap: .1rem; }
  .scene-control-group { gap: 0; }
  .scene-control-group span { min-width: 1.75rem; font-size: .85rem; }
  #scene-dialog .scene-controls { gap: .25rem; }
  .room-copy p { font-size: .93rem; }
  .worktable { border-radius: 1rem; }
  .reward-art { height: 12rem; object-position: 50% 54%; }
  .reward-copy { padding: .7rem .9rem 1.05rem; }
}

[data-reduced-motion='false'] #reward:not([hidden]) .reward-copy { animation: reveal .34s ease-out both; }
[data-reduced-motion='false'] .memory-card:is(.is-selected, .is-solved) .play-icon { animation: open-page .24s ease-out; }
[data-reduced-motion='false'] :is(.search-object.is-solved .play-icon, .unlocked-chest .play-icon:first-child, .key-reward) { animation: turn-key .48s ease-out; }
[data-reduced-motion='false'] #room[data-location='taller'] #room-art { transition: filter .38s ease-out; }
[data-reduced-motion='false'] .star-jewel { animation: wake-star .62s ease-out; }
@keyframes reveal { from { transform: translateY(.28rem); } }
@keyframes open-page { from { transform: perspective(6rem) rotateY(-68deg); } }
@keyframes turn-key {
  0% { transform: rotate(-26deg) scale(.9); }
  60% { transform: rotate(12deg) scale(1.08); }
}
@keyframes wake-star {
  from { transform: scale(.72) rotate(-12deg); }
  65% { transform: scale(1.09) rotate(3deg); }
}
