/* ==========================================================================
   OUR LITTLE STORY • A BRAC University Birthday Tale ❤️
   Pixel-perfect retro styling with scanlines, CRT filter & arcade responsive layout
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --retro-pink: #ff6b8b;
  --retro-gold: #ffd166;
  --retro-cyan: #48cae4;
  --retro-purple: #7209b7;
  --retro-dark: #0f0f1b;
  --retro-card-bg: rgba(18, 16, 32, 0.94);
  --pixel-border: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #06060c;
  color: #fff;
  font-family: 'Press Start 2P', 'VT323', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Master Game Container (Maintains 16:9 Aspect Ratio) */
#game-wrapper {
  position: relative;
  width: 100vw;
  height: 56.25vw; /* 16:9 */
  max-height: 100vh;
  max-width: 177.78vh; /* 16:9 */
  background: #000;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 25px rgba(255, 107, 139, 0.35);
  overflow: hidden;
}

/* HTML5 Game Canvas */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  z-index: 1;
}

/* CRT Scanline & Screen Curvature Overlay */
.crt-overlay {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.18) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7);
  transition: opacity 0.3s ease;
}

.crt-overlay.disabled {
  opacity: 0;
}

/* Top Navigation Bar */
#top-hud {
  position: absolute;
  top: 10px;
  left: 16px;
  right: 16px;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud-badge {
  background: rgba(15, 15, 27, 0.92);
  border: 3px solid var(--retro-pink);
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--retro-gold);
  border-radius: 4px;
  box-shadow: 2px 2px 0px #000;
  text-shadow: 1px 1px 0px #000;
}

.hud-btn {
  background: #1e1b2e;
  border: 2px solid #554f73;
  color: #fff;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: var(--retro-pink);
  color: #000;
  border-color: #fff;
  transform: translate(-1px, -1px);
}

.hud-btn:active {
  transform: translate(1px, 1px);
}

/* Level Select Dropdown */
.chapter-select {
  position: relative;
}

.chapter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #141324;
  border: 3px solid var(--retro-pink);
  border-radius: 4px;
  padding: 6px 0;
  width: 280px;
  display: none;
  flex-direction: column;
  box-shadow: 4px 4px 0 #000;
  z-index: 45;
}

.chapter-dropdown.show {
  display: flex;
}

.chapter-item {
  padding: 8px 12px;
  font-size: 9px;
  color: #ddd;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.chapter-item:hover {
  background: var(--retro-pink);
  color: #000;
}

/* ==========================================================================
   ARCADE MAIN MENU (OUR LITTLE STORY)
   ========================================================================== */
#menu-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 25;
  background: rgba(10, 8, 22, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;
}

.menu-title-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: rgba(15, 12, 28, 0.88);
  padding: 22px 36px;
  border: 4px solid var(--retro-pink);
  border-radius: 10px;
  box-shadow: 6px 6px 0 #000;
}

.menu-pretitle {
  font-size: 10px;
  color: var(--retro-gold);
  letter-spacing: 2px;
  text-shadow: 1px 1px 0 #000;
  animation: pulse 1.5s infinite alternate;
}

.menu-main-title {
  font-size: 36px;
  color: #fff;
  text-shadow: 4px 4px 0 var(--retro-pink), 8px 8px 0 #000;
  letter-spacing: 3px;
  line-height: 1.2;
}

.menu-subtitle {
  font-family: 'VT323', monospace;
  font-size: 24px;
  color: #e2e1f0;
  letter-spacing: 1px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
}

.menu-btn {
  background: #25223a;
  border: 3px solid var(--retro-pink);
  color: #fff;
  padding: 12px 18px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 4px 4px 0 #000;
  text-align: center;
  transition: all 0.15s;
}

.menu-btn.primary {
  background: linear-gradient(180deg, #ffd166, #ff9f1c);
  color: #110f1c;
  border-color: #fff;
}

.menu-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
  background: var(--retro-pink);
  color: #fff;
}

.menu-btn.primary:hover {
  background: #fff;
  color: #000;
}

.menu-footer {
  font-size: 9px;
  color: #ffd166;
  background: rgba(0, 0, 0, 0.75);
  padding: 6px 14px;
  border-radius: 4px;
  text-shadow: 1px 1px 0 #000;
}

/* ==========================================================================
   LEVEL 3: TARC ROOM LAPTOP OVERLAY & NOTIFICATION
   ========================================================================== */
#laptop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.retro-window {
  position: relative;
  background: var(--retro-card-bg);
  border: 4px solid var(--retro-pink);
  border-radius: 6px;
  width: 530px;
  max-width: 90%;
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.85);
  pointer-events: auto;
  animation: slideDownBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDownBounce {
  0% { transform: translateY(-120px); opacity: 0; }
  70% { transform: translateY(15px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.window-titlebar {
  background: linear-gradient(90deg, #ff6b8b, #7209b7);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #000;
}

.window-title {
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 1px 1px 0px #000;
}

.window-controls {
  display: flex;
  gap: 6px;
}

.win-btn {
  width: 14px;
  height: 14px;
  background: #ffd166;
  border: 1px solid #000;
  display: inline-block;
  cursor: pointer;
}

.win-btn.close {
  background: #ff4757;
}

.window-content {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.notif-avatar {
  width: 60px;
  height: 60px;
  border: 3px solid var(--retro-gold);
  border-radius: 8px;
  background: #25223a;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30px;
  box-shadow: 3px 3px 0 #000;
}

.window-heading {
  font-size: 13px;
  color: var(--retro-gold);
  line-height: 1.5;
  text-shadow: 2px 2px 0 #000;
}

.window-text {
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1.4;
  color: #e2e1f0;
}

.start-btn {
  background: linear-gradient(180deg, #ffd166, #ff9f1c);
  border: 3px solid #000;
  color: #1a1a2e;
  padding: 12px 24px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
}

.start-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
  background: #fff;
}

.start-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.desktop-taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 38px;
  background: rgba(20, 20, 35, 0.95);
  border-top: 3px solid #4a4568;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  pointer-events: auto;
  z-index: 12;
}

.taskbar-start {
  background: linear-gradient(180deg, #ff6b8b, #c92a4f);
  border: 2px solid #ffd166;
  color: #fff;
  padding: 4px 10px;
  font-size: 9px;
  font-family: inherit;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 1px 1px 0px #000;
}

.taskbar-tray {
  font-size: 9px;
  color: #a09fc0;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   IMPROVED CHATBOX UI (Positioned at Top to Leave Characters & Feet Fully Visible)
   ========================================================================== */
#dialogue-container {
  position: absolute !important;
  top: 54px !important;
  bottom: auto !important;
  left: 6% !important;
  right: 6% !important;
  height: 122px !important;
  z-index: 50 !important;
  pointer-events: auto;
  display: none;
}

.dialogue-box {
  width: 100%;
  height: 100%;
  background: rgba(14, 11, 28, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 3px solid var(--retro-pink);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), 0 0 20px rgba(255, 107, 139, 0.4), inset 0 0 10px rgba(255, 209, 102, 0.15);
  display: flex;
  padding: 10px 16px;
  gap: 16px;
  position: relative;
  cursor: pointer;
  align-items: center;
}

.dialogue-portrait-box {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  background: #1f1b33;
  border: 3px solid var(--retro-gold);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: 3px 3px 0 #000;
}

.dialogue-portrait-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.dialogue-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.dialogue-speaker {
  font-size: 11px;
  color: var(--retro-gold);
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 0.5px;
  display: inline-block;
  background: rgba(255, 209, 102, 0.15);
  padding: 2px 8px;
  border-radius: 3px;
  border-left: 3px solid var(--retro-gold);
  width: fit-content;
}

.dialogue-text {
  font-family: 'VT323', monospace;
  font-size: 23px;
  line-height: 1.25;
  color: #fff;
  word-break: break-word;
  white-space: pre-wrap;
  text-shadow: 1px 1px 1px #000;
}

.dialogue-arrow {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 13px;
  color: var(--retro-gold);
  animation: bounceDown 0.6s infinite alternate;
}

@keyframes bounceDown {
  from { transform: translateY(0); }
  to { transform: translateY(4px); }
}

/* Toast Prompt */
#game-toast {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 16, 32, 0.94);
  border: 2px solid var(--retro-gold);
  padding: 8px 18px;
  font-size: 10px;
  color: #fff;
  border-radius: 4px;
  box-shadow: 3px 3px 0 #000;
  z-index: 38;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
}

#game-toast.visible {
  opacity: 1;
}

/* Touch Controls */
#touch-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 30;
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

.touch-cluster {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  width: 52px;
  height: 52px;
  background: rgba(30, 27, 46, 0.85);
  border: 3px solid var(--retro-pink);
  color: #fff;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  box-shadow: 2px 2px 0 #000;
  touch-action: manipulation;
}

.touch-btn:active {
  background: var(--retro-pink);
  color: #000;
}

/* Goal Banner */
#goal-banner {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  z-index: 40;
  pointer-events: none;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#goal-banner.show {
  display: flex;
  animation: bannerSlam 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bannerSlam {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
}

.goal-text {
  font-size: 38px;
  font-weight: bold;
  color: #ffd166;
  text-shadow: 4px 4px 0 #ff4757, 8px 8px 0 #000;
  letter-spacing: 2px;
}

.goal-subtext {
  font-size: 13px;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 14px;
  border: 2px solid var(--retro-pink);
  border-radius: 4px;
}

/* Birthday Celebration Grand Modal */
#birthday-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  background: rgba(10, 8, 20, 0.94);
  display: none;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 30px 20px;
}

.birthday-card-container {
  width: 820px;
  max-width: 95%;
  background: #171529;
  border: 5px solid var(--retro-gold);
  border-radius: 10px;
  box-shadow: 10px 10px 0px #000;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: popIn 0.5s ease;
  position: relative;
}

.bday-header {
  text-align: center;
}

.bday-title {
  font-size: 20px;
  color: var(--retro-gold);
  text-shadow: 3px 3px 0 #ff6b8b, 5px 5px 0 #000;
  margin-bottom: 8px;
  line-height: 1.4;
}

.bday-subtitle {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #e2e1f0;
}

/* Hero Centerpiece: brac.png preview */
.bday-hero-img-wrap {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  border: 4px solid var(--retro-pink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 #000;
  background: #000;
  position: relative;
}

.bday-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  display: block;
}

/* Interactive Birthday Cake */
.cake-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #23203c;
  border: 3px dashed var(--retro-pink);
  padding: 16px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  width: 100%;
}

.cake-section:hover {
  transform: scale(1.02);
  background: #2b2749;
}

.cake-visual {
  font-size: 48px;
  filter: drop-shadow(3px 3px 0 #000);
  animation: pulse 1.2s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(0.96); }
  to { transform: scale(1.04); }
}

.cake-prompt {
  font-size: 10px;
  color: var(--retro-gold);
  text-align: center;
  line-height: 1.5;
}

/* Memories Photo Reel */
.memories-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}

.memory-polaroid {
  background: #fff;
  padding: 5px 5px 10px 5px;
  box-shadow: 3px 3px 0 #000;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.memory-polaroid:hover {
  transform: translateY(-4px) rotate(1.5deg);
  box-shadow: 5px 5px 0 #000;
}

.memory-thumb {
  width: 100%;
  height: 75px;
  object-fit: cover;
  border: 1px solid #ccc;
  image-rendering: pixelated;
}

.memory-caption {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #333;
  text-align: center;
  line-height: 1.1;
}

/* Love Letter from MJ */
.love-letter-box {
  background: #fbf7ee;
  border: 3px solid #b89b72;
  border-radius: 6px;
  padding: 16px 20px;
  width: 100%;
  color: #2b2318;
  box-shadow: 4px 4px 0 #000;
}

.letter-title {
  font-size: 11px;
  color: #8c2d19;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.letter-body {
  font-family: 'VT323', monospace;
  font-size: 21px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.bday-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #top-hud {
    top: 6px;
    left: 8px;
    right: 8px;
  }
  .hud-badge {
    font-size: 8px;
    padding: 4px 8px;
  }
  .hud-btn {
    font-size: 8px;
    padding: 4px 6px;
  }
  #dialogue-container {
    height: 105px;
    top: 50px;
    left: 4%;
    right: 4%;
  }
  .dialogue-portrait-box {
    width: 75px;
    height: 75px;
  }
  .dialogue-text {
    font-size: 18px;
  }
  .memories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #touch-controls {
    display: flex;
  }
  .menu-main-title {
    font-size: 24px;
  }
}
