/* ============================================================
   Страж Українського Неба — стилі
   Військова естетика: камуфляж, стенсил, темна оливка
   ============================================================ */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #1a1f14;
  color: #d8dccb;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; cursor: pointer; }

.screen {
  position: fixed; inset: 0;
  display: none !important;
  overflow: hidden;
}
.screen.active { display: block !important; }

#start-screen.screen.active,
#end-screen.screen.active {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
}

#start-screen.screen.active {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 99, 72, 0.55) transparent;
}

#start-screen.screen.active::-webkit-scrollbar {
  width: 8px;
}

#start-screen.screen.active::-webkit-scrollbar-thumb {
  background: rgba(90, 99, 72, 0.55);
  border-radius: 4px;
}

#end-screen.screen.active {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- Камуфляжний фон ---- */
.camo-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  background-color: #2a2f1c;
  background-image:
    radial-gradient(ellipse 200px 140px at 10% 20%, #1a1f10 0, transparent 60%),
    radial-gradient(ellipse 280px 180px at 80% 30%, #3a402a 0, transparent 65%),
    radial-gradient(ellipse 220px 160px at 30% 70%, #4a5234 0, transparent 60%),
    radial-gradient(ellipse 300px 200px at 70% 85%, #1f2412 0, transparent 65%),
    radial-gradient(ellipse 180px 140px at 50% 50%, #232812 0, transparent 60%),
    radial-gradient(ellipse 240px 160px at 90% 60%, #2c331a 0, transparent 60%),
    radial-gradient(ellipse 160px 120px at 15% 95%, #444c2e 0, transparent 60%);
  z-index: 0;
}
.camo-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.15) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 4px);
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================================
   СТАРТОВИЙ ЕКРАН
   ============================================================ */
#start-screen { background: #1a1f14; }
#end-screen { background: #1a1f14; }

.start-version-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a0a;
  background: linear-gradient(180deg, #ffd84d, #c9a832);
  border: 1px solid rgba(255, 220, 120, 0.65);
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.start-brand {
  margin: 0 0 18px;
  font-size: 13px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #6a7348;
}
.start-brand-name {
  color: #ffd84d;
  font-weight: bold;
  letter-spacing: 0.22em;
  text-shadow: 0 0 12px rgba(255, 216, 77, 0.35);
}

.start-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 30px 80px;
  text-align: center;
}

.emblem {
  width: 90px; height: 90px;
  border: 3px solid #c9d199;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: rgba(0,0,0,0.4);
  position: relative;
  transform: rotate(45deg);
}
.emblem-trident {
  transform: rotate(-45deg);
  font-size: 50px;
  color: #ffd84d;
  text-shadow: 0 0 18px rgba(255,216,77,0.5);
}
.emblem::before, .emblem::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 3px solid #c9d199;
}
.emblem::before { top: -10px; left: -10px; border-right: 0; border-bottom: 0; }
.emblem::after  { bottom: -10px; right: -10px; border-left: 0; border-top: 0; }

.title {
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 56px;
  letter-spacing: 6px;
  color: #e6edc1;
  text-shadow: 3px 3px 0 #000, 0 0 20px rgba(0,0,0,0.7);
  margin-bottom: 4px;
}
.title span {
  display: block;
  font-size: 28px;
  letter-spacing: 14px;
  color: #c9d199;
  margin-top: 4px;
}

.subtitle {
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 3px;
  color: #8e9760;
  margin-bottom: 26px;
  text-transform: uppercase;
}

.intro-text {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.7;
  color: #c0c5a3;
  margin-bottom: 30px;
  padding: 14px 20px;
  border-top: 1px solid #4a5234;
  border-bottom: 1px solid #4a5234;
  background: rgba(0,0,0,0.25);
}

.difficulty-section {
  margin-bottom: 30px;
}
.section-label {
  font-size: 14px;
  letter-spacing: 4px;
  color: #c9d199;
  margin-bottom: 18px;
  font-weight: normal;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.diff-card {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.diff-card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  padding: 0 14px 14px;
  border-radius: 16px;
  border: 1px solid var(--card-border, rgba(100, 118, 68, 0.45));
  background:
    radial-gradient(120% 80% at 50% -20%, var(--card-glow, rgba(126, 179, 60, 0.12)), transparent 55%),
    linear-gradient(180deg, rgba(34, 42, 22, 0.98) 0%, rgba(16, 20, 10, 0.99) 100%);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.diff-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent-bar, linear-gradient(90deg, #5b8c2a, #9fd654, #5b8c2a));
}

.diff-card[data-difficulty='easy'] {
  --card-border: rgba(126, 179, 60, 0.42);
  --card-glow: rgba(126, 179, 60, 0.18);
  --card-accent-bar: linear-gradient(90deg, #4a7424, #9fd654, #4a7424);
  --shield-fill: #3d5228;
  --shield-fill-hi: #6a9440;
  --shield-rim: #b8e878;
  --shield-mark: #dff5a8;
}

.diff-card[data-difficulty='medium'] {
  --card-border: rgba(232, 194, 53, 0.38);
  --card-glow: rgba(232, 194, 53, 0.14);
  --card-accent-bar: linear-gradient(90deg, #8a7018, #f0d050, #8a7018);
  --shield-fill: #524820;
  --shield-fill-hi: #8a7828;
  --shield-rim: #f0d86a;
  --shield-mark: #fff0a8;
}

.diff-card[data-difficulty='hard'] {
  --card-border: rgba(200, 64, 48, 0.42);
  --card-glow: rgba(200, 64, 48, 0.16);
  --card-accent-bar: linear-gradient(90deg, #6a2818, #e86048, #6a2818);
  --shield-fill: #4a2018;
  --shield-fill-hi: #883028;
  --shield-rim: #f0a090;
  --shield-mark: #ffd0c8;
}

.diff-card[data-difficulty='vsrf'] {
  --card-border: rgba(255, 216, 77, 0.34);
  --card-glow: rgba(200, 64, 48, 0.14);
  --card-accent-bar: linear-gradient(90deg, #282018, #c84030 42%, #ffd84d 58%, #282018);
  --shield-fill: #3a3028;
  --shield-fill-hi: #5a4030;
  --shield-rim: #ffd84d;
  --shield-mark: #ffd84d;
}

.diff-card:hover .diff-card-inner {
  transform: translateY(-4px);
  border-color: var(--shield-rim);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.diff-card.selected .diff-card-inner {
  transform: translateY(-2px);
  border-color: #ffd84d;
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.42),
    0 0 0 2px rgba(255, 216, 77, 0.35),
    0 0 28px rgba(255, 216, 77, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.diff-card.locked {
  cursor: not-allowed;
}

.diff-card.locked .diff-card-inner {
  opacity: 0.52;
  filter: grayscale(0.35) brightness(0.92);
}

.diff-card.locked:hover .diff-card-inner {
  transform: none;
  border-color: var(--card-border);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.diff-card.locked.selected .diff-card-inner {
  border-color: var(--card-border);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.diff-shield-badge {
  position: relative;
  width: 68px;
  height: 78px;
  margin: 10px auto 6px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.diff-shield-badge::after {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  top: 8%;
  height: 42%;
  border-radius: 40% 40% 50% 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

.diff-card.locked .diff-shield-badge::before {
  content: '🔒';
  position: absolute;
  right: -2px;
  top: -2px;
  z-index: 2;
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.diff-shield-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.diff-shield-rim {
  fill: none;
  stroke: var(--shield-rim);
  stroke-width: 2;
  opacity: 0.85;
}

.diff-shield-mark {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--shield-mark);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.diff-shield-icon-svg {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  color: var(--shield-mark);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.diff-card-header {
  text-align: center;
  padding: 0 2px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}

.diff-card-body {
  flex: 1 1 auto;
  min-height: 0;
}

.diff-card-footer {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.diff-soon-badge {
  display: inline-block;
  margin: 6px auto 0;
  padding: 3px 10px;
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: bold;
  color: #1a1f14;
  background: linear-gradient(90deg, #ffd84d, #e8c235);
  border: 1px solid rgba(255, 216, 77, 0.55);
  border-radius: 999px;
}

.diff-card.locked .diff-soon-badge {
  opacity: 0.55;
}

.diff-outcome-vsrf {
  border-color: rgba(255, 216, 77, 0.35);
  background: rgba(200, 64, 48, 0.1);
}

.progress-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.diff-name {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2.5px;
  color: #fff;
  font-family: 'Impact', sans-serif;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.diff-callsign {
  margin: 4px 0 0;
  font-size: 11px;
  color: #a3ad6e;
  letter-spacing: 1px;
  font-style: italic;
}

.diff-online,
.mode-online {
  font-size: 11px;
  color: #8fa86a;
  text-align: center;
  margin: 6px 0 0;
  letter-spacing: 0.3px;
}
.diff-online::before,
.mode-online::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #5a6a42;
  vertical-align: middle;
  transform: translateY(-1px);
}
.diff-online.has-players::before,
.mode-online.has-players::before {
  background: #7ed492;
  box-shadow: 0 0 6px rgba(126, 212, 146, 0.75);
}
.diff-online-count {
  font-weight: bold;
  color: #c8e878;
}
.mode-online {
  text-align: center;
  margin: 0 auto 8px;
  max-width: 520px;
}
.diff-info {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.55;
  color: #b8be9a;
}
.diff-info li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
}
.diff-info li:last-child {
  margin-bottom: 0;
}
.diff-info li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--shield-rim, #ffd84d);
  box-shadow: 0 0 6px var(--shield-rim, rgba(255, 216, 77, 0.5));
  transform: translateY(-50%);
}
.diff-info b { color: #e6edc1; }

.diff-outcome {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid;
  border-left-width: 3px;
  font-size: 11px;
  line-height: 1.4;
  color: #d0d6b8;
  background: rgba(0, 0, 0, 0.22);
}
.diff-outcome-green {
  background: rgba(91, 140, 42, 0.14);
  border-color: rgba(126, 179, 60, 0.45);
  border-left-color: #7eb33c;
}
.diff-outcome-yellow {
  background: rgba(176, 144, 32, 0.14);
  border-color: rgba(232, 194, 53, 0.42);
  border-left-color: #e8c235;
}
.diff-outcome-red {
  background: rgba(128, 48, 32, 0.16);
  border-color: rgba(200, 64, 48, 0.42);
  border-left-color: #c84030;
}
.diff-outcome-lose {
  opacity: 0.9;
}
.diff-outcome-label {
  display: inline;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-right: 6px;
  color: #f0f4d8;
}
.diff-outcome-green .diff-outcome-label { color: #b8e878; }
.diff-outcome-yellow .diff-outcome-label { color: #f0d86a; }
.diff-outcome-red .diff-outcome-label { color: #f0a090; }
.diff-outcome-vsrf .diff-outcome-label { color: #ffd84d; }
.diff-outcome-text {
  display: inline;
}
.diff-outcome-text b { color: #eef2d4; }

@media (min-width: 1060px) {
  .difficulty-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 1120px;
    gap: 14px;
  }

  .diff-card-inner {
    padding: 0 12px 12px;
  }

  .diff-info {
    font-size: 11px;
    line-height: 1.5;
  }

  .diff-name {
    font-size: 18px;
  }
}

/* Камуфляжна кнопка ПОЧАТИ */
.start-btn {
  position: relative;
  padding: 18px 60px;
  background-color: #4a5d2a;
  background-image:
    radial-gradient(ellipse 60px 40px at 20% 30%, #2c3818 0, transparent 60%),
    radial-gradient(ellipse 80px 50px at 70% 60%, #6b8038 0, transparent 60%),
    radial-gradient(ellipse 50px 30px at 50% 80%, #3a4a20 0, transparent 60%);
  border: 3px solid #1a1f10;
  outline: 2px solid #c9d199;
  color: #fff;
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 26px;
  letter-spacing: 4px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  text-shadow: 2px 2px 0 #000;
  margin-top: 10px;
}
.start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.start-btn:not(:disabled):hover {
  transform: scale(1.05);
  filter: brightness(1.15);
}
.start-btn:not(:disabled):active {
  transform: scale(0.97);
}

.btn-corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 3px solid #ffd84d;
}
.btn-corner-tl { top: -3px; left: -3px;   border-right: 0; border-bottom: 0; }
.btn-corner-tr { top: -3px; right: -3px;  border-left: 0;  border-bottom: 0; }
.btn-corner-bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0;   }
.btn-corner-br { bottom: -3px; right: -3px; border-left: 0; border-top: 0;   }
.btn-text { position: relative; z-index: 1; }

.support-project-hero {
  margin: 8px 0 22px;
  padding: 16px 20px 14px;
  text-align: center;
  background: rgba(232, 194, 53, 0.12);
  border: 2px solid rgba(255, 216, 77, 0.55);
  border-radius: 10px;
  box-shadow: 0 0 28px rgba(255, 216, 77, 0.18);
}
.support-project-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #b8c88a;
  letter-spacing: 0.04em;
}
.support-project-btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #1a1f14;
  background: linear-gradient(180deg, #f5f0a8 0%, #e8c235 45%, #c9a820 100%);
  border: 2px solid #ffd84d;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: filter 0.15s, transform 0.12s;
}
.support-project-btn-hero {
  padding: 16px 40px;
  font-size: 17px;
  letter-spacing: 0.14em;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 216, 77, 0.25);
}
.support-project-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  color: #1a1f14;
}
.support-project-btn:active {
  transform: scale(0.98);
}

.start-reset-progress-btn {
  margin-top: 14px;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #9eb87a;
  background: transparent;
  border: 1px solid rgba(120, 140, 90, 0.45);
  border-radius: 4px;
}
.start-reset-progress-btn:hover {
  color: #e8edd8;
  border-color: #c9d84d;
}

.start-footer-meta {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(74, 82, 52, 0.65);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 18px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8e9760;
}
.start-footer-meta .start-brand-name {
  color: #ffd84d;
  font-weight: bold;
}
.start-footer-meta .start-version-inline {
  font-family: 'Consolas', 'Courier New', monospace;
  color: #c9d199;
  letter-spacing: 0.12em;
}

.footer-note {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 2px;
  color: #8e9760;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.footer-note b {
  color: #e8edd0;
  font-weight: bold;
}
.footer-note-sub {
  letter-spacing: 1px;
  font-size: 11px;
  max-width: 520px;
  text-align: center;
  line-height: 1.45;
  color: #6a7348;
}

/* ============================================================
   ІГРОВИЙ ЕКРАН
   ============================================================ */
#game-screen { background: #0e120a; }

/* Верхній HUD */
#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--hud-h);
  background: linear-gradient(180deg, rgba(10,14,6,0.96), rgba(20,26,14,0.92));
  border-bottom: 2px solid #4a5234;
  display: flex;
  align-items: center;
  padding: 0 18px;
  z-index: 1000;
  gap: 18px;
  font-size: 13px;
}
.hud-group { display: flex; gap: 22px; align-items: center; }
.hud-right { margin-left: auto; }
.hud-center { flex: 1; display: flex; justify-content: center; }

.hud-item {
  display: flex; flex-direction: column;
  line-height: 1.1;
}
.hud-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8e9760;
  text-transform: uppercase;
}
.hud-value {
  font-size: 20px;
  font-weight: bold;
  color: #e6edc1;
  font-family: 'Consolas', monospace;
}
.hud-value.good { color: #7eb33c; }
.hud-value.bad  { color: #ff5050; }
.hud-unit {
  font-size: 10px;
  color: #8e9760;
  align-self: flex-end;
  margin-left: 4px;
}
.hud-score-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.hud-score-goal {
  font-size: 14px;
  font-weight: 600;
  color: #8e9760;
}

.hud-alert {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 24px;
  background: rgba(40, 70, 20, 0.5);
  border: 1px solid #4a7028;
  color: #c9d199;
  font-weight: bold;
  letter-spacing: 3px;
  font-size: 14px;
  transition: all 0.3s;
}
.hud-alert.alarm {
  background: rgba(120, 20, 20, 0.7);
  border-color: #ff4040;
  color: #ff8888;
  animation: alarmPulse 0.8s infinite alternate;
}
@keyframes alarmPulse {
  from { box-shadow: 0 0 0 0 rgba(255,64,64,0.6); }
  to   { box-shadow: 0 0 22px 4px rgba(255,64,64,0.85); }
}
.alert-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #7eb33c;
}
.hud-alert.alarm .alert-dot {
  background: #ff4040;
  animation: dotBlink 0.5s infinite alternate;
}
@keyframes dotBlink {
  from { opacity: 1; }
  to   { opacity: 0.2; }
}

.hud-item.speed { flex-direction: column; gap: 4px; }
.speed-buttons { display: flex; gap: 2px; }
.speed-btn {
  background: #2a3020;
  color: #c9d199;
  border: 1px solid #4a5234;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
}
.speed-btn.active {
  background: #ffd84d;
  color: #1a1f10;
  border-color: #ffd84d;
}
.speed-btn:hover { background: #4a5234; color: #fff; }
.speed-btn.active:hover { background: #ffd84d; color: #1a1f10; }

.icon-btn {
  background: #2a3020;
  color: #c9d199;
  border: 1px solid #4a5234;
  width: 32px; height: 32px;
  font-size: 16px;
  font-weight: bold;
}
.icon-btn:hover { background: #4a5234; color: #fff; }

/* Модалка допомоги */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-body {
  background: #1a1f14;
  border: 2px solid #c9d199;
  padding: 26px 32px;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  color: #d8dccb;
  font-size: 14px;
  line-height: 1.55;
}
.modal-body h2 {
  color: #ffd84d;
  font-family: 'Impact', sans-serif;
  letter-spacing: 3px;
  margin-bottom: 10px;
  margin-top: 14px;
}
.modal-body h2:first-child { margin-top: 0; }
.help-list {
  list-style: none;
  margin-bottom: 16px;
}
.help-list li {
  padding: 6px 0 6px 18px;
  border-left: 2px solid #4a5234;
  margin-bottom: 6px;
  padding-left: 12px;
}
.help-list b { color: #c9d199; }
.modal-close {
  display: block;
  margin: 18px auto 0;
  padding: 10px 28px;
  background: #4a5d2a;
  color: #fff;
  border: 2px solid #c9d199;
  font-weight: bold;
  letter-spacing: 2px;
}
.modal-close:hover { background: #6b8038; }

/* Підтвердження продажу */
#sell-confirm-modal {
  z-index: 2200;
}
.sell-confirm-body {
  max-width: 420px;
}
.sell-confirm-text {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
}
.sell-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.sell-confirm-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.06em;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid #4a5234;
}
.sell-confirm-btn.cancel {
  background: rgba(30, 35, 24, 0.95);
  color: #d8dccb;
}
.sell-confirm-btn.cancel:hover {
  background: #2a3220;
}
.sell-confirm-btn.ok {
  background: linear-gradient(180deg, #8b4545, #5c2020);
  color: #fff;
  border-color: #c45c5c;
}
.sell-confirm-btn.ok:hover {
  filter: brightness(1.08);
}

/* Карта */
#map {
  position: absolute;
  top: var(--hud-h);
  left: 0;
  right: var(--phone-w);
  bottom: calc(var(--unit-bar-h) + var(--phone-panel-h));
  background: #0e120a;
}

/* Легенда міток (праворуч усередині зони карти, перед телефоном) */
.map-legend {
  position: absolute;
  z-index: 800;
  top: calc(var(--hud-h) + 8px);
  right: calc(var(--phone-w) + 10px);
  max-width: 220px;
  padding: 10px 12px 12px;
  background: rgba(12, 16, 8, 0.92);
  border: 1px solid #4a5234;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  font-size: 11px;
  line-height: 1.35;
  color: #d8dccb;
  pointer-events: none;
}
.map-legend-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8e9760;
  margin-bottom: 8px;
  font-weight: bold;
}
.map-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.map-legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-legend-swatch {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #1a1f10;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.map-legend-swatch.swatch-city {
  background: #e6edc1;
}
.map-legend-swatch.swatch-city-big {
  width: 16px;
  height: 16px;
  background: #ffd84d;
}
.map-legend-swatch.swatch-city-warn {
  background: #ff9a3c;
  border-color: #5c2e0a;
  box-shadow: 0 0 6px rgba(255, 154, 60, 0.7);
}
.map-legend-swatch.swatch-city-alert {
  background: #ff4040;
}
.map-legend-swatch.swatch-city-lost {
  background: #802020;
}
.map-legend-swatch.swatch-launch {
  width: 13px;
  height: 13px;
  border-radius: 0;
  transform: rotate(45deg);
  background: #c83030;
  border: 2px solid #000;
}
.map-legend-swatch.swatch-occupied {
  border-radius: 2px;
  background: rgba(107, 58, 58, 0.85);
  border-color: #4a2525;
}

/* Темнішим фільтром карта */
.leaflet-tile-pane {
  filter: brightness(0.7) saturate(0.7) contrast(1.05) sepia(0.15);
}

/* Панель юнітів (висота — для відступу туторіалу та підказок) */
:root {
  --hud-h: 56px;
  --unit-bar-h: 178px;
  --phone-w: 340px;
  --phone-panel-h: 0px;
}

/* Панель юнітів */
#unit-bar {
  position: absolute;
  bottom: 0; left: 0; right: var(--phone-w);
  min-height: var(--unit-bar-h);
  height: auto;
  background: linear-gradient(180deg, rgba(20,26,14,0.9), rgba(10,14,6,0.97));
  border-top: 2px solid #4a5234;
  display: flex;
  align-items: flex-start;
  padding: 6px 18px 10px;
  z-index: 1000;
  gap: 14px;
  box-sizing: border-box;
}
.unit-bar-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: #8e9760;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding-right: 4px;
}
.unit-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  align-items: stretch;
}
.unit-bar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.unit-btn {
  background: rgba(20, 26, 14, 0.9);
  border: 1.5px solid #4a5234;
  color: #d8dccb;
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  max-width: 118px;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}
.unit-btn:hover:not(:disabled) {
  border-color: #c9d199;
  background: rgba(50, 60, 28, 0.9);
}
.unit-btn.selected {
  border-color: #ffd84d;
  background: rgba(80, 90, 30, 0.9);
  box-shadow: 0 0 18px rgba(255, 216, 77, 0.5);
}
.unit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.unit-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  width: 100%;
  background: transparent;
  box-sizing: border-box;
}
/* Великі емодзі — читабельні на панелі */
.unit-panel-emoji {
  display: block;
  font-size: 2.85rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9));
}
/* Радар / МВГ / … — PNG з прозорим фоном (assets/sprites/units/) */
.unit-panel-img-wrap {
  width: 100%;
  max-width: 96px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(12, 16, 10, 0.35);
  border: 1px solid rgba(201, 209, 153, 0.1);
  box-sizing: border-box;
  padding: 4px;
}
.unit-panel-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}
.unit-name {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
}
.unit-price {
  font-size: 11px;
  color: #ffd84d;
  font-family: 'Consolas', monospace;
}
.unit-stock {
  position: absolute;
  top: -6px; right: -6px;
  background: #b03030;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 9px;
  font-weight: bold;
}
.unit-stock.has { background: #4a7028; }

/* Цілі, які збиватиме комплекс (панель закупівлі + прокачка) */
.unit-capabilities {
  width: 100%;
  margin: 4px 0 2px;
  padding: 4px 2px 2px;
  border-top: 1px solid rgba(74, 82, 52, 0.65);
}
.unit-cap-title {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8e9760;
  margin-bottom: 3px;
  text-align: center;
}
.unit-cap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  justify-content: center;
  align-items: flex-start;
}
.unit-cap-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 34px;
  max-width: 52px;
}
.unit-cap-icon {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}
.unit-cap-label {
  font-size: 7px;
  line-height: 1.1;
  color: #a8b088;
  text-align: center;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-cap-pct {
  font-size: 9px;
  font-family: 'Consolas', monospace;
  color: #ffd84d;
  line-height: 1;
}
.unit-cap-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  line-height: 1;
}
.unit-btn .unit-capabilities {
  margin-top: 2px;
  padding: 3px 2px 2px;
  width: 100%;
  box-sizing: border-box;
}
.unit-btn .unit-cap-title {
  font-size: 7px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.unit-btn .unit-cap-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(24px, 1fr));
  gap: 2px 3px;
  justify-content: start;
  align-items: start;
}
.unit-btn .unit-cap-chip {
  min-width: 0;
}
.unit-btn .unit-cap-icon {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
}
.unit-btn .unit-cap-pct {
  font-size: 7px;
  line-height: 1.05;
}
.unit-btn[data-unit-id="patriot"] {
  max-width: 126px;
}
.unit-btn[data-unit-id="patriot"] .unit-cap-list {
  grid-template-columns: repeat(3, 1fr);
  gap: 1px 2px;
}
.unit-btn[data-unit-id="patriot"] .unit-cap-pct {
  font-size: 6px;
}
.unit-btn[data-unit-id="patriot"] .unit-cap-icon {
  width: 12px;
  height: 12px;
}

.unit-upgrade-targets {
  margin: 0 0 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(90, 122, 66, 0.45);
}
.unit-upgrade-targets.hidden {
  display: none;
}
.unit-upgrade-targets .unit-cap-title {
  font-size: 9px;
  text-align: left;
  margin-bottom: 5px;
}
.unit-upgrade-targets .unit-cap-list {
  justify-content: flex-start;
}
.unit-upgrade-targets .unit-cap-item {
  min-width: 40px;
}
.unit-upgrade-targets .unit-cap-icon {
  width: 24px;
  height: 24px;
}
.unit-upgrade-targets .unit-cap-label {
  font-size: 8px;
}
.unit-upgrade-targets .unit-cap-pct {
  font-size: 10px;
}

.unit-price-top {
  font-size: 11px;
  color: #ffd84d;
  font-family: 'Consolas', monospace;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin: 2px 0 2px;
  text-align: center;
  width: 100%;
}
.unit-weapon-name {
  font-size: 9px;
  line-height: 1.2;
  color: #a8b088;
  text-align: center;
  width: 100%;
  max-width: 108px;
  margin: 0 0 5px;
  letter-spacing: 0.2px;
}

/* Ту-95МС на мапі (рейд Х-101) */
.leaflet-div-icon.tu95-bomber-wrap {
  background: transparent;
  border: none;
}
.tu95-bomber-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.75));
  transform-origin: center center;
  pointer-events: none;
}

.cancel-place {
  background: #803020;
  border: 1px solid #b03030;
  color: #fff;
  padding: 8px 14px;
  font-weight: bold;
  letter-spacing: 1px;
}
.cancel-place:hover { background: #b03030; }
.hidden { display: none !important; }

/* Підказка при розміщенні */
.place-hint {
  position: absolute;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 1.5px solid #ffd84d;
  padding: 10px 22px;
  color: #ffd84d;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  z-index: 1200;
  pointer-events: none;
}
.place-hint b { color: #fff; }
.fighter-hint {
  border-color: #6ec0ff;
  color: #b8e8ff;
  max-width: min(560px, 92vw);
  text-align: center;
  line-height: 1.35;
  font-size: 13px;
}
.fighter-hint .fighter-hint-sub {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #9edcff;
  font-weight: bold;
  letter-spacing: 0.03em;
}
.hint-esc {
  display: block;
  font-size: 11px;
  color: #c9d199;
  font-weight: normal;
  margin-top: 3px;
}

.leaflet-div-icon.patrol-jet-wrap.fighter-on-reload .patrol-jet-inner {
  outline: 2px solid rgba(255, 150, 70, 0.85);
  border-radius: 50%;
  filter: saturate(0.65) brightness(0.92);
}

.patrol-jet-marker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
  transform-origin: center bottom;
  transition: transform 0.14s ease-out;
}
.patrol-jet-marker-col.patrol-jet-parked .patrol-jet-inner {
  filter: saturate(0.82) brightness(0.94);
}
.patrol-jet-inner {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.75));
}
.patrol-jet-ammo-track {
  width: 50px;
  height: 5px;
  margin-top: 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(120, 200, 255, 0.35);
  overflow: hidden;
  box-sizing: border-box;
}
.patrol-jet-ammo-track.patrol-jet-ammo-reloading {
  border-color: rgba(255, 170, 90, 0.55);
}
.patrol-jet-ammo-fill {
  height: 100%;
  width: 100%;
  border-radius: 1px;
  background: linear-gradient(90deg, #2d8c4a, #6ee7a0);
  transition: width 0.1s linear;
}
.patrol-jet-ammo-fill.patrol-jet-ammo-low {
  background: linear-gradient(90deg, #b88620, #ffd84d);
}
.patrol-jet-ammo-fill.patrol-jet-ammo-critical {
  background: linear-gradient(90deg, #9a3030, #ff6060);
}
.patrol-jet-ammo-reloading .patrol-jet-ammo-fill {
  background: linear-gradient(90deg, #3a6a9a, #8ed4ff);
  box-shadow: 0 0 5px rgba(110, 200, 255, 0.45);
}
.patrol-jet-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Корабель «Калібр» (Новоросійськ) */
.leaflet-div-icon.kalibr-ship-wrap {
  background: transparent;
  border: none;
  overflow: visible;
}
.kalibr-ship-img {
  width: 54px;
  height: 54px;
  max-width: 54px;
  max-height: 54px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
  transform-origin: center center;
  pointer-events: none;
  transition: transform 0.35s ease-out;
}

/* ============================================================
   ТЕЛЕФОН
   ============================================================ */
#phone {
  position: absolute;
  top: var(--hud-h);
  right: 0;
  width: var(--phone-w);
  bottom: 0;
  padding: 18px 14px;
  background: #0a0e06;
  border-left: 2px solid #4a5234;
  z-index: 999;
  display: flex;
  align-items: stretch;
}

.phone-frame {
  width: 100%;
  background: linear-gradient(160deg, #2a2a2e, #15171c);
  border-radius: 28px;
  padding: 38px 8px 30px;
  box-shadow:
    inset 0 0 0 2px #444,
    0 6px 24px rgba(0,0,0,0.6);
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone-speaker {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  width: 60px; height: 5px;
  background: #0a0a0a;
  border-radius: 3px;
}
.phone-camera {
  position: absolute;
  top: 13px; left: calc(50% + 50px);
  width: 7px; height: 7px;
  background: #050505;
  border-radius: 50%;
  border: 1px solid #1a1a1a;
}
.phone-home-btn {
  position: absolute;
  bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 4px;
  background: #555;
  border-radius: 2px;
}

.phone-screen {
  flex: 1;
  background: #050a0f;
  border-radius: 6px;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.phone-status-bar {
  display: flex; justify-content: space-between;
  font-size: 10px;
  color: #b8c0d0;
  padding: 2px 4px 6px;
  border-bottom: 1px solid #1a2030;
}

.phone-header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid #1a2030;
}
.phone-app-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #4a5234, #7eb33c);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.phone-app-info { flex: 1; }
.phone-app-name {
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
}
.phone-app-status {
  font-size: 10px;
  color: #7eb33c;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.online-dot {
  width: 6px; height: 6px;
  background: #7eb33c;
  border-radius: 50%;
  box-shadow: 0 0 5px #7eb33c;
}

.phone-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.phone-messages::-webkit-scrollbar { width: 4px; }
.phone-messages::-webkit-scrollbar-thumb { background: #2a3040; border-radius: 2px; }

.msg {
  background: #1a2030;
  border-radius: 12px;
  border-top-left-radius: 4px;
  padding: 8px 10px 9px;
  font-size: 12px;
  line-height: 1.4;
  color: #d8e0e8;
  animation: msgIn 0.35s ease-out;
  position: relative;
  max-width: 95%;
  align-self: flex-start;
  border-left: 3px solid #4a5234;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateX(-12px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}
.msg-sender {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
}
.msg-time {
  font-size: 9px;
  color: #8090a0;
  font-weight: normal;
}
.msg-body { color: #e8eef4; }
.msg b { color: #fff; }

.msg.intel    { border-left-color: #4a90c8; }
.msg.intel    .msg-sender { color: #6cb0e0; }
.msg.alarm    { border-left-color: #ff4040; background: #2a1418; }
.msg.alarm    .msg-sender { color: #ff8080; }
.msg.alarm    .msg-body   { color: #ffe0e0; }
.msg.radar    { border-left-color: #c0a040; }
.msg.radar    .msg-sender { color: #ffd060; }
.msg.kill     { border-left-color: #7eb33c; background: #14201a; }
.msg.kill     .msg-sender { color: #a0d860; }
.msg.hit      { border-left-color: #c83030; background: #2a1212; }
.msg.hit      .msg-sender { color: #ff7070; }
.msg.allclear { border-left-color: #20b070; }
.msg.allclear .msg-sender { color: #5ce0a0; }
.msg.system   { border-left-color: #888; background: #181c24; }
.msg.system   .msg-sender { color: #b8c0d0; }
.msg.story    { border-left-color: #b070ff; background: #1a142a; }
.msg.story    .msg-sender { color: #d8a0ff; }

/* ============================================================
   ТОСТИ
   ============================================================ */
#toasts {
  position: absolute;
  top: 70px; left: 18px;
  z-index: 1500;
  display: flex; flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.88);
  border-left: 3px solid #ffd84d;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  animation: toastIn 0.3s, toastOut 0.4s 2.6s forwards;
  max-width: 360px;
}
.toast.good { border-left-color: #7eb33c; }
.toast.bad  { border-left-color: #ff4040; }
.toast.warn { border-left-color: #ffd84d; }
@keyframes toastIn {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(-100%); opacity: 0; }
}

/* ============================================================
   КАРТА: маркери / маршрути
   ============================================================ */
.leaflet-container { background: #0e120a !important; }
.leaflet-tile-pane .leaflet-tile {
  background: #1a2214;
}
.leaflet-control-attribution {
  background: rgba(10,14,6,0.7) !important;
  color: #8e9760 !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: #c9d199 !important; }

/* Прибрати дефолтні стилі Leaflet для divIcon */
.leaflet-div-icon {
  background: transparent !important;
  border: 0 !important;
}
.marker-city-wrap, .marker-launch-wrap, .marker-unit-wrap,
.marker-threat-wrap, .boom-wrap, .kill-float-marker-wrap {
  background: transparent !important;
  border: 0 !important;
}

.marker-city {
  display: flex; flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.marker-city .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e6edc1;
  border: 2px solid #1a1f10;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.marker-city.big .dot { width: 18px; height: 18px; background: #ffd84d; }
.marker-city .label {
  font-size: 11px;
  color: #fff;
  text-shadow: 1px 1px 2px #000, 0 0 4px #000;
  margin-top: 2px;
  font-weight: bold;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.marker-city.big .label { font-size: 13px; color: #ffd84d; }

.marker-city.sector-warn .dot {
  background: #ff9a3c;
  border-color: #5c2e0a;
  box-shadow: 0 0 10px rgba(255, 154, 60, 0.75);
}
.marker-city.big.sector-warn .label { color: #ffb86c; }

.marker-city.under-attack .dot {
  background: #ff4040;
  animation: blink 0.4s infinite alternate;
}
.marker-city.damaged .dot { background: #802020; }

@keyframes fighterRearmHubPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(110, 200, 255, 0.55);
    filter: brightness(1.05);
  }
  50% {
    box-shadow: 0 0 14px 5px rgba(120, 230, 255, 0.75);
    filter: brightness(1.25);
  }
}
.marker-city.fighter-rearm-pulse {
  animation: fighterRearmHubPulse 1.1s ease-in-out infinite;
}
@keyframes blink { from { opacity: 1; } to { opacity: 0.3; } }

.city-hp-bar {
  width: 38px; height: 4px;
  background: #2a1212;
  border: 1px solid #000;
  margin-top: 2px;
  overflow: hidden;
}
.city-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #7eb33c, #c0d850);
  transition: width 0.3s;
}
.city-hp-fill.low { background: #c83030; }

.leaflet-div-icon.marker-launch-wrap {
  overflow: visible !important;
}
.marker-launch-stack {
  position: relative;
  width: 22px;
  height: 22px;
}
.marker-launch {
  position: relative;
  z-index: 2;
  width: 22px; height: 22px;
  background: #d4c020;
  border: 2px solid #000;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(180, 150, 20, 0.55);
}
.marker-launch-x { transform: rotate(-45deg); display: block; }
.marker-launch.active {
  background: #e02020;
  animation: launchPulse 0.8s infinite;
}
.marker-launch.launch-recent {
  background: #c83030;
  box-shadow: 0 0 10px rgba(200, 40, 40, 0.75);
}
.marker-launch-ray {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 3px;
  height: 30px;
  margin-left: -1.5px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 210, 80, 0.25));
  transform-origin: 50% 100%;
  transform: rotate(0deg);
  opacity: 0;
  pointer-events: none;
  border-radius: 1px;
  z-index: 1;
  transition: opacity 0.15s ease-out;
}
.marker-launch-stack.launch-show-ray .marker-launch-ray {
  opacity: 1;
}

/* Підказка при наведенні на точку пуску БпЛА */
.leaflet-tooltip.launch-site-tooltip {
  background: rgba(18, 22, 14, 0.96);
  color: #e6edc1;
  border: 1px solid #5a6238;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  padding: 0;
  font-weight: normal;
  min-width: 200px;
  max-width: min(320px, 90vw);
}
.launch-tip-inner {
  padding: 12px 18px 14px;
  text-align: center;
}
.launch-tip-line1 {
  font-size: 12px;
  line-height: 1.45;
  color: #b8c49a;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.launch-tip-line2 {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 600;
  color: #f2f6dc;
}
.leaflet-tooltip.launch-site-tooltip.leaflet-tooltip-top::before {
  border-top-color: rgba(18, 22, 14, 0.96);
}
.leaflet-tooltip.launch-site-tooltip.leaflet-tooltip-bottom::before {
  border-bottom-color: rgba(18, 22, 14, 0.96);
}
.leaflet-tooltip.launch-site-tooltip.leaflet-tooltip-left::before {
  border-left-color: rgba(18, 22, 14, 0.96);
}
.leaflet-tooltip.launch-site-tooltip.leaflet-tooltip-right::before {
  border-right-color: rgba(18, 22, 14, 0.96);
}
@keyframes launchPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,40,40,0.6); }
  50%      { box-shadow: 0 0 22px rgba(255,80,40,1); }
}

.leaflet-marker-icon.marker-unit-wrap {
  overflow: visible !important;
}

.marker-unit-stack {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  height: 48px;
  box-sizing: border-box;
}
.marker-unit-housing {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  position: relative;
}
/* Розгорнутий юніт на мапі: та сама PNG, що в панелі — без рамок і обрізання, на весь слот */
.marker-unit-stack .marker-unit {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: block;
  box-sizing: border-box;
}
.marker-unit-stack .marker-unit > .unit-marker-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.marker-unit-stack .marker-unit > .unit-marker-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.85rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px #000);
}
.unit-sell-flyout {
  display: none;
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  border: 1px solid #c9d199;
  background: rgba(25, 32, 18, 0.96);
  color: #ffd84d;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  z-index: 5;
}
.unit-sell-flyout:hover {
  background: rgba(50, 55, 28, 0.98);
  color: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .marker-unit-stack:hover .unit-sell-flyout {
    display: block;
  }
}
.marker-unit-stack.sell-open .unit-sell-flyout {
  display: block;
}
.marker-unit-stack .marker-unit.dead > .unit-marker-img,
.marker-unit-stack .marker-unit.dead > .unit-marker-emoji {
  filter: grayscale(1);
  opacity: 0.38;
}
.marker-unit-stack .marker-unit.firing > .unit-marker-img {
  animation: unitMarkerFiring 0.18s 2;
}
.marker-unit-stack .marker-unit.firing > .unit-marker-emoji {
  animation: unitMarkerFiringEmoji 0.18s 2;
}
@keyframes unitMarkerFiring {
  0%, 100% { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
  50%      { filter: drop-shadow(0 0 12px rgba(255, 220, 80, 0.95)) brightness(1.2); }
}
@keyframes unitMarkerFiringEmoji {
  0%, 100% { filter: drop-shadow(0 1px 2px #000); }
  50%      { filter: drop-shadow(0 0 10px rgba(255, 220, 80, 1)); transform: scale(1.08); }
}
.unit-ammo {
  position: absolute;
  bottom: -8px; left: 50%; transform: translateX(-50%);
  font-size: 9px;
  background: #000;
  color: #ffd84d;
  padding: 0 4px;
  border-radius: 4px;
  white-space: nowrap;
}
.unit-ammo.unit-ammo-resupply {
  background: #3a2810;
  color: #ffb84d;
  border: 1px solid rgba(255, 160, 60, 0.55);
}
.marker-unit.ppo-resupplying {
  opacity: 0.72;
  filter: grayscale(0.25) brightness(0.92);
}

.marker-threat {
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255,60,40,0.85));
  transition: opacity 0.35s ease, filter 0.2s ease;
}
.threat-sprite {
  display: block;
  width: 100%; height: 100%;
  transform-origin: 50% 50%;
  /* плавна зміна напрямку */
  transition: transform 0.18s linear;
  pointer-events: none;
  user-select: none;
}
.marker-threat.shahed     { filter: drop-shadow(0 0 5px rgba(255,128,40,0.9)); }
.marker-threat.cruise     { filter: drop-shadow(0 0 5px rgba(255,60,40,0.95)); }
.marker-threat.ballistic  { filter: drop-shadow(0 0 6px rgba(255,40,255,0.95)); }
.marker-threat.hyper      { filter: drop-shadow(0 0 7px rgba(255,0,170,1)); }
.marker-threat.recon      { filter: drop-shadow(0 0 4px rgba(128,200,255,0.95)); }

/* Підпис телеметрії біля цілі (видно разом із маркером у зоні радару) */
.threat-marker-root.threat-reb-jammed .marker-threat {
  filter: drop-shadow(0 0 8px rgba(176, 112, 255, 0.95)) hue-rotate(18deg);
  animation: rebJamWobble 0.85s ease-in-out infinite;
}
@keyframes rebJamWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(8deg) scale(1.04); }
  75% { transform: rotate(-8deg) scale(0.98); }
}
.reb-cap-chip {
  border-color: rgba(176, 112, 255, 0.55) !important;
  color: #e8d4ff !important;
}

.threat-marker-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  user-select: none;
}
.threat-telemetry {
  text-align: center;
  font-size: 9px;
  line-height: 1.3;
  color: #ff5a52;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, 0.95);
  margin-bottom: 2px;
  max-width: 140px;
}
.threat-telemetry .tel-title-line {
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1px;
}
.threat-telemetry .tel-cs {
  color: #ffb8a8;
  font-weight: 600;
}
.threat-telemetry .tel-row {
  color: #ffccc8;
  font-size: 8.5px;
}
.threat-marker-root .marker-threat {
  flex-shrink: 0;
}

/* Шкала захоплення МіГа (лише Shahed) */
.fighter-lock-track {
  height: 4px;
  margin-top: 3px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(120, 200, 255, 0.35);
  overflow: hidden;
  box-sizing: border-box;
}
.fighter-lock-fill {
  height: 100%;
  width: 0%;
  border-radius: 1px;
  background: linear-gradient(90deg, #3a8ec9, #7ef0ff);
  transition: width 0.08s linear;
}
.fighter-lock-fill.fighter-lock-ready {
  background: linear-gradient(90deg, #ffd84d, #fff4a8);
  box-shadow: 0 0 6px rgba(255, 220, 80, 0.85);
}
.fighter-lock-fill.fighter-lock-reloading {
  background: rgba(140, 140, 150, 0.55);
  box-shadow: none;
}

.explosion {
  width: 52px; height: 52px;
  background:
    radial-gradient(circle, #fff5b0 0%, #ffe080 20%, #ff6020 50%, rgba(80,20,10,0.4) 75%, transparent 80%);
  border-radius: 50%;
  animation: boom 1.1s forwards;
  pointer-events: none;
  box-shadow:
    0 0 24px 6px rgba(255,180,40,0.7),
    0 0 60px 14px rgba(255,80,20,0.4);
}
@keyframes boom {
  0%   { transform: scale(0.2); opacity: 1; }
  35%  { transform: scale(1.4); opacity: 1; }
  70%  { transform: scale(2.2); opacity: 0.85; }
  100% { transform: scale(3); opacity: 0; }
}

.intercept-flash {
  width: 16px; height: 16px;
  background: radial-gradient(circle, #fff 0%, #80d8ff 40%, transparent 70%);
  border-radius: 50%;
  animation: intercept 0.4s forwards;
  pointer-events: none;
}
@keyframes intercept {
  0%   { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Плаваючий напис при збитті (на мапі, над точкою) */
.kill-float-marker-wrap.leaflet-marker-icon {
  overflow: visible !important;
}
.kill-float-inner {
  position: relative;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  margin-top: -6px;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  animation: killFloatPop 2.1s ease-out forwards;
}
.kill-float-title {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow:
    0 0 10px rgba(60, 200, 90, 0.95),
    0 0 18px rgba(40, 160, 70, 0.7),
    0 1px 3px #000;
}
.kill-float-amt {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: #d8f5a8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 1px 2px #000;
}
.kill-float-amt .kill-float-curr {
  font-size: 1.05em;
  color: #fff8c4;
}
@keyframes killFloatPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -72%) scale(0.88);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -118%) scale(1.04);
  }
  52% {
    opacity: 1;
    transform: translate(-50%, -128%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -168%) scale(0.98);
  }
}

/* ============================================================
   ЕКРАН КІНЦЯ
   ============================================================ */
.end-content {
  position: relative; z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}
#end-title {
  font-family: 'Impact', sans-serif;
  font-size: 70px;
  letter-spacing: 5px;
  color: #e6edc1;
  margin-bottom: 12px;
  text-shadow: 3px 3px 0 #000;
}
#end-title.victory { color: #7eb33c; }
#end-title.defeat  { color: #ff4040; }
#end-title.draw { color: #8ec8ff; text-shadow: 0 0 18px rgba(100, 180, 255, 0.45); }
#end-subtitle {
  font-size: 18px;
  color: #c9d199;
  margin-bottom: 26px;
  max-width: 700px;
}
.end-stats {
  display: grid;
  grid-template-columns: repeat(3, 200px);
  gap: 14px;
  margin-bottom: 32px;
}
.end-stat {
  background: rgba(10,14,6,0.7);
  border: 1.5px solid #4a5234;
  padding: 14px 18px;
}
.end-stat-label {
  font-size: 11px;
  color: #8e9760;
  letter-spacing: 2px;
}
.end-stat-value {
  font-size: 26px;
  color: #fff;
  font-family: 'Consolas', monospace;
  font-weight: bold;
}

.progress-actions {
  margin: 22px 0 8px;
  text-align: center;
  max-width: 520px;
}
.progress-actions.hidden { display: none; }
.progress-hint {
  color: #c9d199;
  font-size: 15px;
  margin-bottom: 14px;
  line-height: 1.45;
}
.progress-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.progress-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid #4a5234;
}
.progress-btn.primary {
  background: linear-gradient(180deg, #ffd84d, #c9a030);
  color: #1a1f10;
  border-color: #ffd84d;
}
.progress-btn.secondary {
  background: rgba(20, 24, 16, 0.9);
  color: #e6edc1;
}
.progress-btn:hover {
  filter: brightness(1.08);
}

/* --- Навчання (головне меню) --- */
.tutorial-entry-wrap {
  margin: 18px 0 22px;
  text-align: center;
}
.tutorial-start-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.12em;
  padding: 14px 28px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid #6a9c3a;
  background: linear-gradient(180deg, #8bc34a 0%, #5a8f2a 100%);
  color: #0f1408;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.tutorial-start-btn:hover {
  filter: brightness(1.06);
}
.tutorial-entry-hint {
  margin: 10px auto 0;
  max-width: 520px;
  font-size: 13px;
  color: #c8d4a8;
  line-height: 1.45;
}
.test-mode-start-btn {
  border-color: #c9a84a;
  background: linear-gradient(180deg, #e8c86a 0%, #a88428 100%);
}

/* --- Пісочниця (sandbox.guardgame.net) --- */
body.sandbox-site .start-screen-campaign-only {
  display: none !important;
}
body.sandbox-site .support-project-hero {
  display: none !important;
}
body.sandbox-site .intro-text {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
body.sandbox-site .start-version-badge::after {
  content: ' · пісочниця';
  color: #e8c86a;
  font-weight: normal;
}
.sandbox-start-block {
  margin: 18px auto 22px;
  max-width: 520px;
  padding: 18px 20px 16px;
  border-radius: 12px;
  border: 2px solid rgba(201, 168, 74, 0.75);
  background: linear-gradient(165deg, rgba(32, 38, 22, 0.95), rgba(14, 18, 10, 0.98));
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}
.sandbox-start-block.hidden {
  display: none !important;
}
.sandbox-badge {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #e8c86a;
  font-weight: bold;
}
.sandbox-title {
  margin: 0 0 10px;
  font-size: 20px;
  color: #f0f4d8;
  letter-spacing: 0.06em;
}
.sandbox-desc {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #c8d4a8;
}
.sandbox-start-btn {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
  border-color: #e8c86a;
}
.sandbox-main-link-wrap {
  margin: 14px 0 0;
  text-align: center;
}
.sandbox-main-link {
  color: #9edcff;
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid rgba(158, 220, 255, 0.35);
}
.sandbox-main-link:hover {
  color: #d0eeff;
}

/* --- Тестовий пуск (панель на мапі) --- */
.test-launch-panel {
  position: fixed;
  left: 12px;
  top: calc(var(--hud-h) + 10px);
  z-index: 10950;
  width: min(260px, calc(100vw - 24px));
  overflow: visible;
  padding: 10px 12px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 74, 0.65);
  background: rgba(12, 16, 8, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  touch-action: manipulation;
}
.test-launch-panel.hidden {
  display: none;
}
.test-launch-panel.test-launch-collapsed {
  display: none !important;
}
.test-launch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.test-launch-panel.test-launch-collapsed .test-launch-head {
  margin-bottom: 0;
}
.test-launch-title-btn {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 4px 0;
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.14em;
  color: #e8c86a;
  cursor: pointer;
  touch-action: manipulation;
}
.test-launch-collapse-btn {
  flex-shrink: 0;
  border: 1px solid rgba(201, 168, 74, 0.45);
  border-radius: 6px;
  background: rgba(30, 38, 20, 0.9);
  color: #e8c86a;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 8px;
  min-width: 28px;
  min-height: 28px;
  touch-action: manipulation;
}
.test-launch-collapse-btn:hover {
  border-color: #e8c86a;
  color: #fff8c4;
}
.test-launch-body {
  max-height: min(68vh, 500px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.test-launch-fab {
  position: fixed;
  left: 10px;
  top: calc(var(--hud-h) + 8px);
  z-index: 10951;
  touch-action: manipulation;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid rgba(232, 200, 74, 0.9);
  background: linear-gradient(165deg, rgba(32, 38, 22, 0.98), rgba(14, 18, 10, 0.99));
  color: #e8c86a;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: auto;
}
.test-launch-fab:not(.hidden) {
  display: inline-flex !important;
}
.test-launch-fab-icon {
  font-size: 16px;
  line-height: 1;
}
.test-launch-fab-label {
  text-transform: uppercase;
}
.test-launch-label {
  display: block;
  font-size: 10px;
  color: #9aaa7e;
  margin-bottom: 4px;
}
.test-threat-select,
.test-launch-input {
  width: 100%;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #4a5234;
  background: #141a0e;
  color: #d8dccb;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.test-control-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 168, 74, 0.35);
}
.test-control-section.hidden {
  display: none;
}
.test-control-title {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: #e8c86a;
  margin-bottom: 8px;
}
.test-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.test-control-label {
  font-size: 10px;
  color: #9aaa7e;
}
.test-control-value {
  font-size: 12px;
  font-family: 'Consolas', monospace;
  color: #ffd84d;
}
.test-bearing-btns,
.test-speed-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.test-speed-btns {
  grid-template-columns: repeat(4, 1fr);
}
.test-speed-btn.active {
  border-color: #c9a84a;
  color: #ffd84d;
}
#test-bearing-map,
#test-squad-destroy,
#test-tu95-demo {
  width: 100%;
  margin-bottom: 6px;
}
#test-tu95-demo {
  border-color: rgba(142, 212, 255, 0.55);
  color: #b8e4ff;
}
.test-launch-hint {
  font-size: 11px;
  line-height: 1.35;
  color: #c8d4a8;
  margin-bottom: 10px;
}
.test-launch-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.test-launch-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #4a5234;
}
.test-launch-btn.primary {
  border-color: #c9a84a;
  background: linear-gradient(180deg, #c9a84a, #8a6a22);
  color: #0f1408;
}
.test-launch-btn.secondary {
  background: rgba(30, 38, 20, 0.95);
  color: #d8dccb;
}

@media (max-width: 768px) {
  .test-launch-panel {
    left: 6px;
    right: 6px;
    width: auto;
    max-width: min(240px, 72vw);
    top: calc(var(--hud-h) + 4px);
    padding: 6px 8px 8px;
    max-height: min(34vh, 240px);
    font-size: 10px;
  }
  .test-launch-head {
    margin-bottom: 6px;
  }
  .test-launch-title-btn {
    font-size: 9px;
    letter-spacing: 0.1em;
    padding: 3px 0;
  }
  .test-launch-collapse-btn {
    font-size: 11px;
    padding: 2px 6px;
    min-width: 24px;
  }
  .test-launch-body {
    max-height: min(32vh, 220px);
  }
  .test-launch-label {
    font-size: 8px;
    margin-bottom: 2px;
  }
  .test-threat-select,
  .test-launch-input {
    font-size: 10px;
    padding: 4px 6px;
    margin-bottom: 5px;
  }
  .test-block-title {
    font-size: 9px;
  }
  .test-launch-hint {
    font-size: 9px;
    line-height: 1.3;
    margin-bottom: 6px;
  }
  .test-launch-btn {
    font-size: 9px;
    padding: 5px 6px;
    letter-spacing: 0.04em;
  }
  .test-launch-actions {
    gap: 4px;
  }
  .test-control-title {
    font-size: 9px;
  }
  .test-launch-fab {
    left: 6px;
    top: calc(var(--hud-h) + 4px);
    min-width: 48px;
    height: 44px;
    padding: 0 12px;
    z-index: 10960;
  }
  .test-launch-collapse-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: 14px;
  }
}

/* --- Майстерня --- */
.workshop-panel {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(8, 12, 6, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.workshop-panel.hidden {
  display: none;
}
.workshop-panel-inner {
  width: min(520px, 100%);
  max-height: min(86vh, 640px);
  overflow: auto;
  background: linear-gradient(165deg, #1e2418 0%, #12160e 100%);
  border: 2px solid #4a5c38;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  padding: 18px 20px 20px;
  color: #e6edc1;
}
.workshop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.workshop-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.06em;
}
.workshop-close {
  font-size: 18px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid #5a6348;
  background: rgba(0, 0, 0, 0.25);
  color: #e6edc1;
}
.workshop-lead {
  font-size: 13px;
  color: #b8c49a;
  line-height: 1.45;
  margin: 0 0 14px;
}
.workshop-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.workshop-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid #3a4530;
}
.workshop-row-title {
  font-weight: bold;
  font-size: 14px;
}
.workshop-row-meta {
  font-size: 12px;
  color: #a8b892;
  margin-top: 4px;
  line-height: 1.35;
}
.workshop-fighter-stats {
  line-height: 1.5;
  color: #c8d4a8;
}
.workshop-fighter-stats .unit-upgrade-arrow {
  color: #ffd84d;
  font-weight: bold;
  padding: 0 0.2em;
}
.workshop-fighter-lv {
  margin-bottom: 6px;
  color: #e6edc1;
}
.workshop-meta-note {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #9aaa7e;
  line-height: 1.35;
}
.workshop-buy {
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #ffd84d;
  background: linear-gradient(180deg, #ffd84d, #b8922a);
  color: #1a1a0a;
  white-space: nowrap;
  align-self: center;
}
.workshop-buy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Плаваюча панель прокачки позиції на мапі */
.unit-upgrade-float {
  position: fixed;
  z-index: 11300;
  width: 268px;
  max-width: calc(100vw - 16px);
  pointer-events: none;
}
.unit-upgrade-float.hidden {
  display: none;
}
.unit-upgrade-float-inner {
  pointer-events: auto;
  background: linear-gradient(165deg, #1e2418 0%, #12160e 100%);
  border: 2px solid #5a7a42;
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  padding: 10px 12px 12px;
  color: #e6edc1;
}
.unit-upgrade-title {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #ffd84d;
}
.unit-upgrade-stats {
  font-size: 12px;
  line-height: 1.5;
  color: #c8d4a8;
  margin-bottom: 10px;
}
.unit-upgrade-stats .unit-upgrade-arrow {
  color: #ffd84d;
  font-weight: bold;
  padding: 0 0.2em;
}
.unit-upgrade-maxnote {
  margin-top: 8px;
  font-size: 11px;
  color: #9aaa7e;
}
.unit-upgrade-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: stretch;
}
.unit-upgrade-sell {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #a89860;
  background: rgba(40, 36, 22, 0.95);
  color: #ffd84d;
}
.unit-upgrade-sell:hover {
  background: rgba(55, 50, 30, 0.98);
}
.unit-upgrade-buy {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #ffd84d;
  background: linear-gradient(180deg, #ffd84d, #b8922a);
  color: #1a1a0a;
}
.unit-upgrade-buy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.unit-upgrade-chip {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 6;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid #7a9a5a;
  background: rgba(20, 26, 14, 0.95);
  color: #ffd84d;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.unit-upgrade-chip:active {
  transform: scale(0.96);
}
@media (hover: hover) and (pointer: fine) {
  .unit-upgrade-chip {
    display: none;
  }
}

/* --- Логістика --- */
.logistics-hud {
  position: fixed;
  left: 12px;
  top: 72px;
  z-index: 10800;
  width: 220px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #5a7a42;
  background: linear-gradient(165deg, rgba(30, 36, 24, 0.94) 0%, rgba(18, 22, 14, 0.96) 100%);
  color: #d8e4b8;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.logistics-hud.hidden {
  display: none;
}
.logistics-hud-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd84d;
  margin-bottom: 8px;
}
.logistics-hud-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
}
.logistics-hud-grid dt {
  color: #9aaa7e;
  font-weight: 600;
}
.logistics-hud-grid dd {
  margin: 0;
  color: #e8f0c8;
}
.logistics-hud-hint {
  margin: 8px 0 0;
  font-size: 10px;
  color: #8a9a72;
  line-height: 1.4;
}
.factory-upgrade-float {
  transform: none;
}
.cargo-hint {
  border-color: #c9a83a;
  background: rgba(28, 24, 10, 0.92);
}
.logistics-marker-wrap {
  background: transparent !important;
  border: none !important;
}
.leaflet-tooltip.logistics-hub-tooltip {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  font-weight: normal;
  min-width: 168px;
  max-width: min(240px, 88vw);
}
.leaflet-tooltip.logistics-hub-tooltip::before {
  display: none;
}
.logistics-tip-inner {
  padding: 10px 14px 12px;
  border-radius: 10px;
  border: 1px solid #5a7a42;
  background: linear-gradient(165deg, rgba(32, 38, 26, 0.98) 0%, rgba(16, 20, 12, 0.99) 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  text-align: left;
}
.logistics-tip-head {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffd84d;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.logistics-tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.logistics-tip-label {
  font-size: 11px;
  color: #9aaa7e;
}
.logistics-tip-value {
  font-size: 12px;
  color: #e8f0c8;
}
.logistics-tip-value b {
  color: #fff;
  font-size: 14px;
}
.logistics-tip-sep {
  opacity: 0.45;
  padding: 0 2px;
}
.logistics-tip-bar {
  height: 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.logistics-tip-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.25s ease;
}
.logistics-tip-bar.is-ok .logistics-tip-bar-fill {
  background: linear-gradient(90deg, #5a8a42, #b0e070);
}
.logistics-tip-bar.is-mid .logistics-tip-bar-fill {
  background: linear-gradient(90deg, #a87830, #e8c84a);
}
.logistics-tip-bar.is-low .logistics-tip-bar-fill {
  background: linear-gradient(90deg, #8a4040, #e87878);
}
.logistics-tip-factory .logistics-tip-head { color: #e8c84a; }
.logistics-tip-factory .logistics-tip-bar.is-ok .logistics-tip-bar-fill {
  background: linear-gradient(90deg, #a87830, #e8c84a);
}
.logistics-tip-depot .logistics-tip-head { color: #9ed4ff; }
.logistics-tip-depot .logistics-tip-bar.is-ok .logistics-tip-bar-fill {
  background: linear-gradient(90deg, #4a7a9a, #9ed4ff);
}
.logistics-tip-aerodrome .logistics-tip-head { color: #8ee8a0; }
.logistics-marker-root.logistics-destroyed {
  filter: grayscale(0.85) brightness(0.72);
}
.logistics-marker-root.logistics-destroyed .logistics-icon-ruined {
  opacity: 0.55;
}
.logistics-restore-btn {
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0a1018;
  background: linear-gradient(180deg, #9ed4ff, #5a9ac8);
  border: 1px solid #c8e8ff;
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  max-width: 100%;
}
.logistics-restore-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #4a5568;
  color: #9eb0c8;
  border-color: #5a6a7a;
}
.logistics-marker-root {
  text-align: center;
  width: 104px;
  pointer-events: auto;
  background: transparent;
  border: none;
  box-shadow: none;
}
.logistics-marker-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e8f0c8;
  text-shadow: 0 1px 2px #000;
  margin-bottom: 3px;
}
.logistics-marker-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}
.logistics-marker-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.65));
}
.logistics-stock-bar {
  height: 5px;
  margin: 0 auto 3px;
  width: 78px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
}
.logistics-stock-fill {
  height: 100%;
  background: linear-gradient(90deg, #6a9a4a, #b8e878);
  width: 50%;
  transition: width 0.25s ease;
}
.logistics-stock-text {
  font-size: 10px;
  color: #c8d8a8;
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
}
.logistics-stock-num {
  color: #fff;
  font-weight: 700;
}
.logistics-stock-sep {
  opacity: 0.4;
  margin: 0 1px;
}
.logistics-marker-root.logistics-rearm-pulse .logistics-marker-img {
  filter: drop-shadow(0 0 10px rgba(126, 212, 146, 0.85));
  animation: fighterRearmHubPulse 1.1s ease-in-out infinite;
}
.logistics-factory .logistics-stock-bar.is-ok .logistics-stock-fill,
.logistics-factory .logistics-stock-fill {
  background: linear-gradient(90deg, #a87830, #e8c84a);
}
.logistics-depot .logistics-stock-bar.is-ok .logistics-stock-fill,
.logistics-depot .logistics-stock-fill {
  background: linear-gradient(90deg, #4a7a9a, #9ed4ff);
}
.logistics-aerodrome .logistics-marker-badge { color: #b8f0c8; }
.logistics-factory .logistics-marker-badge { color: #f0d890; }
.logistics-depot .logistics-marker-badge { color: #b8dcf8; }
.cargo-plane-marker-wrap {
  background: transparent !important;
  border: none !important;
}
.cargo-plane-marker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
  transform-origin: center bottom;
  transition: transform 0.14s ease-out;
}
.cargo-plane-marker-col.cargo-plane-parked .cargo-plane-inner {
  filter: saturate(0.85) brightness(0.95);
}
.cargo-plane-inner {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.75));
}
.cargo-plane-load-track {
  width: 50px;
  height: 5px;
  margin-top: 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(232, 200, 74, 0.45);
  overflow: hidden;
  box-sizing: border-box;
}
.cargo-plane-load-fill {
  height: 100%;
  width: 0%;
  border-radius: 1px;
  background: linear-gradient(90deg, #8a7020, #e8c84a);
  transition: width 0.12s linear;
}
.cargo-plane-load-fill.cargo-plane-load-mid {
  background: linear-gradient(90deg, #a87830, #f0d060);
}
.cargo-plane-load-fill.cargo-plane-load-full {
  background: linear-gradient(90deg, #c9a020, #ffe878);
  box-shadow: 0 0 5px rgba(255, 220, 80, 0.45);
}
.cargo-plane-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: transform 0.12s linear;
}

/* --- Туторіал поверх мапи --- */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 11500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(var(--unit-bar-h) + 22px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.tutorial-overlay.hidden {
  display: none;
}
.tutorial-card {
  pointer-events: auto;
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(22, 28, 18, 0.97), rgba(12, 14, 10, 0.98));
  border: 2px solid #6a8f4a;
  border-radius: 12px;
  padding: 16px 18px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  color: #eef3dc;
  touch-action: none;
}
.tutorial-card-floating {
  position: fixed;
  margin: 0;
  z-index: 11600;
  max-width: min(560px, calc(100vw - 16px));
}
.tutorial-card-dragging {
  cursor: grabbing;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  border-color: #9ed45a;
}
.tutorial-card-head.tutorial-drag-handle {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  padding-bottom: 4px;
  margin: -4px -6px 6px;
  padding-left: 28px;
  position: relative;
}
.tutorial-card-head.tutorial-drag-handle::before {
  content: '⋮⋮';
  position: absolute;
  left: 6px;
  top: 2px;
  font-size: 14px;
  line-height: 1;
  color: #9aaa7e;
  letter-spacing: -2px;
}
.tutorial-card:not(.tutorial-card-dragging) .tutorial-drag-handle:active {
  cursor: grabbing;
}
.tutorial-title {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: 0.04em;
}
.tutorial-body {
  font-size: 14px;
  line-height: 1.5;
  color: #d5e0c4;
  touch-action: pan-y;
}
.tutorial-body b {
  color: #fff8c4;
}
.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}
.tutorial-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid #5a6348;
}
.tutorial-btn.primary {
  background: linear-gradient(180deg, #8bc34a, #5a8f2a);
  color: #0b0f06;
  border-color: #7cb342;
}
.tutorial-btn.secondary {
  background: rgba(0, 0, 0, 0.35);
  color: #e6edc1;
}
.tutorial-btn:hover {
  filter: brightness(1.05);
}
body.game-paused #pause-btn {
  outline: 2px solid #ffd84d;
  outline-offset: 2px;
}

/* Планшет: вужчий телефон (не на телефонах — інакше перекриває --phone-w: 0) */
@media (min-width: 1025px) and (max-width: 1100px) {
  :root { --phone-w: 290px; }
  .map-legend { right: calc(var(--phone-w) + 10px); max-width: 190px; }
}

/* Мобільний інтерфейс */
.diff-swipe-hint {
  display: none;
}

.start-scroll-hint {
  display: none;
  margin: 0 0 14px;
  font-size: 11px;
  color: #8e9760;
  letter-spacing: 0.08em;
}

.mobile-dock {
  display: none;
}

@media (max-width: 1024px) {
  :root {
    --hud-h: 86px;
    --unit-bar-h: 124px;
    --phone-w: 0px;
    --phone-panel-h: 0px;
  }

  body.phone-panel-open {
    --phone-panel-h: 0px;
  }

  /* HUD / phone — див. game-ui-redesign.css */

  .start-content {
    justify-content: flex-start;
    padding: 16px 12px 48px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }

  .start-version-badge {
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    font-size: 9px;
    padding: 4px 8px;
  }

  .emblem {
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
  }
  .emblem-trident { font-size: 32px; }

  .title {
    font-size: 28px;
    letter-spacing: 3px;
  }
  .title span {
    font-size: 14px;
    letter-spacing: 6px;
  }

  .subtitle {
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 10px;
  }

  .start-brand {
    font-size: 10px;
    letter-spacing: 0.2em;
    margin-bottom: 12px;
  }

  .intro-text {
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 14px;
    padding: 10px 12px;
  }

  .tutorial-entry-wrap { margin-bottom: 12px; }
  .tutorial-start-btn {
    font-size: 12px;
    padding: 10px 16px;
  }
  .tutorial-entry-hint {
    font-size: 10px;
    line-height: 1.35;
    margin-top: 6px;
  }

  .section-label {
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 8px;
  }

  .diff-swipe-hint {
    display: none;
  }

  .difficulty-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: min(100%, 360px);
    padding: 0;
    margin: 0 auto;
  }

  .diff-card-inner {
    padding: 0 12px 12px;
  }

  .diff-shield-badge {
    width: 58px;
    height: 66px;
    margin-top: 8px;
  }

  .diff-shield-mark {
    font-size: 22px;
  }

  .diff-name { font-size: 17px; }
  .diff-callsign { font-size: 10px; }
  .diff-info { font-size: 11px; line-height: 1.5; }
  .diff-outcome { font-size: 10px; }

  .start-btn {
    font-size: 18px;
    padding: 14px 28px;
    letter-spacing: 2px;
    width: min(100%, 340px);
  }

  .footer-note {
    margin-top: 16px;
    font-size: 10px;
  }
  .footer-note-sub { font-size: 9px; }

  #game-screen .mobile-dock {
    display: flex;
    position: absolute;
    z-index: 1050;
    left: 8px;
    bottom: calc(var(--unit-bar-h) + 8px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
  }

  .mob-fab {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #c9d199;
    background: rgba(20, 26, 14, 0.94);
    color: #ffd84d;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
  }
  .mob-fab.active {
    background: #4a5d2a;
    border-color: #ffd84d;
    box-shadow: 0 0 14px rgba(255, 216, 77, 0.45);
  }

  .mob-fab-workshop {
    font-size: 20px;
  }

  #phone {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(var(--unit-bar-h) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    height: min(46vh, 360px);
    padding: 0;
    border-left: none;
    border-top: 2px solid #ffd84d;
    z-index: 1060;
  }

  body.phone-panel-open {
    --phone-panel-h: 0px;
  }

  body.phone-panel-open #phone {
    display: flex;
  }

  .phone-frame {
    border-radius: 0;
    padding: 4px 6px 6px;
  }

  .map-legend {
    display: none;
    right: auto;
    left: 8px;
    top: auto;
    bottom: calc(var(--unit-bar-h) + 60px + env(safe-area-inset-bottom, 0px));
    max-width: min(280px, calc(100vw - 16px));
    font-size: 10px;
    z-index: 1035;
  }

  body.legend-panel-open .map-legend {
    display: block;
  }

  body.legend-panel-open.phone-panel-open .map-legend {
    bottom: calc(var(--unit-bar-h) + min(46vh, 360px) + 12px + env(safe-area-inset-bottom, 0px));
  }

  #unit-bar {
    flex-wrap: nowrap;
    align-items: flex-end;
    overflow: visible;
    padding: 2px 6px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .unit-bar-label { display: none; }

  .unit-buttons {
    flex: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    align-items: flex-end;
    min-width: 0;
  }

  .unit-btn {
    flex: 0 0 auto;
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 5px;
    row-gap: 2px;
    align-items: start;
    align-self: flex-end;
    height: auto;
    min-width: 108px;
    max-width: 132px;
    padding: 5px 6px 6px;
    text-align: left;
  }

  .unit-btn[data-unit-id="patriot"] {
    margin-bottom: 6px;
  }

  .unit-price-top {
    grid-column: 1 / -1;
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
  }

  .unit-weapon-name {
    display: none;
  }

  .unit-icon {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    justify-self: center;
    width: 46px;
    min-height: 0;
    margin: 0;
  }

  .unit-panel-img-wrap {
    height: 40px;
    width: 44px;
    max-width: 44px;
    padding: 2px;
  }

  .unit-panel-emoji {
    font-size: 1.55rem;
  }

  .unit-name {
    grid-column: 2;
    grid-row: 2;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 0;
    line-height: 1.1;
    text-align: left;
    align-self: end;
  }

  .unit-btn .unit-capabilities {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    width: 100%;
    margin: 2px 0 0;
    padding: 3px 4px 4px;
    border-top: none;
    background: rgba(6, 10, 4, 0.72);
    border-radius: 5px;
    border: 1px solid rgba(74, 82, 52, 0.8);
    max-height: none;
    overflow: visible;
  }

  .unit-btn .unit-cap-title {
    display: block;
    font-size: 5.5px;
    letter-spacing: 0.05em;
    text-align: left;
    margin-bottom: 2px;
    color: #9aaa7e;
  }

  .unit-btn .unit-cap-list {
    grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
    gap: 2px;
    max-width: 100%;
  }

  .unit-btn[data-unit-id="patriot"] .unit-cap-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px 2px;
  }

  .unit-btn .unit-cap-icon {
    width: 11px;
    height: 11px;
    max-width: 11px;
    max-height: 11px;
  }

  .unit-btn[data-unit-id="patriot"] .unit-cap-icon {
    width: 10px;
    height: 10px;
    max-width: 10px;
    max-height: 10px;
  }

  .unit-btn .unit-cap-pct {
    font-size: 6.5px;
    line-height: 1;
    font-weight: bold;
  }

  .unit-btn[data-unit-id="patriot"] .unit-cap-pct {
    font-size: 6px;
  }

  .unit-stock {
    font-size: 9px;
    top: -4px;
    right: -4px;
  }

  .unit-bar-right {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .cancel-place {
    font-size: 10px;
    padding: 6px 8px;
    white-space: nowrap;
  }

  .unit-upgrade-float.unit-upgrade-float--compact {
    max-width: min(200px, 56vw);
  }
  .unit-upgrade-float--compact .unit-upgrade-float-inner {
    padding: 6px 8px 8px;
  }
  .unit-upgrade-float--compact .unit-upgrade-title {
    font-size: 10px;
    margin-bottom: 4px;
    line-height: 1.25;
  }
  .unit-upgrade-float--compact .unit-upgrade-stats {
    font-size: 9px;
    line-height: 1.32;
    margin-bottom: 6px;
  }
  .unit-upgrade-float--compact .unit-upgrade-targets {
    font-size: 9px;
    margin-bottom: 4px;
  }
  .unit-upgrade-float--compact .unit-upgrade-sell,
  .unit-upgrade-float--compact .unit-upgrade-buy {
    font-size: 9px;
    padding: 5px 6px;
    border-radius: 6px;
  }
  .unit-upgrade-float--compact .unit-upgrade-maxnote {
    font-size: 8px;
    margin-top: 4px;
  }

  #toasts {
    position: fixed !important;
    top: calc(var(--hud-h) + env(safe-area-inset-top, 0px) + 2px) !important;
    bottom: auto !important;
    left: 4px !important;
    right: 4px !important;
    flex-direction: column !important;
    gap: 4px !important;
    max-height: min(22vh, 96px) !important;
    overflow: hidden !important;
    z-index: 11090 !important;
  }

  #toasts .toast {
    max-width: none;
    font-size: 10px;
    padding: 6px 8px;
    line-height: 1.32;
    font-weight: bold;
  }

  #toasts .toast:not(:last-child) {
    display: none !important;
  }

  .phone-messages .msg:not(:last-child) {
    display: none !important;
  }

  #game-screen .place-hint,
  #game-screen .fighter-hint,
  #game-screen .cargo-hint {
    position: fixed;
    top: calc(var(--hud-h) + env(safe-area-inset-top, 0px) + 2px);
    bottom: auto !important;
    left: 4px;
    right: 4px;
    transform: none;
    width: auto;
    max-width: none;
    max-height: min(20vh, 92px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 10px;
    line-height: 1.32;
    padding: 6px 8px;
    text-align: left;
    z-index: 11080;
    pointer-events: none;
  }

  .fighter-hint .fighter-hint-sub {
    font-size: 9px;
    margin-top: 3px;
  }

  .tutorial-overlay {
    padding: calc(var(--hud-h) + env(safe-area-inset-top, 0px) + 4px) 6px calc(var(--unit-bar-h) + 8px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
    justify-content: flex-start;
  }

  .tutorial-card {
    width: 100%;
    max-width: 100%;
    max-height: min(28vh, 200px);
    padding: 8px 10px 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tutorial-title {
    font-size: 12px;
    margin-bottom: 4px;
    flex-shrink: 0;
  }

  .tutorial-body {
    font-size: 10px;
    line-height: 1.32;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tutorial-actions {
    margin-top: 6px;
    gap: 6px;
    flex-shrink: 0;
  }

  .tutorial-btn {
    font-size: 10px;
    padding: 6px 10px;
  }

  .tutorial-card-floating {
    max-width: min(100%, calc(100vw - 12px));
  }

  .logistics-hud {
    display: none !important;
  }

  .leaflet-tooltip.logistics-hub-tooltip {
    transform: scale(0.454545);
    transform-origin: bottom center;
    max-width: min(240px, 42vw);
  }

  body.phone-panel-open .place-hint,
  body.phone-panel-open .fighter-hint,
  body.phone-panel-open .cargo-hint {
    top: calc(var(--hud-h) + env(safe-area-inset-top, 0px) + 2px);
    bottom: auto !important;
  }

  .modal-body {
    max-height: min(80vh, 560px);
    overflow-y: auto;
  }

  .workshop-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  :root { --hud-h: 74px; --unit-bar-h: 120px; }

  .hud-right .hud-item:nth-child(1),
  .hud-right .hud-item:nth-child(3) {
    display: flex !important;
  }

  .hud-right .hud-item:nth-child(2) {
    display: none !important;
  }

  .hud-group:first-of-type .hud-item:nth-child(3) {
    display: flex !important;
  }

  .unit-btn {
    min-width: 100px;
    max-width: 118px;
  }
}
