* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --card-bg: rgba(255, 253, 245, 0.95);
  --card-shadow: 0 3px 10px rgba(30, 60, 30, 0.25);
  --green: #3faf4e;
  --green-dark: #2e8f3c;
  --text: #2c3a2e;
  --radius: 14px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Roboto', -apple-system, sans-serif;
  background: #7ec850;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-container {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  overflow: hidden;
}
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- Загрузка ---------- */
#loading-screen {
  position: absolute; inset: 0; z-index: 100;
  background: linear-gradient(160deg, #8fd45e 0%, #5cb648 60%, #3f9a3f 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff;
}
.loading-logo { font-size: 72px; animation: bounce 1.2s ease-in-out infinite; }
.loading-title { font-size: 42px; font-weight: 800; letter-spacing: 3px; margin-top: 12px; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.loading-sub { font-size: 18px; opacity: .85; margin-top: 4px; }
.loading-bar { width: 240px; height: 12px; background: rgba(0,0,0,.25); border-radius: 8px; margin-top: 28px; overflow: hidden; }
#loading-fill { width: 0%; height: 100%; background: #ffe066; border-radius: 8px; transition: width .3s; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- Главное меню ---------- */
#main-menu {
  position: absolute; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: flex-end;
  padding: clamp(24px, 6vw, 100px);
  background: #75c8e5 url('assets/main-menu-bg.png') center top / cover no-repeat;
  isolation: isolate;
}
#main-menu::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(4, 20, 14, .02) 20%, rgba(4, 20, 14, .18) 50%, rgba(4, 20, 14, .72) 100%),
    linear-gradient(0deg, rgba(4, 20, 14, .28), transparent 44%);
}
.main-menu-panel {
  width: min(390px, 92vw);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(155deg, rgba(16, 44, 28, .9), rgba(8, 25, 18, .84));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.main-menu-kicker {
  color: #71ef55; font-size: 12px; font-weight: 900;
  letter-spacing: 2.5px; margin-bottom: 8px;
}
.main-menu-heading {
  font-size: clamp(31px, 3vw, 45px); line-height: .98;
  font-weight: 1000; letter-spacing: -1.5px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .22);
}
.main-menu-heading.small { font-size: 29px; line-height: 1.05; }
.main-menu-copy {
  margin-top: 13px; color: rgba(255, 255, 255, .76);
  font-size: 13px; font-weight: 650; line-height: 1.45;
}
.main-menu-copy.warning {
  padding: 13px; border-radius: 12px; color: #ffe4bd;
  background: rgba(201, 99, 42, .22); border: 1px solid rgba(255, 171, 97, .28);
}
.main-menu-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.main-menu-actions.compact { margin-top: 18px; }
.main-menu-secondary-row { display: flex; flex-direction: column; gap: 10px; }
.main-menu-btn {
  width: 100%; min-height: 58px; display: flex; align-items: center; gap: 13px;
  padding: 11px 16px; border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px; cursor: pointer; text-align: left;
  color: #fff; background: rgba(255, 255, 255, .1);
  font-family: inherit; font-size: 14px; font-weight: 900; line-height: 1.1;
  letter-spacing: .45px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .16);
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.main-menu-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.main-menu-btn:active { transform: scale(.98); }
.main-menu-btn > span:first-child {
  width: 30px; flex: 0 0 30px; text-align: center; font-size: 22px;
}
.main-menu-btn small {
  display: block; margin-top: 4px; color: rgba(255, 255, 255, .68);
  font-size: 10px; font-weight: 650; letter-spacing: 0;
}
.main-menu-btn.primary {
  min-height: 66px; border-color: rgba(158, 255, 117, .48);
  background: linear-gradient(180deg, #55d638, #29a91f);
  box-shadow: 0 7px 0 #147b18, 0 14px 26px rgba(0, 0, 0, .24);
}
.main-menu-btn.primary:active { transform: translateY(4px); box-shadow: 0 3px 0 #147b18; }
.main-menu-btn.new-game { background: linear-gradient(180deg, #f5af31, #dd851a); }
.main-menu-btn.leaderboard {
  background: linear-gradient(180deg, rgba(112, 80, 188, .92), rgba(70, 43, 137, .94));
}
.main-menu-btn.settings, .main-menu-btn.back { background: rgba(255, 255, 255, .1); }
.main-menu-btn.danger { background: linear-gradient(180deg, #df6a43, #b93d2c); }
.main-menu-btn:disabled {
  cursor: default; transform: none; filter: grayscale(.75);
  opacity: .52; box-shadow: none;
}
.menu-setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 17px; padding: 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1);
}
.menu-setting-row > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.menu-setting-row b { font-size: 13px; }
.menu-setting-row small { color: rgba(255, 255, 255, .62); font-size: 10px; line-height: 1.3; }
.menu-setting-row.graphics { align-items: stretch; flex-direction: column; }
.menu-toggle, .menu-segment button {
  border: none; border-radius: 9px; padding: 9px 11px; cursor: pointer;
  color: #d4d9d4; background: rgba(255, 255, 255, .1);
  font-size: 10px; font-weight: 900;
}
.menu-toggle.active, .menu-segment button.active {
  color: #fff; background: #39b82e; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.menu-toggle.off { color: #ffc0b1; background: rgba(192, 62, 42, .35); }
.menu-segment { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
#menu-settings-back { margin-top: 17px; min-height: 50px; }
.leaderboard-menu-content {
  margin-top: 16px; max-height: 310px; overflow-y: auto;
  padding-right: 3px;
}
.leaderboard-loading {
  padding: 24px 10px; color: rgba(255, 255, 255, .66);
  font-size: 11px; font-weight: 850; text-align: center; letter-spacing: .7px;
}
.leaderboard-capital {
  padding: 12px 14px; margin-bottom: 9px; border-radius: 13px;
  color: #fff; background: rgba(77, 191, 66, .2);
  border: 1px solid rgba(126, 240, 106, .25);
}
.leaderboard-capital small {
  display: block; color: rgba(255, 255, 255, .64);
  font-size: 9px; font-weight: 700; letter-spacing: .4px;
}
.leaderboard-capital b { display: block; margin-top: 3px; font-size: 22px; }
.leaderboard-list { display: flex; flex-direction: column; gap: 5px; }
.leaderboard-row {
  display: grid; grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  color: #fff; background: rgba(255, 255, 255, .08);
}
.leaderboard-rank { color: #ffd66b; font-size: 12px; font-weight: 950; }
.leaderboard-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 800; }
.leaderboard-score { font-size: 11px; font-weight: 900; }
.leaderboard-note {
  margin-top: 8px; color: rgba(255, 255, 255, .62);
  font-size: 9px; line-height: 1.4;
}
.leaderboard-auth {
  width: 100%; margin-top: 10px; padding: 10px; border: none; border-radius: 10px;
  color: #fff; background: #d08b24; font: inherit; font-size: 10px; font-weight: 900; cursor: pointer;
}
#menu-leaderboard-back { margin-top: 13px; min-height: 48px; }
.main-menu-credit {
  display: none;
  position: absolute; right: clamp(24px, 6vw, 100px); bottom: 15px;
  color: rgba(255, 255, 255, .66); font-size: 9px; font-weight: 850; letter-spacing: 1.2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* ---------- Пауза ---------- */
#pause-menu {
  position: absolute; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(5, 18, 12, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pause-menu-panel {
  width: min(360px, 92vw); padding: 27px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 23px; color: #fff;
  background: linear-gradient(155deg, rgba(18, 49, 31, .97), rgba(7, 24, 16, .96));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.pause-menu-hint {
  margin-top: 18px; color: rgba(255, 255, 255, .48);
  font-size: 10px; font-weight: 750; text-align: center; letter-spacing: .6px;
}

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-collapse {
  display: none; align-items: center; justify-content: center;
  align-self: stretch; width: 34px; min-height: 30px; margin-left: auto;
  border: 1px solid rgba(44, 58, 46, .08); border-radius: 10px;
  color: var(--text); background: rgba(44, 58, 46, .06);
  font-family: inherit; font-size: 18px; font-weight: 900; line-height: 1; cursor: pointer;
}
.hud-collapse > span {
  display: block; line-height: 1; transform: translateY(-1px);
}
#hud.hud-collapsed .hud-top-left > .hud-card:not(#card-day),
#hud.hud-collapsed .hud-top-center { display: none; }

.hud-top-left {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.hud-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border-radius: var(--radius);
  padding: 8px 14px; box-shadow: var(--card-shadow);
  color: var(--text); font-weight: 700; font-size: 13px;
  min-width: 150px;
}
.hud-card .hud-icon { font-size: 22px; }
#card-rep { cursor: pointer; }
#card-rep:active { transform: scale(.98); }
.hud-col { display: flex; flex-direction: column; line-height: 1.2; }
.hud-card.task .hud-col { min-width: 0; }
.hud-big { font-size: 18px; font-weight: 800; }
.hud-card.money #hud-money { color: #1d7a2c; }
.mini-bar { width: 90px; height: 6px; background: #d8d8ce; border-radius: 4px; overflow: hidden; margin-top: 3px; }
#hud-rep-fill { height: 100%; width: 80%; background: var(--green); border-radius: 4px; transition: width .4s; }

.hud-top-center {
  position: absolute; top: auto; bottom: 12px; left: 12px; transform: none;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card-bg); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--card-shadow);
}
.fuel-row { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text); }
.fuel-name { width: 58px; }
.fuel-bar { width: 130px; height: 12px; background: #d8d8ce; border-radius: 8px; overflow: hidden; }
.fuel-fill { height: 100%; border-radius: 8px; transition: width .4s; }
.fuel-fill.petrol92 { background: #75b843; }
.fuel-fill.petrol { background: #43b34f; }
.fuel-fill.petrol98 { background: #d94f70; }
.fuel-fill.diesel { background: #ef8c1f; }
.fuel-fill.gas { background: #2f7fe0; }
.fuel-fill.battery { background: #9b59b6; }
.fuel-val { width: 62px; text-align: right; font-size: 12px; }
.fuel-row.low .fuel-val { color: #d33; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.hud-top-right {
  position: absolute; top: 10px; right: 10px;
  display: grid; grid-template-columns: repeat(2, auto); gap: 8px;
  width: 160px; justify-items: end;
}
.menu-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 76px; height: 62px;
  background: var(--card-bg); border: none; border-radius: var(--radius);
  box-shadow: var(--card-shadow); cursor: pointer;
  font-size: 10px; font-weight: 800; color: var(--text); letter-spacing: .5px;
  transition: transform .1s;
}
.menu-btn.hud-menu-collapse { display: none; }
#hud.hud-menu-collapsed .hud-top-right > .menu-btn:not(.hud-menu-collapse) { display: none; }
#hud.hud-menu-collapsed .hud-menu-collapse { grid-column: -2 / -1; }
.menu-btn span { font-size: 24px; margin-bottom: 2px; }
.menu-btn > .menu-btn-label { font-size: inherit; margin-bottom: 0; }
.menu-btn:active { transform: scale(.93); }
.menu-btn.attention { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 90, 60, .35); } }
.menu-btn.build { background: var(--card-bg); color: var(--text); }
.menu-btn.build.active-mode {
  background: var(--card-bg); color: var(--text);
  box-shadow: 0 0 0 3px #f0a832, var(--card-shadow);
}

/* ---------- Карточка задания ---------- */
.hud-card.task { border: 2px solid #f0a832; max-width: 235px; }
#hud-task-text { font-size: 11px; line-height: 1.25; }
.hud-task-progress { font-size: 12px; font-weight: 800; color: #c07f10; }
.hud-task-reward {
  align-self: flex-start; margin-top: 4px; padding: 3px 7px;
  border-radius: 7px; background: #f0a832; color: #fff;
  font-size: 10px; font-weight: 900; letter-spacing: .25px;
}
.hud-card.task.done { border-color: var(--green); }
.hud-card.task.done .hud-task-progress { color: var(--green-dark); }
.hud-card.task.done .hud-task-reward { background: var(--green); }

/* ---------- Режим стройки ---------- */
#build-bar {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(35, 45, 35, .93); color: #fff;
  padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 700;
  z-index: 20;
}
#build-exit, #build-catalog {
  border: none; border-radius: 10px; padding: 10px 18px;
  background: var(--green); color: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
}
#build-catalog { background: #f0a832; color: #2f2b20; }

#build-catalog-dock {
  position: absolute; left: 10px; bottom: 78px; z-index: 25;
  width: min(470px, calc(100vw - 20px));
  max-height: min(67vh, 650px);
  display: flex; flex-direction: column;
  overflow: hidden;
  color: var(--text); background: rgba(250, 248, 239, .97);
  border: 1px solid rgba(255, 255, 255, .72); border-radius: 17px;
  box-shadow: 0 14px 40px rgba(20, 40, 22, .34);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.build-dock-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px 9px; color: #fff;
  background: linear-gradient(180deg, #43b853, #318f3e);
  font-size: 13px; letter-spacing: .35px;
}
.build-dock-header > div { display: flex; align-items: center; gap: 7px; }
#build-dock-close {
  width: 29px; height: 29px; border: none; border-radius: 8px;
  color: #fff; background: rgba(255, 255, 255, .2);
  font-weight: 900; cursor: pointer;
}
.build-catalog-tabs {
  display: flex; gap: 5px; padding: 8px 9px;
  overflow-x: auto; flex: 0 0 auto;
  background: #ebe9dd;
}
.build-catalog-tabs button {
  flex: 0 0 auto; padding: 8px 9px; border: none; border-radius: 9px;
  color: #5a6159; background: rgba(255, 255, 255, .72);
  font-size: 10px; font-weight: 900; cursor: pointer; white-space: nowrap;
}
.build-catalog-tabs button.active {
  color: #fff; background: var(--green);
  box-shadow: 0 2px 6px rgba(30, 110, 45, .22);
}
.build-catalog-content {
  padding: 9px; overflow-y: auto; overscroll-behavior: contain;
}
.build-catalog-content .delivery-note { margin-bottom: 8px; }
.build-catalog-content .panel-section:last-child { margin-bottom: 0; }

.catalog-card {
  display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 11px 12px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.catalog-card.built { opacity: .72; }
.catalog-icon { font-size: 28px; text-align: center; }
.catalog-name { font-size: 14px; font-weight: 800; }
.catalog-desc { font-size: 11px; line-height: 1.35; opacity: .68; margin-top: 2px; }
.catalog-price { font-size: 12px; font-weight: 800; color: var(--green-dark); margin-top: 3px; }
.catalog-action {
  border: none; border-radius: 9px; padding: 9px 10px; min-width: 78px;
  background: var(--green); color: #fff; font-size: 11px; font-weight: 800; cursor: pointer;
}
.catalog-action:disabled { background: #b9b7ab; cursor: default; }
.catalog-action.sell, .upg-buy.sell, .sell-confirm { background: #c56b36; }
.sell-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border-radius: 10px; padding: 9px 10px; margin-bottom: 7px;
  font-size: 12px; font-weight: 750;
}

/* ---------- Мини-игра VIP ---------- */
#vip-game {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(30, 38, 30, .95); border-radius: 18px;
  padding: 14px 18px 16px; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  width: min(430px, 92vw);
}
.vip-title { color: #ffd23f; font-size: 14px; font-weight: 800; text-align: center; }
.vip-bar {
  position: relative; width: 100%; height: 26px;
  background: #58423a; border-radius: 13px; overflow: hidden;
}
.vip-zone.yellow {
  position: absolute; left: 28%; width: 44%; height: 100%;
  background: #d9a53c;
}
.vip-zone.green {
  position: absolute; left: 41%; width: 18%; height: 100%;
  background: #3faf4e;
}
.vip-marker {
  position: absolute; top: -2px; width: 8px; height: 30px;
  background: #fff; border-radius: 4px; left: 0;
  box-shadow: 0 0 6px rgba(255,255,255,.8);
}
#vip-stop {
  border: none; border-radius: 12px; padding: 12px 40px;
  background: #d6473b; color: #fff; font-weight: 800; font-size: 18px;
  cursor: pointer; letter-spacing: 1px;
}
#vip-stop:active { transform: scale(.95); }

.hud-bottom-right {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; gap: 6px;
  background: var(--card-bg); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--card-shadow);
}
.speed-btn {
  width: 48px; height: 44px; border: none; border-radius: 10px;
  background: #e7e5da; font-size: 16px; font-weight: 800; color: var(--text);
  cursor: pointer;
}
.speed-btn.active { background: var(--green); color: #fff; }
.speed-btn:active { transform: scale(.93); }

/* ---------- Тосты ---------- */
#toast-area {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(35, 45, 35, .92); color: #fff;
  padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  animation: toast-in .25s ease-out, toast-out .4s ease-in forwards;
  animation-delay: 0s, 3.2s;
  max-width: 90vw; text-align: center;
}
.toast.good { background: rgba(40, 130, 60, .94); }
.toast.bad { background: rgba(180, 55, 45, .94); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(10px); opacity: 0; } }

/* ---------- Модальные окна ---------- */
#modal-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(20, 35, 20, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
#modal-window {
  background: #faf8ef; border-radius: 18px;
  width: 100%; max-width: 480px; max-height: 86vh;
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  overflow: hidden;
}
#modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--green); color: #fff;
  font-size: 18px; font-weight: 800; letter-spacing: .5px;
}
#modal-close {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: rgba(255,255,255,.25); color: #fff;
  font-size: 16px; font-weight: 800; cursor: pointer;
}
#modal-body { padding: 14px 16px; overflow-y: auto; min-height: 0; color: var(--text); }

/* Содержимое модалок */
.panel-section { margin-bottom: 14px; }
.panel-title { font-size: 13px; font-weight: 800; opacity: .6; margin-bottom: 6px; letter-spacing: 1px; }

.price-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.price-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.price-info { flex: 1; }
.price-fuel-name { font-weight: 800; font-size: 14px; }
.price-market { font-size: 11px; opacity: .6; }
.price-controls { display: flex; align-items: center; gap: 6px; }
.price-controls button {
  width: 34px; height: 34px; border: none; border-radius: 9px;
  background: var(--green); color: #fff; font-size: 18px; font-weight: 800; cursor: pointer;
}
.price-controls button:active { transform: scale(.9); }
.price-value { width: 72px; text-align: center; font-weight: 800; font-size: 15px; }
.price-demand { font-size: 11px; font-weight: 700; width: 100%; margin-top: 4px; }
.price-demand .margin-negative { color: #c0392b; font-weight: 900; }

.buy-item {
  background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.buy-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.buy-fuel-name { font-weight: 800; font-size: 14px; }
.buy-stock { font-size: 12px; opacity: .65; }
.buy-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.buy-btn {
  flex: 1; min-width: 90px; padding: 9px 6px; border: none; border-radius: 10px;
  background: var(--green); color: #fff; font-weight: 800; font-size: 12px; cursor: pointer;
  line-height: 1.3;
}
.buy-btn small { display: block; font-weight: 600; opacity: .85; }
.buy-btn:disabled { background: #b9b7ab; cursor: default; }
.buy-btn:active:not(:disabled) { transform: scale(.96); }
.delivery-note { font-size: 12px; background: #fff4d6; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-weight: 600; }
.manager-automation {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; padding: 11px 12px;
  border: 1px solid #d9dfd3; border-radius: 12px; background: #f3f7f0;
}
.manager-automation > div { min-width: 0; }
.manager-automation b { display: block; margin-bottom: 3px; font-size: 13px; color: var(--text); }
.manager-automation small { display: block; font-size: 10px; line-height: 1.4; color: #687066; }
.manager-automation button {
  flex: 0 0 auto; min-width: 92px; padding: 9px 10px;
  border: none; border-radius: 9px; cursor: pointer;
  color: #8a4a42; background: #ead8d4;
  font-size: 9px; font-weight: 900;
}
.manager-automation button.active { color: #fff; background: var(--green); }
.manager-automation button:disabled {
  min-width: 116px; color: #858980; background: #d9dcd5; cursor: default;
}

.upg-item {
  display: flex; gap: 12px; align-items: center;
  background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.upg-icon { font-size: 30px; width: 42px; text-align: center; flex-shrink: 0; }
.upg-info { flex: 1; min-width: 0; }
.upg-name { font-weight: 800; font-size: 14px; }
.upg-desc { font-size: 11.5px; opacity: .65; line-height: 1.35; margin-top: 2px; }
.upg-level { font-size: 11px; font-weight: 700; color: var(--green-dark); margin-top: 2px; }
.upg-buy {
  border: none; border-radius: 10px; padding: 10px 12px;
  background: var(--green); color: #fff; font-weight: 800; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.upg-buy:disabled { background: #b9b7ab; }
.upg-buy.maxed { background: #8a8875; }
.upg-buy:active:not(:disabled) { transform: scale(.95); }

.report-grid { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 14px; }
.report-grid .r-label { font-weight: 600; opacity: .75; }
.report-grid .r-val { font-weight: 800; text-align: right; }
.r-val.plus { color: #1d7a2c; }
.r-val.minus { color: #c0392b; }
.report-details { grid-column: 1 / -1; margin-top: 1px; }
.report-details summary {
  display: flex; align-items: center; gap: 6px; width: fit-content;
  color: var(--green-dark); font-size: 11px; font-weight: 900;
  cursor: pointer; list-style: none;
}
.report-details summary::-webkit-details-marker { display: none; }
.report-details summary::before { content: '+'; font-size: 15px; line-height: 1; }
.report-details[open] summary::before { content: '−'; }
.report-details-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  margin-top: 7px; padding: 8px 10px; border-radius: 10px;
  background: #f3f7f0;
}
.report-details-grid .r-label { min-width: 0; }
.report-details-grid .r-val { white-space: nowrap; }
.report-divider { grid-column: 1 / -1; height: 1px; background: #ddd; margin: 4px 0; }
.report-subhead {
  grid-column: 1 / -1; margin-top: 2px;
  color: #6f776d; font-size: 11px; font-weight: 900; letter-spacing: .7px;
}
.report-auto-option {
  display: flex; align-items: center; gap: 9px;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid #d9dfd3; border-radius: 11px;
  background: #f3f7f0; color: var(--text);
  font-size: 12px; font-weight: 750; cursor: pointer;
}
.report-auto-option input {
  width: 18px; height: 18px; margin: 0;
  accent-color: var(--green); cursor: pointer;
}

/* ---------- Мобильная адаптация ---------- */
/* ---------- Ручное обслуживание ---------- */
#service-panel {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  background: rgba(24, 34, 28, 0.94);
  border: 2px solid #f0a832;
  border-radius: 16px;
  padding: 12px 14px;
  color: #fff;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
}
.sp-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 15px; }
#sp-close {
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.sp-request { font-size: 14px; color: #ffe08a; font-weight: 700; }
.sp-step-hint { font-size: 12px; font-weight: 800; color: #cfe8d4; margin-bottom: 7px; }
.sp-fuel-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.sp-fuel-btn {
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 11px;
  padding: 11px 5px;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.sp-fuel-btn small { display: block; margin-top: 3px; font-size: 9px; font-weight: 700; }
.sp-fuel-btn:active { transform: scale(0.96); }
.sp-fuel-btn.selected {
  border-color: #ffd23f;
  box-shadow: 0 0 0 2px rgba(255,210,63,.35), 0 0 12px rgba(255,210,63,.45);
}
.sp-fuel-btn:disabled { opacity: .42; cursor: default; }
#sp-dispense-step { display: flex; flex-direction: column; gap: 8px; }
#sp-dispense-step.awaiting-fuel { opacity: .45; }
.sp-gauge {
  position: relative; height: 26px;
  background: rgba(255,255,255,0.12);
  border-radius: 13px; overflow: hidden;
}
.sp-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #35b24a, #8dff9a);
  border-radius: 13px;
  transition: none;
}
.sp-fill.over { background: linear-gradient(90deg, #d98324, #ff6b5a); }
.sp-target {
  position: absolute; top: -2px; bottom: -2px; width: 4px;
  background: #ffd23f; border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 210, 63, 0.9);
}
.sp-nums { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: #cfe8d4; }
#sp-hold {
  background: linear-gradient(180deg, #2e9e42, #1d7a2c);
  border: none; border-radius: 12px; color: #fff;
  font-weight: 900; font-size: 16px; padding: 16px;
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
#sp-hold:active { transform: scale(0.98); filter: brightness(1.15); }
#sp-hold:disabled, #sp-done:disabled { cursor: default; filter: grayscale(.7); opacity: .55; }
#sp-done {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px; color: #fff;
  font-weight: 800; font-size: 13px; padding: 10px; cursor: pointer;
}

/* ---------- Индикатор проблем ---------- */
.hud-card.alert {
  border: 2px solid #d6473b; max-width: 220px; text-align: left;
  cursor: pointer; font-family: inherit;
  animation: pulse 1.6s infinite;
}
#hud-alert-text { font-size: 11px; font-weight: 800; color: #b5342a; line-height: 1.3; }

/* ---------- Персонал ---------- */
.staff-item {
  display: flex; align-items: center; gap: 10px;
  background: #f2f0e6; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.staff-item.candidate { background: #eef4ea; border: 1px dashed #9cbf95; }
.staff-icon { font-size: 26px; width: 34px; text-align: center; }
.staff-info { flex: 1; min-width: 0; }
.staff-name { font-weight: 800; font-size: 13px; color: var(--text); }
.staff-meta { font-size: 11px; color: #6b7168; line-height: 1.4; }
.staff-stat { display: inline-block; margin-right: 8px; font-weight: 700; }
.staff-actions { display: flex; flex-direction: column; gap: 4px; }
.staff-btn {
  border: none; border-radius: 8px; padding: 7px 10px;
  font-size: 11px; font-weight: 800; cursor: pointer;
  background: var(--green); color: #fff; white-space: nowrap;
}
.staff-btn.warn { background: #d6473b; }
.staff-btn.ghost { background: #d9d6c8; color: #5c6157; }
.staff-btn:disabled { background: #cfcdc2; color: #8b8f86; cursor: default; }
.mood-bar { height: 5px; background: #d8d8ce; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.mood-fill { height: 100%; border-radius: 3px; }

.menu-btn.bank { background: var(--card-bg); color: var(--text); }
.menu-btn.bank.ready { animation: pulse 1.4s infinite; }
.menu-btn.ads { background: var(--card-bg); color: var(--text); }
.menu-btn.leaderboard { background: var(--card-bg); color: var(--text); }

.leaderboard-modal .leaderboard-capital {
  color: var(--text); background: #eef8ea; border-color: #c9e6c1;
}
.leaderboard-modal .leaderboard-capital small,
.leaderboard-modal .leaderboard-note { color: #697267; }
.leaderboard-modal .leaderboard-row { color: var(--text); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

@media (max-width: 760px) {
  #main-menu {
    align-items: flex-end; justify-content: center;
    padding: 12px 12px 14px; background-position: 53% center;
  }
  #main-menu::before {
    background: linear-gradient(0deg, rgba(3, 17, 11, .9) 0%, rgba(3, 17, 11, .3) 62%, rgba(3, 17, 11, .08) 100%);
  }
  .main-menu-panel { width: min(410px, 100%); padding: 15px 16px; border-radius: 18px; }
  .main-menu-kicker { margin-bottom: 5px; font-size: 10px; }
  .main-menu-heading { font-size: 26px; }
  .main-menu-copy { margin-top: 8px; font-size: 10px; line-height: 1.3; }
  .main-menu-actions { margin-top: 10px; gap: 6px; }
  .main-menu-btn { min-height: 43px; gap: 9px; padding: 7px 10px; font-size: 12px; }
  .main-menu-btn.primary { min-height: 49px; }
  .main-menu-btn > span:first-child { width: 24px; flex-basis: 24px; font-size: 18px; }
  .main-menu-btn small { margin-top: 2px; font-size: 8px; }
  .main-menu-secondary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .main-menu-secondary-row .main-menu-btn { min-width: 0; min-height: 42px; font-size: 10px; }
  .main-menu-secondary-row .main-menu-btn small { display: none; }
  .main-menu-credit { display: none; }
  #service-panel { bottom: 76px; }
  .hud-top-left {
    align-items: flex-start; width: min(186px, calc(100vw - 142px));
  }
  .hud-top-left .hud-card { width: 100%; min-width: 0; }
  #card-day { padding-right: 5px; }
  .hud-collapse { display: flex; }
  .hud-top-center {
    top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 8px;
    transform: none; padding: 6px 7px; gap: 2px;
  }
  .fuel-row { gap: 4px; font-size: 10px; line-height: 1; }
  .fuel-name { width: 39px; font-size: 10px; }
  .fuel-bar { width: 58px; height: 8px; }
  .fuel-val { width: 45px; font-size: 10px; }
  .hud-card { min-width: 112px; padding: 5px 8px; gap: 5px; font-size: 10px; }
  .hud-card .hud-icon { font-size: 18px; }
  .hud-big { font-size: 14px; }
  .mini-bar { width: 70px; height: 5px; }
  .hud-top-right { width: 116px; }
  .menu-btn.hud-menu-collapse { display: flex; }
  .menu-btn { width: 54px; height: 48px; font-size: 8px; }
  .menu-btn span { font-size: 18px; }
  .speed-btn { width: 34px; height: 34px; font-size: 12px; }
  .hud-bottom-right { bottom: calc(12px + env(safe-area-inset-bottom)); right: 8px; }
  .hud-card.task { width: 100%; max-width: none; padding: 5px 8px; }
  .hud-card.task .hud-icon { font-size: 17px; }
  #hud-task-text { font-size: 10px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-task-progress { font-size: 10px; }
  .hud-task-reward { margin-top: 2px; padding: 2px 5px; font-size: 8px; white-space: nowrap; }
  #toast-area { bottom: 110px; }
  #modal-overlay {
    padding: 8px;
  }
  #modal-window {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 15px;
  }
  #modal-header { padding: 10px 12px; font-size: 16px; }
  #modal-close { width: 30px; height: 30px; font-size: 14px; }
  #modal-body { padding: 10px 11px; }
  .panel-section { margin-bottom: 8px; }
  .panel-title { margin-bottom: 4px; font-size: 11px; }
  .report-grid { gap: 5px 8px; font-size: 12px; }
  .report-grid .r-label { min-width: 0; overflow-wrap: anywhere; }
  .report-details summary { font-size: 10px; }
  .report-details-grid { gap: 5px 8px; margin-top: 5px; padding: 7px 8px; }
  .report-auto-option { gap: 7px; margin-top: 8px; padding: 8px 9px; font-size: 10px; }
  .report-auto-option input { width: 16px; height: 16px; }
  .manager-automation {
    align-items: stretch; flex-direction: column; gap: 8px;
  }
  .manager-automation button {
    width: 100%; min-width: 0; padding: 8px 9px;
    white-space: normal; line-height: 1.2;
  }
  .upg-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(68px, 38%);
    grid-template-rows: auto auto auto;
    align-items: start; gap: 7px 8px; padding: 10px;
  }
  .upg-item .upg-icon { grid-column: 1; grid-row: 1 / -1; width: 34px; font-size: 24px; align-self: center; }
  .upg-item .upg-info { display: contents; }
  .upg-item .upg-name { grid-column: 2; grid-row: 1; min-width: 0; }
  .upg-item .upg-buy {
    grid-column: 3; grid-row: 1; width: 100%; min-width: 0;
    margin: 0; padding: 8px 6px; font-size: 10px;
    line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere;
  }
  .upg-item .upg-desc { grid-column: 2 / -1; grid-row: 2; }
  .upg-item .upg-level { grid-column: 2 / -1; grid-row: 3; }
  .loading-title { font-size: 30px; }
  #build-bar { bottom: 130px; font-size: 12px; padding: 10px 12px; }
  #build-bar > span { display: none; }
  #build-exit, #build-catalog { padding: 9px 12px; font-size: 11px; }
  #build-catalog-dock {
    bottom: 178px; left: 8px; width: calc(100vw - 16px);
    max-height: min(48vh, 440px);
  }
  .build-dock-header { padding: 9px 10px 7px; font-size: 11px; }
  .build-catalog-tabs { padding: 6px 7px; }
  .build-catalog-tabs button { padding: 7px 8px; font-size: 9px; }
  .build-catalog-content { padding: 7px; }
  .build-catalog-content .catalog-card {
    grid-template-columns: 34px 1fr auto; gap: 7px; padding: 8px;
  }
  .build-catalog-content .catalog-icon { font-size: 23px; }
  .build-catalog-content .catalog-action { min-width: 68px; padding: 8px 7px; font-size: 9px; }
  #vip-game { bottom: 140px; }
}

/* Очень узкие телефоны: оставляем нижние панели в одной строке. */
@media (max-width: 360px) {
  .hud-top-center { left: 6px; padding-inline: 5px; }
  .fuel-row { gap: 3px; }
  .fuel-name { width: 35px; font-size: 9px; }
  .fuel-bar { width: 45px; }
  .fuel-val { width: 42px; font-size: 9px; }
  .hud-bottom-right { right: 6px; gap: 2px; padding: 4px; }
  .speed-btn { width: 29px; height: 32px; font-size: 11px; }
  .hud-card.task .hud-icon { display: none; }
  #hud-task-text { font-size: 9px; letter-spacing: -.15px; }
}

/* Низкие горизонтальные экраны: освобождаем место над нижней панелью. */
@media (orientation: landscape) and (max-height: 620px) and (min-width: 761px) {
  .hud-top-left {
    top: 8px; left: 8px; gap: 5px;
    align-items: flex-start; width: min(190px, 23vw);
  }
  .hud-top-left .hud-card { width: 100%; min-width: 0; }
  #card-day { padding-right: 5px; }
  .hud-collapse { display: flex; }
  .hud-card {
    min-width: 130px; padding: 5px 8px; gap: 5px; font-size: 10px;
  }
  .hud-card .hud-icon { font-size: 19px; }
  .hud-big { font-size: 15px; }
  .mini-bar { width: 70px; height: 5px; }
  .hud-card.task { max-width: 200px; padding: 5px 8px; }
  #hud-task-text { font-size: 10px; line-height: 1.1; }
  .hud-task-progress { font-size: 10px; }
  .hud-task-reward { margin-top: 2px; padding: 2px 5px; font-size: 8px; white-space: nowrap; }
  .hud-top-right {
    top: 8px; right: 8px; gap: 5px;
    width: 196px; grid-template-columns: repeat(3, auto);
  }
  .menu-btn.hud-menu-collapse { display: flex; }
  .menu-btn {
    width: 62px; height: 48px; font-size: 8px;
  }
  .menu-btn span { font-size: 18px; margin-bottom: 0; }
  .hud-top-center {
    padding: 6px 8px; gap: 2px;
  }
  .fuel-row { gap: 5px; font-size: 10px; }
  .fuel-name { width: 48px; font-size: 10px; }
  .fuel-bar { width: 90px; height: 9px; }
  .fuel-val { width: 50px; font-size: 10px; }
  .hud-bottom-right {
    bottom: 8px; right: 8px; gap: 4px; padding: 5px;
  }
  .speed-btn { width: 36px; height: 34px; font-size: 13px; }
}

/* Итоги и другие модальные окна не выходят за пределы низкого экрана. */
@media (max-height: 620px) {
  #modal-overlay { padding: 8px; }
  #modal-window {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 15px;
  }
  #modal-header { padding: 10px 12px; font-size: 16px; }
  #modal-close { width: 30px; height: 30px; font-size: 14px; }
  #modal-body { padding: 10px 11px; }
  .panel-section { margin-bottom: 8px; }
  .panel-title { margin-bottom: 4px; font-size: 11px; }
  .report-grid { gap: 5px 8px; font-size: 12px; }
  .report-grid .r-label { min-width: 0; overflow-wrap: anywhere; }
  .report-details summary { font-size: 10px; }
  .report-details-grid { gap: 5px 8px; margin-top: 5px; padding: 7px 8px; }
  .report-auto-option { gap: 7px; margin-top: 8px; padding: 8px 9px; font-size: 10px; }
  .report-auto-option input { width: 16px; height: 16px; }
  .manager-automation {
    align-items: stretch; flex-direction: column; gap: 8px;
  }
  .manager-automation button {
    width: 100%; min-width: 0; padding: 8px 9px;
    white-space: normal; line-height: 1.2;
  }
  .upg-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(68px, 38%);
    grid-template-rows: auto auto auto;
    align-items: start; gap: 7px 8px; padding: 10px;
  }
  .upg-item .upg-icon { grid-column: 1; grid-row: 1 / -1; width: 34px; font-size: 24px; align-self: center; }
  .upg-item .upg-info { display: contents; }
  .upg-item .upg-name { grid-column: 2; grid-row: 1; min-width: 0; }
  .upg-item .upg-buy {
    grid-column: 3; grid-row: 1; width: 100%; min-width: 0;
    margin: 0; padding: 8px 6px; font-size: 10px;
    line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere;
  }
  .upg-item .upg-desc { grid-column: 2 / -1; grid-row: 2; }
  .upg-item .upg-level { grid-column: 2 / -1; grid-row: 3; }
}

/* Главное меню на мобильном экране в горизонтальной ориентации. */
@media (orientation: landscape) and (max-height: 620px) {
  #main-menu {
    align-items: center; justify-content: flex-end;
    padding: 10px clamp(10px, 2vw, 28px);
    background-position: center top;
  }
  #main-menu::before {
    background:
      linear-gradient(90deg, rgba(4, 20, 14, .02) 18%, rgba(4, 20, 14, .2) 52%, rgba(4, 20, 14, .8) 100%),
      linear-gradient(0deg, rgba(4, 20, 14, .3), transparent 55%);
  }
  .main-menu-panel {
    width: min(340px, 44vw);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    padding: 12px 14px;
    border-radius: 15px;
  }
  .main-menu-kicker { font-size: 8px; letter-spacing: 1.5px; margin-bottom: 4px; }
  .main-menu-heading { font-size: clamp(22px, 3.4vw, 29px); line-height: .95; }
  .main-menu-heading.small { font-size: 20px; }
  .main-menu-copy { margin-top: 6px; font-size: 9px; line-height: 1.22; }
  .main-menu-copy.warning { padding: 9px; }
  .main-menu-actions { gap: 5px; margin-top: 8px; }
  .main-menu-actions.compact { margin-top: 8px; }
  .main-menu-btn {
    min-height: 36px; gap: 7px; padding: 6px 9px;
    border-radius: 10px; font-size: 10px;
  }
  .main-menu-btn.primary { min-height: 42px; }
  .main-menu-btn > span:first-child { width: 20px; flex-basis: 20px; font-size: 15px; }
  .main-menu-btn small { margin-top: 1px; font-size: 7px; }
  .main-menu-secondary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .main-menu-secondary-row .main-menu-btn { min-width: 0; min-height: 36px; font-size: 8px; }
  .main-menu-secondary-row .main-menu-btn small { display: none; }
  .main-menu-credit { display: none; }
  .menu-setting-row { gap: 8px; margin-top: 9px; padding: 9px; }
  .menu-setting-row b { font-size: 10px; }
  .menu-setting-row small { font-size: 8px; }
  .menu-toggle, .menu-segment button { padding: 7px 8px; font-size: 8px; }
  #menu-settings-back, #menu-leaderboard-back { margin-top: 9px; min-height: 38px; }
  .leaderboard-menu-content { margin-top: 9px; max-height: 190px; }
  .leaderboard-capital { padding: 8px 10px; margin-bottom: 6px; }
  .leaderboard-capital small, .leaderboard-note { font-size: 8px; }
  .leaderboard-capital b { font-size: 17px; }
  .leaderboard-row { gap: 5px; padding: 6px 7px; }
  .leaderboard-rank, .leaderboard-name, .leaderboard-score { font-size: 9px; }
}

/* Вертикальная иллюстрация для главного меню на мобильных телефонах. */
@media (orientation: portrait) and (max-width: 760px) {
  #main-menu {
    background-image: url('assets/main-menu-bg-portrait.png');
    background-position: center top;
    background-size: cover;
  }
}

/* Горизонтальный фон заполняет экран; лишняя часть обрезается только снизу. */
@media (orientation: landscape) {
  #main-menu {
    background-position: left top;
    background-size: cover;
    background-repeat: no-repeat;
  }
}

/* На компьютере отводим панели правую часть, не перекрывая логотип. */
@media (orientation: landscape) and (hover: hover) and (pointer: fine) {
  #main-menu { padding-right: clamp(16px, 2vw, 32px); }
  .main-menu-panel { width: min(350px, 32vw); }
}

/* Компактная панель режима стройки: не заходит под HUD слева и меню справа. */
#build-bar {
  gap: 8px;
  max-width: min(560px, calc(100vw - 460px));
  padding: 8px 10px;
  font-size: 12px;
}
#build-bar > span {
  min-width: 0;
  max-width: 240px;
  line-height: 1.15;
  text-align: center;
}
#build-exit, #build-catalog {
  flex: 0 0 auto;
  padding: 8px 13px;
  font-size: 12px;
  white-space: nowrap;
}

@media (orientation: landscape) and (max-width: 1100px) {
  #build-bar {
    max-width: calc(100vw - 360px);
  }
  #build-bar > span {
    max-width: 180px;
  }
}

@media (max-width: 760px) {
  #build-bar {
    max-width: calc(100vw - 16px);
    gap: 6px;
    padding: 7px 8px;
  }
  #build-exit, #build-catalog {
    padding: 8px 10px;
    font-size: 10px;
  }
}

@media (max-width: 760px) {
  html[lang="en"] #btn-ads .menu-btn-label { display: none; }
  html[lang="en"] #btn-ads::after {
    content: 'AD';
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .5px;
  }
}

/* Английские обложки главного меню. Русские варианты остаются базовыми. */
html[lang="en"] #main-menu {
  background-image: url('assets/main-menu-bg-en.png');
}

@media (orientation: portrait) and (max-width: 760px) {
  html[lang="en"] #main-menu {
    background-image: url('assets/main-menu-bg-portrait-en.png');
  }
}
