/* ==========================================================================
   TYPE & PLAY - ZOMBIE TYPING SURVIVAL GAME STYLES
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&family=JetBrains+Mono:wght@500;700;800&family=Creepster&display=swap');

:root {
  --z-bg: #050811;
  --z-hud-bg: rgba(9, 14, 26, 0.9);
  --z-border: rgba(0, 240, 255, 0.35);
  --z-cyan: #00f0ff;
  --z-emerald: #10b981;
  --z-crimson: #ef4444;
  --z-amber: #f59e0b;
  --z-purple: #a855f7;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--z-bg);
  font-family: 'Outfit', -apple-system, sans-serif;
  color: #fff;
}

/* Master Game Container */
#zombieGameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
}

/* Primary Game Canvas */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* ==========================================================================
   TOP GAME HUD
   ========================================================================== */
.z-top-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(5, 8, 17, 0.95) 0%, rgba(5, 8, 17, 0) 100%);
  pointer-events: none;
}

.z-hud-left, .z-hud-center, .z-hud-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  pointer-events: auto;
}

/* Brand & Back Button */
.z-btn-back {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.z-btn-back:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--z-cyan);
}

/* Health Bar */
.z-health-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--z-hud-bg);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.25);
}

.z-health-heart {
  font-size: 1.15rem;
  animation: heartBeat 1.2s infinite;
}

.z-health-track {
  width: 120px;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.z-health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f87171);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  transition: width 0.25s ease-out;
}

.z-health-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  min-width: 42px;
}

/* Center World / Level Banner with Kill Progress */
.z-world-banner {
  text-align: center;
  background: var(--z-hud-bg);
  border: 1px solid var(--z-border);
  padding: 0.4rem 1.2rem;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
  min-width: 220px;
}

.z-world-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--z-cyan);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.z-level-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.15rem 0;
}

.z-level-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.z-btn-level-select {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--z-cyan);
  color: var(--z-cyan);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.z-btn-level-select:hover {
  background: var(--z-cyan);
  color: #000;
}

/* Kill Objective Progress */
.z-level-progress-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.z-level-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.z-level-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f0ff, #10b981);
  box-shadow: 0 0 8px #00f0ff;
  transition: width 0.2s ease-out;
}

.z-level-progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--z-emerald);
}

/* Right Stats Gauges (WPM, Accuracy, Combo, Score) */
.z-stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--z-hud-bg);
  border: 1px solid var(--z-border);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
}

.z-stat-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
}

.z-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
}

.z-stat-score-pill {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.z-stat-score-val {
  color: var(--z-amber);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.z-stat-combo {
  border-color: var(--z-purple);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.z-combo-fire {
  color: var(--z-amber);
  animation: fireFlicker 0.8s infinite alternate;
}

/* ==========================================================================
   DYNAMIC SCREEN EFFECTS (DAMAGE / LOW HEALTH / BOSS ALARM)
   ========================================================================== */
.z-damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0);
  transition: box-shadow 0.1s ease-out;
}

.z-damage-vignette.hit {
  box-shadow: inset 0 0 80px 30px rgba(239, 68, 68, 0.8);
}

.z-damage-vignette.low-health {
  animation: lowHealthPulse 1s infinite alternate;
}

/* Boss Warning Banner Overlay */
.z-boss-warning {
  position: absolute;
  top: 35%;
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0) 0%, rgba(239, 68, 68, 0.95) 50%, rgba(239, 68, 68, 0) 100%);
  border-top: 2px solid #fff;
  border-bottom: 2px solid #fff;
  padding: 1.5rem 0;
  text-align: center;
  z-index: 20;
  transform: scaleY(0);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.z-boss-warning.active {
  transform: scaleY(1);
  opacity: 1;
}

.z-boss-warning h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px #000;
  animation: warningTextPulse 0.6s infinite alternate;
}

/* ==========================================================================
   SLEEK FUTURISTIC TYPING CONSOLE (NO KEYBOARD BLOCKING SCREEN)
   ========================================================================== */
.z-typing-console-container {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 660px;
  z-index: 15;
  pointer-events: none;
}

.z-console-card {
  background: linear-gradient(135deg, rgba(8, 14, 28, 0.94) 0%, rgba(5, 8, 17, 0.98) 100%);
  border: 2px solid var(--z-cyan);
  border-radius: 16px;
  padding: 0.85rem 1.8rem;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.3), inset 0 0 20px rgba(0, 240, 255, 0.08);
  text-align: center;
  backdrop-filter: blur(12px);
}

.z-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--z-cyan);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.z-console-radar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--z-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--z-emerald);
  margin-right: 6px;
  animation: heartBeat 1.2s infinite;
}

.z-console-word-wrapper {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 3px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.z-console-placeholder {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 2px;
  font-weight: 700;
  animation: warningTextPulse 1.4s infinite alternate;
}

.z-char-typed {
  color: var(--z-emerald);
  text-shadow: 0 0 14px var(--z-emerald);
}

.z-char-current {
  color: #fff;
  background: rgba(0, 240, 255, 0.35);
  border: 1px solid var(--z-cyan);
  padding: 0 4px;
  border-radius: 6px;
  box-shadow: 0 0 16px var(--z-cyan);
  animation: heartBeat 0.8s infinite;
}

.z-char-pending {
  color: #cbd5e1;
}

/* ==========================================================================
   IN-GAME MODALS (GAME OVER, VICTORY, PAUSE, LEVEL SELECTOR)
   ========================================================================== */
.z-game-modal {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 14, 0.92);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.z-game-modal.active {
  opacity: 1;
  visibility: visible;
}

.z-modal-content {
  background: #0d1527;
  border: 2px solid var(--z-cyan);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  max-width: 540px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.z-modal-content.game-over {
  border-color: var(--z-crimson);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.35);
}

.z-modal-content.victory {
  border-color: var(--z-amber);
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.4);
}

.z-modal-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.z-modal-title {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.z-modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 1.5rem 0;
}

.z-stat-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 8px;
}

.z-stat-box .lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
}

.z-stat-box .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

.z-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Level Select Modal Grid (Stages 1 - 30) */
.z-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.z-level-card-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--z-border);
  border-radius: 8px;
  padding: 0.75rem 0.4rem;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.z-level-card-btn:hover, .z-level-card-btn.current {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--z-cyan);
  transform: scale(1.08);
  box-shadow: 0 0 12px var(--z-cyan);
}

.z-level-card-btn.boss-level {
  border-color: var(--z-amber);
  background: rgba(245, 158, 11, 0.15);
}

.z-level-card-btn.boss-level:hover {
  background: var(--z-amber);
  color: #000;
}

.z-lvl-sub {
  font-size: 0.6rem;
  color: #94a3b8;
  text-transform: uppercase;
}

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

@keyframes fireFlicker {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #f59e0b); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 8px #ef4444); }
}

@keyframes lowHealthPulse {
  0% { box-shadow: inset 0 0 40px 10px rgba(239, 68, 68, 0.3); }
  100% { box-shadow: inset 0 0 90px 40px rgba(239, 68, 68, 0.85); }
}

@keyframes warningTextPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}
