/* ============================================
   PINDROP - Retro Arcade Game Stylesheet
   Session 1: Base styles + CRT effects
   ============================================ */

/* ============================================
   CSS Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background-color: #000000;
  font-family: 'Courier New', 'Courier', monospace;
  color: #00ff00;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   Retro Arcade Color Palette
   ============================================ */
:root {
  --color-black: #000000;
  --color-dark-bg: #0a0a0a;
  --color-green-primary: #00ff00;
  --color-green-dim: #00aa00;
  --color-amber: #ffaa00;
  --color-amber-dim: #aa6600;
  --color-white: #ffffff;
  --color-gray: #333333;
  
  /* CRT effect variables */
  --scanline-opacity: 0.15;
  --vignette-strength: 0.5;
}

/* ============================================
   Arcade Cabinet Container
   ============================================ */
.arcade-cabinet {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.screen-bezel {
  position: relative;
  background: var(--color-dark-bg);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 
    0 0 20px rgba(0, 255, 0, 0.3),
    inset 0 0 30px rgba(0, 0, 0, 0.8);
}

/* ============================================
   Canvas Styling & Scaling
   ============================================ */
#game-canvas {
  display: block;
  width: 320px;
  height: 240px;
  max-width: 100%;
  background-color: var(--color-black);
  
  /* Pixel-perfect rendering (nearest-neighbor scaling) */
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  
  /* Prevent blur on some browsers */
  -ms-interpolation-mode: nearest-neighbor;
  
  border: 2px solid var(--color-gray);
  position: relative;
  z-index: 1;
}

/* ============================================
   CRT Visual Effects
   ============================================ */
.crt-overlay {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  bottom: 15px;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  border-radius: 2px;
}

/* Scanlines effect */
.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, var(--scanline-opacity)) 50%
  );
  background-size: 100% 4px;
  z-index: 3;
  animation: scanline-flicker 0.1s infinite;
}

@keyframes scanline-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* Vignette effect */
.crt-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, var(--vignette-strength)) 100%
  );
  z-index: 4;
}

/* Subtle screen curvature illusion */
.screen-bezel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* ============================================
   Responsive Viewport Handling
   ============================================ */
@media (max-width: 640px) {
  .arcade-cabinet {
    padding: 10px;
  }
  
  .screen-bezel {
    padding: 10px;
  }
  
  #game-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

/* Mobile landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
  .arcade-cabinet {
    padding: 5px;
  }
  
  .screen-bezel {
    padding: 5px;
  }
  
  #game-canvas {
    width: auto;
    height: 90vh;
    max-height: calc(100vh - 10px);
    aspect-ratio: 4 / 3;
  }
}

@media (min-width: 641px) {
  #game-canvas {
    width: 640px;
    height: 480px;
    max-height: calc(100vh - 70px);
    max-width: calc((100vh - 70px) * 4 / 3);
  }
}

@media (min-width: 961px) {
  #game-canvas {
    width: 960px;
    height: 720px;
    max-height: calc(100vh - 70px);
    max-width: calc((100vh - 70px) * 4 / 3);
  }
}

/* ============================================
   Pixel Font Setup
   ============================================ */
/* Using system monospace as fallback for Session 1 */
/* Future sessions will load custom pixel font */
.pixel-text {
  font-family: 'Courier New', 'Courier', 'Monaco', 'Menlo', monospace;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-green-primary);
  text-shadow: 0 0 5px var(--color-green-dim);
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
  display: none !important;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Prevent touch callouts on mobile */
canvas {
  -webkit-touch-callout: none;
}