@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Press+Start+2P&family=Share+Tech+Mono&display=swap');

/* 80s Arcade Theme Variables */
:root {
  --arcade-cyan: #00f0ff;
  --arcade-magenta: #ff007f;
  --arcade-yellow: #ffe600;
  --arcade-green: #39ff14;
  --arcade-purple: #9d4edd;
  --arcade-dark-bg: #090a15;
  --arcade-glass: rgba(15, 18, 40, 0.85);
  --font-arcade: 'Press Start 2P', monospace;
  --font-hud: 'Orbitron', sans-serif;
  --font-mono-arcade: 'Share Tech Mono', monospace;
}

/* Fullscreen Game Overlay Container */
#snake-game-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background-color: var(--arcade-dark-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  overflow: hidden;
  font-family: var(--font-hud);
  user-select: none;
}

#snake-game-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* CRT Scanlines Overlay Filter */
.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.35) 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%;
}

/* 3D WebGL Canvas */
#snake-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ARCADE HUD OVERLAY (Top bar during gameplay) */
.arcade-hud {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.hud-panel {
  background: var(--arcade-glass);
  border: 2px solid var(--arcade-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.2);
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  backdrop-filter: blur(8px);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hud-label {
  font-family: var(--font-arcade);
  font-size: 0.65rem;
  color: var(--arcade-magenta);
  text-shadow: 0 0 5px var(--arcade-magenta);
  letter-spacing: 1px;
}

.hud-value {
  font-family: var(--font-arcade);
  font-size: 1.2rem;
  color: var(--arcade-yellow);
  text-shadow: 0 0 8px var(--arcade-yellow);
  margin-top: 4px;
}

/* North Compass Indicator */
.compass-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--arcade-cyan);
}

.compass-arrow {
  color: var(--arcade-cyan);
  font-size: 1.1rem;
  font-weight: bold;
  text-shadow: 0 0 8px var(--arcade-cyan);
  animation: pulseNorth 2s infinite alternate;
}

@keyframes pulseNorth {
  from { transform: translateY(0); opacity: 0.8; }
  to { transform: translateY(-2px); opacity: 1; }
}

/* Controls Hint Panel during Game */
.hud-controls-hint {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  background: var(--arcade-glass);
  border: 1px solid var(--arcade-purple);
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.3);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--font-mono-arcade);
  font-size: 0.85rem;
  color: #fff;
  pointer-events: none;
  display: flex;
  gap: 12px;
  align-items: center;
}

.kbd-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--arcade-cyan);
  color: var(--arcade-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  box-shadow: 0 0 5px var(--arcade-cyan);
}

/* ARCADE SCREEN MODAL BOXES (Landing & Game Over) */
.arcade-modal {
  position: relative;
  z-index: 20;
  background: rgba(12, 14, 30, 0.92);
  border: 3px solid var(--arcade-cyan);
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.5), inset 0 0 20px rgba(0, 240, 255, 0.15);
  padding: 30px 40px;
  max-width: 600px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: modalGlow 3s infinite alternate ease-in-out;
}

@keyframes modalGlow {
  0% { border-color: var(--arcade-cyan); box-shadow: 0 0 30px rgba(0, 240, 255, 0.5); }
  50% { border-color: var(--arcade-magenta); box-shadow: 0 0 30px rgba(255, 0, 127, 0.5); }
  100% { border-color: var(--arcade-yellow); box-shadow: 0 0 30px rgba(255, 230, 0, 0.5); }
}

.arcade-title {
  font-family: var(--font-arcade);
  font-size: 1.6rem;
  background: linear-gradient(180deg, #ffffff 0%, var(--arcade-cyan) 50%, var(--arcade-magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.8);
  margin: 0;
  line-height: 1.4;
  letter-spacing: 2px;
}

.arcade-subtitle {
  font-family: var(--font-mono-arcade);
  font-size: 0.95rem;
  color: var(--arcade-yellow);
  margin-top: -10px;
  letter-spacing: 1px;
}

/* TOP 5 HIGH SCORES CABINET TABLE */
.high-scores-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px stroke var(--arcade-purple);
  border: 1px solid rgba(157, 78, 221, 0.6);
  border-radius: 8px;
  padding: 15px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.high-scores-header {
  font-family: var(--font-arcade);
  font-size: 0.8rem;
  color: var(--arcade-magenta);
  text-shadow: 0 0 8px var(--arcade-magenta);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.scores-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-arcade);
  font-size: 0.75rem;
}

.scores-table th {
  color: var(--arcade-cyan);
  padding: 6px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
}

.scores-table td {
  padding: 8px 6px;
  color: #fff;
}

.scores-table tr:nth-child(1) td { color: #ffe600; text-shadow: 0 0 6px #ffe600; }
.scores-table tr:nth-child(2) td { color: #e0e0e0; }
.scores-table tr:nth-child(3) td { color: #cd7f32; }

/* DIFFICULTY SELECTOR */
.difficulty-selector {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
  margin-top: 5px;
}

.diff-btn {
  font-family: var(--font-arcade);
  font-size: 0.7rem;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--arcade-purple);
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.diff-btn:hover {
  border-color: var(--arcade-cyan);
  color: #fff;
}

.diff-btn.selected {
  background: var(--arcade-purple);
  border-color: var(--arcade-cyan);
  color: #fff;
  box-shadow: 0 0 12px var(--arcade-purple);
}

/* ARCADE BUTTONS */
.arcade-btn-group {
  display: flex;
  gap: 15px;
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

.arcade-btn {
  font-family: var(--font-arcade);
  font-size: 0.85rem;
  padding: 12px 24px;
  background: linear-gradient(180deg, var(--arcade-cyan) 0%, #0088cc 100%);
  border: none;
  border-radius: 8px;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 15px var(--arcade-cyan);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.arcade-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 25px var(--arcade-cyan);
}

.arcade-btn.secondary {
  background: linear-gradient(180deg, #444 0%, #111 100%);
  border: 1px solid #777;
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.arcade-btn.secondary:hover {
  border-color: var(--arcade-magenta);
  box-shadow: 0 0 15px var(--arcade-magenta);
}

/* INITIAL ENTRY SPINNER (GAME OVER HIGH SCORE ENTRY) */
.initials-picker {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 15px 0;
}

.initial-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.initial-arrow {
  background: none;
  border: none;
  color: var(--arcade-cyan);
  font-size: 1.2rem;
  cursor: pointer;
  user-select: none;
}

.initial-arrow:hover {
  color: var(--arcade-yellow);
  text-shadow: 0 0 8px var(--arcade-yellow);
}

.initial-val {
  font-family: var(--font-arcade);
  font-size: 1.8rem;
  width: 48px;
  height: 54px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--arcade-cyan);
  border-radius: 6px;
  color: var(--arcade-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px var(--arcade-cyan);
}

/* TOGGLE OVERLAY EFFECT BUTTON & MODAL MINIMIZE */
.crt-toggle-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--arcade-cyan);
  color: var(--arcade-cyan);
  font-family: var(--font-mono-arcade);
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.modal-toggle-btn {
  position: absolute;
  top: 12px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--arcade-cyan);
  color: var(--arcade-cyan);
  font-family: var(--font-mono-arcade);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 30;
  transition: all 0.2s;
}

.modal-toggle-btn:hover {
  background: var(--arcade-cyan);
  color: #000;
  box-shadow: 0 0 10px var(--arcade-cyan);
}

.arcade-modal.minimized {
  padding: 12px 25px;
  max-width: 320px;
  gap: 0;
  position: absolute;
  bottom: 25px;
  top: auto;
  border-color: var(--arcade-cyan);
}

.arcade-modal.minimized #gameover-modal-body {
  display: none !important;
}

