/* STAHLFRONT 2045 – global stylesheet (menus, in-game HUD, research tree).
   Dark translucent sci-fi panels, thin steel/cyan borders, angled corners (StarCraft-2-like). */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
  --bg: rgba(8, 14, 22, 0.82);
  --bg-solid: #080e16;
  --bg-2: rgba(16, 28, 40, 0.88);
  --bg-3: rgba(24, 42, 58, 0.92);
  --line: #2c4a5e;
  --line-2: #3d6880;
  --hi: #5ff2ff;
  --hi-dim: rgba(95, 242, 255, 0.35);
  --text: #d8e6f0;
  --text-dim: #8fa8bb;
  --ok: #3ddc84;
  --warn: #ffc21a;
  --bad: #ff5050;
  --font: 'Rajdhani', 'Segoe UI', sans-serif;
  --cut: 10px;
  --cut-s: 6px;
  --slot: 58px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #000; color: var(--text);
  font-family: var(--font); font-size: 15px;
  user-select: none; -webkit-user-select: none;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }

#boot {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-solid); color: var(--hi); z-index: 50;
  font-size: 26px; font-weight: 700; letter-spacing: 4px; text-transform: uppercase;
  text-shadow: 0 0 12px var(--hi-dim);
}

h1, h2, h3, h4 { font-family: var(--font); text-transform: uppercase; letter-spacing: 1.5px; margin: 0 0 10px; color: var(--hi); font-weight: 700; }

/* ---------- generic building blocks ---------- */
.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  box-shadow: inset 0 0 18px rgba(95, 242, 255, 0.06);
  pointer-events: auto;
}

.btn, button {
  font-family: var(--font);
}
.btn {
  display: inline-block;
  background: linear-gradient(180deg, rgba(36, 62, 80, 0.9), rgba(16, 28, 40, 0.92));
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 8px 18px; margin: 4px;
  font-size: 15px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  cursor: pointer; pointer-events: auto;
  clip-path: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s));
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--hi); color: #fff; background: linear-gradient(180deg, rgba(50, 96, 120, 0.95), rgba(22, 44, 60, 0.95)); box-shadow: 0 0 12px var(--hi-dim); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn.active, .btn.selected { border-color: var(--hi); color: var(--hi); box-shadow: 0 0 10px var(--hi-dim); }
.btn.primary { border-color: var(--hi); color: var(--hi); }
.btn.danger { border-color: #8a3030; background: linear-gradient(180deg, rgba(110, 30, 30, 0.9), rgba(50, 14, 14, 0.92)); }
.btn.danger:hover { border-color: var(--bad); box-shadow: 0 0 12px rgba(255, 80, 80, 0.4); }

select, input, textarea {
  font-family: var(--font); font-size: 15px;
  background: rgba(10, 20, 30, 0.9); color: var(--text);
  border: 1px solid var(--line); padding: 6px 8px; outline: none;
  pointer-events: auto;
}
select:focus, input:focus, textarea:focus { border-color: var(--hi); box-shadow: 0 0 8px var(--hi-dim); }
input[type="range"] { padding: 0; accent-color: var(--hi); background: transparent; border: none; box-shadow: none; }
input[type="checkbox"] { accent-color: var(--hi); width: auto; }
label { color: var(--text-dim); }

/* ---------- menus (src/ui/menus.js) ---------- */
.menu-screen {
  position: fixed; inset: 0; overflow-y: auto; padding: 40px 20px 60px;
  text-align: center; pointer-events: auto; z-index: 10;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(40, 90, 120, 0.35), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(44, 74, 94, 0.12) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(44, 74, 94, 0.12) 19px 20px),
    #060b11;
}
.title {
  font-size: 54px; letter-spacing: 8px; margin: 10px 0 8px; color: #e8fbff;
  text-shadow: 0 0 18px rgba(95, 242, 255, 0.6), 0 0 2px #fff;
}
.subtitle { color: var(--text-dim); letter-spacing: 1.5px; margin: 0 0 24px; }
.menu-card {
  display: block; max-width: 760px; margin: 0 auto 18px; padding: 18px 22px; text-align: left;
  background: var(--bg); border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.menu-card h2 { font-size: 18px; margin: 12px 0 8px; }
.menu-card h2:first-child { margin-top: 0; }
#profile-badge { display: flex; gap: 24px; justify-content: center; max-width: 420px; }
.menu-buttons { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.menu-buttons .btn { min-width: 300px; font-size: 18px; padding: 10px 24px; }
.difficulty-buttons, .operation-buttons, .campaign-buttons, .lobby-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.settings-group, .slider-container, .checkbox-container, .map-settings { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.slider-container input[type="range"] { flex: 1; min-width: 160px; }
.unlock-item { padding: 6px 10px; margin: 4px 0; border-left: 2px solid var(--line-2); background: var(--bg-2); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 8px 16px; cursor: pointer; border-bottom: 2px solid transparent; text-transform: uppercase; letter-spacing: 1px; }
.tab.active { border-bottom-color: var(--hi); color: var(--hi); }
.lobby-list { display: flex; flex-direction: column; gap: 6px; }
.lobby-item { padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; }
.lobby-item:hover { border-color: var(--hi); box-shadow: 0 0 8px var(--hi-dim); }
.end-screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(6, 10, 16, 0.95); z-index: 30; pointer-events: auto; }
.end-stats { background: var(--bg); border: 1px solid var(--line); padding: 20px; width: 520px; max-width: 94vw; }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.stats-table tr:last-child td { border-bottom: none; }
.toasts { position: fixed; top: 60px; right: 12px; z-index: 30; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg); border: 1px solid var(--line); padding: 8px 12px; animation: sf-toast 4s forwards; }
@keyframes sf-toast { 0%, 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ---------- in-game HUD (src/ui/hud.js) ---------- */
.game-ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#selbox { position: fixed; border: 1px solid var(--ok); background: rgba(61, 220, 132, 0.12); pointer-events: none; z-index: 4; }

/* top-left: menu buttons + speed */
.hud-menubar {
  position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; align-items: center; padding: 4px 6px;
}
.hud-mbtn {
  background: linear-gradient(180deg, rgba(36, 62, 80, 0.9), rgba(14, 24, 34, 0.92));
  border: 1px solid var(--line-2); color: var(--text); cursor: pointer; pointer-events: auto;
  font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; height: 28px;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.hud-mbtn:hover { border-color: var(--hi); color: #fff; box-shadow: 0 0 8px var(--hi-dim); }
.hud-mbtn.on { border-color: var(--warn); color: var(--warn); }
.hud-mbtn:disabled { opacity: 0.4; cursor: default; }
.hud-speed { font-size: 14px; font-weight: 700; color: var(--hi); min-width: 42px; text-align: center; }

/* objectives under the menu bar */
.hud-obj { position: absolute; top: 50px; left: 8px; width: 300px; padding: 8px 12px 10px; }
.hud-obj h4 { font-size: 13px; margin: 0 0 6px; }
.obj-item { display: flex; gap: 6px; font-size: 14px; line-height: 1.25; margin: 3px 0; }
.obj-item .box { width: 14px; flex: none; font-size: 14px; color: var(--hi); }
.obj-item.done { color: var(--ok); }
.obj-item.done .box { color: var(--ok); }
.obj-item.done .txt { text-decoration: line-through; opacity: 0.8; }
.obj-item.failed { color: var(--bad); }
.obj-item.failed .box { color: var(--bad); }
.obj-item .opt { color: var(--text-dim); font-size: 12px; }

/* top-right: resource bar */
.hud-top {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 2px; padding: 4px 10px 4px 14px;
}
.res-item { display: flex; align-items: center; gap: 5px; padding: 2px 7px; border-right: 1px solid rgba(44, 74, 94, 0.6); cursor: default; }
.res-item:last-child { border-right: none; }
.res-icon { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.res-svg { display: block; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6)); }
.res-amount { font-size: 17px; font-weight: 700; color: #fff; min-width: 34px; font-variant-numeric: tabular-nums; }
.res-income { font-size: 11px; color: var(--ok); font-variant-numeric: tabular-nums; }
.res-income.zero { color: var(--text-dim); }
.res-item.bad .res-amount { color: var(--bad); }
.res-item.short .res-amount { color: var(--warn); }
.hud-clock { display: flex; flex-direction: column; align-items: flex-end; padding-left: 8px; line-height: 1; min-width: 74px; }
.hud-clock .season { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--hi); }
.hud-clock .time { font-size: 17px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.hud-clock .sbar { width: 70px; height: 2px; background: rgba(95, 242, 255, 0.15); margin-top: 3px; }
.hud-clock .sbar i { display: block; height: 100%; background: var(--hi); }

/* bottom-left: minimap (canvas sized by CSS; Minimap reads clientWidth) */
#minimap-wrap { position: absolute; left: 8px; bottom: 8px; width: 236px; height: 236px; padding: 7px; }
#minimap { display: block; width: 220px; height: 220px; background: #05090d; cursor: crosshair; image-rendering: pixelated; }

/* messages above the minimap */
.hud-msgs { position: absolute; left: 10px; bottom: 256px; width: 520px; max-width: 46vw; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
/* chat line under the messages (Enter) */
.hud-chat { position: absolute; left: 10px; bottom: 256px; width: 520px; max-width: 46vw; display: none; align-items: center; gap: 8px;
  padding: 4px 8px; background: rgba(4, 8, 12, 0.85); border: 1px solid rgba(95, 242, 255, 0.55); box-shadow: 0 0 12px rgba(95, 242, 255, 0.25); }
.hud-chat.open { display: flex; }
.hud-msgs.chatting { bottom: 294px; }
.hud-chat .chat-to { color: #5ff2ff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.hud-chat input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font: inherit; font-size: 15px; font-weight: 600; }
.msg-item {
  font-size: 15px; font-weight: 600; padding: 2px 8px; background: rgba(4, 8, 12, 0.55); border-left: 2px solid currentColor;
  text-shadow: 0 1px 2px #000; animation: sf-msg-in 0.25s ease-out; width: fit-content; max-width: 100%;
}
.msg-item.old { opacity: 0.5; }
@keyframes sf-msg-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* mode hint (placement / target selection) */
.hud-hint {
  position: absolute; left: 50%; top: 56px; transform: translateX(-50%); padding: 5px 16px; font-size: 15px; font-weight: 600;
  color: var(--warn); letter-spacing: 1px; pointer-events: none; display: none;
}
.hud-hint.show { display: block; }

/* pause banner */
.hud-paused { position: absolute; left: 50%; top: 32%; transform: translateX(-50%); font-size: 40px; font-weight: 700; letter-spacing: 10px; color: #fff; text-shadow: 0 0 18px var(--hi); display: none; pointer-events: none; }
.hud-paused.show { display: block; }

/* bottom-center: selection panel */
.hud-sel {
  position: absolute; bottom: 8px; left: 256px; right: 336px; max-width: 640px; margin: 0 auto;
  height: 196px; padding: 10px 14px; overflow: hidden;
}
.hud-sel.empty { opacity: 0.55; }
.sel-empty { color: var(--text-dim); font-size: 14px; text-align: center; margin-top: 70px; letter-spacing: 1px; text-transform: uppercase; }
.sel-single { display: flex; gap: 14px; height: 100%; }
.sel-portrait { width: 92px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sel-portrait .ico { width: 84px; height: 84px; font-size: 30px; }
.sel-hptxt { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.sel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sel-name { font-size: 20px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 1.5px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-sub { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.sel-stats { display: grid; grid-template-columns: repeat(5, auto); gap: 1px 12px; justify-content: start; font-size: 13px; }
.sel-stats .k { color: var(--text-dim); font-size: 11px; text-transform: uppercase; display: block; }
.sel-stats .v { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.sel-stats .v .bonus { color: var(--ok); font-size: 11px; margin-left: 2px; }
.sel-desc { font-size: 13px; color: var(--text-dim); line-height: 1.2; max-height: 32px; overflow: hidden; }
.sel-extra { font-size: 13px; color: var(--text); }
.sel-workers { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.sel-workers .k { color: var(--dim, #8a9aa8); }
.sel-workers b { color: #fff; font-size: 15px; }
.sel-workers .pips { display: flex; gap: 3px; flex-wrap: wrap; }
.sel-workers .pips i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #5ff2ff88; background: transparent; }
.sel-workers .pips i.on { background: #5ff2ff; box-shadow: 0 0 5px #5ff2ff; }
.mine-label { position: absolute; transform: translate(-50%, -100%); pointer-events: none; padding: 2px 7px; border-radius: 4px;
  background: #0b1016cc; border: 1px solid #5ff2ff88; color: #e8f6ff; font: 600 13px/1.3 system-ui, sans-serif; white-space: nowrap; z-index: 5; }
.mine-label.full { border-color: #3ddc84; color: #3ddc84; }
/* construction progress: label background fills up with --p */
.mine-label.site { border-color: #f2c21b99; color: #fff3cf;
  background: linear-gradient(90deg, #f2c21b55 var(--p, 0%), #0b1016cc var(--p, 0%)); }
.mine-label.site.idle { border-color: #ff6b5a99; color: #ffd0c8; }
.sel-extra .warn { color: var(--warn); }
.sel-extra .bad { color: var(--bad); }
.sel-queue { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.q-item { position: relative; width: 38px; height: 38px; cursor: pointer; pointer-events: auto; }
.q-item .ico { width: 38px; height: 38px; font-size: 12px; }
.q-item:hover .ico { border-color: var(--bad); box-shadow: 0 0 8px rgba(255, 80, 80, 0.5); }
.q-item .qp { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--hi); }
.q-item .qn { position: absolute; right: 2px; top: 0; font-size: 10px; color: #fff; text-shadow: 0 0 2px #000; }
.q-item.blocked .ico { border-color: var(--bad); }
.q-item.first { width: 46px; height: 46px; }
.q-item.first .ico { width: 46px; height: 46px; }

.bar { height: 6px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); width: 100%; }
.bar > i { display: block; height: 100%; background: var(--ok); transition: width 0.12s linear; }
.bar.mid > i { background: var(--warn); }
.bar.low > i { background: var(--bad); }
.bar.prog > i { background: var(--hi); }

.sel-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-content: start; }
.sel-cell { cursor: pointer; pointer-events: auto; display: flex; flex-direction: column; gap: 1px; }
.sel-cell .ico { width: 100%; height: 34px; font-size: 11px; }
.sel-cell .bar { height: 3px; }
.sel-cell:hover .ico { border-color: var(--hi); box-shadow: 0 0 6px var(--hi-dim); }
.sel-more { grid-column: span 12; font-size: 12px; color: var(--text-dim); text-align: right; }

/* unit/building icon glyph */
.ico {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(40, 70, 92, 0.95), rgba(12, 22, 32, 0.95));
  border: 1px solid var(--line-2); color: #fff; line-height: 1; overflow: hidden;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.ico .g { font-size: 1.2em; opacity: 0.9; }
.ico .ini { font-size: 0.85em; font-weight: 700; letter-spacing: 0.5px; margin-top: 1px; }
.ico .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
/* rendered unit pictures (render/portraits.js) */
.ico.has-pic { padding: 0; overflow: hidden; }
.ico .pic { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.cmd-btn .g .pic { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.cmd-btn.has-pic .g { position: absolute; left: 1px; right: 1px; top: 1px; bottom: 11px; text-shadow: none; }
.cmd-btn.has-pic .lbl { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 9px; margin: 0; -webkit-line-clamp: 1; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.cmd-btn.has-pic .hk, .cmd-btn.has-pic .era, .cmd-btn.has-pic .cnt { z-index: 1; text-shadow: 0 0 3px #000; }

/* bottom-right: command card 5×3 */
.hud-cmd {
  position: absolute; right: 8px; bottom: 8px; padding: 9px;
  display: grid; grid-template-columns: repeat(5, var(--slot)); grid-template-rows: repeat(3, var(--slot)); gap: 4px;
}
.cmd-slot { width: var(--slot); height: var(--slot); border: 1px dashed rgba(44, 74, 94, 0.45); }
.cmd-btn {
  position: relative; width: var(--slot); height: var(--slot); padding: 0; cursor: pointer; pointer-events: auto;
  background: linear-gradient(160deg, rgba(40, 72, 94, 0.95), rgba(10, 20, 30, 0.95));
  border: 1px solid var(--line-2); color: #fff; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: border-color 0.1s, box-shadow 0.1s, background 0.1s;
}
.cmd-btn:hover { border-color: var(--hi); box-shadow: inset 0 0 14px rgba(95, 242, 255, 0.35); background: linear-gradient(160deg, rgba(56, 104, 132, 0.98), rgba(16, 32, 46, 0.98)); }
.cmd-btn:active, .cmd-btn.flash { background: rgba(95, 242, 255, 0.35); }
.cmd-btn .g { font-size: 22px; line-height: 1; color: var(--hi); text-shadow: 0 0 6px var(--hi-dim); }
.cmd-btn .lbl { font-size: 10px; font-weight: 600; line-height: 1.05; text-transform: uppercase; text-align: center; padding: 0 2px; margin-top: 2px; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cmd-btn .hk { position: absolute; left: 3px; top: 1px; font-size: 11px; font-weight: 700; color: var(--warn); }
.cmd-btn .cnt { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 0 2px #000; }
.cmd-btn .era { position: absolute; right: 3px; top: 1px; font-size: 10px; color: var(--text-dim); }
.cmd-btn.tab { background: linear-gradient(160deg, rgba(30, 46, 58, 0.95), rgba(8, 14, 20, 0.95)); }
.cmd-btn.tab .lbl { font-size: 11px; }
.cmd-btn.tab.active { border-color: var(--hi); box-shadow: inset 0 0 12px rgba(95, 242, 255, 0.4); }
.cmd-btn.tab.active .lbl { color: var(--hi); }
.cmd-btn.research .g { color: #b88cff; text-shadow: 0 0 6px rgba(184, 140, 255, 0.5); }
.cmd-btn.unit .g { color: #9fe8ff; }
.cmd-btn.disabled { filter: grayscale(0.85); opacity: 0.55; cursor: not-allowed; }
/* cooldown: dark remaining part with a bright edge line moving right to left, seconds at the bottom center */
.cmd-btn.cooling { opacity: 1; filter: none; }
.cmd-btn.cooling .g, .cmd-btn.cooling .lbl { filter: grayscale(0.85); opacity: 0.6; }
.cmd-btn .cd { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: rgba(2, 8, 14, 0.62); border-right: 2px solid #5ff2ff;
  box-shadow: 2px 0 8px rgba(95, 242, 255, 0.75); pointer-events: none; z-index: 2; transition: width 0.12s linear; }
.cmd-btn .cd-t { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: 13px; font-weight: 800; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 2px #000; pointer-events: none; z-index: 3; }
.cmd-btn.disabled:hover { border-color: var(--line-2); box-shadow: none; }
.cmd-btn.poor .lbl { color: var(--bad); }
.cmd-btn.armed { border-color: var(--warn); box-shadow: inset 0 0 14px rgba(255, 194, 26, 0.45); }

/* tooltip */
.hud-tip {
  position: fixed; z-index: 40; max-width: 320px; min-width: 200px; padding: 8px 12px; pointer-events: none; display: none;
  background: rgba(6, 12, 18, 0.95); border: 1px solid var(--hi); box-shadow: 0 0 14px rgba(95, 242, 255, 0.25);
  font-size: 13px; line-height: 1.3; color: var(--text);
}
.hud-tip.show { display: block; }
.tip-name { font-size: 16px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 1px; }
.tip-hk { color: var(--warn); font-size: 12px; margin-left: 6px; }
.tip-cost { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0; font-weight: 700; }
.tip-cost .c { display: inline-flex; align-items: center; gap: 4px; }
.tip-cost .c i { width: 9px; height: 9px; display: inline-block; transform: rotate(45deg); border: 1px solid rgba(255, 255, 255, 0.45); }
.tip-cost .c.no { color: var(--bad); }
.tip-time { color: var(--text-dim); }
.tip-desc { color: var(--text-dim); margin-top: 4px; font-style: italic; }
.tip-stats { display: grid; grid-template-columns: auto auto; gap: 0 12px; margin-top: 4px; }
.tip-stats span:nth-child(odd) { color: var(--text-dim); }
.tip-eff { color: var(--ok); margin-top: 3px; }
.tip-req { color: var(--bad); margin-top: 4px; font-weight: 600; }
.tip-note { color: var(--hi); margin-top: 4px; font-size: 12px; }

/* in-game menu (F10) */
.hud-menu-back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); pointer-events: auto; display: none; align-items: center; justify-content: center; z-index: 20; }
.hud-menu-back.show { display: flex; }
.hud-menu { width: 340px; padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 6px; }
.hud-menu h3 { text-align: center; margin-bottom: 8px; }
.hud-menu .btn { margin: 0; width: 100%; }
.hud-menu .vol { display: grid; grid-template-columns: 90px 1fr 38px; align-items: center; gap: 8px; font-size: 14px; }
.hud-menu .vol span:last-child { text-align: right; color: var(--hi); font-variant-numeric: tabular-nums; }
.hud-menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.hud-menu .note { font-size: 12px; color: var(--text-dim); text-align: center; }

/* ---------- research tree (src/ui/research_tree.js) ---------- */
.rt-overlay {
  position: absolute; inset: 0; z-index: 15; pointer-events: auto; display: none; flex-direction: column;
  background: rgba(3, 7, 11, 0.93);
  padding: 14px 18px 12px;
}
.rt-overlay.show { display: flex; }
.rt-header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.rt-header h2 { margin: 0; font-size: 24px; letter-spacing: 3px; }
.rt-count { color: var(--text-dim); font-size: 14px; }
.rt-search { width: 260px; }
.rt-legend { display: flex; gap: 12px; font-size: 13px; color: var(--text-dim); margin-left: auto; }
.rt-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; border: 1px solid currentColor; }
.rt-legend .l-done { color: var(--ok); }
.rt-legend .l-avail { color: var(--hi); }
.rt-legend .l-busy { color: var(--warn); }
.rt-legend .l-locked { color: #6c7a86; }
.rt-close { width: 34px; height: 34px; font-size: 18px; padding: 0; margin: 0; }
.rt-scroll { flex: 1; overflow: auto; border: 1px solid var(--line); background: rgba(8, 14, 22, 0.6); }
.rt-grid { display: grid; grid-template-columns: 128px repeat(4, minmax(200px, 1fr)); min-width: 980px; }
.rt-colhead {
  position: sticky; top: 0; z-index: 2; padding: 8px; text-align: center; font-weight: 700; font-size: 16px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--hi); background: rgba(10, 20, 30, 0.97); border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line);
}
.rt-colhead:first-child { border-left: none; }
.rt-rowhead {
  padding: 10px 8px; font-weight: 700; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text);
  border-top: 1px solid var(--line); background: rgba(16, 28, 40, 0.6); writing-mode: horizontal-tb;
}
.rt-rowhead small { display: block; color: var(--text-dim); font-weight: 500; font-size: 12px; letter-spacing: 0.5px; }
.rt-cell { border-top: 1px solid var(--line); border-left: 1px solid rgba(44, 74, 94, 0.5); padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.rt-card {
  position: relative; padding: 6px 8px 7px 10px; cursor: default; background: rgba(14, 22, 30, 0.95);
  border: 1px solid #34424e; border-left-width: 3px;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  transition: box-shadow 0.12s, border-color 0.12s, background 0.12s;
}
.rt-card .n { font-weight: 700; font-size: 14px; color: #fff; line-height: 1.1; text-transform: uppercase; letter-spacing: 0.5px; }
.rt-card .fx { font-size: 12px; color: var(--ok); line-height: 1.2; margin-top: 2px; }
.rt-card .meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; margin-top: 3px; color: var(--text-dim); }
.rt-card .meta .c { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.rt-card .meta .c i { width: 7px; height: 7px; display: inline-block; transform: rotate(45deg); border: 1px solid rgba(255, 255, 255, 0.4); }
.rt-card .meta .c.no { color: var(--bad); }
.rt-card .st { position: absolute; right: 8px; top: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.rt-card .pb { height: 3px; margin-top: 4px; background: rgba(255, 194, 26, 0.18); display: none; }
.rt-card .pb i { display: block; height: 100%; background: var(--warn); }
.rt-card.done { border-color: rgba(61, 220, 132, 0.6); border-left-color: var(--ok); background: rgba(14, 40, 26, 0.9); }
.rt-card.done .st { color: var(--ok); }
.rt-card.avail { border-color: rgba(95, 242, 255, 0.55); border-left-color: var(--hi); cursor: pointer; }
.rt-card.avail .st { color: var(--hi); }
.rt-card.avail:hover { box-shadow: 0 0 14px rgba(95, 242, 255, 0.4); background: rgba(24, 48, 62, 0.95); }
.rt-card.busy { border-color: rgba(255, 194, 26, 0.6); border-left-color: var(--warn); background: rgba(44, 36, 10, 0.9); }
.rt-card.busy .st { color: var(--warn); }
.rt-card.busy .pb { display: block; }
.rt-card.locked { opacity: 0.55; filter: grayscale(0.7); }
.rt-card.locked .st { color: #8a96a0; }
.rt-card.poor .st { color: var(--bad); }
.rt-card.hidden { display: none; }
.rt-empty { color: #4a5a66; font-size: 12px; text-align: center; padding-top: 6px; }
.rt-tip { position: fixed; z-index: 41; }
.rt-foot { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(8, 14, 22, 0.8); }
::-webkit-scrollbar-thumb { background: var(--line-2); }
::-webkit-scrollbar-thumb:hover { background: var(--hi); }

/* smaller screens */
@media (max-width: 1500px) {
  .hud-top .res-income { display: none; }
  .res-item { padding: 2px 5px; }
}
@media (max-width: 1280px) {
  :root { --slot: 50px; }
  .hud-sel { left: 250px; right: 296px; height: 176px; }
  .sel-stats { grid-template-columns: repeat(4, auto); }
  .hud-obj { width: 240px; }
  .hud-top .res-income { display: none; }
}
@media (max-width: 1100px) {
  .hud-top { top: 44px; }
}
@media (max-width: 960px) {
  :root { --slot: 46px; }
  .hud-sel { display: none; }
  .hud-msgs { max-width: 60vw; bottom: 200px; }
  .hud-chat { max-width: 60vw; bottom: 200px; }
  .hud-msgs.chatting { bottom: 238px; }
  .hud-top { left: 8px; flex-wrap: wrap; justify-content: flex-end; top: 44px; padding: 2px 6px; }
  .hud-top .res-income { display: none; }
  .res-item { padding: 1px 4px; }
  .res-amount { font-size: 14px; min-width: 0; }
  .hud-obj { top: 96px; width: 200px; }
  #minimap-wrap { width: 166px; height: 166px; }
  #minimap { width: 150px; height: 150px; }
  .rt-header { gap: 8px; }
  .rt-legend { display: none; }
}
/* cover shield over infantry (game.js _updateCoverIcons) */
.cover-icon { position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 4; line-height: 0; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.8)); }
.cover-icon path { stroke: #0b1016; stroke-width: 1.4; stroke-linejoin: round; }
.cover-icon .ci-mark { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1.6; fill: none; }
.cover-icon.heavy path:first-child { fill: #3ddc84; }
.cover-icon.light path:first-child { fill: #ffa53a; }
.cover-icon.none path:first-child { fill: #ff4d4d; }
.cover-icon.none { opacity: 0.8; }
/* selection panel: combat line (damage type, targets, strengths / weaknesses) and cover state */
.sel-combat { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--text); }
.sel-combat .good { color: var(--ok); }
.sel-combat .bad { color: var(--bad); }
.sel-stats .cov0 { color: #ff6b5a; } .sel-stats .cov1 { color: #ffa53a; } .sel-stats .cov2 { color: #3ddc84; }
.sel-hptxt .k { color: var(--text-dim); font-size: 11px; }
/* low / empty ammo marker over own units (game.js _updateCoverIcons) */
.ammo-icon { position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 4; line-height: 0; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.85)); }
.ammo-icon path { stroke: #0b1016; stroke-width: 1.2; }
.ammo-icon.low path { fill: #ffa53a; }
.ammo-icon.empty path { fill: #ff4d4d; }
.ammo-icon.empty { animation: ammo-blink 1s steps(2, start) infinite; }
@keyframes ammo-blink { 50% { opacity: 0.35; } }

/* developer window (ui/devpanel.js) */
.devpanel { position: absolute; top: 44px; left: 8px; width: 330px; padding: 10px 12px 12px; z-index: 30; font-size: 13px; color: var(--text); pointer-events: auto; max-height: calc(100vh - 300px); overflow-y: auto; }
.devpanel .dev-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--hi); letter-spacing: 1px; text-transform: uppercase; }
.devpanel .dev-hint { color: var(--text-dim); font-size: 11px; }
.devpanel .dev-x { margin-left: auto; background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.devpanel .dev-x:hover { color: #fff; }
.devpanel .dev-sec { margin: 10px 0 4px; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--line); }
.devpanel .dev-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.devpanel .btn { padding: 3px 8px; font-size: 12px; }
.devpanel .dev-danger { border-color: #a33; color: #ff8a80; }
.devpanel .dev-chk { display: flex; align-items: center; gap: 6px; margin: 3px 0; cursor: pointer; }
.devpanel select, .devpanel input[type=number] { background: var(--bg-solid); color: var(--text); border: 1px solid var(--line); padding: 3px; font: inherit; }
.devpanel .dev-unit { width: 100%; }
.devpanel .dev-n { width: 56px; }
@media (max-width:1100px){.devpanel{top:92px}}
