/* ======================================================
   ДИГЛОВ ПРОТИВ ТЕОРИЙ ЗАГОВОРА — CSS
   Стиль: советский конструктивизм + мем-эстетика
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Russo+One&display=swap');

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

:root {
  --red:     #cc2222;
  --orange:  #b85a22;
  --gold:    #b08030;
  --green:   #2a8844;
  --blue:    #2a5aaa;
  --cyan:    #4a8a8a;
  --purple:  #6a2a88;
  --dark:    #0a0303;
  --darker:  #060101;
  --panel:   rgba(12,4,4,0.92);
  --border:  #3a1a1a;
  --text:    #c8b8a8;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--darker);
  font-family: 'Russo One', sans-serif;
  color: var(--text);
}

/* ===== GAME CANVAS ===== */
#game-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ===== МЕНЮ ===== */
#menu-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--darker);
  z-index: 100;
}

.menu-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(160,20,20,0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160,20,20,0.15) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 16s linear infinite;
}
@keyframes gridMove {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

.menu-content {
  position: relative;
  text-align: center;
  max-width: 700px;
  padding: 40px;
}

.menu-eye {
  font-size: 80px;
  display: block;
  animation: eyePulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px var(--red));
}
@keyframes eyePulse {
  0%,100% { transform: scale(1);    filter: drop-shadow(0 0 15px rgba(180,20,10,0.9)); }
  30%      { transform: scale(0.98); filter: drop-shadow(0 0 8px  rgba(100,10,5,0.6)); }
  50%      { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(220,40,20,0.7)); }
  70%      { transform: scale(1.0);  filter: drop-shadow(0 0 10px rgba(150,15,8,0.8)); }
}

.menu-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(18px, 4vw, 36px);
  line-height: 1.4;
  color: #fff;
  text-shadow:
    0 0 10px var(--red),
    0 0 30px var(--orange),
    4px 4px 0 #300;
  margin: 24px 0 12px;
}
.menu-title span {
  font-size: 0.55em;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold);
}

.menu-sub {
  font-size: 14px;
  color: var(--cyan);
  margin-bottom: 32px;
  font-style: italic;
  opacity: 0.8;
}

.menu-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 16px 40px;
  background: var(--red);
  border: 3px solid #fff;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(224,53,53,0.5), 4px 4px 0 #300;
}
.menu-btn:hover {
  background: var(--orange);
  transform: translate(-2px,-2px);
  box-shadow: 0 0 30px rgba(224,120,53,0.7), 6px 6px 0 #300;
}
.menu-btn:active { transform: translate(2px,2px); }

/* Secondary style — gold outline */
.menu-btn-secondary {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 20px rgba(224,181,53,0.3), 4px 4px 0 #330;
}
.menu-btn-secondary:hover {
  background: rgba(224,181,53,0.15);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 30px rgba(224,181,53,0.5), 6px 6px 0 #330;
}

.menu-content .menu-btn { display: block; margin: 0 auto 14px; }

.menu-controls {
  margin-top: 24px;
  font-size: 11px;
  color: rgba(200,200,232,0.5);
  line-height: 2;
}

/* ===== ОВЕРЛЕИ (ПАУЗА/СМЕРТЬ/ПОБЕДА) ===== */
#pause-screen, #death-screen, #win-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 90;
}

.pause-box {
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 48px 64px;
  text-align: center;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
}
.pause-box h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  margin-bottom: 16px;
  color: #fff;
}
.pause-box p { margin-bottom: 24px; color: var(--text); font-size: 13px; }

.death-box h2 { color: var(--red); text-shadow: 0 0 20px var(--red); }
.win-box   h2 { color: var(--gold); text-shadow: 0 0 20px var(--gold); }
.death-flavor { font-style: italic; opacity: 0.6; font-size: 12px !important; }

.hidden { display: none !important; }

/* ===== HUD ===== */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  font-family: 'Russo One', sans-serif;
}

/* Портрет */
#hud-portrait {
  position: absolute;
  bottom: 20px; left: 20px;
  text-align: center;
}
#portrait-canvas {
  display: block;
  border: 2px solid var(--border);
  image-rendering: pixelated;
  width: 80px; height: 80px;
  box-shadow: 0 0 12px rgba(224,53,53,0.4);
}
#hud-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--gold);
  margin-top: 4px;
  text-shadow: 0 0 8px var(--gold);
}

/* Статы */
#hud-stats {
  position: absolute;
  bottom: 24px; left: 120px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 200px;
}
.stat-row {
  display: flex; align-items: center; gap: 8px;
}
.stat-icon { font-size: 14px; width: 20px; text-align: center; }
.stat-bar-bg {
  flex: 1; height: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  overflow: hidden;
}
.stat-bar {
  height: 100%;
  transition: width 0.2s ease;
}
.hp-bar    { background: linear-gradient(90deg, var(--red), #ff6060); }
.armor-bar { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.stat-row span:last-child {
  font-size: 12px;
  width: 32px; text-align: right;
  color: #fff;
}

/* Оружие */
#hud-weapon {
  position: absolute;
  bottom: 20px; right: 20px;
  text-align: right;
}
#weapon-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--cyan);
  margin-bottom: 6px;
  text-shadow: 0 0 8px var(--cyan);
}
#ammo-display {
  font-size: 28px;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}
.ammo-sep { color: var(--border); margin: 0 4px; }
#weapon-slots {
  display: flex; gap: 6px; justify-content: flex-end;
}
.wslot {
  font-size: 10px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: rgba(200,200,232,0.5);
  cursor: pointer;
  transition: all 0.1s;
}
.wslot.active {
  background: rgba(224,181,53,0.2);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(224,181,53,0.4);
}

/* Очки */
#hud-score {
  position: absolute;
  top: 16px; left: 16px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  background: var(--panel);
  padding: 10px 16px;
  border: 1px solid var(--border);
  text-shadow: 0 0 6px rgba(53,212,224,0.3);
}
#val-score { color: var(--gold); }
#val-wave  { color: var(--cyan); }
#val-enemies { color: var(--red); }

/* Комбо-множитель (серия убийств без урона) */
#row-combo { color: var(--gold); }
#val-combo {
  color: #ff8800;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255,136,0,0.6);
}

/* Кукуруза */
#hud-corn {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 32px;
  opacity: 0.15;
  transition: opacity 0.3s, transform 0.3s;
  filter: drop-shadow(0 0 8px rgba(224,181,53,0.5));
}
#hud-corn.active {
  opacity: 1;
  animation: cornBounce 0.3s;
}
@keyframes cornBounce {
  0%,100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.5) rotate(15deg); }
}

/* Kill feed */
#kill-feed {
  position: absolute;
  top: 50%; right: 16px;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
  align-items: flex-end;
  pointer-events: none;
}
.kill-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 6px 12px;
  background: rgba(224,53,53,0.2);
  border-left: 3px solid var(--red);
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold);
  animation: killFade 3s ease-out forwards;
}
@keyframes killFade {
  0%   { opacity: 1; transform: translateX(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(20px); }
}

/* Перекрестие */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 24px;
  color: rgba(255,255,255,0.8);
  pointer-events: none;
  text-shadow: 0 0 6px rgba(255,255,255,0.5);
  line-height: 1;
  user-select: none;
}

/* Перезарядка */
#reload-msg {
  position: absolute;
  bottom: 120px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold);
  animation: reloadBlink 0.5s ease-in-out infinite;
}
@keyframes reloadBlink {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* Дамаг оверлей */
#damage-overlay {
  position: absolute; inset: 0;
  border: 0px solid var(--red);
  box-shadow: inset 0 0 0 rgba(224,53,53,0);
  transition: all 0.1s;
  pointer-events: none;
}
#damage-overlay.hit {
  box-shadow: inset 0 0 80px rgba(224,53,53,0.6);
  border-width: 4px;
}

/* Волна */
#wave-announce {
  position: absolute;
  top: 35%; left: 50%;
  transform: translate(-50%,-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(14px, 3vw, 24px);
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold), 0 0 40px var(--orange);
  text-align: center;
  animation: waveIn 0.5s ease-out;
  pointer-events: none;
  background: rgba(0,0,0,0.6);
  padding: 20px 40px;
  border: 2px solid var(--gold);
}
@keyframes waveIn {
  from { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}

/* ===== MOBILE TOUCH CONTROLS ===== */
#touch-overlay {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 55;
  touch-action: none;
}

/* Move joystick (left side) */
#joy-base {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.18);
  pointer-events: none;
}
.joy-hidden { display: none !important; }

#joy-knob {
  position: absolute;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(224,53,53,0.65);
  border: 2px solid rgba(255,255,255,0.35);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 12px rgba(224,53,53,0.5);
}

/* Aim joystick (right side) — cyan tint to distinguish from move stick */
#aim-base {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(0,220,255,0.07);
  border: 2px solid rgba(0,220,255,0.22);
  pointer-events: none;
}
#aim-knob {
  position: absolute;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(0,180,224,0.65);
  border: 2px solid rgba(255,255,255,0.35);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 12px rgba(0,180,224,0.5);
}

/* Shared button base */
.touch-ui-btn {
  position: absolute;
  pointer-events: auto;
  font-family: 'Press Start 2P', monospace;
  border: 2px solid rgba(255,255,255,0.25);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.touch-ui-btn:active { opacity: 0.65; }

/* Fire button — big, bottom-right */
#btn-touch-fire {
  bottom: 36px; right: 28px;
  width: 88px; height: 88px;
  border-radius: 50%;
  font-size: 30px;
  background: rgba(224,53,53,0.55);
  border-color: var(--red);
  box-shadow: 0 0 24px rgba(224,53,53,0.5);
}

/* Reload button */
#btn-touch-reload {
  bottom: 140px; right: 52px;
  width: 54px; height: 54px;
  border-radius: 50%;
  font-size: 18px;
  background: rgba(53,119,224,0.5);
  border-color: var(--blue);
}

/* Pause button — top center */
#btn-touch-pause {
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 48px; height: 48px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(10,10,20,0.72);
}

/* Weapon row — stacked vertically left of fire */
#touch-weapon-row {
  position: absolute;
  bottom: 40px; right: 136px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
.touch-weapon-btn {
  width: 46px; height: 46px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  background: rgba(10,10,20,0.72);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.touch-weapon-btn:active { opacity: 0.65; }

/* ===== LEADERBOARD SCREEN ===== */
#leaderboard-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--darker);
  z-index: 100;
}

.lb-box {
  position: relative;
  text-align: center;
  max-width: 560px;
  width: 90%;
  padding: 40px 32px;
}

.lb-eye {
  font-size: 56px;
  display: block;
  animation: eyePulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px var(--gold));
  margin-bottom: 12px;
}

.lb-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(12px, 3vw, 20px);
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold), 0 0 30px var(--orange), 3px 3px 0 #330;
  margin-bottom: 28px;
  letter-spacing: 2px;
}

#lb-table {
  width: 100%;
  margin-bottom: 28px;
}

.lb-loading {
  color: var(--text);
  font-size: 12px;
  opacity: 0.6;
  padding: 20px;
}

.lb-empty {
  color: rgba(200,200,232,0.4);
  font-size: 11px;
  font-style: italic;
  padding: 20px;
}

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 0 12px;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  font-size: 12px;
  transition: background 0.1s;
}
.lb-row:hover { background: rgba(255,255,255,0.07); }

/* Gold / Silver / Bronze */
.lb-row.rank-1 { border-color: var(--gold);   background: rgba(224,181,53,0.08); }
.lb-row.rank-2 { border-color: #aaa;           background: rgba(200,200,200,0.05); }
.lb-row.rank-3 { border-color: #cd7f32;        background: rgba(205,127,50,0.06); }

.lb-rank {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  text-align: right;
}
.rank-1 .lb-rank { color: var(--gold);  text-shadow: 0 0 8px var(--gold); }
.rank-2 .lb-rank { color: #ccc; }
.rank-3 .lb-rank { color: #cd7f32; }

.lb-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #fff;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
  white-space: nowrap;
}

.lb-date {
  font-size: 9px;
  color: rgba(200,200,232,0.35);
  white-space: nowrap;
}

.lb-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.lb-actions .menu-btn { margin: 0; font-size: 11px; padding: 12px 28px; }

/* ===== LEADERBOARD MAP TABS ===== */
.lb-map-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 10px 0 16px;
}
.lb-tab {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 18px;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.lb-tab:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.lb-tab.active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(53,212,224,0.3);
}

/* ===== SCORE SUBMIT FORM (on death / win screens) ===== */
.score-submit {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.submit-label {
  font-size: 10px !important;
  color: var(--text) !important;
  margin: 0 !important;
  opacity: 0.8;
}

/* Аркадный спиннер имени */
.arcade-name {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.arcade-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.arcade-char {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold), 0 0 30px rgba(224,181,53,0.3);
  width: 44px;
  height: 44px;
  line-height: 44px;
  text-align: center;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.06);
}
.arcade-up, .arcade-down {
  font-size: 18px;
  background: none;
  border: 2px solid transparent;
  color: var(--cyan);
  cursor: pointer;
  padding: 4px 14px;
  font-family: 'Press Start 2P', monospace;
  transition: color 0.1s, text-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.arcade-up:hover, .arcade-down:hover,
.arcade-up:active, .arcade-down:active {
  color: #fff;
  text-shadow: 0 0 10px var(--cyan);
}

.submit-save-btn { font-size: 10px !important; padding: 12px 24px !important; }

.submit-saved {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
  animation: reloadBlink 0.6s ease-in-out 3;
}

.end-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.end-actions .menu-btn { font-size: 10px; padding: 12px 20px; }

/* ===== MAP SELECT SCREEN ===== */
#map-select-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--darker);
  z-index: 100;
}

.map-select-content {
  position: relative;
  text-align: center;
  max-width: 860px;
  width: 96%;
  padding: 24px 16px;
}

.map-select-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(13px, 3vw, 22px);
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold), 3px 3px 0 #330;
  margin: 10px 0 28px;
  letter-spacing: 2px;
}

.map-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.map-card {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 28px 22px 22px;
  width: 270px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.map-card:hover {
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(224,181,53,0.25);
  transform: translateY(-4px);
}

.map-card-new { border-color: rgba(53,212,224,0.5); }
.map-card-new:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 28px rgba(53,212,224,0.3);
}

.map-card-badge {
  position: absolute;
  top: -11px; right: 14px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  background: var(--cyan);
  color: var(--darker);
  padding: 4px 10px;
  letter-spacing: 1px;
}

.map-card-icon {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 10px rgba(224,181,53,0.4));
}

.map-card-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.6;
}

.map-card-size {
  font-size: 11px;
  color: var(--cyan);
  margin-bottom: 10px;
  opacity: 0.8;
}

.map-card-desc {
  font-size: 11px;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.7;
  opacity: 0.65;
  min-height: 52px;
}

.map-card-diff {
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 18px;
  text-shadow: 0 0 8px rgba(224,181,53,0.35);
  letter-spacing: 3px;
}

.map-card-btn {
  display: block !important;
  width: 100%;
  font-size: 10px !important;
  padding: 12px 16px !important;
  margin: 0 !important;
}

#btn-map-back {
  font-size: 11px;
  padding: 12px 28px;
}
