@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Bebas+Neue&family=Oswald:wght@400;700&display=swap');

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

:root {
  --neon-red: #ff2244;
  --neon-yellow: #ffcc00;
  --neon-green: #00ff88;
  --neon-blue: #00cfff;
  --neon-purple: #cc44ff;
  --dark-bg: #0a0a0f;
  --panel-bg: rgba(10,10,20,0.92);
  --font-mono: 'Share Tech Mono', monospace;
  --font-title: 'Bebas Neue', sans-serif;
  --font-ui: 'Oswald', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--dark-bg);
  font-family: var(--font-mono);
  color: #fff;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

/* ─── SCREENS ─────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--dark-bg);
  z-index: 10;
}

.screen.hidden { display: none; }

/* scanline overlay */
.screen::before,
#overlay-scanlines::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.25) 3px,
    rgba(0,0,0,0.25) 4px
  );
  pointer-events: none;
  z-index: 100;
}

#overlay-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* ─── MAIN MENU ───────────────────────────── */
#screen-menu {
  background: radial-gradient(ellipse at 50% 30%, #1a0a2e 0%, #0a0a0f 70%);
}

.menu-logo {
  font-family: var(--font-title);
  font-size: clamp(48px, 8vw, 96px);
  color: var(--neon-red);
  text-shadow: 0 0 20px var(--neon-red), 0 0 60px rgba(255,34,68,0.4);
  letter-spacing: 4px;
  text-align: center;
  line-height: 1;
  margin-bottom: 8px;
}

.menu-subtitle {
  font-family: var(--font-title);
  font-size: clamp(18px, 3vw, 32px);
  color: var(--neon-yellow);
  text-shadow: 0 0 12px var(--neon-yellow);
  letter-spacing: 6px;
  margin-bottom: 60px;
}

.menu-tagline {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  margin-bottom: 48px;
}

/* Language toggle */
.lang-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.lang-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5);
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}

.lang-btn.active {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
}

/* ─── CHARACTER SELECT ────────────────────── */
.char-select-title {
  font-family: var(--font-title);
  font-size: clamp(22px, 3vw, 40px);
  color: #fff;
  letter-spacing: 4px;
  margin-bottom: 36px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 700px;
  width: 90%;
  margin-bottom: 36px;
}

.char-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  position: relative;
}

.char-card:hover,
.char-card.selected {
  border-color: var(--neon-yellow);
  background: rgba(255,204,0,0.08);
  transform: scale(1.02);
}

.char-card .diff-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 2px 10px;
  border-radius: 20px;
  font-family: var(--font-ui);
  font-weight: 700;
}

.badge-ultra { background: #8800ff; color: #fff; }
.badge-easy  { background: #00bb44; color: #000; }
.badge-med   { background: #ff8800; color: #000; }
.badge-hard  { background: var(--neon-red); color: #fff; }

.char-icon { font-size: 40px; margin-bottom: 8px; }
.char-name {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--neon-yellow);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.char-ability {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
}

/* ─── BUTTONS ─────────────────────────────── */
.btn {
  font-family: var(--font-title);
  font-size: 22px;
  letter-spacing: 4px;
  padding: 14px 48px;
  border: 2px solid currentColor;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
  text-transform: uppercase;
}

.btn-primary {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--neon-red);
  border-color: var(--neon-red);
  box-shadow: 0 0 20px rgba(255,34,68,0.2), inset 0 0 20px rgba(255,34,68,0.05);
}

.btn-primary:hover {
  background: var(--neon-red);
  color: #000;
  text-shadow: none;
  box-shadow: 0 0 40px rgba(255,34,68,0.6);
}

.btn-secondary {
  color: rgba(255,255,255,0.5);
  border-color: rgba(255,255,255,0.2);
  font-size: 16px;
  padding: 10px 32px;
}

.btn-secondary:hover {
  color: #fff;
  border-color: #fff;
}

/* ─── PHASE TRANSITION ─────────────────────── */
#screen-transition {
  background: #000;
  flex-direction: column;
  gap: 16px;
}

.transition-phase-num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 6px;
}

.transition-phase-name {
  font-family: var(--font-title);
  font-size: clamp(36px, 6vw, 80px);
  color: var(--neon-yellow);
  text-shadow: 0 0 30px var(--neon-yellow);
  letter-spacing: 6px;
  text-align: center;
}

.transition-phase-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  text-align: center;
}

.transition-bar {
  width: 200px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  margin-top: 24px;
  position: relative;
  overflow: hidden;
}

.transition-bar::after {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--neon-yellow);
  animation: barFill 1.8s ease forwards;
  animation-delay: 0.3s;
}

@keyframes barFill {
  to { left: 0; }
}

/* ─── DEATH SCREEN ────────────────────────── */
#screen-death {
  background: radial-gradient(ellipse at center, #3a0000 0%, #0a0000 100%);
}

.death-title {
  font-family: var(--font-title);
  font-size: clamp(60px, 10vw, 120px);
  color: var(--neon-red);
  text-shadow: 0 0 40px var(--neon-red), 0 0 80px rgba(255,34,68,0.3);
  letter-spacing: 8px;
  animation: flicker 0.5s ease-in-out infinite alternate;
}

.death-subtitle {
  font-family: var(--font-title);
  font-size: clamp(18px, 3vw, 32px);
  color: rgba(255,255,255,0.6);
  letter-spacing: 4px;
  margin-bottom: 40px;
}

.death-flavor {
  font-size: 14px;
  color: rgba(255,100,100,0.5);
  max-width: 500px;
  text-align: center;
  line-height: 1.8;
  margin-bottom: 48px;
}

/* ─── ENDING SCREENS ──────────────────────── */
#screen-ending {
  overflow-y: auto;
  padding: 40px 20px;
  justify-content: flex-start;
}

.ending-card {
  max-width: 680px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: var(--panel-bg);
  padding: 40px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.ending-main-title {
  font-family: var(--font-title);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: 4px;
  text-shadow: 0 0 20px currentColor;
}

.ending-type-label {
  font-size: 12px;
  letter-spacing: 4px;
  background: rgba(255,255,255,0.1);
  padding: 6px 16px;
  border-radius: 20px;
}

.ending-char-badge {
  font-size: 18px;
  color: #fff;
  background: rgba(255,255,255,0.05);
  padding: 8px 24px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
}

.celso-container {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 16/9;
  border: 2px solid #ff8800;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255,136,0,0.3);
}

.ending-quote {
  font-family: var(--font-title);
  font-size: 28px;
  color: #fff;
  letter-spacing: 2px;
}

.ending-plane-anim {
  font-size: 80px;
  animation: planeFly 2s ease-in-out infinite alternate;
}

@keyframes planeFly {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-15px) scale(1.1); }
}

.ending-route {
  font-family: var(--font-mono);
  font-size: 18px;
  margin: 10px 0;
}

.ending-flavor {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  max-width: 500px;
}

.ending-stats-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin-top: 20px;
}

.ending-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.stat-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px;
  border-radius: 4px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--neon-yellow);
}

.bonus-indicators {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.bonus-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(0,0,0,0.5);
}

.bonus-dot.collected {
  border-color: var(--neon-green);
  background: rgba(0,255,136,0.1);
  box-shadow: 0 0 12px rgba(0,255,136,0.3);
}

/* ─── HUD (rendered on canvas via JS) ────────
   These are DOM overlays for persistent UI */
#hud-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 4;
}

/* ─── PAUSE ───────────────────────────────── */
#screen-pause {
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
}

.pause-title {
  font-family: var(--font-title);
  font-size: 72px;
  letter-spacing: 10px;
  color: #fff;
  margin-bottom: 48px;
}

/* ─── ANIMATIONS ─────────────────────────── */
@keyframes flicker {
  0%   { opacity: 1; }
  60%  { opacity: 0.85; }
  80%  { opacity: 0.95; }
  100% { opacity: 0.8; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%   { box-shadow: 0 0 8px currentColor; }
  50%  { box-shadow: 0 0 24px currentColor; }
  100% { box-shadow: 0 0 8px currentColor; }
}

.anim-fadein { animation: fadeIn 0.4s ease forwards; }
.anim-pulse  { animation: pulseGlow 2s ease infinite; }

/* ─── BONUS ITEM POPUP ────────────────────── */
#bonus-popup {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid var(--neon-green);
  border-radius: 6px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green);
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

#bonus-popup.show { opacity: 1; }
#bonus-popup .icon { font-size: 22px; }

/* ─── OBJECTIVE POPUP ─────────────────────── */
#objective-popup {
  position: absolute;
  top: 70px;
  right: 20px;
  background: rgba(0,0,0,0.75);
  border-left: 3px solid var(--neon-yellow);
  padding: 10px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  pointer-events: none;
  z-index: 6;
  max-width: 240px;
}

#objective-popup .obj-title {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--neon-yellow);
  letter-spacing: 2px;
  margin-bottom: 4px;
}
