﻿@font-face {
  font-family: "Paaxel";
  src:
    url("/assets/fonts/Paaxel-xRjLO.otf") format("opentype"),
    local("Paaxel");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f9f1df;
  --muted: #c7ba9c;
  --shadow: #12151a;
  --panel: #27272b;
  --accent: #f3c65f;
  --blue: #78a7c7;
  --green: #82b580;
  --red: #c86e5c;
  --floor: #6d5446;
  --wall: #45616f;
  --wall-dark: #243840;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #12151a;
  color: var(--ink);
  font-family: "Paaxel", monospace;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.back-home-button {
  position: fixed;
  z-index: 15;
  top: 16px;
  right: 16px;
  padding: 10px 14px;
  border: 3px solid rgba(0,0,0,.35);
  border-radius: 8px;
  background: rgba(18,21,26,.86);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.back-home-button:hover,
.back-home-button:focus-visible {
  background: rgba(39,39,43,.94);
}

.hidden {
  display: none !important;
}

.door-screen,
.access-screen,
.game-screen {
  min-height: 100vh;
}

.door-screen {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.18) 0 2px, transparent 2px),
    radial-gradient(circle at 16% 84%, rgba(255,255,255,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 22% 34%, rgba(158,218,233,.18) 0 2px, transparent 2px),
    radial-gradient(circle at 28% 72%, rgba(255,255,255,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 33% 12%, rgba(255,255,255,.15) 0 1px, transparent 1px),
    radial-gradient(circle at 36% 58%, rgba(255,255,255,.14) 0 2px, transparent 2px),
    radial-gradient(circle at 44% 26%, rgba(158,218,233,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 48% 88%, rgba(255,255,255,.14) 0 1px, transparent 1px),
    radial-gradient(circle at 54% 42%, rgba(255,255,255,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 63% 14%, rgba(255,255,255,.2) 0 2px, transparent 2px),
    radial-gradient(circle at 68% 82%, rgba(158,218,233,.14) 0 2px, transparent 2px),
    radial-gradient(circle at 72% 32%, rgba(255,255,255,.15) 0 1px, transparent 1px),
    radial-gradient(circle at 76% 58%, rgba(158,218,233,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 81% 74%, rgba(255,255,255,.16) 0 2px, transparent 2px),
    radial-gradient(circle at 88% 24%, rgba(255,255,255,.14) 0 2px, transparent 2px),
    radial-gradient(circle at 91% 62%, rgba(158,218,233,.14) 0 1px, transparent 1px),
    radial-gradient(circle at 18% 52%, rgba(255,255,255,.12) 0 1px, transparent 1px),
    radial-gradient(circle at 26% 92%, rgba(255,255,255,.12) 0 1px, transparent 1px),
    radial-gradient(circle at 41% 70%, rgba(255,255,255,.12) 0 1px, transparent 1px),
    radial-gradient(circle at 58% 78%, rgba(255,255,255,.14) 0 1px, transparent 1px),
    radial-gradient(circle at 66% 54%, rgba(255,255,255,.1) 0 1px, transparent 1px),
    radial-gradient(circle at 84% 44%, rgba(255,255,255,.12) 0 1px, transparent 1px),
    linear-gradient(180deg, #173843 0%, #132833 45%, #0b1219 100%);
}

.door-wrap {
  width: min(320px, 74vw);
  aspect-ratio: 3 / 4;
  perspective: 900px;
}

.door {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 12px solid #2b1f1b;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 18%, transparent 82%, rgba(0,0,0,.22)),
    repeating-linear-gradient(90deg, #74483b 0 34px, #63392f 34px 38px);
  box-shadow: 0 26px 0 #1b1718, 0 36px 50px rgba(0,0,0,.45);
  transform-origin: left center;
  transition: transform 1100ms ease-in, filter 800ms ease;
  appearance: none;
  cursor: pointer;
}

.door.open {
  transform: rotateY(-78deg);
  filter: brightness(.65);
}

.door.has-graphic {
  border-color: transparent;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  box-shadow:
    0 0 18px rgba(104, 187, 195, .34),
    0 0 42px rgba(104, 187, 195, .22);
}

.door:focus-visible {
  outline: 4px solid var(--accent);
  outline-offset: 6px;
}

.door.has-graphic::before,
.door.has-graphic::after,
.door.has-graphic .door-sign,
.door.has-graphic .door-knob {
  display: none;
}

.door::before,
.door::after {
  content: "";
  position: absolute;
  left: 13%;
  width: 74%;
  height: 24%;
  border: 6px solid rgba(42,27,22,.55);
}

.door::before {
  top: 13%;
}

.door::after {
  bottom: 15%;
}

.door-sign {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 16%;
  width: 74%;
  padding: 16px 10px;
  transform: translateX(-50%) rotate(-2deg);
  border: 4px solid #211c1d;
  background: #f2e7c9;
  color: #231d1b;
  text-align: center;
  box-shadow: 0 8px 0 rgba(0,0,0,.2);
}

.door-sign:empty {
  display: none;
}

.door-sign p {
  margin: 0 0 8px;
  font-size: clamp(20px, 5vw, 31px);
  font-weight: 900;
  line-height: 1;
}

.door-sign span {
  display: block;
  font-size: 16px;
}

.door-knob {
  position: absolute;
  right: 14%;
  top: 51%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -5px -5px 0 rgba(0,0,0,.22);
}

.door-screen h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 54px);
  text-align: center;
}

.door-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 18px;
  text-align: center;
}

.primary-button,
.password-row button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  color: #1d1916;
  background: var(--accent);
  box-shadow: 0 5px 0 #9f7631;
  font-weight: 800;
}

.primary-button {
  padding: 13px 34px;
  font-size: 22px;
}

.primary-button:active,
.password-row button:active,
.ghost-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9f7631;
}

.password-panel {
  width: min(460px, 88vw);
  padding: 18px;
  border: 4px solid #1b1718;
  background: rgba(22, 25, 31, .92);
}

.password-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.password-row input {
  min-width: 0;
  border: 3px solid #1b1718;
  border-radius: 6px;
  padding: 11px 12px;
  background: #f9f1df;
  color: #171718;
}

.password-row button,
.ghost-button {
  padding: 0 16px;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #f0a69a;
}

.access-screen {
  display: grid;
  place-items: center;
  align-content: center;
  background: #050608;
  letter-spacing: 0;
}

.access-screen p {
  color: var(--green);
  font-size: clamp(24px, 6vw, 60px);
  font-weight: 900;
}

.access-screen h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 42px);
}

.game-screen {
  position: relative;
  background: #12151a;
}

.hud {
  position: fixed;
  z-index: 10;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.hud div {
  padding: 10px 14px;
  border: 3px solid rgba(0,0,0,.35);
  border-radius: 8px;
  background: rgba(18,21,26,.75);
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.viewport {
  position: relative;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  outline: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,.07), transparent 48%),
    #11151a;
}

.memory-room {
  position: relative;
  width: 1280px;
  height: 760px;
  transform: scale(var(--room-scale, 1));
  transform-origin: center;
  overflow: hidden;
  border: 8px solid #151719;
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 0 39%, #e0ab57 39% 41%, transparent 41% 100%),
    url("/assets/graphics/room/wall.png") center top / 100% 41% no-repeat,
    #f5c57e;
  box-shadow: 0 24px 60px rgba(0,0,0,.48);
}

.memory-room::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 41%;
  bottom: 0;
  background:
    url("/assets/graphics/room/floor-tiles.png") left top / 260px auto repeat,
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.1));
}

.room-rug {
  position: absolute;
  left: 350px;
  top: 432px;
  width: 540px;
  height: 235px;
  border: 8px solid #2b2630;
  border-radius: 50%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 15px, transparent 15px 38px),
    #9b4d4a;
  opacity: .9;
}

.room-rug.has-graphic,
.room-shelf.has-graphic,
.room-table.has-graphic {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.room-rug.has-graphic {
  border-color: transparent;
  background-color: transparent;
}

.room-shelf {
  position: absolute;
  right: 132px;
  top: 66px;
  width: 214px;
  height: 129px;
  background: #51372f;
  box-shadow: 0 58px 0 #51372f;
}

.room-shelf.has-graphic {
  background-color: transparent;
  box-shadow: none;
}

.room-shelf::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 22px;
  width: 22px;
  height: 48px;
  background: #f0c65f;
  box-shadow: 34px 8px 0 #78a7c7, 68px -4px 0 #c86e5c, 132px 4px 0 #82b580, 172px -6px 0 #efe3c5;
}

.room-shelf.has-graphic::before {
  display: none;
}

.room-table {
  position: absolute;
  z-index: 4;
  width: 180px;
  height: 126px;
}

.room-table-left {
  left: 118px;
  top: 534px;
}

.room-table-right {
  left: 860px;
  top: 462px;
}

.baba-sprite {
  position: absolute;
  z-index: 3;
  left: 190px;
  top: 620px;
  width: 104px;
  height: 174px;
  transform: translate(-50%, -100%);
}

.baba-sprite.has-graphic {
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
}

.baba-sprite.facing-left {
  transform: translate(-50%, -100%) scaleX(-1);
}

.baba-sprite.has-graphic span {
  display: none;
}

.baba-sprite span {
  position: absolute;
  display: block;
}

.head {
  left: 21px;
  top: 5px;
  width: 32px;
  height: 32px;
  border-radius: 14px 14px 12px 12px;
  background: #d9a477;
  box-shadow: inset -5px -4px 0 rgba(0,0,0,.12);
}

.glasses {
  left: 18px;
  top: 17px;
  width: 38px;
  height: 9px;
  border: 3px solid #1e2830;
  border-left-width: 7px;
  border-right-width: 7px;
}

.body {
  left: 17px;
  top: 42px;
  width: 38px;
  height: 43px;
  border-radius: 6px 6px 3px 3px;
  background: var(--green);
}

.mug {
  left: 51px;
  top: 54px;
  width: 16px;
  height: 18px;
  border: 3px solid #1e2830;
  background: #f0efe7;
}

.bag {
  left: 5px;
  top: 47px;
  width: 16px;
  height: 36px;
  border-radius: 5px;
  background: #47535c;
}

.leg {
  top: 84px;
  width: 14px;
  height: 28px;
  background: #29364a;
}

.leg.left {
  left: 22px;
}

.leg.right {
  left: 41px;
}

.baba-sprite.walking .leg.left {
  animation: step-left .3s infinite alternate;
}

.baba-sprite.walking .leg.right {
  animation: step-right .3s infinite alternate;
}

@keyframes step-left {
  to { transform: translateX(-5px); }
}

@keyframes step-right {
  to { transform: translateX(5px); }
}

.memory-object,
.final-door {
  position: absolute;
  z-index: 5;
  width: 112px;
  height: 112px;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
}

.memory-object.has-graphic,
.final-door.has-graphic {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.memory-object::before,
.memory-object::after {
  content: "";
  position: absolute;
  display: block;
}

.memory-object.has-graphic::before,
.memory-object.has-graphic::after {
  display: none;
}

.memory-object.available {
  filter:
    drop-shadow(0 0 5px rgba(94, 198, 255, .78))
    drop-shadow(0 0 12px rgba(94, 198, 255, .46));
}

.memory-object.unlocked {
  filter: drop-shadow(0 0 9px rgba(130,181,128,.85));
}

.object-window {
  width: 190px;
  height: 132px;
}

.final-door {
  left: 640px;
  top: 500px;
  width: 182px;
  height: 182px;
  border: 0;
  background: url("/assets/graphics/memoryItems/Heart.png") center / contain no-repeat;
  color: transparent;
  box-shadow: none;
}

.final-door.has-graphic {
  border-color: transparent;
  background-color: transparent;
  color: transparent;
  box-shadow: none;
}

.final-door span {
  position: absolute;
  left: 50%;
  top: -48px;
  width: 210px;
  transform: translateX(-50%);
  color: var(--accent);
  font-weight: 900;
}

.final-door span {
  display: none;
}

.final-door.has-graphic span {
  display: none;
}

.final-door.locked {
  filter: grayscale(.8) brightness(.55);
}

.final-door.unlocked {
  filter:
    drop-shadow(0 0 6px rgba(94, 198, 255, .82))
    drop-shadow(0 0 14px rgba(94, 198, 255, .5));
}

.inspect-hint {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: 68px;
  transform: translateX(-50%);
  padding: 10px 15px;
  border: 3px solid rgba(0,0,0,.35);
  border-radius: 8px;
  background: rgba(18,21,26,.82);
  color: var(--accent);
  font-weight: 900;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(4,5,7,.72);
}

.memory-modal article,
.final-modal article {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(260px, 420px);
  gap: 22px;
  width: min(860px, calc(100vw - 26px));
  max-height: calc(100vh - 26px);
  overflow: auto;
  padding: 22px;
  border: 5px solid #1b1718;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px) 0 0 / 28px 28px,
    #efe3c5;
  color: #251f1c;
  box-shadow: 0 26px 80px rgba(0,0,0,.52);
}

.close-button {
  position: absolute;
  z-index: 3;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #251f1c;
  color: #efe3c5;
  font-weight: 900;
}

.photo-slot {
  min-height: 300px;
  border: 10px solid #fff8e8;
  background:
    linear-gradient(135deg, rgba(255,255,255,.2), transparent),
    linear-gradient(135deg, #78a7c7, #f0c65f 55%, #c86e5c);
  box-shadow: 0 8px 18px rgba(0,0,0,.2);
  transform: rotate(-1deg);
}

.photo-slot.has-image {
  background-position: center;
  background-size: cover;
}

.memory-copy {
  align-self: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2f5d84;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1;
  color: #4c7ea6;
}

.memory-copy p {
  font-size: 20px;
  line-height: 1.45;
}

#memoryPrompt {
  min-height: 6em;
}

.quiz {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.quiz button {
  padding: 10px 12px;
  border: 3px solid #251f1c;
  border-radius: 8px;
  background: #fff8e8;
  color: #251f1c;
  text-align: left;
}

.quiz button.correct {
  background: #b8d09c;
}

.quiz button.incorrect {
  background: #e9aaa0;
}

.reveal {
  margin-top: 18px;
}

.reveal label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.reveal input {
  width: 100%;
}

.final-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-self: start;
}

.final-gallery span {
  min-height: 220px;
  border: 6px solid #fff8e8;
  background: linear-gradient(135deg, #78a7c7, #f0c65f 55%, #c86e5c);
  box-shadow: 0 5px 12px rgba(0,0,0,.2);
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.achievements span {
  padding: 8px 10px;
  border: 3px solid #251f1c;
  border-radius: 8px;
  background: #f0c65f;
  color: #251f1c;
  font-weight: 900;
}

.final-video {
  width: 100%;
  max-height: 240px;
  margin-top: 10px;
  border: 5px solid #251f1c;
}

@media (max-width: 720px) {
  .memory-modal article,
  .final-modal article {
    grid-template-columns: 1fr;
  }

  .photo-slot {
    min-height: 220px;
  }


  .memory-object,
  .final-door {
    transform: translate(-50%, -50%) scale(.86);
  }

  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }
}
