/* ==========================================================================
   VERITY TCG — VERITY LAUNCHER MINI-GAME STYLESHEET
   ========================================================================== */

:root {
  --bg-deep: #070912;
  --gold-primary: #ffd166;
  --gold-glow: rgba(255, 209, 102, 0.4);
  --cyan-accent: #00f5d4;
  --pink-accent: #ff4d88;
  --purple-accent: #a855f7;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

*, *::before, *::after {
  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: var(--bg-deep);
  font-family: var(--font-sans);
  color: #ffffff;
  touch-action: none;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Top HUD
   -------------------------------------------------------------------------- */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(13, 16, 28, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: #cbd5e1;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.back-link:hover {
  background: rgba(25, 30, 50, 0.9);
  color: #ffffff;
  border-color: rgba(255, 209, 102, 0.4);
  transform: translateY(-1px);
}

.back-arrow {
  color: var(--gold-primary);
  font-weight: bold;
}

.hud-pill {
  display: flex;
  flex-direction: column;
  padding: 6px 14px;
  background: rgba(13, 16, 28, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 1.2px;
  color: #94a3b8;
  font-weight: 700;
}

.hud-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.hud-val small {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
}

.hud-val.gold {
  color: var(--gold-primary);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.4);
}

/* Boost Meter */
.boost-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(13, 16, 28, 0.85);
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.15);
}

.boost-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 1.2px;
  color: var(--cyan-accent);
  font-weight: 700;
}

.boost-pips {
  display: flex;
  gap: 6px;
}

.boost-pip {
  font-size: 0.95rem;
  color: #334155;
  transition: all 0.25s ease;
  filter: grayscale(1);
}

.boost-pip.active {
  color: var(--cyan-accent);
  filter: drop-shadow(0 0 6px var(--cyan-accent));
  animation: pipPulse 1.8s infinite;
}

.boost-pip.super {
  color: var(--gold-primary);
  filter: drop-shadow(0 0 10px var(--gold-primary));
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 1px;
  animation: superPulse 0.7s infinite alternate ease-in-out;
}

@keyframes superPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px #ffd166); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 16px #ffd166); }
}

@keyframes pipPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.sound-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(13, 16, 28, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.sound-toggle:hover {
  background: rgba(25, 30, 50, 0.9);
  border-color: rgba(255, 209, 102, 0.35);
}

/* --------------------------------------------------------------------------
   In-Game Aiming Instruction Pill
   -------------------------------------------------------------------------- */
.aim-instruction-pill {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  padding: 10px 24px;
  background: rgba(15, 20, 36, 0.92);
  border: 1.5px solid var(--gold-color);
  border-radius: 999px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 25px rgba(255, 209, 102, 0.4), 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 15;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: aimPillGlow 1.4s ease-in-out infinite;
}

.aim-instruction-pill.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.aim-icon {
  font-size: 1.15rem;
}

.aim-text {
  color: var(--gold-color);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.5);
}

@keyframes aimPillGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 209, 102, 0.3), 0 8px 24px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 209, 102, 0.7);
  }
  50% {
    box-shadow: 0 0 32px rgba(255, 209, 102, 0.65), 0 8px 24px rgba(0, 0, 0, 0.6);
    border-color: #ffffff;
  }
}

/* --------------------------------------------------------------------------
   Verity Ball Selector Dock
   -------------------------------------------------------------------------- */
.ball-selector-dock {
  position: absolute;
  bottom: 20px;
  right: 24px;
  background: rgba(13, 16, 28, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.dock-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: #94a3b8;
  font-weight: 700;
}

.dock-balls {
  display: flex;
  gap: 8px;
}

.ball-choice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s var(--ease-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.ball-choice-btn:hover {
  transform: scale(1.18);
}

.ball-choice-btn.active {
  border-color: #ffffff;
  transform: scale(1.22);
  box-shadow: 0 0 14px currentColor;
}

/* --------------------------------------------------------------------------
   Launch Prompt Modal (Before Launch)
   -------------------------------------------------------------------------- */
.launch-prompt {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(7, 9, 18, 0.65) 0%, rgba(7, 9, 18, 0.88) 100%);
  z-index: 20;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.launch-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}

.prompt-box {
  background: linear-gradient(145deg, rgba(22, 28, 48, 0.95) 0%, rgba(11, 14, 25, 0.98) 100%);
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 24px;
  padding: 36px 40px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 209, 102, 0.1);
  animation: promptAppear 0.4s var(--ease-spring);
}

@keyframes promptAppear {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.prompt-crest {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 2.5px;
  color: var(--gold-primary);
  margin-bottom: 8px;
  font-weight: 700;
}

.prompt-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  margin-bottom: 8px;
  line-height: 1.15;
}

.prompt-sub {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-bottom: 24px;
  line-height: 1.5;
}

.prompt-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #ffd166 0%, #ff7b00 100%);
  color: #120900;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 14px 28px;
  border-radius: 30px;
  margin-bottom: 24px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255, 120, 0, 0.45);
  animation: pulseAction 2s infinite ease-in-out;
  transition: transform 0.2s ease;
}

.prompt-action-pill:hover {
  transform: scale(1.05);
}

@keyframes pulseAction {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 24px rgba(255, 120, 0, 0.45); }
  50% { transform: scale(1.03); box-shadow: 0 6px 32px rgba(255, 209, 102, 0.7); }
}

.how-to-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 20px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 209, 102, 0.18);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Results Modal
   -------------------------------------------------------------------------- */
.results-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(7, 9, 18, 0.75) 0%, rgba(7, 9, 18, 0.95) 100%);
  z-index: 30;
  backdrop-filter: blur(8px);
}

.results-modal.show {
  display: flex;
}

.modal-card {
  background: linear-gradient(145deg, rgba(22, 28, 48, 0.96) 0%, rgba(11, 14, 25, 0.98) 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 28px;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 50px rgba(255, 209, 102, 0.2);
  animation: modalPop 0.4s var(--ease-spring);
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.record-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--gold-primary);
  font-weight: 800;
  margin-bottom: 8px;
  animation: recordGlow 1.5s infinite;
}

.record-badge.visible {
  display: block;
}

@keyframes recordGlow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 12px var(--gold-primary); }
}

.results-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #ffffff;
  margin-bottom: 20px;
}

.score-showcase {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 24px;
}

.score-huge {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--gold-primary);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.5);
  line-height: 1;
  margin-bottom: 6px;
}

.score-huge small {
  font-size: 1rem;
  letter-spacing: 2px;
  color: #cbd5e1;
}

.score-sub {
  font-size: 0.92rem;
  color: #94a3b8;
}

.results-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.r-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 8px;
}

.r-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.r-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-launch-again {
  background: linear-gradient(135deg, #ffd166 0%, #ff7b00 100%);
  color: #120900;
  box-shadow: 0 6px 20px rgba(255, 120, 0, 0.4);
}

.btn-launch-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(255, 120, 0, 0.6);
}

.btn-return {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-return:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   In-game Floating Toast
   -------------------------------------------------------------------------- */
.game-toast {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(13, 16, 28, 0.92);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 8px 24px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 209, 102, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s var(--ease-spring);
  z-index: 25;
}

.game-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   Responsive Rules
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .game-hud {
    padding: 12px 16px;
  }

  .stat-pill {
    display: none;
  }

  .ball-selector-dock {
    bottom: 14px;
    right: 50%;
    transform: translateX(50%);
    width: auto;
    padding: 8px 12px;
  }

  .dock-title {
    display: none;
  }

  .prompt-box {
    padding: 24px 20px;
  }

  .prompt-title {
    font-size: 1.8rem;
  }

  .score-huge {
    font-size: 2.5rem;
  }

  .modal-card {
    padding: 24px 20px;
  }

  .modal-actions {
    flex-direction: column;
  }
}

/* ==========================================================================
   2D BACKROOMS LEVEL 0 HUD & VHS OVERLAY
   ========================================================================== */
.backrooms-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 32px;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
}

.backrooms-overlay.hidden {
  display: none !important;
}

/* Subtle CRT Scanlines */
.vhs-scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 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%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

/* Top VHS Header */
.backrooms-hud-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(18, 18, 10, 0.7);
  backdrop-filter: blur(8px);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid rgba(222, 208, 136, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.vhs-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fef08a;
  letter-spacing: 1px;
}

.vhs-rec-dot {
  color: #ef4444;
  font-size: 16px;
  animation: recBlink 1s infinite alternate ease-in-out;
}

@keyframes recBlink {
  0% { opacity: 1; }
  100% { opacity: 0.2; }
}

.vhs-level-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.level-main {
  font-size: 15px;
  font-weight: 800;
  color: #fef9c3;
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(254, 240, 138, 0.4);
}

.level-sub {
  font-size: 10.5px;
  color: #ca8a04;
  letter-spacing: 1px;
}

.vhs-entity-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 4px 10px;
  border-radius: 4px;
}

/* Bottom VHS Footer & Controls */
.backrooms-hud-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.vhs-controls {
  background: rgba(18, 18, 10, 0.7);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(222, 208, 136, 0.25);
  font-size: 12px;
  color: #fef08a;
}

.vhs-controls strong {
  color: #fff;
}

.btn-noclip-exit {
  pointer-events: auto;
  background: rgba(234, 88, 12, 0.25);
  border: 1px solid rgba(249, 115, 22, 0.5);
  color: #fed7aa;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.btn-noclip-exit:hover {
  background: rgba(234, 88, 12, 0.5);
  color: #fff;
  border-color: #f97316;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
}

/* Screen Noclip Glitch Transition Effect */
@keyframes noclipGlitchTear {
  0% { transform: translate(0, 0) scale(1); filter: invert(0) hue-rotate(0deg); }
  20% { transform: translate(-10px, 8px) scale(1.02); filter: invert(1) hue-rotate(90deg); }
  40% { transform: translate(12px, -6px) scale(0.98); filter: invert(0.6) hue-rotate(180deg); }
  60% { transform: translate(-8px, -4px) scale(1.01); filter: invert(0.9) hue-rotate(270deg); }
  80% { transform: translate(6px, 10px) scale(1); filter: invert(0.2) hue-rotate(360deg); }
  100% { transform: translate(0, 0) scale(1); filter: invert(0) hue-rotate(0deg); }
}

.noclip-active {
  animation: noclipGlitchTear 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

