/* ═══════════════════════════════════════════════════════════
   УЛИЦА СВОБОДЫ — FREEDOM STREET
   Post-Soviet Gritty Pixel-Art Top-Down Game
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --concrete: #696969;
  --dark-concrete: #404040;
  --dirty-snow: #b0b0b0;
  --mud-green: #4a5d23;
  --rust: #8b4513;
  --pale-yellow: #f0e68c;
  --blood: #8b0000;
  --vodka-green: #2f4f4f;
  --panel-bg: rgba(20, 20, 20, 0.88);
  --border-color: #555;
  --text-light: #ddd;
  --text-dim: #999;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #111;
  color: var(--text-light);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ═══ CANVAS ═══ */
#gameCanvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  background: #1a1a1a;
  z-index: 0;
}

/* ═══ MENU SCREENS ═══ */
.menu-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60,60,40,0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(100,40,30,0.3) 0%, transparent 50%),
    linear-gradient(180deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
  z-index: -1;
}

.menu-content {
  text-align: center;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  animation: fadeInUp 0.8s ease-out;
}

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

.menu-title { margin-bottom: 8px; }

.title-cyr {
  display: block;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--pale-yellow);
  text-shadow: 0 0 20px rgba(240,230,140,0.3), 2px 2px 0 #333;
  margin-bottom: 4px;
}

.title-lat {
  display: block;
  font-size: 18px;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.7;
}

.menu-subtitle {
  font-size: 14px;
  color: var(--rust);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 40px;
  opacity: 0.8;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.menu-btn {
  background: var(--panel-bg);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  padding: 14px 28px;
  font-size: 16px;
  font-family: 'Segoe UI', monospace;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  border-radius: 0;
}

.menu-btn:hover {
  background: #333;
  border-color: var(--pale-yellow);
  color: var(--pale-yellow);
  transform: scale(1.02);
}

.menu-btn:active { transform: scale(0.98); }

.menu-footer {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  opacity: 0.5;
}

/* ═══ HELP ═══ */
.help-title {
  font-size: 28px;
  color: var(--pale-yellow);
  letter-spacing: 4px;
  margin-bottom: 24px;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  text-align: left;
  margin-bottom: 30px;
  font-size: 14px;
  color: var(--text-dim);
}

.help-grid div { display: flex; align-items: center; gap: 8px; }

.key {
  display: inline-block;
  background: #333;
  border: 1px solid #555;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: bold;
  color: var(--pale-yellow);
  min-width: 40px;
  text-align: center;
}

/* ═══ PAUSE ═══ */
.pause-title {
  font-size: 36px;
  color: var(--pale-yellow);
  letter-spacing: 8px;
  margin-bottom: 30px;
}

/* ═══ HUD ═══ */
#hud {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
}

#hud > * { pointer-events: auto; }

#hudHealth {
  position: absolute;
  top: 16px; left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.7);
  padding: 6px 12px;
  border: 1px solid #444;
}

#healthIcon { color: #cc3333; font-size: 16px; }

.bar-track {
  width: 120px;
  height: 10px;
  background: #222;
  border: 1px solid #444;
}

.bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #cc3333, #cc6633);
  transition: width 0.2s;
}

#healthText {
  font-size: 13px;
  color: #ccc;
  min-width: 30px;
  text-align: right;
}

#hudRep {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  padding: 4px 14px;
  border: 1px solid #444;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

#hudMoney {
  position: absolute;
  top: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.7);
  padding: 6px 12px;
  border: 1px solid #444;
  font-size: 15px;
}

#moneyIcon { color: var(--pale-yellow); font-weight: bold; }
#moneyText { color: var(--pale-yellow); font-weight: bold; min-width: 40px; text-align: right; }

#hudWanted {
  position: absolute;
  top: 50px; right: 16px;
  background: rgba(0,0,0,0.7);
  padding: 4px 10px;
  border: 1px solid #444;
  display: none;
  flex-direction: column;
  align-items: center;
}

#wantedText { font-size: 10px; color: #cc3333; letter-spacing: 2px; }
#wantedStars { font-size: 14px; color: #cc3333; letter-spacing: 2px; }

#hudWeapon {
  position: absolute;
  bottom: 16px; left: 16px;
  background: rgba(0,0,0,0.7);
  padding: 6px 12px;
  border: 1px solid #444;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

#weaponIcon { font-size: 16px; }
#weaponName { color: var(--text-light); }

#hudInventory {
  position: absolute;
  bottom: 16px; right: 16px;
  background: rgba(0,0,0,0.7);
  padding: 6px 12px;
  border: 1px solid #444;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
}

#hudInventory:hover { border-color: var(--pale-yellow); color: var(--pale-yellow); }

#hudMission {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  padding: 6px 16px;
  border: 1px solid #444;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  min-width: 200px;
}

#hudVodka {
  position: absolute;
  top: 50px; left: 16px;
  background: rgba(0,0,0,0.7);
  padding: 4px 10px;
  border: 1px solid #444;
  display: none;
}

#vodkaBar {
  width: 100px;
  height: 14px;
  background: #222;
  border: 1px solid #444;
  position: relative;
  overflow: hidden;
}

#vodkaText {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #ccc;
  z-index: 1;
}

#hudPrompt {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  padding: 8px 20px;
  border: 1px solid var(--pale-yellow);
  font-size: 13px;
  color: var(--pale-yellow);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

#hudReputation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  padding: 8px 20px;
  border: 1px solid #555;
  font-size: 14px;
  animation: fadeOut 2s forwards;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ═══ DIALOGUE ═══ */
#dialogueBox {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 550px;
  max-width: 90vw;
  background: rgba(10, 10, 10, 0.92);
  border: 2px solid #555;
  padding: 20px;
  z-index: 50;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(30px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

#dialoguePortrait {
  position: absolute;
  left: 16px; top: 16px;
  width: 48px; height: 48px;
  background: #333;
  border: 1px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

#dialogueName {
  margin-left: 60px;
  font-size: 14px;
  font-weight: bold;
  color: var(--pale-yellow);
  margin-bottom: 8px;
}

#dialogueText {
  margin-left: 60px;
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.5;
  min-height: 40px;
}

#dialogueOptions {
  margin-top: 12px;
  margin-left: 60px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialogue-opt {
  background: #222;
  border: 1px solid #444;
  padding: 8px 12px;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
}

.dialogue-opt:hover {
  background: #333;
  border-color: var(--pale-yellow);
  color: var(--pale-yellow);
}

#dialogueHint {
  position: absolute;
  bottom: 6px; right: 12px;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.5;
}

/* ═══ INVENTORY ═══ */
#inventoryPanel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 450px;
  max-width: 90vw;
  background: var(--panel-bg);
  border: 2px solid #555;
  z-index: 60;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.inv-header {
  font-size: 20px;
  font-weight: bold;
  color: var(--pale-yellow);
  letter-spacing: 3px;
  margin-bottom: 16px;
  text-align: center;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.inv-item {
  background: #222;
  border: 1px solid #444;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.inv-item:hover { background: #333; border-color: var(--pale-yellow); }
.inv-item-icon { font-size: 22px; }
.inv-item-name { font-size: 11px; color: var(--text-dim); }
.inv-item-count { font-size: 10px; color: var(--pale-yellow); }

.inv-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
}

/* ═══ MISSION COMPLETE ═══ */
#missionComplete {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel-bg);
  border: 2px solid var(--pale-yellow);
  padding: 30px 40px;
  text-align: center;
  z-index: 70;
  animation: fadeIn 0.5s ease-out;
}

.mc-icon { font-size: 48px; margin-bottom: 10px; }
.mc-title { font-size: 24px; color: var(--pale-yellow); letter-spacing: 3px; margin-bottom: 8px; }
.mc-desc { font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }
.mc-reward { font-size: 18px; color: var(--pale-yellow); margin-top: 8px; }

/* ═══ GAME OVER ═══ */
#gameOverScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.go-icon { font-size: 64px; margin-bottom: 16px; animation: pulse 1.5s ease-in-out infinite; }
.go-title {
  font-size: 48px;
  font-weight: 900;
  color: var(--blood);
  text-shadow: 0 0 30px rgba(139,0,0,0.5);
  letter-spacing: 8px;
  margin-bottom: 10px;
}
.go-sub { font-size: 14px; color: var(--text-dim); margin-bottom: 24px; }

/* ═══ RAID WARNING ═══ */
#raidWarning {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  z-index: 30;
  animation: raidFlash 0.5s ease-in-out infinite alternate;
}

@keyframes raidFlash { from { opacity: 0.6; } to { opacity: 1; } }

.raid-icon { font-size: 36px; }
.raid-text {
  font-size: 24px;
  font-weight: 900;
  color: #ff2222;
  letter-spacing: 6px;
  text-shadow: 0 0 20px rgba(255,0,0,0.5);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 600px) {
  .title-cyr { font-size: 28px; letter-spacing: 3px; }
  .title-lat { font-size: 14px; letter-spacing: 4px; }
  .menu-subtitle { font-size: 11px; }
  .menu-btn { font-size: 13px; padding: 10px 20px; }
  .help-grid { grid-template-columns: 1fr; }
  #dialogueBox { width: 95vw; bottom: 20px; }
  #inventoryPanel { width: 95vw; }
  .inv-grid { grid-template-columns: repeat(2, 1fr); }
  #hudHealth .bar-track { width: 80px; }
  #hudMission { font-size: 10px; min-width: 140px; }
}