/* === PS1 JRPG Theme Variables === */
:root {
  --ps1-bg-top: #1a1a4a;
  --ps1-bg-bottom: #0a0a2a;
  --ps1-border-outer: #666677;
  --ps1-border-inner: #aaaacc;
  --ps1-text: #ffffff;
  --ps1-gold: #ffffff;
  --ps1-pink: #ff6688;
  --ps1-hint: #7777aa;
  --ps1-font: 'Press Start 2P', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--ps1-font);
  cursor: none;
  user-select: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  image-rendering: pixelated;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* === Scanline overlay (now handled by CRT shader) === */
/* === Scanline overlay === */
#scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
}

/* === Vignette overlay === */
#vignette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

/* === Camera Flash overlay === */
#camera-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
}

#camera-flash.active {
  animation: camera-flash-anim 0.5s ease-out forwards;
}

@keyframes camera-flash-anim {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

/* === UI Layer === */
#ui-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 60px;
}

.hidden {
  display: none !important;
}

/* === PS1 Bouncing Cursor Animation === */
@keyframes ps1-cursor-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

@keyframes ps1-cursor-bounce-centered {
  0%, 100% { transform: translateX(0) translateY(-50%); }
  50% { transform: translateX(3px) translateY(-50%); }
}

.ps1-cursor::before {
  content: '\25B6';
  color: var(--ps1-gold);
  margin-right: 8px;
  display: inline-block;
  vertical-align: middle;
  animation: ps1-cursor-bounce 0.6s ease-in-out infinite;
  font-size: 8px;
}

/* ====================================
   CROSSHAIR — Center dot reticle
   ==================================== */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 999;
  mix-blend-mode: difference;
}

/* ====================================
   INTERACT PROMPT — PS1 Window
   ==================================== */
#interact-prompt {
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  text-align: center;
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 10px 20px;
  letter-spacing: 0.5px;
  animation: prompt-fade-pulse 2.5s ease-in-out infinite;
}

.prompt-key {
  display: none;
}

.prompt-key-sm {
  display: none;
}

@keyframes prompt-fade-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ====================================
   MEMORY POPUP — PS1 Dialog Window
   ==================================== */
#memory-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 25;
  max-width: 90vw;
  width: 480px;
}

.popup-border {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 20px 24px;
  text-align: center;
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  line-height: 2.0;
  position: relative;
}

.popup-border::before,
.popup-border::after {
  content: none;
}

#memory-title {
  font-family: var(--ps1-font);
  font-size: 12px;
  font-weight: normal;
  color: var(--ps1-gold);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

#memory-image-area {
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}

.image-placeholder {
  width: 200px;
  height: 130px;
  border: 2px solid var(--ps1-border-outer);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  line-height: 2.0;
  text-align: center;
  background: rgba(0, 0, 20, 0.5);
}

.placeholder-heart {
  font-size: 16px;
  color: var(--ps1-pink);
  opacity: 0.5;
}

.memory-photo {
  max-width: 100%;
  max-height: 200px;
  image-rendering: pixelated;
  border: 2px solid var(--ps1-border-outer);
  border-radius: 3px;
}

#memory-text {
  margin-bottom: 14px;
  min-height: 30px;
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  line-height: 2.0;
}

.popup-dismiss {
  font-family: var(--ps1-font);
  font-size: 8px;
  color: var(--ps1-hint);
}

/* Popup animations — fast snap (PS1 style) */
.popup-enter {
  animation: popup-open 0.1s ease-out;
}
.popup-exit {
  animation: popup-close 0.1s ease-in forwards;
}

@keyframes popup-open {
  from { opacity: 0; transform: translate(-50%, -50%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes popup-close {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to { opacity: 0; transform: translate(-50%, -50%); }
}

/* === Area label — PS1 style === */
#area-label {
  position: fixed;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  animation: label-fade 3.5s ease forwards;
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 8px 20px;
}

@keyframes label-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

/* ====================================
   HUD — PS1 Window
   ==================================== */
#hud {
  position: fixed;
  top: 12px;
  right: 16px;
  text-align: right;
  pointer-events: none;
}

#memory-counter {
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 8px;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 8px 12px;
  line-height: 2.0;
}

#portal-hint,
#journal-hint {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

.heart-filled {
  color: var(--ps1-pink);
  font-style: normal;
  margin-left: 2px;
  font-size: 10px;
}

.heart-empty {
  color: rgba(60, 60, 100, 0.5);
  font-style: normal;
  margin-left: 2px;
  font-size: 10px;
}

.sparkle {
  animation: sparkle-pulse 1.2s ease-in-out infinite;
  color: var(--ps1-gold);
}

@keyframes sparkle-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.1); }
}

.all-found {
  color: var(--ps1-gold);
  border-color: var(--ps1-gold);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344, 0 0 8px rgba(255, 215, 0, 0.15);
}

/* ====================================
   PORTAL / AREA SELECTION MENU
   PS1 Window with cursor navigation
   ==================================== */
#portal-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 25;
  width: 340px;
  max-width: 90vw;
}

.portal-border {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 18px 20px;
}

.portal-title {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 10px;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

#portal-options {
  margin-bottom: 12px;
}

.portal-option {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 10px;
  padding: 8px 12px;
  padding-left: 24px;
  cursor: pointer;
  position: relative;
  margin: 2px 0;
  line-height: 1.8;
  border-radius: 3px;
  border-left: none;
}

.portal-option::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.portal-option.selected {
  color: var(--ps1-text);
  background: rgba(136, 136, 204, 0.1);
}

.portal-option.selected::before {
  content: '\25B6';
  color: var(--ps1-gold);
  font-size: 8px;
  animation: ps1-cursor-bounce-centered 0.6s ease-in-out infinite;
  position: absolute;
  left: 8px;
  top: 50%;
}

.portal-option:hover {
  color: var(--ps1-text);
}

.portal-option.locked {
  color: #444466;
  font-style: italic;
  cursor: default;
}

.portal-option.locked.selected::before {
  color: #444466;
}

.portal-option.locked:hover {
  color: #444466;
}

.portal-notes {
  font-size: 8px;
  color: #ff88aa;
  margin-left: 8px;
  opacity: 0.8;
}

.portal-hint {
  font-family: var(--ps1-font);
  font-size: 8px;
  color: var(--ps1-hint);
  text-align: center;
  margin-top: 12px;
}

/* === Finale overlay === */
#finale-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

#finale-overlay.active {
  pointer-events: auto;
  cursor: default;
}

.finale-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0;
  animation: text-appear 3s ease forwards;
  z-index: 52;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

@keyframes text-appear {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.02); }
}

/* Finale letter prompt */
.finale-letter-prompt {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 52;
  animation: prompt-fade-in 1.5s ease forwards;
}

.letter-prompt-line {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.letter-prompt-hint {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  opacity: 0;
  animation: prompt-hint-pulse 2s ease 1.5s infinite;
}

@keyframes prompt-fade-in {
  0% { opacity: 0; transform: translate(-50%, -50%) translateY(10px); }
  100% { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
}

@keyframes prompt-hint-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Love letter screen */
.love-letter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 2, 12, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: letter-fade-in 1.5s ease forwards;
}

@keyframes letter-fade-in {
  to { opacity: 1; }
}

.letter-border {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 28px 32px;
  max-width: 520px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.letter-border::before,
.letter-border::after {
  content: none;
}

.letter-image {
  text-align: center;
  margin-bottom: 20px;
}

.letter-image img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  border: 2px solid var(--ps1-gold);
  image-rendering: auto;
}

.letter-greeting {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 14px;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.letter-body {
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 9px;
  line-height: 2.4;
  text-align: center;
  margin-bottom: 24px;
}

.letter-signoff {
  color: var(--ps1-pink);
  font-family: var(--ps1-font);
  font-size: 10px;
  text-align: right;
  margin-bottom: 20px;
}

.letter-footer {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 12px;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 2px;
  animation: gentle-pulse 2.5s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.letter-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: none;
  border: 2px solid var(--ps1-border-outer);
  color: var(--ps1-text);
  font-size: 24px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-family: var(--ps1-font);
  transition: background 0.2s, color 0.2s;
}

.letter-close-btn:hover {
  background: var(--ps1-pink);
  color: #fff;
}

/* Floating hearts background for love letter */
.floating-hearts {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.float-heart {
  position: absolute;
  color: rgba(255, 107, 157, 0.08);
  font-size: 14px;
  animation: float-up linear infinite;
}

@keyframes float-up {
  0% {
    transform: translateY(100vh);
    opacity: 0;
  }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% {
    transform: translateY(-20vh);
    opacity: 0;
  }
}

/* ====================================
   TITLE / START SCREEN
   PS1 game logo screen
   ==================================== */
#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.8s ease;
  overflow: hidden;
}

#start-screen.fade-out {
  opacity: 0;
}

/* --- Layered background effects --- */
.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Layer 1: Aurora / color wash that shifts */
.starfield::before {
  display: none;
}

@keyframes aurora-drift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-5%, -3%); }
  66% { transform: translate(-2%, -6%); }
  100% { transform: translate(-8%, -2%); }
}

/* Layer 2: Stars */
.starfield::after {
  display: none;
}

@keyframes starfield-twinkle {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Layer 3: Light rays from center */
.title-screen-rays {
  display: none;
}

@keyframes rays-rotate {
  from { transform: translate(-50%, -55%) rotate(0deg); }
  to { transform: translate(-50%, -55%) rotate(360deg); }
}

/* Layer 4: Horizon glow at bottom */
.title-screen-horizon {
  display: none;
}

/* Layer 5: Floating particles */
.title-screen-particles {
  display: none;
}

@keyframes particles-float-a {
  0% { transform: translate(0, 0); }
  50% { transform: translate(15px, -20px); }
  100% { transform: translate(-10px, 15px); }
}

@keyframes particles-float-b {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-20px, 10px); }
  100% { transform: translate(12px, -18px); }
}

.start-content {
  text-align: center;
  color: #ffffff;
  position: relative;
  z-index: 1;
}

/* --- Diamond emblem with heart character --- */
.title-emblem {
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emblem-diamond {
  width: 90px;
  height: 90px;
  border: 2px solid #ffffff;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
}

.emblem-diamond::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.emblem-heart {
  transform: rotate(-45deg);
  font-size: 32px;
  line-height: 1;
  color: #ffffff;
  text-shadow: none;
  animation: none;
}

@keyframes heart-pulse {
  0%, 100% {
    text-shadow:
      0 0 15px rgba(255, 102, 136, 0.6),
      0 0 30px rgba(255, 102, 136, 0.3);
  }
  50% {
    text-shadow:
      0 0 20px rgba(255, 102, 136, 0.8),
      0 0 40px rgba(255, 102, 136, 0.4),
      0 0 60px rgba(255, 102, 136, 0.2);
  }
}

@keyframes emblem-glow {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: none; }
}

/* --- Title "626" --- */
.title-626 {
  font-family: var(--ps1-font);
  font-size: 52px;
  margin: 0 0 4px;
  color: #ffffff;
  letter-spacing: 14px;
  text-shadow: none;
  animation: none;
}

@keyframes title-shimmer {
  0%, 100% {
    text-shadow:
      0 0 20px rgba(255, 255, 255, 0.4),
      0 0 40px rgba(200, 200, 255, 0.2),
      0 0 80px rgba(170, 170, 220, 0.1),
      0 2px 0 #888899,
      0 4px 0 #666677,
      0 6px 8px rgba(0, 0, 0, 0.5);
  }
  50% {
    text-shadow:
      0 0 30px rgba(255, 255, 255, 0.6),
      0 0 60px rgba(200, 200, 255, 0.3),
      0 0 100px rgba(170, 170, 220, 0.15),
      0 2px 0 #888899,
      0 4px 0 #666677,
      0 6px 12px rgba(0, 0, 0, 0.6);
  }
}

/* --- Title "Memories" --- */
.title-memories {
  font-family: var(--ps1-font);
  font-size: 14px;
  margin: 0 0 48px;
  color: #ffffff;
  letter-spacing: 8px;
  text-transform: uppercase;
  text-shadow: none;
}

/* --- Divider line --- */
.title-memories::after {
  content: '';
  display: block;
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ffffff, transparent);
  margin: 28px auto 0;
}

.start-content .subtitle {
  display: none;
}

.start-content .start-cta {
  font-family: var(--ps1-font);
  font-size: 10px;
  color: #ffffff;
  animation: cta-pulse 2.5s ease-in-out infinite;
  letter-spacing: 1px;
}

@keyframes cta-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* === Photostrip Popup === */
#photostrip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.photostrip-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.photostrip-strip {
  width: 200px;
  background: #f0ece4;
  padding: 12px 10px 10px;
  border: 2px solid var(--ps1-border-outer);
  border-radius: 3px;
  animation: photostrip-dispense 1.0s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform: translateY(-120vh);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#photostrip-image-area {
  width: 100%;
  min-height: 260px;
  background: #d8d4cc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ps1-border-inner);
  border-radius: 2px;
}

.photostrip-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
}

.photostrip-placeholder {
  width: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #887766;
  font-family: var(--ps1-font);
  font-size: 8px;
  line-height: 2.0;
}

.photostrip-placeholder .placeholder-heart {
  font-size: 24px;
  color: var(--ps1-pink);
  opacity: 0.6;
  margin-bottom: 6px;
}

.photostrip-footer {
  font-family: var(--ps1-font);
  font-size: 7px;
  color: #776655;
  text-align: center;
  margin-top: 10px;
  letter-spacing: 0.5px;
}

.photostrip-dismiss {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  margin-top: 20px;
}

@keyframes photostrip-dispense {
  0% {
    transform: translateY(-120vh);
  }
  70% {
    transform: translateY(2%);
  }
  85% {
    transform: translateY(-1%);
  }
  100% {
    transform: translateY(0);
  }
}

/* ====================================
   COMPUTER POPUP — PS1 Terminal Window
   ==================================== */
#computer-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 25;
  max-width: 90vw;
  width: 460px;
}

.computer-border {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 20px 24px;
  text-align: center;
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  line-height: 2.0;
  position: relative;
}

.computer-heading {
  font-family: var(--ps1-font);
  font-size: 12px;
  color: var(--ps1-gold);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.computer-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.computer-option {
  background: transparent;
  border: none;
  border-radius: 3px;
  padding: 8px 12px;
  padding-left: 24px;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 10px;
  cursor: pointer;
  position: relative;
}

.computer-option::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.computer-option:hover {
  color: var(--ps1-text);
}

.computer-option.selected {
  color: var(--ps1-text);
  background: rgba(136, 136, 204, 0.1);
}

.computer-option.selected::before {
  content: '\25B6';
  color: var(--ps1-gold);
  font-size: 8px;
  animation: ps1-cursor-bounce-centered 0.6s ease-in-out infinite;
  position: absolute;
  left: 8px;
  top: 50%;
}

.computer-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.computer-gallery-slot {
  aspect-ratio: 1;
  background: rgba(0, 0, 20, 0.5);
  border: 2px solid var(--ps1-border-outer);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
}

.computer-gallery-slot:hover {
  border-color: var(--ps1-border-inner);
}

.computer-back-btn {
  display: inline-block;
  background: transparent;
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 6px 20px;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  cursor: pointer;
  margin-bottom: 12px;
}

.computer-back-btn:hover {
  color: var(--ps1-text);
}

.computer-dismiss {
  font-family: var(--ps1-font);
  font-size: 8px;
  color: var(--ps1-hint);
}

/* === Area Transition Overlay === */
#area-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

#area-transition.fade-in {
  animation: transition-fade-in 0.5s ease forwards;
  pointer-events: auto;
}

#area-transition.hold {
  opacity: 1;
  pointer-events: auto;
}

#area-transition.fade-out {
  animation: transition-fade-out 0.5s ease forwards;
  pointer-events: none;
}

@keyframes transition-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes transition-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

#transition-location-name {
  font-family: var(--ps1-font);
  font-size: 14px;
  color: var(--ps1-gold);
  text-transform: uppercase;
  letter-spacing: 3px;
  opacity: 0;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

#area-transition.hold #transition-location-name {
  animation: location-name-appear 1.5s ease forwards;
}

@keyframes location-name-appear {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ====================================
   OBJECTIVE TRACKER — Top-left PS1 HUD
   ==================================== */
#objective-tracker {
  position: fixed;
  top: 12px;
  left: 16px;
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 8px;
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 8px 12px;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.3s;
  line-height: 2.0;
}

#objective-tracker.hidden { display: none !important; }

/* ====================================
   LOVE NOTE COUNTER — HUD
   ==================================== */
#love-note-counter {
  color: var(--ps1-pink);
  font-family: var(--ps1-font);
  font-size: 8px;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 8px 12px;
  margin-top: 6px;
  line-height: 2.0;
}

/* ====================================
   LOVE NOTE POPUP — Auto-dismiss
   ==================================== */
#love-note-popup {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  pointer-events: none;
  max-width: 80vw;
  width: 360px;
}

.love-note-border {
  background: linear-gradient(180deg, #2a1a3a, #1a0a2a);
  border: 2px solid var(--ps1-pink);
  box-shadow: inset 1px 1px 0 rgba(255, 136, 170, 0.3), inset -1px -1px 0 #332233, 0 0 12px rgba(255, 102, 136, 0.2);
  border-radius: 3px;
  padding: 16px 20px;
  text-align: center;
  animation: love-note-appear 3s ease forwards;
}

.love-note-icon {
  font-size: 16px;
  color: var(--ps1-pink);
  margin-bottom: 8px;
}

#love-note-text {
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 9px;
  line-height: 2.0;
  font-style: italic;
}

@keyframes love-note-appear {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ====================================
   JOURNAL OVERLAY — J key
   ==================================== */
/* ====================================
   JOURNAL OVERLAY (Modern-PS1 Hybrid)
   ==================================== */
#journal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.88);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  animation: journal-fade-in 0.25s ease-out;
}

@keyframes journal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.journal-container {
  display: flex;
  width: 820px;
  max-width: 95vw;
  height: 520px;
  max-height: 85vh;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(170, 170, 204, 0.15);
}

/* --- Sidebar --- */
.journal-sidebar {
  width: 160px;
  min-width: 160px;
  background: linear-gradient(180deg, #1a1a4a, #0d0d2d);
  border-right: 1px solid rgba(170, 170, 204, 0.15);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 2px;
}

.journal-logo {
  font-family: var(--ps1-font);
  font-size: 18px;
  color: var(--ps1-pink);
  text-align: center;
  padding: 8px 0 20px;
  letter-spacing: 4px;
  text-shadow: 0 0 12px rgba(255, 102, 136, 0.4);
}

.journal-tab {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-tab:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.03);
}

.journal-tab.selected {
  color: #fff;
  background: rgba(255, 102, 136, 0.08);
  border-left-color: var(--ps1-pink);
}

.tab-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.journal-close-hint {
  margin-top: auto;
  font-family: var(--ps1-font);
  font-size: 7px;
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
  padding: 12px;
}

/* --- Main Panel --- */
.journal-panel {
  flex: 1;
  background: linear-gradient(180deg, #141430, #0a0a24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#journal-header {
  padding: 20px 24px 12px;
  font-family: var(--ps1-font);
  font-size: 12px;
  color: var(--ps1-gold);
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(170, 170, 204, 0.08);
}

#journal-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 102, 136, 0.3) transparent;
}

#journal-content::-webkit-scrollbar {
  width: 4px;
}
#journal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 102, 136, 0.3);
  border-radius: 2px;
}

/* --- Grid Views --- */
.journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.journal-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(170, 170, 204, 0.1);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.journal-card:hover {
  border-color: rgba(255, 102, 136, 0.3);
  background: rgba(255, 102, 136, 0.05);
  transform: translateY(-1px);
}

.journal-card.selected {
  border-color: var(--ps1-pink);
  background: rgba(255, 102, 136, 0.08);
}

.journal-card.locked {
  opacity: 0.3;
  cursor: default;
}
.journal-card.locked:hover {
  border-color: rgba(170, 170, 204, 0.1);
  background: rgba(255, 255, 255, 0.03);
  transform: none;
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.card-thumbnail .lock-icon {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.15);
}

.card-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  line-height: 1.3;
}

.card-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

/* --- Note Cards (smaller, quote-focused) --- */
.journal-grid.notes-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.note-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(170, 170, 204, 0.1);
  border-radius: 6px;
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  text-align: center;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-card:hover {
  border-color: rgba(255, 102, 136, 0.3);
  background: rgba(255, 102, 136, 0.05);
}

.note-card.found {
  border-color: rgba(255, 102, 136, 0.2);
  color: var(--ps1-pink);
}

.note-card.locked {
  opacity: 0.25;
  cursor: default;
  font-style: normal;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.2);
}
.note-card.locked:hover {
  border-color: rgba(170, 170, 204, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

/* --- Detail View --- */
.journal-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail-back {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.detail-back:hover {
  color: var(--ps1-pink);
}

.detail-image-container {
  position: relative;
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  cursor: grab;
  margin-bottom: 16px;
}
.detail-image-container:active {
  cursor: grabbing;
}

.detail-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transform-origin: 0 0;
  transition: transform 0.1s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.detail-image-container.photostrip-frame {
  background: #f0ece4;
  padding: 12px;
  border-radius: 4px;
  max-height: 350px;
}

.zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
}

.detail-title {
  font-family: var(--ps1-font);
  font-size: 13px;
  color: var(--ps1-gold);
  margin-bottom: 8px;
}

.detail-area {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 12px;
}

.detail-text {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
}

.detail-quote {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-style: italic;
  color: var(--ps1-pink);
  line-height: 1.8;
  text-align: center;
  padding: 32px 24px;
}

.detail-caption {
  font-family: var(--ps1-font);
  font-size: 9px;
  color: #8b7e6a;
  text-align: center;
  margin-top: 8px;
}

/* --- Settings Tab --- */
.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-family: var(--ps1-font);
  font-size: 10px;
  color: var(--ps1-gold);
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.settings-area-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(170, 170, 204, 0.06);
}
.settings-area-title:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  min-width: 100px;
}

.settings-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ps1-pink);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 102, 136, 0.4);
}

.settings-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ps1-pink);
  cursor: pointer;
  border: none;
}

.settings-value {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  min-width: 32px;
  text-align: right;
}

/* --- Text Editor in Settings --- */
.editor-section {
  margin-bottom: 24px;
}

.editor-section-title {
  font-family: var(--ps1-font);
  font-size: 9px;
  color: var(--ps1-gold);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.editor-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(170, 170, 204, 0.08);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}

.editor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.editor-item-name {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
}

.editor-item-area {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

.editor-btn {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--ps1-pink);
  background: rgba(255, 102, 136, 0.1);
  border: 1px solid rgba(255, 102, 136, 0.2);
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.editor-btn:hover {
  background: rgba(255, 102, 136, 0.2);
}

.editor-btn.save-btn {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.2);
}
.editor-btn.save-btn:hover {
  background: rgba(74, 222, 128, 0.2);
}

.editor-preview {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  line-height: 1.5;
  margin-top: 4px;
}

.editor-textarea {
  width: 100%;
  min-height: 60px;
  margin-top: 8px;
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(170, 170, 204, 0.15);
  border-radius: 4px;
  resize: vertical;
  outline: none;
}
.editor-textarea:focus {
  border-color: var(--ps1-pink);
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

/* --- Counter badges --- */
.journal-counter {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 16px;
  text-align: center;
}

.journal-counter span {
  color: var(--ps1-pink);
  font-weight: 600;
}

/* --- Responsive --- */
@media (max-width: 700px) {
  .journal-container {
    flex-direction: column;
    height: 90vh;
  }
  .journal-sidebar {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    padding: 8px;
    gap: 0;
    border-right: none;
    border-bottom: 1px solid rgba(170, 170, 204, 0.15);
    overflow-x: auto;
  }
  .journal-logo { display: none; }
  .journal-close-hint { display: none; }
  .journal-tab {
    padding: 8px 14px;
    font-size: 11px;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .journal-tab.selected {
    border-left-color: transparent;
    border-bottom-color: var(--ps1-pink);
  }
}

/* ====================================
   PUZZLE OVERLAY
   ==================================== */
#puzzle-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: default;
}

.puzzle-window {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 20px 24px;
  width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
}

.puzzle-title {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 12px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.puzzle-hint {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  margin-bottom: 16px;
  line-height: 1.8;
}

/* --- Constellation puzzle (full-screen sky mode) --- */
#puzzle-overlay.sky-puzzle-mode {
  background: rgba(0, 0, 10, 0.35) !important;
}

.constellation-sky-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
  z-index: 1;
}

.constellation-bg-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #ffffff;
  border-radius: 50%;
  animation: constellation-twinkle 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes constellation-twinkle {
  0% { opacity: 0.15; }
  100% { opacity: 0.8; }
}

.sky-star {
  position: fixed;
  width: 18px;
  height: 18px;
  background: var(--ps1-gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.7), 0 0 20px rgba(255, 215, 0, 0.4), 0 0 40px rgba(255, 215, 0, 0.15);
  z-index: 3;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sky-star:hover {
  transform: translate(-50%, -50%) scale(1.6);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.9), 0 0 28px rgba(255, 215, 0, 0.5), 0 0 50px rgba(255, 215, 0, 0.2);
}

.sky-star.active {
  background: #ff6688;
  box-shadow: 0 0 14px rgba(255, 102, 136, 0.9), 0 0 28px rgba(255, 102, 136, 0.5), 0 0 50px rgba(255, 102, 136, 0.2);
}

.sky-star.wrong {
  background: #ff2244 !important;
  box-shadow: 0 0 14px rgba(255, 34, 68, 0.9), 0 0 28px rgba(255, 34, 68, 0.5) !important;
}

.sky-star-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ps1-font);
  font-size: 8px;
  color: var(--ps1-gold);
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* HUD bar at the bottom of the sky puzzle */
.constellation-hud {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 10px 24px;
}

.constellation-hud-title {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 10px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.constellation-hud-hint {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
}

.puzzle-reset {
  display: inline-block;
  background: transparent;
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 6px 20px;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  cursor: pointer;
}

.puzzle-reset:hover {
  color: var(--ps1-text);
}

.puzzle-exit-btn {
  display: block;
  margin-top: 12px;
  text-align: center;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  cursor: pointer;
  padding: 6px 0;
}

.puzzle-exit-btn:hover {
  color: var(--ps1-pink);
}

.puzzle-complete-msg {
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 14px;
  text-align: center;
  letter-spacing: 2px;
  animation: puzzle-complete-anim 1.2s ease;
}

@keyframes puzzle-complete-anim {
  0% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1.0); }
}

/* --- Aim Trainer puzzle --- */
.aim-trainer-puzzle {
  max-width: 400px;
}

.aim-trainer-hud {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: var(--ps1-font);
  font-size: 9px;
  color: var(--ps1-hint);
}

.aim-trainer-hud #aim-hits {
  color: var(--ps1-pink);
}

.aim-trainer-field {
  display: flex;
  justify-content: center;
}

.aim-trainer-field canvas {
  background: #0a0612;
  border: 2px solid var(--ps1-border-outer);
  border-radius: 3px;
  cursor: crosshair;
  image-rendering: pixelated;
  max-width: 100%;
  height: auto;
}

/* --- Quiz puzzle --- */
.quiz-puzzle {
  width: 480px !important;
  position: relative;
  min-height: 300px;
}

.quiz-question {
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  line-height: 2.0;
  margin-bottom: 16px;
  text-align: left;
  padding: 0 8px;
}

.quiz-input {
  display: block;
  width: 80%;
  margin: 0 auto 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 20, 0.5);
  border: 2px dotted var(--ps1-border-outer);
  border-radius: 3px;
  color: var(--ps1-text);
  font-family: var(--ps1-font);
  font-size: 10px;
  text-align: center;
  outline: none;
}

.quiz-input:focus {
  border-color: var(--ps1-gold);
}

.quiz-submit {
  margin: 0 auto 8px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 0 8px;
}

.quiz-option {
  background: transparent;
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 8px 14px;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 9px;
  cursor: pointer;
  text-align: left;
  line-height: 1.8;
}

.quiz-option:hover {
  color: var(--ps1-text);
  border-color: var(--ps1-gold);
}

.quiz-feedback {
  color: var(--ps1-pink);
  font-family: var(--ps1-font);
  font-size: 10px;
  text-align: center;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.quiz-feedback.visible {
  opacity: 1;
}

.quiz-runaway-area {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 20px 0;
  position: relative;
  min-height: 120px;
}

.quiz-runaway-btn {
  display: inline-block;
  padding: 10px 24px;
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  font-family: var(--ps1-font);
  font-size: 10px;
  cursor: pointer;
  min-width: 120px;
  text-align: center;
  transition: none !important;
  user-select: none;
}

.quiz-btn-valorie {
  color: var(--ps1-pink);
  border-color: var(--ps1-pink);
}

.quiz-btn-reagan {
  color: var(--ps1-gold);
  border-color: var(--ps1-gold);
}

.quiz-btn-reagan:hover {
  background: rgba(255, 215, 0, 0.1);
}

/* --- Letter Assembly puzzle (paper note aesthetic) --- */
.letter-puzzle {
  width: 620px !important;
  max-width: 95vw !important;
  max-height: 90vh;
  overflow-y: auto;
  background: #faf6f0 !important;
  border: none !important;
  box-shadow: 2px 4px 20px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05) !important;
  border-radius: 2px !important;
  padding: 28px 32px !important;
  position: relative;
}

.letter-puzzle .puzzle-title {
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 20px !important;
  color: #3a2a1a !important;
  font-style: italic;
  letter-spacing: 0 !important;
  text-shadow: none !important;
}

.letter-puzzle .puzzle-hint {
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 13px !important;
  color: #8a7a6a !important;
  font-style: italic;
  letter-spacing: 0 !important;
}

.letter-puzzle .quiz-feedback {
  color: #994444 !important;
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 13px !important;
}

.letter-puzzle .puzzle-exit-btn {
  color: #aa9988 !important;
}

.letter-slots-label,
.letter-bank-label {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 12px;
  color: #8a7a6a;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.letter-slots {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 18px;
}

.letter-slot {
  padding: 10px 14px;
  border: 1px dashed #c5b8a8;
  border-radius: 2px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 12px;
  line-height: 1.6;
  color: #bbb0a0;
  text-align: left;
  cursor: pointer;
  min-height: 28px;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(255,252,245,0.5);
}

.letter-slot .letter-slot-num {
  font-weight: bold;
  color: #aa8866;
  font-size: 13px;
}

.letter-slot.filled {
  border-style: solid;
  border-color: #aa8866;
  color: #3a2a1a;
  background: rgba(255,248,235,0.8);
}

.letter-slot.empty:hover {
  border-color: #aa8866;
  background: rgba(255,248,235,0.6);
}

.letter-slot.wrong {
  border-color: #cc4444 !important;
  background: rgba(255, 220, 220, 0.4) !important;
}

.letter-bank {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 18px;
  padding-top: 12px;
  border-top: 1px solid #ddd4c8;
}

.letter-card {
  padding: 10px 14px;
  border: 1px solid #d4c8b8;
  border-radius: 2px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 12px;
  line-height: 1.6;
  color: #4a3a2a;
  text-align: left;
  cursor: pointer;
  background: #fff8ee;
  position: relative;
  transition: all 0.15s;
}

.letter-card::before {
  content: none;
}

.letter-card:hover {
  border-color: #aa8866;
  background: #fff4e4;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.08);
}

.letter-card.selected {
  border-color: #cc6644;
  background: #fff0e0;
  box-shadow: 0 0 0 2px rgba(204, 102, 68, 0.2), 1px 2px 8px rgba(0,0,0,0.1);
}

.letter-puzzle-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.letter-puzzle .puzzle-reset {
  background: #aa8866 !important;
  color: #fff !important;
  border: none !important;
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 13px !important;
  padding: 8px 28px !important;
  border-radius: 3px !important;
  cursor: pointer;
  box-shadow: none !important;
  letter-spacing: 0 !important;
}

.letter-puzzle .puzzle-reset:hover {
  background: #996644 !important;
}

/* --- Maze puzzle --- */
.maze-puzzle {
  width: auto !important;
  max-width: 90vw;
}

.maze-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  border: 3px solid var(--ps1-border-outer);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: #0a0a2a;
}

#maze-canvas {
  display: block;
  image-rendering: pixelated;
}

.maze-timer {
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 8px;
  text-align: center;
  margin-bottom: 8px;
}

/* ====================================
   MEMORY RESPONSE CHOICES
   ==================================== */
#memory-choices {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  pointer-events: auto;
  width: 400px;
  max-width: 90vw;
}

.memory-choice {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-border-outer);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344;
  border-radius: 3px;
  padding: 10px 14px;
  padding-left: 24px;
  color: var(--ps1-hint);
  font-family: var(--ps1-font);
  font-size: 9px;
  line-height: 1.8;
  margin-bottom: 6px;
  cursor: pointer;
  position: relative;
}

.memory-choice::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.memory-choice.selected {
  color: var(--ps1-text);
  border-color: var(--ps1-gold);
}

.memory-choice.selected::before {
  content: '\25B6';
  color: var(--ps1-gold);
  font-size: 8px;
  animation: ps1-cursor-bounce-centered 0.6s ease-in-out infinite;
  position: absolute;
  left: 8px;
  top: 50%;
}

/* ====================================
   AREA UNLOCK NOTIFICATION
   ==================================== */
#unlock-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  pointer-events: none;
}

.unlock-text {
  background: linear-gradient(180deg, var(--ps1-bg-top), var(--ps1-bg-bottom));
  border: 2px solid var(--ps1-gold);
  box-shadow: inset 1px 1px 0 var(--ps1-border-inner), inset -1px -1px 0 #333344, 0 0 12px rgba(255, 215, 0, 0.2);
  border-radius: 3px;
  padding: 10px 20px;
  color: var(--ps1-gold);
  font-family: var(--ps1-font);
  font-size: 9px;
  letter-spacing: 1px;
  text-align: center;
  animation: unlock-appear 3s ease forwards;
}

@keyframes unlock-appear {
  0% { opacity: 0; transform: translateY(-10px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ====================================
   SCREEN TINT (environmental effects)
   ==================================== */
#screen-tint {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 14;
  opacity: 0;
  transition: opacity 0.5s;
}

#screen-tint.active {
  opacity: 1;
}

/* === Resume Prompt (pointer lock lost) === */
#resume-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

#resume-prompt .resume-prompt-text {
  font-family: var(--ps1-font);
  font-size: 14px;
  color: var(--ps1-text);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  animation: resume-blink 1.2s ease-in-out infinite;
}

@keyframes resume-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Area Entry Text (museum intro etc.) === */
#area-entry-text {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 900;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 28px;
  font-style: italic;
  color: #fff;
  text-shadow: 0 0 20px rgba(200, 180, 255, 0.6), 0 0 40px rgba(200, 180, 255, 0.3);
  letter-spacing: 3px;
}

#area-entry-text.hidden {
  display: none;
}

@keyframes entryTextFade {
  0% { opacity: 0; transform: scale(0.95); }
  15% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}

/* === Responsive === */
@media (max-width: 600px) {
  .title-626 {
    font-size: 32px;
    letter-spacing: 8px;
  }
  .title-memories {
    font-size: 10px;
    letter-spacing: 4px;
  }
  .emblem-diamond {
    width: 60px;
    height: 60px;
  }
  .start-content .subtitle {
    font-size: 8px;
  }
  #memory-popup {
    width: 95vw;
  }
  .popup-border {
    padding: 16px 14px;
    font-size: 8px;
  }
  #memory-title {
    font-size: 10px;
  }
  #memory-text {
    font-size: 8px;
  }
  .letter-border {
    padding: 20px 16px;
  }
  .letter-greeting {
    font-size: 10px;
  }
  .letter-body {
    font-size: 8px;
  }
  #portal-menu {
    width: 95vw;
  }
  .portal-option {
    font-size: 8px;
  }
  #area-label {
    font-size: 8px;
  }
  #computer-popup {
    width: 95vw;
  }
  .computer-border {
    padding: 16px 14px;
    font-size: 8px;
  }
  .computer-heading {
    font-size: 10px;
  }
  #interact-prompt {
    font-size: 8px;
    padding: 8px 16px;
  }
  #transition-location-name {
    font-size: 10px;
  }
  #objective-tracker {
    font-size: 7px;
    padding: 6px 10px;
  }
  .puzzle-window {
    width: 95vw;
    padding: 14px 16px;
  }
  #love-note-popup {
    width: 90vw;
  }
}
