/* ============================================================
   Страж — сучасний ігровий UI (оливкова палітра основної гри)
   ============================================================ */

:root {
  --olive-0: #1a1f14;
  --olive-1: #242b18;
  --olive-2: #2e3620;
  --olive-3: #4a5234;
  --olive-4: #6a7348;
  --olive-5: #8e9760;
  --olive-text: #e6edc1;
  --olive-muted: #b8be9a;
  --olive-gold: #ffd84d;
  --olive-green: #7eb33c;
  --olive-red: #e85040;
  --panel-glass: rgba(20, 26, 14, 0.88);
  --panel-border: rgba(201, 209, 153, 0.22);
  --panel-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --hud-h: 58px;
  --unit-bar-h: 132px;
  --phone-w: 292px;
  --ui-font: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --ui-mono: 'JetBrains Mono', 'Consolas', monospace;
}

body.steam-edition,
body.game-ui-v2 {
  font-family: var(--ui-font);
}

/* ============================================================
   ВЕРХНІЙ HUD
   ============================================================ */
#hud-top {
  height: var(--hud-h);
  padding: 0 14px;
  gap: 12px;
  background: linear-gradient(180deg, rgba(14, 18, 10, 0.97) 0%, rgba(22, 28, 16, 0.92) 100%);
  border-bottom: 1px solid var(--olive-3);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.hud-group {
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-border);
}

.hud-item {
  min-width: 52px;
  padding: 2px 8px;
  border-right: 1px solid rgba(74, 82, 52, 0.35);
}

.hud-item:last-child {
  border-right: none;
}

.hud-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--olive-5);
  font-weight: 600;
}

.hud-value {
  font-size: 17px;
  font-family: var(--ui-mono);
  color: var(--olive-text);
  font-weight: 600;
}

.hud-unit {
  font-size: 9px;
  color: var(--olive-5);
}

.hud-center {
  flex: 1;
  min-width: 0;
}

.hud-alert {
  padding: 8px 28px;
  border-radius: 999px;
  background: rgba(74, 112, 40, 0.35);
  border: 1px solid rgba(126, 179, 60, 0.45);
  font-size: 13px;
  letter-spacing: 0.2em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hud-alert.alarm {
  border-radius: var(--radius-md);
  letter-spacing: 0.14em;
}

.hud-right {
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
}

.hud-right .hud-item {
  border-right: 1px solid rgba(74, 82, 52, 0.35);
}

.hud-toolbar {
  display: flex;
  gap: 4px;
  margin-left: 6px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--panel-border);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--olive-3);
  background: rgba(42, 48, 32, 0.9);
  color: var(--olive-text);
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(74, 93, 42, 0.95);
  border-color: var(--olive-gold);
  color: #fff;
  transform: translateY(-1px);
}

#pause-btn {
  position: relative;
}

#pause-btn.pause-on-cooldown::after {
  content: attr(data-cooldown);
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  font-size: 7px;
  line-height: 1;
  font-family: var(--ui-mono, monospace);
  color: #ffd84d;
  background: rgba(0, 0, 0, 0.88);
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}

#pause-btn.pause-on-cooldown {
  opacity: 0.75;
}

/* ============================================================
   ПАНЕЛЬ ЮНІТІВ (нижня дока)
   ============================================================ */
#unit-bar {
  min-height: var(--unit-bar-h);
  padding: 8px 12px 10px;
  background: linear-gradient(0deg, rgba(10, 14, 6, 0.98) 0%, rgba(24, 30, 18, 0.94) 100%);
  border-top: 1px solid var(--olive-3);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  align-items: center;
  gap: 10px;
}

.unit-bar-label {
  writing-mode: horizontal-tb;
  transform: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--olive-gold);
  padding: 8px 12px;
  margin: 0;
  border-right: 1px solid var(--olive-3);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 72px;
}

.unit-buttons {
  gap: 8px;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--olive-3) transparent;
}

.unit-buttons::-webkit-scrollbar {
  height: 6px;
}

.unit-buttons::-webkit-scrollbar-thumb {
  background: var(--olive-3);
  border-radius: 3px;
}

.unit-btn {
  min-width: 108px;
  max-width: 124px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--olive-3);
  background: linear-gradient(165deg, rgba(36, 44, 24, 0.95), rgba(18, 22, 12, 0.98));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}

.unit-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: rgba(201, 209, 153, 0.55);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.unit-btn.selected {
  border-color: var(--olive-gold);
  box-shadow: 0 0 0 1px rgba(255, 216, 77, 0.35), 0 8px 24px rgba(255, 216, 77, 0.15);
  background: linear-gradient(165deg, rgba(58, 68, 28, 0.98), rgba(32, 38, 18, 0.99));
}

.unit-panel-img-wrap {
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(201, 209, 153, 0.15);
  height: 48px;
}

.unit-name {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--olive-text);
}

.unit-price,
.unit-price-top {
  color: var(--olive-gold);
  font-family: var(--ui-mono);
}

.unit-stock {
  top: 4px;
  right: 4px;
  border-radius: 6px;
  font-family: var(--ui-mono);
  font-size: 9px;
}

.cancel-place {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  letter-spacing: 0.08em;
}

/* ============================================================
   КОМАНДНИЙ ЦЕНТР (права панель)
   ============================================================ */
#phone {
  width: var(--phone-w);
  padding: 10px 10px 10px 8px;
  background: linear-gradient(180deg, rgba(12, 16, 8, 0.98), rgba(8, 10, 6, 0.99));
  border-left: 1px solid var(--olive-3);
}

.phone-frame {
  border-radius: var(--radius-lg);
  padding: 12px 10px 14px;
  background: linear-gradient(165deg, rgba(34, 40, 26, 0.98), rgba(16, 20, 12, 0.99));
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.phone-speaker,
.phone-camera,
.phone-home-btn {
  display: none;
}

.phone-screen {
  border-radius: var(--radius-md);
  background: rgba(8, 12, 8, 0.95);
  border: 1px solid rgba(74, 82, 52, 0.4);
}

.phone-status-bar {
  color: var(--olive-muted);
  border-bottom-color: var(--olive-3);
  font-family: var(--ui-mono);
  font-size: 9px;
}

.phone-header {
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--olive-3);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(0, 0, 0, 0.2);
}

.phone-app-info {
  flex: 1;
  min-width: 0;
}

.phone-close-btn {
  display: none;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--olive-text);
  font-size: 16px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .phone-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.phone-app-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--olive-3), var(--olive-green));
  border: 1px solid rgba(126, 179, 60, 0.4);
}

.phone-app-name {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--olive-text);
}

.phone-app-status {
  color: var(--olive-green);
  font-size: 10px;
}

.phone-messages {
  gap: 6px;
  padding: 8px 4px;
}

.msg {
  border-radius: var(--radius-md);
  border-top-left-radius: 4px;
  padding: 10px 12px;
  font-size: 12px;
  background: rgba(26, 32, 20, 0.95);
  border: 1px solid var(--olive-3);
  border-left-width: 3px;
  max-width: 100%;
}

/* ============================================================
   ЛОГІСТИКА, ЛЕГЕНДА, ПІДКАЗКИ
   ============================================================ */
.logistics-hud {
  top: calc(var(--hud-h) + 10px);
  left: 14px;
  width: 200px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--panel-shadow);
}

.logistics-hud-title {
  font-family: var(--ui-mono);
  letter-spacing: 0.14em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--olive-3);
}

.logistics-hud-grid {
  gap: 6px 12px;
}

.logistics-hud-grid dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.map-legend {
  top: calc(var(--hud-h) + 10px);
  right: calc(var(--phone-w) + 14px);
  max-width: 200px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--panel-shadow);
  font-size: 10px;
}

.map-legend-title {
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  color: var(--olive-gold);
}

.place-hint,
.fighter-hint,
.cargo-hint {
  top: calc(var(--hud-h) + 14px);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--panel-shadow);
  border: 1px solid rgba(255, 216, 77, 0.45);
}

/* ============================================================
   ТУТОРІАЛ — картка зліва внизу (не закриває центр мапи)
   ============================================================ */
.tutorial-overlay {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 calc(var(--unit-bar-h) + 16px) 16px;
  background: transparent;
  pointer-events: none;
}

.tutorial-card {
  pointer-events: auto;
  max-width: min(400px, calc(100vw - var(--phone-w) - 32px));
  margin: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  background: linear-gradient(165deg, rgba(28, 34, 20, 0.97), rgba(14, 18, 10, 0.98));
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}

.tutorial-card-head {
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--olive-3);
}

.tutorial-title {
  font-family: var(--ui-font);
  font-size: 15px;
  font-weight: 700;
  color: var(--olive-gold);
  letter-spacing: 0.04em;
}

.tutorial-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--olive-muted);
}

.tutorial-actions {
  gap: 8px;
  padding-top: 4px;
}

.tutorial-btn {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.tutorial-btn.primary {
  background: linear-gradient(135deg, #5a7a32, #4a5d2a);
  border: 1px solid rgba(201, 209, 153, 0.4);
  color: #fff;
}

.tutorial-btn.secondary {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--olive-3);
  color: var(--olive-muted);
}

/* ============================================================
   МОДАЛКИ, МАЙСТЕРНЯ, ТЕСТ, ТОСТИ
   ============================================================ */
.modal-body,
.workshop-panel-inner,
.unit-upgrade-float-inner {
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.modal-body h2,
.workshop-head h2 {
  font-family: var(--ui-font);
  color: var(--olive-gold);
  letter-spacing: 0.1em;
}

.test-launch-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--panel-shadow);
}

#toasts {
  top: calc(var(--hud-h) + 12px);
  left: 14px;
}

.toast {
  border-radius: var(--radius-sm);
  border-left-width: 4px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   ЕКРАН КАМПАНІЇ — базові доповнення (ПК layout у campaign-screen.css)
   ============================================================ */
body.steam-edition .steam-campaign-back {
  border-radius: var(--radius-sm);
  border-color: var(--panel-border);
  background: var(--panel-glass);
  color: var(--olive-text);
  font-family: var(--ui-font);
}

body.steam-edition .steam-campaign-back:hover {
  background: rgba(74, 93, 42, 0.5);
  border-color: var(--olive-gold);
}

/* Кампанія: інвентар і повтор рівня */
.campaign-prep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
  max-width: 640px;
  margin: 8px auto 4px;
}

.campaign-prep-btn {
  flex: 1;
  min-width: 200px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--olive-3);
  background: linear-gradient(165deg, rgba(42, 52, 28, 0.95), rgba(22, 28, 14, 0.98));
  color: var(--olive-text);
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.campaign-prep-btn:hover:not(:disabled) {
  border-color: var(--olive-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.campaign-prep-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.campaign-prep-btn.secondary {
  border-color: rgba(201, 209, 153, 0.35);
  background: rgba(0, 0, 0, 0.35);
}

.campaign-inventory-list {
  max-height: 50vh;
  overflow-y: auto;
  margin: 12px 0;
}

.campaign-inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.campaign-inv-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(74, 82, 52, 0.4);
  color: var(--olive-muted);
}

.campaign-inv-table .inv-qty {
  text-align: right;
  color: var(--olive-gold);
  font-family: var(--ui-mono);
  width: 4em;
}

.campaign-inv-empty {
  color: var(--olive-muted);
  font-size: 13px;
}

.steam-support-link {
  text-decoration: none;
  margin-bottom: 4px;
}

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (min-width: 1025px) and (max-width: 1100px) {
  :root {
    --phone-w: 260px;
    --unit-bar-h: 120px;
  }

  .hud-value {
    font-size: 15px;
  }

  .hud-group {
    padding: 4px 6px;
    gap: 4px;
  }

  .hud-item {
    padding: 2px 5px;
    min-width: 44px;
  }
}

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

  /* ---- HUD: два ряди ---- */
  #hud-top {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'hudleft hudright'
      'hudalert hudalert';
    align-items: center;
    align-content: center;
    height: var(--hud-h) !important;
    min-height: var(--hud-h);
    max-height: var(--hud-h);
    padding: 4px 6px !important;
    padding-top: max(4px, env(safe-area-inset-top, 0px)) !important;
    gap: 2px 4px !important;
    overflow: hidden;
    flex-wrap: nowrap !important;
  }

  #hud-top > .hud-group:first-of-type {
    grid-area: hudleft;
    display: flex !important;
    min-width: 0;
    padding: 2px 4px !important;
    gap: 2px !important;
    margin: 0;
    flex-wrap: nowrap;
  }

  #hud-top > .hud-right {
    grid-area: hudright;
    display: flex !important;
    margin-left: 0 !important;
    padding: 2px 3px !important;
    gap: 2px !important;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  #hud-top > .hud-center {
    grid-area: hudalert;
    display: flex !important;
    width: 100%;
    min-width: 0;
    order: unset !important;
    margin: 0 !important;
    flex: none !important;
  }

  #hud-top .hud-item {
    min-width: 0;
    padding: 0 4px !important;
  }

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

  #hud-top .hud-group:first-of-type .hud-item:nth-child(3) .hud-unit {
    display: inline;
    font-size: 6px;
    letter-spacing: 0;
  }

  #hud-top .hud-label {
    font-size: 7px;
    letter-spacing: 0.04em;
    line-height: 1.05;
  }

  #hud-top .hud-value {
    font-size: 11px;
    line-height: 1.1;
  }

  #hud-top .hud-score-goal {
    font-size: 8px;
  }

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

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

  #hud-top .hud-alert {
    width: 100%;
    justify-content: center;
    font-size: 8px;
    letter-spacing: 0.08em;
    padding: 2px 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #hud-top .hud-toolbar {
    margin: 0 !important;
    padding: 0 !important;
    gap: 2px !important;
    border: none !important;
    background: transparent !important;
  }

  #hud-top .icon-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
    flex-shrink: 0;
  }

  #hud-top .hud-toolbar #help-btn {
    display: none !important;
  }

  #hud-top .hud-toolbar #workshop-btn {
    display: none !important;
  }

  #hud-top #pause-btn {
    position: relative;
  }

  /* ---- Телефон: оверлей поверх мапи (без чорної смуги) ---- */
  body.phone-panel-open {
    --phone-panel-h: 0px !important;
  }

  #phone {
    display: none;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: calc(var(--unit-bar-h) + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    max-height: min(46vh, 360px) !important;
    height: min(46vh, 360px) !important;
    padding: 0 !important;
    border: none !important;
    border-top: 2px solid var(--olive-gold, #ffd84d) !important;
    z-index: 1060 !important;
    flex-direction: column;
    background: #0e120a !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.55);
  }

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

  #phone .phone-frame {
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100%;
    padding: 4px 6px 6px !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
  }

  #phone .phone-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(12, 16, 10, 0.98) !important;
    border: 1px solid rgba(74, 82, 52, 0.5);
    border-radius: 8px;
  }

  #phone .phone-status-bar {
    flex-shrink: 0;
    color: #8e9760;
    border-bottom: 1px solid rgba(74, 82, 52, 0.4);
  }

  #phone .phone-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(74, 82, 52, 0.4);
  }

  #phone .phone-app-info {
    flex: 1;
    min-width: 0;
  }

  #phone .phone-close-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(201, 209, 153, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: #e6edc1;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
  }

  #phone .phone-close-btn:active {
    background: rgba(74, 93, 42, 0.55);
  }

  #phone .phone-app-name {
    color: #e6edc1;
    font-size: 11px;
  }

  #phone .phone-messages {
    flex: 1 1 auto;
    min-height: 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #phone .msg {
    color: #e6edc1 !important;
    background: rgba(30, 36, 22, 0.98) !important;
    border: 1px solid rgba(74, 82, 52, 0.55) !important;
    font-size: 12px;
    line-height: 1.45;
    max-width: 100%;
  }

  #phone .msg-body {
    color: #e6edc1 !important;
  }

  #phone .msg-sender {
    color: #c9d199 !important;
  }

  #phone .msg.alarm {
    background: rgba(42, 20, 24, 0.98) !important;
  }

  body.phone-panel-open .mobile-dock {
    bottom: calc(var(--unit-bar-h) + min(46vh, 360px) + 8px + env(safe-area-inset-bottom, 0px));
    z-index: 1065;
  }

  #map {
    left: 0;
    right: 0;
    width: 100%;
  }

  #unit-bar {
    left: 0;
    right: 0;
  }

  .map-legend {
    display: none;
    right: 8px;
  }

  .tutorial-card {
    max-width: calc(100vw - 24px);
  }

  /* Повноекран під час раунду / навчання */
  html.mobile-immersive-root,
  html:has(body.mobile-immersive) {
    overscroll-behavior: none;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  body.mobile-immersive {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
  }

  body.mobile-immersive #game-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 9000;
    overscroll-behavior: none;
  }

  .mobile-expand-prompt {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
  }

  .mobile-expand-prompt.hidden {
    display: none !important;
  }

  .mobile-expand-prompt-inner {
    width: min(100%, 360px);
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(201, 209, 153, 0.35);
    background: linear-gradient(165deg, rgba(34, 42, 22, 0.98), rgba(14, 18, 10, 0.99));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
  }

  .mobile-expand-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--olive-gold);
  }

  .mobile-expand-text {
    margin: 0 0 12px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--olive-muted);
  }

  .mobile-expand-btn {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 216, 77, 0.55);
    background: linear-gradient(135deg, #6a9438, #3d5a22);
    color: #fff;
    font-family: var(--ui-font);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
  }

  .mobile-expand-skip {
    display: block;
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--olive-muted);
    font-size: 11px;
    cursor: pointer;
  }

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

  /* ---- Кампанія на телефоні: міні-версія ПК-дизайну ---- */
  body.steam-edition #start-screen.screen.active {
    overflow: hidden;
    background: #12160e;
  }

  body.steam-edition #start-screen .camo-bg {
    opacity: 0.32;
    filter: saturate(0.8);
  }

  body.steam-edition #start-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 70% 50% at 50% 20%, rgba(126, 179, 60, 0.08), transparent 55%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
    z-index: 0;
  }

  body.steam-edition .start-version-badge {
    display: none;
  }

  body.steam-edition .campaign-screen.start-content {
    max-width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: calc(36px + env(safe-area-inset-top, 0px)) 10px calc(8px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    overflow: hidden;
  }

  body.steam-edition .campaign-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(201, 209, 153, 0.2);
    background: linear-gradient(165deg, rgba(22, 28, 16, 0.92), rgba(12, 16, 10, 0.96));
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }

  body.steam-edition .campaign-brand-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    text-align: center;
  }

  body.steam-edition .campaign-mark {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 216, 77, 0.35);
    background: linear-gradient(145deg, rgba(74, 93, 42, 0.55), rgba(20, 26, 14, 0.9));
    color: #ffd84d;
    flex-shrink: 0;
  }

  body.steam-edition .campaign-title {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;
    color: #eef2dc;
    margin: 0;
  }

  body.steam-edition .campaign-title em {
    font-style: normal;
    color: #c9d199;
    font-weight: 600;
  }

  body.steam-edition .campaign-subtitle {
    font-size: 9px;
    margin-top: 3px;
    letter-spacing: 0.08em;
    color: #8e9760;
    text-transform: uppercase;
  }

  body.steam-edition .campaign-header-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
  }

  body.steam-edition .campaign-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(201, 209, 153, 0.3);
    background: rgba(0, 0, 0, 0.35);
    color: #e6edc1 !important;
    font-family: var(--ui-font, 'Outfit', sans-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none !important;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  body.steam-edition .campaign-chip-tutorial {
    border-color: rgba(126, 179, 60, 0.55);
    background: linear-gradient(135deg, rgba(90, 140, 52, 0.45), rgba(40, 58, 28, 0.65));
  }

  body.steam-edition .campaign-chip-support {
    color: #ffd84d !important;
    border-color: rgba(255, 216, 77, 0.28);
    background: rgba(40, 36, 18, 0.55);
  }

  body.steam-edition .campaign-version {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-family: var(--ui-mono, monospace);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #1a1a0a;
    background: linear-gradient(180deg, #ffd84d, #c9a832);
    border: 1px solid rgba(255, 220, 120, 0.55);
    flex-shrink: 0;
  }

  body.steam-edition .campaign-main {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  body.steam-edition .campaign-tutorial-meta {
    display: none !important;
  }

  body.steam-edition #start-screen .section-label {
    font-size: 9px;
    letter-spacing: 0.14em;
    margin: 0 0 6px;
    color: #9aa872;
  }

  body.steam-edition .section-label::before,
  body.steam-edition .section-label::after {
    display: inline;
    opacity: 0.45;
  }

  body.steam-edition .difficulty-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body.steam-edition .difficulty-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    flex: 1;
    align-content: center;
  }

  body.steam-edition .diff-card-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 8px 7px;
    border-radius: 12px;
    min-height: 0;
    border: 1px solid rgba(201, 209, 153, 0.14);
    background: rgba(14, 18, 10, 0.78);
    backdrop-filter: blur(8px);
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  body.steam-edition .diff-card.selected .diff-card-inner {
    border-color: rgba(126, 179, 60, 0.65);
    box-shadow: 0 0 0 1px rgba(126, 179, 60, 0.25), 0 8px 24px rgba(0, 0, 0, 0.4);
  }

  body.steam-edition .diff-card.locked .diff-card-inner {
    opacity: 0.55;
    filter: grayscale(0.35);
  }

  body.steam-edition .diff-shield-badge {
    width: 38px;
    height: 44px;
    margin: 0 auto 4px;
  }

  body.steam-edition .diff-shield-mark {
    font-size: 14px;
  }

  body.steam-edition .diff-card-header {
    text-align: center;
    padding: 0 0 4px;
    margin: 0 0 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  body.steam-edition .diff-name {
    font-size: 11px;
    letter-spacing: 0.05em;
  }

  body.steam-edition .diff-callsign {
    display: block;
    font-size: 8px;
    margin-top: 1px;
    color: #8e9760;
  }

  body.steam-edition .diff-online {
    display: block;
    font-size: 7px;
    margin-top: 2px;
    color: #7eb33c;
  }

  body.steam-edition .diff-card-body {
    display: none;
    padding: 0 2px;
  }

  body.steam-edition .diff-card.selected .diff-card-body {
    display: block;
  }

  body.steam-edition .diff-info {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 8px;
    line-height: 1.35;
    color: #b8be9a;
  }

  body.steam-edition .diff-info li:nth-child(n + 2) {
    display: none;
  }

  body.steam-edition .diff-card-footer {
    display: none;
    margin-top: 4px;
    padding-top: 4px;
    gap: 3px;
  }

  body.steam-edition .diff-card.selected .diff-card-footer {
    display: grid;
  }

  body.steam-edition .diff-outcome {
    font-size: 7px;
    padding: 3px 5px;
    line-height: 1.3;
  }

  body.steam-edition .diff-card.selected .diff-card-inner {
    border-color: #7eb33c;
    box-shadow: 0 0 0 1px rgba(255, 216, 77, 0.25), 0 6px 18px rgba(0, 0, 0, 0.35);
  }

  body.steam-edition .campaign-footer {
    gap: 5px;
  }

  body.steam-edition .campaign-footer-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  body.steam-edition .campaign-footer-left {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
  }

  body.steam-edition .campaign-prep-actions {
    display: flex;
    gap: 5px;
    margin: 0;
  }

  body.steam-edition .campaign-prep-btn {
    padding: 7px 10px;
    font-size: 9px;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(201, 209, 153, 0.3);
    background: rgba(0, 0, 0, 0.35);
    color: #e6edc1;
    font-family: var(--ui-font, 'Outfit', sans-serif);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
  }

  body.steam-edition .campaign-prep-btn.secondary {
    border-color: rgba(201, 209, 153, 0.22);
    background: rgba(30, 36, 22, 0.65);
  }

  body.steam-edition .diff-card {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    text-align: inherit;
    color: inherit;
    cursor: pointer;
  }

  body.steam-edition .campaign-start-btn.start-btn {
    -webkit-appearance: none;
    appearance: none;
  }

  body.steam-edition .campaign-reset-btn {
    display: none;
  }

  body.steam-edition .campaign-start-btn.start-btn {
    margin: 0;
    min-width: 0;
    width: auto;
    padding: 10px 14px;
    font-size: 10px;
    letter-spacing: 0.08em;
    border-radius: 10px;
    border: 1px solid rgba(255, 216, 77, 0.45);
    background: linear-gradient(135deg, #6a9438 0%, #3d5a22 55%, #2e4218 100%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }

  body.steam-edition .campaign-disclaimer.footer-note {
    display: block !important;
    margin: 0;
    font-size: 8px;
    line-height: 1.25;
    color: #5a6348;
    text-align: center;
  }

  body.steam-edition .campaign-disclaimer .footer-note-sub {
    display: none;
  }

  body.steam-edition .steam-campaign-back {
    top: max(6px, env(safe-area-inset-top));
    left: 6px;
    padding: 5px 9px;
    font-size: 10px;
    z-index: 11002;
  }
}
