/* ======================================================
   ДИГЛОВ ПРОТИВ ТЕОРИЙ ЗАГОВОРА — 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;
}

/* Release 2: readable controls and responsive in-run decisions. */
:root { --text:#f1e8dc; --gold:#f5c966; --cyan:#93d5dc; }
button:focus-visible,select:focus-visible,input:focus-visible {outline:3px solid #9ffff1;outline-offset:4px;}
.settings {display:flex;flex-wrap:wrap;justify-content:center;gap:14px;margin:18px 0;font-size:13px;}
.settings label {display:flex;gap:7px;align-items:center;}
.settings input {accent-color:#f5c966;width:18px;height:18px;}
.settings select {background:#211715;color:#fff;border:1px solid #937964;padding:8px;}
.pause-box {max-height:94dvh;overflow:auto;}
.pause-box .menu-btn {display:block;margin:10px auto;}
.small-note {font-size:11px!important;margin:10px 0!important;}
.modal-screen {position:fixed;inset:0;z-index:200;background:rgba(6,10,15,.96);display:flex;align-items:center;justify-content:center;padding:20px;overflow:auto;}
.info-panel {width:min(850px,100%);max-height:92dvh;overflow:auto;background:#151b24;border:1px solid #71818d;padding:clamp(18px,4vw,40px);box-shadow:0 20px 100px #000;}
.info-panel h2 {font-size:clamp(22px,4vw,34px);margin:8px 0 20px;color:#ffe0a0;}
.info-panel p,.info-panel li {font:16px/1.6 'Russo One',sans-serif;color:#e4e9ed;}
.info-panel ul {padding-left:24px;margin:18px 0 24px;}
.info-panel li {margin:12px 0;}
.eyebrow {font-size:11px!important;letter-spacing:1px;color:#a0dcd7!important;}
#upgrade-choices {display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:24px;}
.upgrade-card {background:#202d39;color:#fff;border:2px solid #697d8c;padding:24px 18px;text-align:left;cursor:pointer;min-height:170px;font:inherit;}
.upgrade-card:hover {border-color:#ffe0a0;background:#304351;}
.upgrade-card strong {display:block;font-size:19px;color:#ffe0a0;margin-bottom:16px;}
.upgrade-card span {font-size:14px;line-height:1.6;}
#wave-announce {color:#fff4ce!important;background:rgba(9,14,22,.94)!important;border:2px solid #e7be68!important;text-shadow:0 2px 3px #000;font-size:clamp(13px,2vw,22px);max-width:90vw;white-space:pre-wrap!important;}
#weapon-name {color:#d7ecff;text-shadow:0 1px 3px #000;}
#wave-goal {position:fixed;top:18px;left:50%;transform:translateX(-50%);background:#101720e8;padding:9px 14px;font-size:12px;white-space:nowrap;}
#boss-status {position:fixed;top:57px;left:50%;transform:translateX(-50%);color:#fff;background:#962f2fed;padding:8px 16px;font-size:12px;white-space:nowrap;}
#run-upgrades {position:fixed;bottom:10px;left:25%;width:50%;text-align:center;color:#ffe0a0;font-size:10px;text-shadow:0 1px 3px #000;}
.threat-arrow {position:fixed;color:#ffac64;font-size:25px;text-shadow:0 1px 5px #000;pointer-events:none;}
.reduced-effects *, .reduced-effects *::before,.reduced-effects *::after {animation:none!important;}
#menu-screen,#map-select-screen {overflow-y:auto;}
.map-select-content {padding-top:24px;padding-bottom:24px;max-height:100dvh;overflow:auto;}
@media(max-width:700px) {
  #upgrade-choices {grid-template-columns:1fr;gap:10px;}
  .upgrade-card {min-height:0;padding:16px;}
  .upgrade-card strong {margin-bottom:7px;font-size:16px;}
  #wave-goal {top:120px;font-size:10px;}
  #boss-status {top:153px;font-size:10px;}
  #run-upgrades {bottom:104px;left:12%;width:76%;font-size:9px;}
  .info-panel p,.info-panel li {font-size:13px;}
  .settings {font-size:12px;gap:10px;}
}
@media(max-height:550px) {
  .menu-eye {display:none;}
  .menu-content {padding:12px;}
  .menu-title {font-size:28px;}
  .menu-sub {margin:8px 0;}
  .menu-btn {padding:10px 16px;}
  .settings {margin:8px 0;}
}
@media(prefers-reduced-motion:reduce) {* {animation:none!important;}}

/* Start screen: portrait rendered from the original character model. */
#menu-screen {
  background: #080a0b;
  justify-content: flex-start;
  isolation: isolate;
  overflow-x: hidden;
}
.menu-portrait {
  position: absolute;
  inset: 0 0 0 36%;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22%);
  mask-image: linear-gradient(to right, transparent, #000 22%);
}
.menu-portrait img {
  position: absolute;
  width: 100%; height: 112%; bottom: -9%;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: 50% 85%;
  animation: menuBreath 6s ease-in-out infinite;
}
@keyframes menuBreath {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.012); }
}
.menu-atmosphere {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, #080a0b 0%, transparent 30%, transparent 90%, #080a0b99),
    linear-gradient(90deg, #080a0b 0%, #080a0bdb 30%, transparent 65%),
    repeating-linear-gradient(0deg, #00000010 0px, #00000010 1px, transparent 1px, transparent 4px);
}
.menu-edition {
  position: absolute; top: 32px; left: 6.5%;
  display: flex; align-items: center; gap: 20px;
  font: 10px/1.4 monospace; letter-spacing: 2px; color: #7d8486;
}
.menu-mark { color: #d95242; font: 24px 'Russo One', sans-serif; letter-spacing: -2px; }
#menu-screen .menu-content {
  width: 51%; max-width: 770px; padding: 112px 0 54px 6.5%;
  text-align: left;
}
.menu-eyebrow { font: 10px/1.6 monospace; letter-spacing: 2px; color: #a5acad; }
.menu-eyebrow > span { display: inline-block; width: 6px; height: 6px; background: #cd4b3d; margin-right: 9px; }
#menu-screen .menu-title {
  margin: 22px 0; font-family: 'Russo One', 'Arial Black', sans-serif;
  font-size: clamp(56px, 7.8vw, 116px); line-height: 1; letter-spacing: -.045em;
  color: #e7e6df; text-shadow: none;
}
#menu-screen .menu-title span {
  display: block; margin-top: 14px; font-size: .30em; line-height: 1.25;
  letter-spacing: .065em; color: #cf5041; text-shadow: none;
}
#menu-screen .menu-sub { font: 14px/1.7 sans-serif; color: #a5a8a6; opacity: 1; margin: 22px 0 30px; }
.menu-actions { width: min(320px, 90%); }
#menu-screen .menu-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin: 0 0 10px; padding: 18px 22px;
  font: 14px 'Russo One', sans-serif; letter-spacing: 1.5px;
  border: 1px solid #cf5041; background: #c74739; color: #fff1e8;
  box-shadow: none; transition: background .2s, border-color .2s;
}
#menu-screen .menu-btn:hover { background: #df5948; border-color: #ef7b69; transform: none; }
#menu-screen .menu-btn-secondary { background: #1115169c; color: #d3d6d2; border-color: #363c3d; }
#menu-screen .menu-btn-secondary:hover { background: #252b2c; border-color: #808987; }
.menu-options { width: min(360px, 95%); margin: 24px 0 0; }
.menu-options summary { cursor: pointer; width: fit-content; font: 11px/1.5 monospace; color: #b6bdbb; letter-spacing: 1.5px; padding: 6px 0; }
.menu-options summary:focus-visible { outline: 2px solid #ef7b69; outline-offset: 4px; }
#menu-screen .settings { justify-content: flex-start; font: 12px sans-serif; padding: 12px 0; margin: 0; }
#menu-screen .settings input { accent-color: #cf5041; }
#menu-screen .settings select { background: #151a1b; border-color: #4e5757; }
#menu-screen .menu-controls { margin-top: 26px; font: 11px/2 sans-serif; color: #858d8d; }
#menu-screen .menu-controls b { color: #b8bfbb; font-weight: 500; }
.menu-caption { position: absolute; right: 5%; bottom: 32px; font: 10px/1.8 monospace; letter-spacing: 2px; color: #b8bcb7; text-align: right; }
.menu-caption span { display: block; font-size: 9px; color: #747e7e; }
@media (min-width: 1500px) { #menu-screen .menu-content { padding-left: 8%; } .menu-edition { left: 8%; } }
@media (max-width: 700px) {
  #menu-screen { align-items: flex-start; }
  .menu-edition { top: 22px; left: 7%; font-size: 8px; gap: 12px; letter-spacing: 1px; }
  .menu-portrait { inset: 40px -25% auto 12%; height: 530px; opacity: .75; }
  .menu-portrait img { height: 100%; bottom: 0; }
  .menu-atmosphere { position: fixed; background: linear-gradient(0deg, #080a0b 5%, #080a0bd9 36%, #080a0b22 80%), linear-gradient(90deg, #080a0bcc, transparent); }
  #menu-screen .menu-content { width: 100%; padding: 190px 7% 30px; }
  #menu-screen .menu-title { font-size: clamp(54px, 13vw, 85px); }
  #menu-screen .menu-title span { font-size: .32em; }
  .menu-eyebrow { font-size: 9px; letter-spacing: 1px; }
  .menu-actions { width: 100%; max-width: 360px; }
  .menu-caption { display: none; }
  #menu-screen .menu-controls { max-width: 360px; }
}
@media (max-height: 620px) and (min-width: 701px) {
  .menu-edition { top: 18px; }
  #menu-screen .menu-content { padding-top: 74px; padding-bottom: 24px; }
  #menu-screen .menu-title { font-size: 62px; margin: 12px 0; }
  #menu-screen .menu-sub { margin: 12px 0; }
  #menu-screen .menu-btn { padding: 12px 18px; }
  .menu-options { margin-top: 12px; }
  #menu-screen .menu-controls { margin-top: 12px; }
}
#menu-screen .menu-options:not([open]) > .settings { display: none; }

/* Shared menu system: charcoal surfaces, warm white type, muted red accents. */
#map-select-screen, #leaderboard-screen, #pause-screen, #death-screen, .modal-screen {
  background: radial-gradient(ellipse at 90% 0%, #33201d55, transparent 55%), #080a0bf5;
  padding: clamp(16px, 3vw, 40px);
  overflow-y: auto;
}
.menu-bg-grid, .map-select-content > .menu-eye, .lb-eye { display: none; }
.menu-btn {
  font-family: 'Russo One', sans-serif; font-size: 13px;
  padding: 16px 22px; letter-spacing: 1.3px;
  border: 1px solid #cf5041; background: #c74739; color: #fff1e8;
  box-shadow: none; transition: background .2s, border-color .2s;
}
.menu-btn:hover { background: #df5948; border-color: #ef7b69; box-shadow: none; transform: none; }
.menu-btn:active { transform: none; background: #ab382d; }
.menu-btn-secondary { background: #111516; color: #d3d6d2; border-color: #363c3d; box-shadow: none; }
.menu-btn-secondary:hover { background: #252b2c; color: #eee; border-color: #808987; box-shadow: none; }
.pause-box, .lb-box, .info-panel {
  border: 1px solid #363c3d; background: #101415;
  padding: clamp(22px, 4vw, 48px); box-shadow: 0 24px 90px #0005;
  width: min(850px, 100%); max-width: 850px; text-align: left;
  max-height: 90dvh; overflow-y: auto;
}
.pause-box { width: min(660px, 100%); }
.pause-box h2, .lb-title, .map-select-title, .info-panel h2 {
  font-family: 'Russo One', sans-serif; color: #e7e6df;
  font-size: clamp(23px, 3.5vw, 38px); letter-spacing: .02em;
  line-height: 1.25; text-shadow: none; margin: 0 0 24px;
}
.death-box h2 { color: #cf5041; text-shadow: none; }
.pause-box p, .info-panel p, .info-panel li { color: #adb5b3; font-family: sans-serif; line-height: 1.65; }
.pause-box .menu-btn { margin: 10px 0; width: 100%; }
.settings { justify-content: flex-start; color: #b6bdbb; font-family: sans-serif; }
.settings input { accent-color: #cf5041; }
.settings select { background: #151a1b; border: 1px solid #4e5757; }
.small-note { color: #929c99 !important; font: 11px/1.6 sans-serif !important; }
.eyebrow { color: #cf7568 !important; font-family: monospace !important; }
.map-select-content { max-width: 1120px; width: 100%; text-align: left; padding: 4px; }
.map-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.map-card { width: auto; padding: 26px; text-align: left; background: #101415; border: 1px solid #363c3d; box-shadow: none; display: flex; flex-direction: column; }
.map-card:hover, .map-card-new:hover { border-color: #ab5b50; box-shadow: none; transform: none; }
.map-card-icon { font-size: 30px; filter: none; opacity: .8; margin-bottom: 24px; }
.map-card-name { font: 20px/1.3 'Russo One',sans-serif; color: #e7e6df; }
.map-card-size { color: #b87c70; font: 11px monospace; margin: 12px 0; }
.map-card-desc { opacity: 1; font: 14px/1.65 sans-serif; color: #a5aeaa; flex: 1; }
.map-card-diff { color: #cf7568; text-shadow: none; font-size: 13px; }
.map-card-badge { background: #c74739; color: #fff1e8; font: 10px monospace; }
.lb-tab { font: 12px 'Russo One',sans-serif; border: 1px solid #363c3d; color: #a5aeaa; background: #151a1b; padding: 12px; }
.lb-tab.active, .lb-tab:hover { background: #32201e; color: #e7e6df; border-color: #b85b4e; }
.lb-row, .lb-row.rank-1, .lb-row.rank-2, .lb-row.rank-3 { border-color: #363c3d; background: #151a1b; }
.lb-rank, .lb-name, .lb-score, .lb-date, .lb-loading, .lb-empty { font-family: 'Russo One',sans-serif; text-shadow: none; }
.rank-1 .lb-rank, .lb-score { color: #d98778; text-shadow: none; }
.lb-actions { justify-content: flex-start; flex-wrap: wrap; }
.upgrade-card { background: #171d1e; border: 1px solid #465050; color: #aeb6b2; }
.upgrade-card:hover { background: #302220; border-color: #cf7568; }
.upgrade-card strong { color: #e7e6df; }
.upgrade-card span { font-family: sans-serif; }
.arcade-char { font-family: 'Russo One',sans-serif; color: #e7e6df; background: #171d1e; border: 1px solid #465050; text-shadow: none; }
.arcade-up, .arcade-down { color: #cf7568; text-shadow: none; }
.submit-saved { color: #9dc5ab; text-shadow: none; }
.score-submit { align-items: flex-start; }
#portrait-canvas { border: 1px solid #465050; box-shadow: none; background: #101516; }
#hud-name { font: 9px 'Russo One',sans-serif; color: #c4ccc7; letter-spacing: 1px; text-shadow: none; }
@media (max-width: 760px) {
  .map-cards { grid-template-columns: 1fr; }
  .map-card { padding: 22px; }
  .map-card-icon { margin-bottom: 12px; }
  #map-select-screen, #leaderboard-screen { align-items: flex-start; }
  .lb-box { max-height: none; }
  .lb-map-tabs { flex-wrap: wrap; }
  .end-actions { width: 100%; }
}

/* Center the final score and name entry on the defeat screen. */
#death-score {
  text-align: center;
  font: clamp(28px, 5vw, 44px)/1.2 'Russo One', sans-serif;
  font-variant-numeric: tabular-nums;
  color: #e7e6df;
  margin: 28px 0;
  padding: 20px 12px;
  background: #171d1e;
  border: 1px solid #363c3d;
}
#death-submit { align-items: center; text-align: center; }
