:root {
  font-family: Georgia, 'Times New Roman', serif;
  color: #fff4e9;
  background: #141121;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  background:
    radial-gradient(ellipse at 20% 12%, #653d68 0, transparent 37%),
    radial-gradient(ellipse at 80% 80%, #253f63 0, transparent 43%),
    #141121;
}

.app {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  min-height: min(720px, 96vh);
  overflow: hidden;
  border: 1px solid #ffffff30;
  border-radius: 24px;
  background: linear-gradient(150deg, #33213cdd, #171b32ed);
  box-shadow: 0 24px 80px #0806109c;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 15px;
}

.brand {
  color: #f8d5bb;
  font: 700 0.74rem/1.5 Arial, sans-serif;
  letter-spacing: 2px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.small-btn {
  padding: 9px 12px;
  border: 1px solid #ffffff38;
  border-radius: 25px;
  background: #ffffff10;
  color: #f5e7e4;
  font: 600 12px Arial, sans-serif;
  cursor: pointer;
}

.small-btn:hover {
  background: #ffffff25;
}

.progress {
  height: 6px;
  margin: 0 24px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff19;
}

.progress > div {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #e8a7b0, #ffdfaa);
  transition: width 0.35s;
}

.scene {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px 36px 36px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: #f2bdc4;
  font: 700 12px Arial, sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.scene h1 {
  max-width: 600px;
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.14;
}

.scene h2 {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.18;
}

.scene p {
  max-width: 560px;
  margin: 0;
  color: #f5e7e5;
  font-size: 1.07rem;
  line-height: 1.65;
}

.scene .hint {
  color: #d9c9d6;
  font: 14px/1.5 Arial, sans-serif;
}

.illustration {
  color: #e6bd8b;
  font: 500 13px/1 Arial, sans-serif;
  letter-spacing: 4px;
}

.illustration.level-number {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid #e6bd8b66;
  border-radius: 50%;
  font-size: 15px;
  letter-spacing: 2px;
}

.birthday-badge {
  padding: 9px 16px;
  border: 1px solid #e6bd8b75;
  border-radius: 999px;
  background: #e6bd8b12;
  color: #ffe1b5;
  font: 700 11px/1.3 Arial, sans-serif;
  letter-spacing: 2px;
}

.scene > .birthday-badge + .eyebrow {
  margin-top: 2px;
}

.actions {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 530px;
  margin-top: 8px;
}

.choice,
.primary,
.secondary {
  padding: 14px 18px;
  border-radius: 14px;
  font: 600 15px/1.4 Arial, sans-serif;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.primary {
  border: 1px solid #f4c7b8;
  background: #f4c7b8;
  color: #291d31;
}

.primary:hover {
  background: #ffe1ce;
}

.secondary {
  border: 1px solid #e6bd8b99;
  background: #ffffff08;
  color: #f5e7e5;
}

.secondary:hover {
  background: #ffffff18;
}

.game-feedback {
  min-height: 24px;
  color: #ffdcab !important;
  font: 600 14px/1.5 Arial, sans-serif !important;
}

.lock-display {
  min-width: 180px;
  padding: 14px 20px;
  border: 1px solid #e6bd8b70;
  border-radius: 12px;
  background: #11121b;
  color: #ffe1b5;
  font: 500 32px/1.2 'Courier New', monospace;
  letter-spacing: 8px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 8px;
}

.keypad-button {
  min-height: 48px;
  border: 1px solid #ffffff35;
  border-radius: 10px;
  background: #ffffff10;
  color: #fff4e9;
  font: 600 15px Arial, sans-serif;
  cursor: pointer;
}

.keypad-button:hover {
  border-color: #e6bd8b;
  background: #ffffff20;
}

.keypad-utility {
  color: #e6bd8b;
  font-size: 12px;
}

.cipher-label {
  color: #d3bca7 !important;
  font: 700 11px/1.4 Arial, sans-serif !important;
  letter-spacing: 2px;
}

.cipher-text,
.cipher-result {
  font: 600 17px/1.5 'Courier New', monospace !important;
  letter-spacing: 2px;
}

.cipher-result {
  min-height: 28px;
  color: #ffe1b5 !important;
}

.cipher-dial {
  width: min(100%, 340px);
  accent-color: #e6bd8b;
}

.playlist-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  width: min(100%, 390px);
}

.playlist-track {
  min-height: 78px;
  border: 1px solid #ffffff38;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff12, #ffffff06);
  color: #f5e7e5;
  font: italic 19px Georgia, serif;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.playlist-track:hover {
  transform: translateY(-2px);
  border-color: #e6bd8b88;
}

.playlist-track.playing {
  border-color: #ffe1b5;
  background: #e6bd8b45;
  box-shadow: 0 0 24px #e6bd8b55;
}

.forest-board,
.library-board,
.memory-board {
  display: grid;
  gap: 9px;
  width: min(100%, 390px);
}

.forest-board {
  grid-template-columns: repeat(4, 1fr);
}

.library-board {
  grid-template-columns: repeat(4, 1fr);
}

.forest-tile,
.library-book,
.memory-card {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #ffffff45;
  border-radius: 12px;
  background: #ffffff12;
  color: #fff4e9;
  font-size: clamp(24px, 6vw, 38px);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.forest-tile:hover:not(:disabled),
.library-book:hover:not(:disabled),
.memory-card:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #ffffff25;
}

.forest-tile:disabled,
.library-book:disabled {
  cursor: default;
}

.forest-tile.found,
.library-book.found,
.memory-card.matched {
  border-color: #ffdfaa;
  background: #ffdfaa30;
}

.forest-tile.obstacle,
.forest-tile.empty,
.library-book.searched {
  opacity: 0.7;
}

.maze-board {
  display: grid;
  grid-template-columns: repeat(5, 48px);
  gap: 5px;
  padding: 8px;
  border: 1px solid #ffffff30;
  border-radius: 14px;
  background: #111827;
}

.maze-cell {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff12;
  font-size: 23px;
}

.maze-cell.wall {
  background: #4a3861;
  box-shadow: inset 0 0 0 1px #ffffff18;
}

.maze-cell.player,
.maze-cell.exit {
  background: #ffdfaa35;
}

.maze-controls {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.maze-lower-controls {
  display: flex;
  gap: 5px;
}

.maze-control {
  width: 48px;
  height: 42px;
  border: 1px solid #ffffff45;
  border-radius: 10px;
  background: #ffffff12;
  color: #fff4e9;
  font: 700 20px Arial, sans-serif;
  cursor: pointer;
}

.maze-control:hover {
  background: #ffffff2a;
}

.island-track,
.island-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: min(100%, 500px);
}

.island-marker {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #ffffff30;
  border-radius: 50%;
  background: #ffffff10;
  font-size: 24px;
}

.island-marker.current {
  border-color: #ffdfaa;
  box-shadow: 0 0 16px #ffdfaa70;
}

.island-option {
  flex: 1 1 120px;
  min-height: 74px;
  border: 1px solid #ffffff45;
  border-radius: 14px;
  background: #ffffff12;
  color: #fff4e9;
  font: 600 14px Arial, sans-serif;
  cursor: pointer;
}

.island-option:hover {
  background: #ffffff25;
}

.memory-board {
  grid-template-columns: repeat(4, 1fr);
}

.memory-card {
  padding: 8px;
  font: 500 13px/1.35 Georgia, serif;
  letter-spacing: 0;
}

.memory-card.revealed {
  border-color: #e6bd8b;
  background: #e6bd8b24;
  color: #ffe1b5;
}

.reward-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  width: min(100%, 520px);
}

.photo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 260px;
  overflow: hidden;
  border: 2px solid #f2d2cf7d;
  border-radius: 18px;
  background: linear-gradient(135deg, #8c617a, #33455d);
  box-shadow: 0 12px 35px #08071160;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  background: #211c31;
  object-fit: contain;
}

.reward-gallery.multiple .photo-frame {
  height: 200px;
}

.placeholder {
  padding: 20px;
  color: #fff4e9;
  font: 14px/1.6 Arial, sans-serif;
}

.message {
  color: #ffe0c6 !important;
  font-size: 1.15rem !important;
  font-style: italic;
}

.all-photos + .actions .primary {
  background: linear-gradient(110deg, #f4c7b8, #ffe1b5);
}

.all-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(100%, 520px);
}

.all-photos img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #ffffff50;
  border-radius: 10px;
  background: #211c31;
  object-fit: cover;
}

footer {
  padding: 17px 20px;
  border-top: 1px solid #ffffff20;
  color: #c9b9c9;
  font: 12px/1.6 Arial, sans-serif;
  text-align: center;
}

@media (max-width: 560px) {
  body {
    padding: 0;
  }

  .app {
    min-height: 100vh;
    border-radius: 0;
  }

  .topbar {
    padding: 18px 16px 12px;
  }

  .brand {
    max-width: 170px;
    font-size: 10px;
  }

  .progress {
    margin: 0 16px;
  }

  .scene {
    gap: 14px;
    padding: 22px 18px 32px;
  }

  .photo-frame {
    height: 230px;
  }

  .keypad {
    grid-template-columns: repeat(3, 58px);
  }

  .memory-board {
    grid-template-columns: repeat(2, 1fr);
    max-width: 310px;
  }

  .reward-gallery.multiple .photo-frame {
    height: 170px;
  }

  .top-actions {
    gap: 4px;
  }

  .small-btn {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
