@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(../fonts/russo-one-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(../fonts/russo-one-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+2212; }
@font-face { font-family: 'Exo 2'; font-weight: 400; font-display: swap; src: url(../fonts/exo-2-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Exo 2'; font-weight: 400; font-display: swap; src: url(../fonts/exo-2-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+2212; }
@font-face { font-family: 'Exo 2'; font-weight: 600; font-display: swap; src: url(../fonts/exo-2-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Exo 2'; font-weight: 600; font-display: swap; src: url(../fonts/exo-2-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+2212; }
@font-face { font-family: 'Exo 2'; font-weight: 800; font-display: swap; src: url(../fonts/exo-2-cyrillic-800-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Exo 2'; font-weight: 800; font-display: swap; src: url(../fonts/exo-2-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+2212; }

:root {
  --bg: #d5e5f4;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --line: #dde2e9;
  --line-2: #c3cad4;
  --accent: #2f8fe8;
  --accent-d: #1a5aa3;
  --ink: #1d2533;
  --gold: #d99a12;
  --violet: #8a5ad8;
  --text: #1d2533;
  --muted: #6b7584;
  --danger: #e03a5c;
  --good: #1faf7c;
  --r: 10px;
  --surface: #ffffff;
  --track: #e6eaf0;
  --track-2: #cfd5de;
  --disabled: #c3cad4;
  --gold-soft: #fff6df;
  --bg-rgb: 213,229,244;
  --text-2: #3d4757;
  --good-d: #1a8a5f;
  --gold-d: #8a6006;
  --cut: 12px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: 'Exo 2', system-ui, sans-serif; font-weight: 600;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#c { position: fixed; inset: 0; display: block; touch-action: none; }
canvas { display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h2, h3, .logo, .kicker, b.num { font-family: 'Russo One', 'Exo 2', sans-serif; font-weight: 400; letter-spacing: .04em; }

/* скошенные углы — фирменная форма интерфейса */
.cut { clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }

/* ============ экраны ============ */
#menuShade { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(var(--bg-rgb),.55), rgba(var(--bg-rgb),.15) 35%, rgba(var(--bg-rgb),.15) 65%, rgba(var(--bg-rgb),.7)); opacity: 0; transition: opacity .4s; z-index: 1; }
body.in-menu #menuShade { opacity: 1; }
.screen {
  position: fixed; inset: 0; z-index: 10; display: none; flex-direction: column; align-items: center;
  padding: 12px calc(16px + var(--safe-r)) 16px calc(16px + var(--safe-l)); overflow-y: auto; overflow-x: hidden; touch-action: pan-y;
}
.screen::-webkit-scrollbar { width: 0; height: 0; }
.screen.active { display: flex; animation: scrIn .28s ease both; }
.screen.dim { background: rgba(29,37,51,.42); justify-content: center; }
@keyframes scrIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.topbar { width: 100%; max-width: 1100px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; min-height: 44px; flex: none; }
.topbar h2 { font-size: clamp(20px, 3vw, 28px); text-transform: uppercase; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; background: var(--panel); border: 1px solid var(--line); font-size: 17px; justify-self: end; }
.chip .ico { color: var(--gold); font-size: 20px; }
.chip b { font-family: 'Russo One'; font-weight: 400; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line); padding: clamp(14px, 2.2vw, 24px); width: 100%; max-width: 1100px; margin: 10px 0 auto;
  box-shadow: 0 6px 22px rgba(29,37,51,.12); border-radius: 14px;
  position: relative;
}
.panel.narrow { max-width: 480px; }
.panel.center { display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center; margin: auto 0; }
.panel h2 { font-size: 26px; text-transform: uppercase; }
.hint { color: var(--muted); font-size: 15px; font-weight: 400; line-height: 1.45; }

/* кнопки */
.ibtn {
  width: 48px; height: 44px; display: grid; place-items: center; font-size: 22px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--accent);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background .15s, transform .08s;
}
.ibtn:active { transform: scale(.94); }
.ibtn.txt { font-family: 'Russo One'; font-size: 17px; }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 15px 26px;
  font-family: 'Russo One'; font-size: 19px; letter-spacing: .06em; text-transform: uppercase; color: #ffffff;
  background: linear-gradient(90deg, #2f8fe8, #2f8fe8);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  transition: filter .15s, transform .08s;
}
.cta:hover { filter: brightness(1.1); }
.cta:active { transform: scale(.97); }
.cta:disabled { filter: grayscale(1) brightness(.6); cursor: default; }
.sbtn { padding: 12px 20px; font-size: 16px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); text-transform: uppercase; letter-spacing: .05em; }
.sbtn:active { transform: scale(.97); }
.danger { margin-top: 10px; padding: 12px; width: 100%; border: 1px solid rgba(224,58,92,.45); color: var(--danger); background: rgba(224,58,92,.07); text-transform: uppercase; letter-spacing: .05em; }
.badge { position: absolute; top: 8px; right: 10px; font-style: normal; font-size: 11px; padding: 3px 7px; background: rgba(217,154,18,.14); color: var(--gold); border: 1px solid rgba(217,154,18,.4); letter-spacing: .08em; }

/* ============ главное меню ============ */
/* как в мобильных стратегиях: сверху логотип и валюта, по центру — поле боя,
   крупная кнопка «В бой» и нижняя навигационная панель */
#scrMenu { justify-content: space-between; padding-top: 10px; padding-bottom: 8px; }
.mtop { width: 100%; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mtop-r { display: flex; align-items: center; gap: 8px; }
.logo {
  font-size: clamp(34px, 5.2vw, 70px); line-height: .95; color: var(--ink); position: relative; letter-spacing: .02em;
}
.sub { margin-top: 6px; font-family: 'Russo One'; letter-spacing: .45em; color: var(--accent); font-size: clamp(10px, 1.2vw, 14px); opacity: .9; }
.mplay { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
.playbtn {
  display: flex; align-items: center; gap: 14px; padding: 12px 34px 12px 26px;
  color: #ffffff; background: linear-gradient(90deg, #2f8fe8, #2f8fe8);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px); text-align: left;
}
.playbtn > span:first-child { font-size: 30px; display: grid; }
.playbtn b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 26px; text-transform: uppercase; letter-spacing: .06em; line-height: 1; }
.playbtn small { display: block; font-size: 12px; font-weight: 600; opacity: .75; margin-top: 3px; }
.playbtn:active { transform: scale(.97); }
.bnav {
  width: 100%; max-width: 820px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  padding: 6px; background: var(--panel); border: 1px solid var(--line);
}
.bnav button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; color: var(--text); }
.bnav button > span:first-child { font-size: 24px; color: var(--accent); display: grid; transition: transform .15s; }
.bnav button b { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.bnav button small { font-size: 10px; color: var(--muted); font-weight: 400; }
.bnav button:active > span:first-child { transform: scale(.88); }
.bnav button.gold > span:first-child { color: var(--gold); }
.bnav button.locked { opacity: .45; }
.bnav .soon { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: 9px; color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.ver { color: var(--muted); font-size: 12px; font-weight: 400; text-align: center; margin-top: 10px; }

/* ============ кампания ============ */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  padding: 9px 14px; font-size: 14px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.tabs button.on { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.tabs button:disabled { opacity: .35; }
.ch-intro { margin: 14px 0; color: var(--muted); font-weight: 400; line-height: 1.5; min-height: 22px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lv {
  position: relative; padding: 12px 12px 10px; text-align: left; min-height: 92px;
  background: var(--panel); border: 1px solid var(--line);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  display: flex; flex-direction: column; gap: 4px; transition: transform .1s, border-color .15s;
}
.lv:hover:not(:disabled) { border-color: var(--line-2); transform: translateY(-2px); }
.lv .n { font-family: 'Russo One'; font-size: 26px; color: var(--accent); line-height: 1; }
.lv .t { font-size: 14px; color: var(--text); }
.lv .st { display: flex; gap: 3px; color: var(--track); font-size: 15px; margin-top: auto; }
.lv .st .on { color: var(--gold); }
.lv.cur { border-color: var(--accent); }
.lv.cur::after { content: 'СЛЕДУЮЩИЙ'; position: absolute; right: 10px; top: 10px; font-size: 10px; letter-spacing: .1em; color: var(--accent); }
.lv.boss .n { color: var(--danger); }
.lv.boss::before { content: 'БОСС'; position: absolute; right: 10px; bottom: 10px; font-size: 10px; letter-spacing: .1em; color: var(--danger); }
.lv:disabled { opacity: .4; cursor: default; }
.lv:disabled .n { color: var(--muted); }
.fill-star .ico { fill: currentColor; }

/* ============ брифинг ============ */
.panel.brief { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.kicker { color: var(--accent); font-size: 13px; letter-spacing: .18em; text-transform: uppercase; }
.kicker small { color: var(--muted); letter-spacing: .05em; font-family: 'Exo 2'; }
.brief h3 { font-size: clamp(24px, 3.2vw, 36px); margin: 6px 0 10px; text-transform: uppercase; }
.brtext { color: var(--text-2); font-weight: 400; line-height: 1.55; font-size: 16px; }
.brobj { margin: 16px 0 12px; padding: 12px 14px; border-left: 3px solid var(--gold); background: rgba(217,154,18,.07); display: flex; gap: 12px; align-items: center; }
.brobj .ico { color: var(--gold); font-size: 24px; }
.brobj small { display: block; color: var(--muted); font-weight: 400; }
.foes { display: flex; flex-wrap: wrap; gap: 8px; }
.foe { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; }
.foe i { width: 12px; height: 12px; transform: rotate(45deg); background: currentColor; }
.foe small { color: var(--muted); font-weight: 400; }
.brief-side { display: flex; flex-direction: column; gap: 10px; }
.protos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; align-content: start; }
.proto { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); }
.proto > .ico { font-size: 26px; color: var(--accent); margin-top: 2px; }
.proto b { display: block; font-size: 15px; }
.proto small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.3; }
.proto em { font-style: normal; color: var(--gold); font-size: 12px; }
.proto.on { border-color: var(--accent); background: rgba(47,143,232,.12); }
.proto.locked { opacity: .35; }
.proto.locked::after { content: attr(data-lock); position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--muted); }
.sk { display: grid; gap: 10px; margin-top: 8px; }
.sk .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sk .row > span { color: var(--muted); font-size: 14px; min-width: 90px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { padding: 8px 12px; font-size: 14px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.seg button.on { background: var(--accent); color: #ffffff; border-color: var(--accent); }

/* ============ доктрины ============ */
.dtabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dtabs button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-bottom: 3px solid transparent; }
.dtabs button .ico { font-size: 22px; color: var(--bc); }
.dtabs button b { font-size: 14px; }
.dtabs button small { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400; }
.dtabs button.on { border-bottom-color: var(--bc); background: var(--track); }
.dtabs button.locked { opacity: .45; }
.dtabs button.locked .ico { color: var(--muted); }
.dnodes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.node { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-top: 3px solid var(--bc); }
.node + .node::before { content: ''; position: absolute; left: -9px; top: 26px; width: 8px; height: 2px; background: var(--line-2); }
.nd-h { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.nd-h b { font-size: 14px; }
.nd-h em { font-style: normal; font-family: 'Russo One'; font-size: 12px; color: var(--bc); }
.node small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; line-height: 1.3; }
.node small.next { color: var(--good-d); min-height: 15px; }
.pips { display: flex; gap: 2px; margin: 4px 0 6px; }
.pips i { flex: 1; height: 4px; background: var(--track); }
.pips i.on { background: var(--bc); }
.node button { margin-top: auto; width: 100%; padding: 7px 4px; display: flex; align-items: center; justify-content: center; gap: 5px; background: rgba(47,143,232,.12); border: 1px solid rgba(47,143,232,.4); color: var(--accent); font-size: 13px; }
.node button .ico { color: var(--gold); }
.node button:disabled { opacity: .4; cursor: default; }
.node.locked { opacity: .5; }
.node.max { }

/* ============ стратегия в брифинге ============ */
.stg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 5px; }
.stg button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; background: var(--panel-2); border: 1px solid var(--line); font-size: 10px; }
.stg button .ico { font-size: 18px; color: var(--accent); }
.stg button.on { border-color: var(--accent); background: rgba(47,143,232,.14); }
.stg button.locked { opacity: .4; }
.stg button.locked .ico { color: var(--muted); }
.strat:empty { display: none; }

/* ============ онлайн ============ */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.mode { position: relative; padding: 18px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; opacity: .8; }
.mode > span { font-size: 30px; color: var(--accent); }
.mode small { color: var(--muted); font-weight: 400; }

/* ============ настройки ============ */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.row > span:first-child { color: var(--accent); font-size: 20px; display: grid; }
.row input[type=range], .row .seg { margin-left: auto; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 160px; height: 4px; background: var(--track); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--accent); transform: rotate(45deg); cursor: pointer; }

/* ============ итог ============ */
.res-ico { font-size: 64px; color: var(--gold); display: grid; place-items: center; }
.result.lose .res-ico { color: var(--danger); }
.result h2 { font-size: 34px; }
.stars { display: flex; justify-content: center; gap: 14px; }
.stars .s { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 110px; }
.stars .s .ico { font-size: 44px; color: var(--track); transition: color .3s, transform .3s; }
.stars .s.on .ico { color: var(--gold); fill: var(--gold); transform: scale(1.1); animation: pop .4s ease; }
.stars .s small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.2; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.3); } 100% { transform: scale(1.1); } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { padding: 8px 4px; background: var(--panel-2); }
.stats b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 19px; }
.stats small { color: var(--muted); font-size: 11px; font-weight: 400; }
.reward { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Russo One'; font-size: 24px; color: var(--gold); }
.pause-obj { color: var(--muted); font-weight: 400; }

/* ============ модальное окно ============ */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(29,37,51,.42); display: flex; align-items: center; justify-content: center; padding: 16px; }
.md-btns { display: flex; gap: 10px; justify-content: center; }
.md-btns > * { flex: 1; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .obj, #basePanel { pointer-events: auto; }
.hud-top {
  position: absolute; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); top: 8px;
  display: flex; align-items: center; gap: 10px;
}
.obj { display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 10px; background: var(--panel); border: 1px solid var(--line); min-width: 0; max-width: 34%; }
.obj-ico { font-size: 22px; color: var(--gold); display: grid; }
.obj-txt { min-width: 0; }
.obj b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terr { flex: 1; height: 14px; display: flex; background: var(--track); border: 1px solid var(--line); overflow: hidden; }
.terr div { height: 100%; transition: width .4s ease; }

.hud-bottom {
  position: absolute; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: 8px;
  display: flex; align-items: flex-end; gap: 12px;
}
.frac { display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.frac button { width: 58px; padding: 7px 0; font-family: 'Russo One'; font-size: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.frac button.on { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.dock { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.energy { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); color: var(--gold); padding: 0 4px; }
.energy > span { font-size: 18px; display: grid; }
.ebar { flex: 1; height: 8px; background: var(--track); border: 1px solid rgba(217,154,18,.3); overflow: hidden; }
.ebar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d99a12, #d99a12); transition: width .2s linear; }
.energy b { font-family: 'Russo One'; font-weight: 400; font-size: 15px; min-width: 30px; text-align: right; }
.cards { display: flex; gap: 8px; pointer-events: auto; }
.card {
  position: relative; width: 86px; height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--panel); border: 1px solid var(--line-2);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  overflow: hidden; transition: transform .08s, border-color .15s;
}
.card > .ico { font-size: 26px; color: var(--accent); }
.card b { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.card em { position: absolute; top: 4px; right: 7px; font-style: normal; font-family: 'Russo One'; font-size: 12px; color: var(--gold); }
.card .cd { position: absolute; inset: 0; background: conic-gradient(rgba(29,37,51,.42) calc(var(--p, 0) * 1%), transparent 0); pointer-events: none; }
.card.off { filter: saturate(.25) brightness(.7); }
.card.arm { border-color: var(--gold); transform: translateY(-4px); }
.card.arm > .ico { color: var(--gold); }
.card kbd { position: absolute; top: 4px; left: 8px; font-family: 'Russo One'; font-size: 10px; color: var(--muted); }
.air .card > .ico { color: #e06a12; }

.tip {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); max-width: min(620px, 90vw);
  padding: 10px 18px; background: var(--panel); border: 1px solid rgba(217,154,18,.45); color: var(--text);
  font-size: 15px; text-align: center; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.tip.show { opacity: 1; }
#toast {
  position: fixed; left: 50%; top: 110px; transform: translate(-50%, -10px); z-index: 30;
  padding: 10px 20px; background: var(--panel); border: 1px solid var(--line-2); font-size: 15px;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; text-align: center; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.bpanel {
  position: absolute; width: 230px; padding: 12px; background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(29,37,51,.18); border-radius: var(--r); font-size: 13px; animation: scrIn .15s ease both;
}
.bpanel .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bpanel .hd .ico { font-size: 22px; }
.bpanel .hd b { font-size: 16px; }
.bpanel .hd small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.bpanel p { color: var(--muted); font-weight: 400; margin-bottom: 8px; line-height: 1.35; }
.bpanel .kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 8px; }
.bpanel .kv span { color: var(--muted); font-weight: 400; }
.bpanel button { width: 100%; padding: 9px; background: rgba(217,154,18,.14); border: 1px solid rgba(217,154,18,.55); color: var(--gold); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; }
.bpanel button:disabled { opacity: .4; }


/* ============ кошелёк ============ */
.wallet { display: flex; gap: 8px; justify-self: end; }
.wallet .chip { padding: 6px 12px; font-size: 16px; }
.chip .ico-c { display: grid; font-size: 19px; color: var(--gold); }
.chip.crys .ico-c { color: #8a5ad8; }
.lt { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); }
.lt .ico { font-size: 16px; color: var(--gold); }
.lt.rare { border-color: rgba(138,90,216,.6); background: rgba(138,90,216,.1); }
.lt.rare .ico { color: #8a5ad8; }
.lt.first { border-color: rgba(217,154,18,.55); }

/* ============ меню: казна и значки ============ */
.hqchip { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 12px; text-align: left; background: var(--panel); border: 1px solid var(--line); }
.hqchip > span:first-child { font-size: 22px; color: var(--gold); display: grid; }
.hqchip b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 14px; }
.hqchip small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.hqchip:active { transform: scale(.97); }
.dot { position: absolute; top: 2px; right: 18%; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.3); } }
.lockmark { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: 9px; color: var(--muted); display: flex; align-items: center; gap: 2px; }

/* ============ кампания: подарок ============ */
.lv .gift { position: absolute; right: 10px; bottom: 8px; font-size: 18px; color: #8a5ad8; }
.lv.boss .gift { bottom: 24px; }

/* ============ брифинг: новинки, бустеры, награда ============ */
.newtech { display: grid; gap: 8px; margin-bottom: 10px; }
.newtech:empty { display: none; }
.nt { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--panel); border: 1px solid rgba(138,90,216,.45); }
.nt > .ico { font-size: 28px; color: #8a5ad8; }
.nt em { font-style: normal; font-size: 10px; letter-spacing: .15em; color: #8a5ad8; text-transform: uppercase; }
.nt b { display: block; }
.nt small { color: var(--muted); font-weight: 400; font-size: 12px; }
.bst { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.bst button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; }
.bst button .ico { font-size: 20px; color: var(--gold); }
.bst button em { font-style: normal; color: var(--muted); }
.bst button.on { border-color: var(--gold); background: rgba(217,154,18,.12); }
.bst button.empty { opacity: .4; }
.brreward { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.brreward .kicker { width: 100%; }
.brreward:empty { display: none; }
.loot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ============ штаб ============ */
.panel.hq { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.hq-col { display: flex; flex-direction: column; gap: 10px; }
.daily { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; }
.dd .ico { font-size: 20px; color: var(--gold); }
.dd small { color: var(--muted); font-weight: 400; font-size: 10px; }
.dd.got { opacity: .45; }
.dd.got .ico { color: var(--good); }
.dd.today { border-color: var(--gold); background: rgba(217,154,18,.14); animation: pulse2 1.4s infinite; }
@keyframes pulse2 { 50% { } }
.treasury, .ms { padding: 12px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.tr-top { display: flex; gap: 12px; align-items: center; }
.tr-top .ico { font-size: 32px; color: var(--gold); }
.tr-top b { font-family: 'Russo One'; font-weight: 400; font-size: 20px; }
.tr-top small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.tr-bar { height: 6px; background: var(--track); overflow: hidden; }
.tr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d99a12, #d99a12); }
.missions { display: flex; flex-direction: column; gap: 8px; }
.ms-t { display: flex; justify-content: space-between; gap: 10px; }
.ms-t small { color: var(--muted); font-weight: 400; }
.ms-r { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ms-r .sbtn { margin-left: auto; padding: 7px 14px; font-size: 13px; }
.ms.done { border-color: rgba(31,175,124,.5); }
.ms.done .sbtn { background: rgba(31,175,124,.18); border-color: var(--good); color: var(--good); }
.ms.claimed { opacity: .5; }
.ms .tr-bar i { background: linear-gradient(90deg, #2f8fe8, #2f8fe8); }
.locked-note { padding: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px dashed var(--line); }
.sbtn:disabled { opacity: .45; cursor: default; }

/* ============ магазин ============ */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.sc { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--panel); border: 1px solid var(--line); }
.sc-ico { height: 64px; display: grid; place-items: center; font-size: 44px; color: #8a5ad8; }
.sc-ico canvas { width: 96px; height: 72px; }
.sc b { font-size: 16px; }
.sc small { color: var(--muted); font-weight: 400; font-size: 12px; line-height: 1.35; }
.sc-l { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-content: flex-start; }
.sc .cta, .sc .sbtn { padding: 10px; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.sc .sbtn .ico { color: #8a5ad8; }
.sc.featured { border-color: rgba(217,154,18,.6); grid-column: span 2; }
.sc.featured::before { content: 'ВЫГОДНО'; position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: .12em; color: #ffffff; background: var(--gold); padding: 3px 7px; }
.sc.best::before { content: 'ХИТ'; position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: .12em; color: #ffffff; background: #8a5ad8; padding: 3px 7px; }
.sc.equipped { border-color: var(--accent); }
.sc.legendary { border-color: rgba(217,154,18,.6); }
.hint.small { font-size: 12px; margin-top: 12px; }

/* ============ окно открытий ============ */
.panel.unlock { max-width: 560px; }
.ul-cards { display: grid; gap: 8px; }
.ulc { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); animation: ulIn .45s cubic-bezier(.2,1.4,.4,1) both; }
.ulc > .ico { grid-row: span 2; font-size: 34px; color: var(--gold); }
.ulc small { color: var(--muted); font-weight: 400; font-size: 12px; }
.ulc.rare { border-color: rgba(138,90,216,.6); background: var(--panel); }
.ulc.rare > .ico { color: #8a5ad8; }
@keyframes ulIn { from { opacity: 0; transform: scale(.7) translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ справочник ============ */
.codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; margin-top: 10px; }
.cx-card { display: flex; gap: 12px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.cx-ico { width: 48px; height: 48px; flex: none; display: grid; place-items: center; font-size: 28px; color: var(--accent); background: rgba(47,143,232,.08); border: 1px solid var(--line-2); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.cx-ico.t-tower { color: #e06a12; background: rgba(224,106,18,.1); }
.cx-ico.t-hq { color: var(--gold); background: rgba(217,154,18,.1); }
.cx-main { flex: 1; min-width: 0; }
.cx-h { display: flex; align-items: center; gap: 8px; }
.cx-h b { font-size: 15px; }
.cx-lock { margin-left: auto; font-style: normal; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.cx-main p { color: var(--text-2); font-weight: 400; font-size: 13px; line-height: 1.4; margin: 3px 0 6px; }
.cx-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.cx-stats span { padding: 3px 8px; background: var(--panel-2); font-size: 12px; }
.cx-stats small { color: var(--muted); font-weight: 400; margin-right: 4px; }
.cx-rules { grid-column: 1 / -1; list-style: none; display: grid; gap: 6px; }
.cx-rules li { padding: 8px 12px; background: var(--panel-2); border-left: 3px solid var(--accent); font-weight: 400; font-size: 14px; line-height: 1.4; }
.cx-credits { grid-column: 1 / -1; display: grid; gap: 4px; font-weight: 400; font-size: 13px; color: var(--text-2); }
.codex > .hint { grid-column: 1 / -1; }
.bnav { grid-template-columns: repeat(7, 1fr); max-width: 900px; }

/* ============ оборона, поток, стройка ============ */
.mplay { gap: 10px; }
.defbtn {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 18px; text-align: left; color: var(--text);
  background: var(--panel); border: 1px solid rgba(224,58,92,.55);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.defbtn > span:first-child { font-size: 24px; color: #e03a5c; display: grid; }
.defbtn b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
.defbtn small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.defbtn.locked { opacity: .45; }
.defbtn .lockmark { top: 4px; right: 8px; }
.wavebtn {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; color: #fff; font-size: 13px; pointer-events: auto;
  background: linear-gradient(90deg, #e03a5c, #e03a5c);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.wavebtn b { font-family: 'Russo One'; font-weight: 400; letter-spacing: .05em; text-transform: uppercase; }
.frac button.route { display: grid; place-items: center; font-size: 18px; color: var(--accent); }
.frac button.route.on { background: var(--gold); border-color: var(--gold); color: #ffffff; }
.bpanel button.alt { margin-top: 6px; background: var(--track); border-color: var(--line-2); color: var(--text); }
.bp-build { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; }
.bp-build button { flex-direction: column; gap: 1px; padding: 5px 2px; font-size: 18px; background: rgba(47,143,232,.08); border: 1px solid var(--line-2); color: var(--accent); }
.bp-build button em { font-style: normal; font-size: 10px; color: var(--gold); }
.bp-build button:disabled { opacity: .35; }

/* ============ звание и достижения ============ */
.rankchip { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 5px 10px; text-align: left; background: var(--panel); border: 1px solid rgba(217,154,18,.4); }
.rankchip > span:first-child { color: var(--gold); font-size: 18px; display: grid; }
.rankchip b { display: block; font-size: 12px; }
.rk-bar { display: block; width: 110px; height: 4px; margin-top: 3px; background: var(--track); }
.rk-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d99a12, #d99a12); }
.hq-tabs { grid-column: 1 / -1; }
.cnt { font-style: normal; margin-left: 4px; padding: 0 6px; background: var(--danger); color: #fff; font-size: 11px; }
.ach { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; max-height: 60vh; overflow-y: auto; touch-action: pan-y; }
.ac { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.ac-h { display: flex; justify-content: space-between; gap: 6px; }
.ac-h b { font-size: 13px; }
.ac small { color: var(--muted); font-weight: 400; font-size: 11px; }
.ac.done { border-color: rgba(31,175,124,.5); }
.ac.done .sbtn { background: rgba(31,175,124,.18); border-color: var(--good); color: var(--good); }
.ac.claimed { opacity: .45; }
.ac .ms-r .sbtn { margin-left: auto; padding: 4px 9px; font-size: 11px; }

/* ============ телефоны (альбомная ориентация) ============ */
/* Правило: всё помещается в экран без прокрутки, окна узкие, текст короткий */
@media (max-height: 520px) {
  .screen { padding-top: 6px; padding-bottom: 6px; }
  .topbar { min-height: 36px; gap: 8px; grid-template-columns: 40px 1fr auto; }
  .topbar h2 { font-size: 18px; }
  .panel { padding: 10px 12px; margin-top: 4px; }
  .panel h2 { font-size: 20px; }
  .hint { font-size: 12.5px; }
  .ibtn { width: 38px; height: 34px; font-size: 18px; }
  .cta { padding: 9px 16px; font-size: 14px; gap: 6px; }
  .sbtn { padding: 8px 14px; font-size: 13px; }
  .wallet .chip { padding: 3px 8px; font-size: 13px; }
  .chip .ico-c { font-size: 16px; }
  .kicker { font-size: 11px; letter-spacing: .12em; }
  .lt { padding: 3px 7px; font-size: 11.5px; }
  .lt .ico { font-size: 13px; }
  .tabs button { padding: 6px 10px; font-size: 12px; }

  /* меню */
  .logo { font-size: clamp(28px, 9vh, 46px); }
  .sub { font-size: 10px; letter-spacing: .35em; margin-top: 3px; }
  .hqchip { padding: 4px 9px; gap: 6px; }
  .hqchip > span:first-child { font-size: 18px; }
  .hqchip b { font-size: 13px; }
  .hqchip small { font-size: 9.5px; }
  .playbtn { padding: 9px 26px 9px 20px; gap: 10px; }
  .playbtn b { font-size: 20px; }
  .playbtn small { font-size: 10.5px; }
  .playbtn > span:first-child { font-size: 22px; }
  .mplay { padding-bottom: 6px; }
  .bnav { padding: 3px; gap: 3px; max-width: 640px; }
  .bnav button { padding: 4px 2px 3px; }
  .bnav button > span:first-child { font-size: 19px; }
  .bnav button b { font-size: 10.5px; }
  .bnav button small { display: none; }

  /* кампания */
  .ch-intro { margin: 6px 0; font-size: 12px; }
  .levels { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .lv { min-height: 58px; padding: 6px 8px; gap: 2px; }
  .lv .n { font-size: 18px; }
  .lv .t { font-size: 11px; }
  .lv .st { font-size: 12px; }
  .lv.cur::after { font-size: 8px; top: 6px; right: 6px; }

  /* брифинг: две колонки, без длинных описаний */
  .panel.brief { gap: 12px; grid-template-columns: 1fr 1.1fr; }
  .brief h3 { font-size: 20px; margin: 2px 0 4px; }
  .brtext { font-size: 12.5px; line-height: 1.4; }
  .brobj { margin: 6px 0; padding: 6px 10px; gap: 8px; }
  .brobj .ico { font-size: 18px; }
  .brobj small { display: none; }
  .foe { padding: 4px 8px; font-size: 12px; }
  .nt { padding: 5px 8px; gap: 8px; }
  .nt > .ico { font-size: 20px; }
  .nt small { display: none; }
  .brief-side { gap: 6px; }
  .protos { grid-template-columns: repeat(3, 1fr); gap: 4px; flex: none; }
  .proto { padding: 5px 6px; gap: 6px; align-items: center; }
  .proto > .ico { font-size: 18px; margin: 0; }
  .proto b { font-size: 11.5px; }
  .proto em { font-size: 10px; }
  .proto small { display: none; }
  .proto.locked::after { display: none; }
  .stg button { padding: 4px 1px; font-size: 9px; }
  .stg button .ico { font-size: 15px; }
  .bst button { padding: 4px 2px; font-size: 9.5px; }
  .bst button .ico { font-size: 15px; }
  .sk { gap: 5px; margin-top: 4px; }
  .sk .row > span { min-width: 70px; font-size: 12px; }
  .seg button { padding: 5px 8px; font-size: 12px; }

  /* штаб, магазин, доктрины */
  .panel.hq { gap: 10px; }
  .hq-col { gap: 6px; }
  .dd { padding: 4px 1px; font-size: 10px; gap: 2px; }
  .dd .ico { font-size: 15px; }
  .treasury, .ms { padding: 8px; gap: 5px; }
  .tr-top .ico { font-size: 24px; }
  .tr-top b { font-size: 16px; }
  .tr-top small { font-size: 10.5px; }
  .ms-t b { font-size: 13px; }
  .ms-r .sbtn { padding: 5px 10px; font-size: 12px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 8px; }
  .sc { padding: 8px; gap: 4px; }
  .sc-ico { height: 38px; font-size: 28px; }
  .sc-ico canvas { width: 64px; height: 48px; }
  .sc b { font-size: 13px; }
  .sc small { font-size: 10.5px; }
  .sc .cta, .sc .sbtn { padding: 7px; font-size: 13px; }
  .sc.featured { grid-column: span 2; }
  .dtabs button { padding: 5px 8px; gap: 5px; }
  .dtabs button .ico { font-size: 17px; }
  .dtabs button b { font-size: 12px; }
  .dnodes { gap: 5px; margin-top: 6px; }
  .node { padding: 6px; }
  .nd-h b { font-size: 12px; }
  .node small { font-size: 10px; }
  .node button { padding: 5px 2px; font-size: 11.5px; }

  /* итог и окна */
  .panel.center { gap: 6px; }
  .panel.center.result { max-width: 520px; }
  .res-ico { font-size: 28px; }
  .result h2 { font-size: 22px; }
  .result .hint { font-size: 12px; }
  .stars { gap: 8px; }
  .stars .s { width: 90px; }
  .stars .s .ico { font-size: 26px; }
  .stars .s small { font-size: 9.5px; }
  .stats { gap: 4px; }
  .stats b { font-size: 14px; }
  .stats div { padding: 4px; }
  .stats small { font-size: 9.5px; }
  .row { padding: 6px 0; font-size: 14px; }
  .ulc { padding: 8px; }
  .ulc > .ico { font-size: 26px; }

  /* HUD */
  .hud-top { top: 5px; gap: 6px; }
  .obj { padding: 3px 9px 3px 7px; gap: 6px; }
  .obj-ico { font-size: 17px; }
  .obj b { font-size: 12px; }
  .obj small { font-size: 10.5px; }
  .terr { height: 10px; }
  .card { width: 64px; height: 50px; gap: 1px; }
  .card > .ico { font-size: 19px; }
  .card b { font-size: 8.5px; }
  .card em { font-size: 10px; top: 2px; right: 5px; }
  .card kbd { display: none; }
  .hud-bottom {
    top: 46px; bottom: 5px; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 1fr auto;
    grid-template-areas: "air . dock" "frac . dock"; align-items: end; gap: 6px;
  }
  .hud-bottom .frac { grid-area: frac; }
  .hud-bottom .air { grid-area: air; flex-direction: column; align-self: end; }
  .hud-bottom .dock { grid-area: dock; flex: none; align-self: end; width: 66px; gap: 4px; }
  .dock .cards { flex-direction: column; gap: 5px; }
  .cards { gap: 5px; }
  .energy { width: 64px; padding: 0; gap: 3px; }
  .energy > span { display: none; }
  .energy b { font-size: 11px; min-width: 18px; }
  .ebar { height: 6px; }
  .frac { gap: 3px; }
  .frac button { width: 44px; padding: 4px 0; font-size: 11px; }
  .tip { top: 42px; font-size: 12px; padding: 5px 12px; }
  #toast { top: 48px; font-size: 13px; padding: 7px 14px; }
  .bpanel { width: 190px; padding: 8px; font-size: 11.5px; }
  .bpanel .hd b { font-size: 13px; }
  .bpanel p { margin-bottom: 5px; }
  .bpanel button { padding: 6px; font-size: 12px; }
}
@media (max-height: 520px) {
  /* брифинг: протоколы в один ряд, новинки — значками */
  .protos { grid-template-columns: repeat(6, 1fr); }
  .proto { flex-direction: column; align-items: center; text-align: center; padding: 4px 2px; gap: 1px; }
  .proto b { font-size: 9.5px; }
  .proto em { display: none; }
  .newtech { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
  .nt { padding: 3px 8px; }
  .nt > .ico { font-size: 15px; }
  .nt em { display: none; }
  .nt b { font-size: 12px; }
  .nt b::before { content: 'Новое: '; color: #8a5ad8; font-weight: 400; }
  .brreward .kicker { display: none; }
  .bst { margin-top: 3px; }
  #brSkirmish:not(.hidden) ~ .foes, #scrBrief .sk:not(.hidden) { margin-top: 2px; }
  /* магазин: горизонтальная лента карточек */
  .shop-grid { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 168px; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; touch-action: pan-x; }
  .shop-grid::-webkit-scrollbar { height: 3px; }
  .shop-grid::-webkit-scrollbar-thumb { background: var(--line-2); }
  .shop-grid { grid-auto-columns: 232px; }
  .sc-ico { height: 60px; font-size: 24px; }
  .sc-ico canvas { width: 84px; height: 63px; }
  .sc:not(.pv) .sc-ico { display: grid; }
  .hint.small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sc-l .lt { padding: 2px 6px; font-size: 10.5px; }
  .hint.small { margin-top: 6px; font-size: 10.5px; }
  /* схватка: настройки шире, кнопки мельче */
  #scrBrief.sk-mode .panel.brief { grid-template-columns: 1.5fr 1fr; }
  #scrBrief.sk-mode .brobj, #scrBrief.sk-mode .brtext { display: none; }
  .sk .row { gap: 6px; }
  .sk .row > span { min-width: 64px; }
  .sk .seg { gap: 3px; }
  .sk .seg button { padding: 4px 6px; font-size: 11px; }
  /* онлайн */
  .modes { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
  .mode { padding: 10px; gap: 3px; }
  .mode > span { font-size: 22px; }
  .mode small { font-size: 11px; }
  .badge { top: 5px; right: 6px; font-size: 9px; padding: 2px 5px; }
}
@media (max-height: 520px) {
  .codex { grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 6px; }
  .cx-rules { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .codex > .hint { display: none; }
  .cx-main p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .cx-card { flex-direction: column; gap: 4px; }
  .cx-h .cx-lock { font-size: 9.5px; }
  .cx-card { padding: 6px; gap: 8px; }
  .cx-ico { width: 30px; height: 30px; font-size: 17px; position: absolute; }
  .cx-card { position: relative; }
  .cx-h { padding-left: 36px; min-height: 30px; }
  .cx-main p { font-size: 11.5px; margin: 1px 0 3px; }
  .cx-stats span { font-size: 10.5px; padding: 2px 6px; }
  .cx-rules li { font-size: 11px; padding: 4px 8px; line-height: 1.3; }
}
@media (max-height: 520px) {
  .defbtn { padding: 7px 12px; gap: 6px; }
  .defbtn > span:first-child { font-size: 18px; }
  .defbtn b { font-size: 13px; }
  .defbtn small { font-size: 9.5px; }
  .wavebtn { padding: 4px 8px; font-size: 11px; }
  .frac button.route { font-size: 14px; }
  .bp-build button { font-size: 15px; padding: 3px 1px; }
}
@media (max-height: 520px) {
  .rankchip { margin-top: 4px; padding: 3px 8px; }
  .rankchip b { font-size: 10.5px; }
  .rk-bar { width: 90px; }
  .ach { max-height: 238px; grid-template-columns: repeat(3, 1fr); }
  .hq-tabs button { padding: 4px 10px; }
  .panel.hq { row-gap: 6px; }
  #scrHQ .kicker { font-size: 10px; }
  .daily .dd small { display: none; }
  #scrHQ .tr-top small { display: none; }
  #scrHQ .ms { padding: 5px 8px; gap: 3px; }
  #scrHQ .ms-t b { font-size: 12px; }
  #scrHQ .tr-bar { height: 4px; }
  #scrHQ .missions { gap: 5px; }
  #scrHQ .treasury .md-btns .sbtn, #scrHQ .treasury .cta { padding: 6px 10px; font-size: 12px; }
  .ac { padding: 5px 7px; }
}
/* очень низкие экраны (маленькие телефоны) */
@media (max-height: 380px) {
  .brtext { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .foes { gap: 6px; }                                   /* на низком экране — только портреты генералов */
  .foe { padding: 3px 8px 3px 3px; }
  .foe span small { display: none; }
  .stats { display: none; }
  .res-ico { display: none; }
  .card { width: 58px; height: 44px; }
  .card b { display: none; }
  .hud-bottom .dock { width: 60px; }
  .energy { width: 58px; }
  .lv .t { display: none; }
}
@media (max-width: 760px) {
  .panel.brief { grid-template-columns: 1fr; }
  .panel.hq { grid-template-columns: 1fr; }
  .dnodes { grid-template-columns: repeat(2, 1fr); }
  .dtabs { grid-template-columns: repeat(2, 1fr); }
  .sc.featured { grid-column: auto; }
  .levels { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bnav button b { font-size: 10px; }
}

/* ============ плоская светлая тема: общие правки ============ */
/* углы скругляем вместо скосов, границы тонкие, без свечения */
.ibtn, .cta, .playbtn, .card, .lv, .defbtn, .wavebtn, .cut { clip-path: none; border-radius: var(--r); }
.sbtn, .tabs button, .seg button, .chip, .hqchip, .rankchip, .obj, .terr, .frac button, .foe, .proto, .stg button, .bst button,
.dtabs button, .node, .node button, .dd, .treasury, .ms, .sc, .ulc, .lt, .cx-card, .ac, .mode, .bpanel button, .bp-build button,
.brobj, .nt, .locked-note, .stats div, #toast, .tip, .danger, .bnav, .badge, .cx-rules li, .cx-stats span { border-radius: 8px; }
.cx-ico { clip-path: none; border-radius: 50%; }
.ibtn { color: var(--ink); background: var(--panel); border-color: var(--line); box-shadow: 0 2px 6px rgba(29,37,51,.1); }
.cta, .playbtn { color: #fff; background: var(--accent); box-shadow: 0 3px 0 var(--accent-d); }
.cta:active, .playbtn:active { box-shadow: 0 1px 0 var(--accent-d); transform: translateY(2px); }
.cta:disabled { filter: none; background: var(--disabled); box-shadow: none; color: #fff; }
.sbtn { background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); }
.chip, .hqchip, .rankchip { background: var(--panel); box-shadow: 0 2px 6px rgba(29,37,51,.08); }
.bnav { background: var(--panel); border-color: var(--line); box-shadow: 0 4px 14px rgba(29,37,51,.12); border-radius: 14px; }
.tabs button.on, .seg button.on, .frac button.on { color: #fff; }
.tabs button, .seg button, .frac button { background: var(--panel); }
.lv { background: var(--panel); box-shadow: 0 2px 6px rgba(29,37,51,.07); }
.lv.cur { border: 2px solid var(--accent); }
.lv .st { color: var(--track-2); }
.proto.on, .stg button.on { background: rgba(47,143,232,.1); }
.bst button.on { background: rgba(217,154,18,.12); }
.foe i { border-radius: 3px; }
.node button { background: rgba(47,143,232,.08); border-color: rgba(47,143,232,.45); color: var(--accent-d); }
.card { background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 2px 8px rgba(29,37,51,.14); }
.card.off { filter: none; opacity: .55; }
.card.arm { border: 2px solid var(--gold); background: var(--gold-soft); }
.obj, .terr, .frac button { box-shadow: 0 2px 6px rgba(29,37,51,.1); }
.terr { background: var(--track); }
.ebar { background: var(--track); border-color: rgba(217,154,18,.45); border-radius: 4px; }
.energy { color: var(--gold-d); }
.energy b { color: var(--ink); }
.tip { background: var(--panel); border-color: rgba(217,154,18,.6); box-shadow: 0 4px 14px rgba(29,37,51,.15); }
#toast { background: var(--ink); color: #fff; border-color: var(--ink); }
.bpanel { background: var(--panel); border-color: var(--line-2); }
.bpanel button { background: rgba(217,154,18,.12); border-color: rgba(217,154,18,.6); color: var(--gold-d); }
.bpanel button.alt { background: var(--panel-2); color: var(--ink); }
.bp-build button { background: rgba(47,143,232,.08); color: var(--accent-d); }
.wavebtn { background: var(--danger); box-shadow: 0 3px 0 #9b1d38; color: #fff; }
.defbtn { background: var(--panel); border: 1px solid rgba(224,58,92,.5); box-shadow: 0 2px 8px rgba(29,37,51,.1); }
.defbtn > span:first-child { color: var(--danger); }
.frac button.route.on { color: #fff; }
.sc { background: var(--panel); box-shadow: 0 2px 8px rgba(29,37,51,.08); }
.sc-ico { color: var(--violet); }
.sc.featured::before, .sc.best::before { color: #fff; border-radius: 4px; }
.sc-ico canvas { background: var(--panel-2); border-radius: 8px; }
.stars .s .ico { color: var(--track-2); }
.dd.today { background: var(--gold-soft); animation: none; }
.sub, .kicker, .lv .n { color: var(--accent-d); }
.cx-ico { background: rgba(47,143,232,.1); border-color: rgba(47,143,232,.3); }
input[type=range] { background: var(--track); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { transform: none; border-radius: 50%; box-shadow: 0 1px 4px rgba(29,37,51,.3); }
.ulc.rare, .nt { background: rgba(138,90,216,.07); }

/* ============ арсенал: модели ============ */
.md-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 12px; margin-top: 10px; }
.md-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; touch-action: pan-y; }
.md-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 30px 4px 4px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.md-row canvas { width: 64px; height: 46px; flex: none; }
.md-row b { display: block; font-size: 14px; }
.md-row small { display: flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 400; font-size: 11.5px; white-space: nowrap; }
.md-row.cur { border: 2px solid var(--accent); background: var(--panel); }
.md-row.locked b { color: var(--muted); }
.md-on { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #fff; font-size: 12px; }
.md-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.md-head { display: flex; gap: 12px; align-items: center; }
.md-head canvas { width: 150px; height: 110px; flex: none; background: var(--surface); border-radius: 8px; }
.md-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.md-info > b { font-family: 'Russo One'; font-weight: 400; font-size: 20px; }
.md-info small { color: var(--muted); font-weight: 400; font-size: 13px; line-height: 1.35; }
.md-lvl { font-size: 13px; color: var(--muted); }
.md-lvl b { color: var(--ink); font-family: 'Russo One'; font-weight: 400; font-size: 16px; }
.md-stats { display: grid; gap: 5px; }
.md-st { display: grid; grid-template-columns: 96px 1fr 132px; gap: 8px; align-items: center; font-size: 13px; }
.md-st > span { color: var(--muted); }
.md-bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.md-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.md-st em { font-style: normal; white-space: nowrap; text-align: right; }
.md-st em u { text-decoration: none; color: var(--good); }
.md-act { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.md-act .sbtn, .md-act .cta { padding: 9px 14px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.md-act .cta { flex: 1; justify-content: center; }
.md-lock { flex: 1; color: var(--muted); font-weight: 400; font-size: 12px; }
@media (max-height: 520px) {
  .md-wrap { grid-template-columns: 172px 1fr; gap: 8px; margin-top: 6px; }
  .md-list { gap: 4px; max-height: calc(100vh - 112px); }
  .md-row { padding: 2px 24px 2px 2px; gap: 5px; }
  .md-row canvas { width: 50px; height: 36px; }
  .md-row b { font-size: 12px; }
  .md-row small { font-size: 10px; }
  .md-on { width: 16px; height: 16px; font-size: 10px; right: 5px; }
  .md-card { padding: 6px 10px; gap: 5px; }
  .md-head { gap: 8px; }
  .md-head canvas { width: 96px; height: 70px; }
  .md-info > b { font-size: 16px; }
  .md-info small { font-size: 11px; line-height: 1.25; }
  .md-lvl { font-size: 11px; }
  .md-lvl b { font-size: 13px; }
  .md-stats { gap: 3px; }
  .md-st { grid-template-columns: 82px 1fr 112px; gap: 6px; font-size: 11px; }
  .md-bar { height: 6px; }
  .md-act .sbtn, .md-act .cta { padding: 6px 10px; font-size: 12px; }
}
/* карточка облика: превью слева, текст справа — ничего не перекрывается */
.sc.pv { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 4px; align-content: start; }
.sc.pv .sc-ico { grid-row: 1 / span 2; height: auto; align-self: start; }
.sc.pv > b, .sc.pv > small { grid-column: 2; }
.sc.pv .sc-l, .sc.pv > button { grid-column: 1 / -1; }
.sc.pv > button { margin-top: auto; }
@media (max-height: 520px) {
  .sc.pv .sc-ico { height: auto; }
  .sc.pv .sc-ico canvas { width: 60px; height: 45px; }
}
/* валюты везде одного цвета: кредиты — золото, кристаллы — фиолетовые */
.ico.i-credit { color: var(--gold) !important; }
.ico.i-crystal { color: var(--violet) !important; }

/* ============ штаб: профиль ============ */
.profile { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.pf-dossier { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.pf-rank-box { display: flex; gap: 14px; align-items: center; min-width: 0; }
.pf-badge { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, #f5c443, #d99a12); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 4px 12px rgba(217,154,18,.35); flex: none; }
.pf-rank-info { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.pf-rank-title { display: flex; gap: 10px; align-items: baseline; }
.pf-rank-title b { font-family: 'Russo One', sans-serif; font-size: 20px; color: var(--text); }
.pf-lvl-chip { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.pf-xp-bar { display: flex; flex-direction: column; gap: 4px; }
.pf-xp-txt { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.pf-next-reward { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.pf-next-reward small { color: var(--muted); font-size: 11px; }

.pf-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pf-stat-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; position: relative; }
.pf-stat-card.primary { background: linear-gradient(135deg, var(--surface), var(--panel-2)); border-color: rgba(47,143,232,.35); }
.pf-stat-card .pf-ico { font-size: 24px; color: var(--accent); flex: none; }
.pf-stat-card b { display: block; font-family: 'Russo One', sans-serif; font-size: 20px; color: var(--text); }
.pf-stat-card small { font-size: 12px; color: var(--muted); line-height: 1.2; }
.pf-tag { position: absolute; top: 8px; right: 10px; font-size: 11px; font-weight: 700; color: var(--good); background: rgba(31,175,124,.12); padding: 2px 6px; border-radius: 4px; }
.pf-stat-card.mini { padding: 8px 12px; justify-content: center; }
.pf-stat-card.mini small { font-size: 12px; color: var(--text); }
.pf-stat-card.mini b { display: inline; font-size: 13px; color: var(--accent-d); }

.pf-unlocks-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pf-unlock-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.pf-u-top { display: flex; align-items: center; gap: 8px; }
.pf-u-top .ico { font-size: 18px; color: var(--accent); }
.pf-u-top b { font-size: 14px; flex: 1; }
.pf-u-top span { font-size: 13px; font-weight: 700; color: var(--gold); }
.pf-unlock-card small { font-size: 11.5px; color: var(--muted); }
.pf-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pf-chip { font-size: 11px; padding: 3px 7px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.pf-chip.on { border-color: rgba(31,175,124,.5); color: var(--good); font-weight: 700; background: rgba(31,175,124,.06); }

@media (max-width: 900px) {
  .pf-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pf-unlocks-grid { grid-template-columns: 1fr; }
  .pf-dossier { grid-template-columns: 1fr; }
  .pf-next-reward { align-items: flex-start; }
}
@media (max-height: 520px) {
  .profile { gap: 6px; }
  .pf-dossier { padding: 8px 12px; gap: 8px; }
  .pf-badge { width: 38px; height: 38px; font-size: 18px; }
  .pf-rank-title b { font-size: 16px; }
  .pf-stats-grid { gap: 6px; }
  .pf-stat-card { padding: 6px 10px; gap: 8px; }
  .pf-stat-card b { font-size: 16px; }
  .pf-stat-card .pf-ico { font-size: 18px; }
  .pf-unlocks-grid { gap: 6px; }
  .pf-unlock-card { padding: 8px 10px; gap: 5px; }
}

/* ============ штаб: сундуки ============ */
.chests { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ch-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.ch-h { display: flex; gap: 10px; align-items: center; }
.ch-h > .ico { font-size: 30px; color: var(--gold); }
.ch-h b { display: block; font-size: 15px; }
.ch-h small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; line-height: 1.3; }
.ch-card .ms-r { flex: 1; align-content: flex-start; }
.ch-card .cta, .ch-card .sbtn { padding: 9px; font-size: 14px; }
@media (max-height: 520px) {
  .chests { gap: 6px; }
  .ch-card { padding: 8px; gap: 4px; }
  .ch-h > .ico { font-size: 22px; }
  .ch-h b { font-size: 13px; }
  .ch-h small { font-size: 10.5px; }
  .ch-card .cta, .ch-card .sbtn { padding: 6px; font-size: 12px; }
}
@media (max-width: 760px) { .chests { grid-template-columns: 1fr; } }
/* подписи протоколов в HUD: без капса, чтобы длинные названия влезали */
.card b { text-transform: none; letter-spacing: 0; font-size: 11px; max-width: calc(100% - 6px); overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 520px) { .card b { font-size: 9px; } }

/* магазин: бесплатные карточки */
.sc.free { border-color: rgba(31,175,124,.5); }
.sc.free .sc-ico { color: var(--good); }
.sc.free::before { content: 'БЕСПЛАТНО'; position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: .08em; color: #fff; background: var(--good); padding: 3px 7px; border-radius: 4px; }
.sc.soon { opacity: .7; }
.sc.soon .sc-ico { color: var(--muted); }
@media (max-height: 520px) {
  .sc { gap: 3px; }
  .sc-l { gap: 3px; }
  .sc-l .lt { padding: 1px 6px; }
  .codex { gap: 4px; }
  .cx-card { padding: 5px 6px; }
}
@media (max-height: 520px) and (min-height: 381px) {
  .card { width: 74px; }
  .hud-bottom .dock { width: 76px; }
  .energy { width: 74px; }
}
.nt.help { background: rgba(31,175,124,.08); border-color: rgba(31,175,124,.45); }
.nt.help > .ico, .nt.help em { color: var(--good); }
@media (max-height: 520px) { .nt.help b::before { content: ''; } }
.md-list { position: relative; }
/* «×2» на кнопке «В бой»: первая победа дня */
.playbtn { position: relative; }
.playbtn .x2 { position: absolute; top: -8px; right: -8px; font-style: normal; font-family: 'Russo One'; font-size: 13px; padding: 3px 7px; border-radius: 10px; background: var(--gold); color: #fff; box-shadow: 0 2px 6px rgba(29,37,51,.2); }
@media (max-height: 520px) { .cx-rules { max-height: calc(100vh - 110px); overflow-y: auto; touch-action: pan-y; } }

/* ============ экспедиция (рогалик) ============ */
.expedbtn {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--panel); border: 1px solid rgba(138, 90, 216, 0.5);
  box-shadow: 0 2px 8px rgba(29, 37, 51, 0.1); border-radius: var(--r);
  cursor: pointer; position: relative;
}
.expedbtn > span:first-child { font-size: 24px; color: var(--violet); display: grid; }
.expedbtn b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
.expedbtn small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.expedbtn.locked { opacity: .45; }
.expedbtn .lockmark { top: 4px; right: 8px; }

@media (max-width: 480px) {
  .expedbtn { padding: 7px 12px; gap: 6px; }
  .expedbtn > span:first-child { font-size: 18px; }
  .expedbtn b { font-size: 13px; }
  .expedbtn small { font-size: 9.5px; }
}

.exp-panel { display: flex; flex-direction: column; gap: 14px; max-width: 680px; margin: 0 auto; }
.exp-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.exp-badge {
  display: inline-block; padding: 4px 10px; font-size: 11px; letter-spacing: .1em;
  font-family: 'Russo One', sans-serif; color: #ffffff; background: var(--accent); border-radius: 6px;
}
.exp-badge.boss { background: var(--danger); }
.exp-desc { color: var(--muted); font-size: 13px; max-width: 480px; margin: 0; line-height: 1.4; }
.exp-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.exp-artifacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; min-height: 60px; }
.empty-arts { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 13px; padding: 16px; border: 1px dashed var(--line); border-radius: 8px; }
.art-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-align: left;
}
.art-ico { font-size: 24px; color: var(--violet); display: grid; place-items: center; }
.art-chip b { display: block; font-size: 13px; }
.art-chip small { display: block; font-size: 11px; color: var(--muted); line-height: 1.25; }
.exp-actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }

/* драфт-карты */
.draft-panel { max-width: 520px; }
.draft-cards { display: grid; gap: 10px; margin: 14px 0; }
.draft-card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; text-align: left; transition: transform .15s, border-color .15s;
}
.draft-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.dc-ico { font-size: 30px; color: var(--violet); display: grid; place-items: center; }
.dc-info b { display: block; font-size: 15px; margin-bottom: 2px; }
.dc-info small { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ============ реферальная система / пригласи друга ============ */
.gold-glow {
  border-color: rgba(224, 160, 48, 0.8) !important;
  color: var(--gold) !important;
  box-shadow: 0 0 10px rgba(224, 160, 48, 0.35) !important;
}
.gold-glow:hover {
  box-shadow: 0 0 16px rgba(224, 160, 48, 0.6) !important;
}

.invite-panel {
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  touch-action: pan-y;
  padding: 20px 24px;
}
.close-invite {
  position: absolute;
  top: 14px;
  left: 14px;
}

.ref-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 14px;
}
.ref-kicker {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-family: 'Russo One', sans-serif;
}
.ref-hero h3 { margin: 0; font-size: 22px; }
.ref-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; max-width: 480px; margin: 0; }

.ref-code-card {
  width: 100%; max-width: 440px; margin-top: 6px; padding: 10px 14px;
  background: var(--panel); border: 1px dashed rgba(224, 160, 48, 0.6); border-radius: 8px;
}
.ref-code-card small { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ref-code-row {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.ref-code-val {
  font-family: 'Russo One', monospace; font-size: 18px; letter-spacing: .1em; color: var(--gold);
  background: rgba(224, 160, 48, 0.12); padding: 5px 12px; border-radius: 6px; border: 1px solid rgba(224, 160, 48, 0.3);
}

.ref-stats-box {
  width: 100%; display: flex; align-items: center; gap: 16px; margin-top: 10px;
}
.ref-stat {
  display: flex; flex-direction: column; align-items: center; min-width: 100px;
}
.ref-stat-num {
  font-family: 'Russo One', sans-serif; font-size: 26px; color: var(--accent); line-height: 1;
}
.ref-stat small { font-size: 10.5px; color: var(--muted); text-align: center; }

.ref-progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ref-prog-labels {
  display: flex; justify-content: space-between; font-size: 10px; color: var(--muted);
}

.ref-tiers-list {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; text-align: left;
}
.ref-tier-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.ref-tier-card.ready {
  border-color: rgba(31, 175, 124, 0.7);
  box-shadow: 0 0 12px rgba(31, 175, 124, 0.25);
  background: rgba(31, 175, 124, 0.04);
}
.ref-tier-card.claimed {
  opacity: 0.65;
}
.ref-tier-header {
  display: flex; align-items: center; gap: 10px;
}
.ref-tier-badge {
  padding: 3px 8px; font-size: 10.5px; font-family: 'Russo One', sans-serif;
  background: var(--line); border-radius: 6px; color: #fff;
}
.ref-tier-card.ready .ref-tier-badge { background: var(--good); }
.ref-tier-title b { display: block; font-size: 13.5px; }
.ref-tier-title small { display: block; font-size: 11px; color: var(--muted); }
.ref-tier-rewards {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ref-tier-actions {
  display: flex; justify-content: flex-end; margin-top: 2px;
}
.ref-test-zone {
  display: flex; justify-content: center; padding-top: 4px; border-top: 1px dashed var(--line);
}


/* ============ телефон: новые экраны без прокрутки страницы ============ */
@media (max-height: 520px) {
  .sc-ico { height: 36px; }
  .sc-ico canvas { width: 48px; height: 36px; }
  .exp-panel { gap: 6px; }
  .exp-hero { padding: 8px 10px; gap: 4px; }
  .exp-desc { display: none; }
  .exp-artifacts { min-height: 0; max-height: 104px; overflow-y: auto; touch-action: pan-y; }
  .empty-arts { padding: 8px; }
  #hqProfile, #hqReferral { max-height: calc(100vh - 100px); overflow-y: auto; touch-action: pan-y; }
  #inviteModal > * { max-height: calc(100vh - 20px); overflow-y: auto; touch-action: pan-y; }
}
@media (max-height: 520px) {
  .shop-grid { grid-auto-columns: 256px; }
  .sc-l { gap: 2px 3px; }
  .sc-l .lt { padding: 1px 5px; font-size: 10px; }
  #hqProfile, #hqReferral { max-height: calc(100vh - 112px); }
}
/* картинки товаров: слева от названия, крупнее */
.sc.pv .sc-ico canvas { width: 84px; height: 63px; }
@media (max-height: 520px) { .sc.pv .sc-ico canvas { width: 64px; height: 48px; } }
/* плашки «Выгодно / Хит / Бесплатно» — наклейкой на картинке, не на названии */
.sc.pv::before { top: 6px; left: 6px; right: auto; font-size: 8.5px; padding: 2px 5px; z-index: 1; }

/* документы внутри игры */
.panel.legal { flex: 1; display: flex; padding: 0; overflow: hidden; margin-bottom: 0; }
.panel.legal iframe { flex: 1; width: 100%; min-height: 60vh; border: 0; border-radius: 14px; background: var(--surface); }
#shopNote a { color: var(--accent-d); }
.bnav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
@media (max-height: 520px) { .panel.legal iframe { min-height: calc(100vh - 60px); } }
@media (max-height: 520px) {
  #scrSettings .row { padding: 3px 0; }
  #scrSettings .seg button { padding: 4px 8px; }
  #scrSettings .hint.small:empty { display: none; }
  #scrSettings .md-btns { margin-top: 2px; }
  #scrSettings .md-btns > * { padding: 7px; margin-top: 4px; }
  #scrSettings .ver { margin-top: 4px; }
}
/* облако в настройках и поле ввода кода */
.cl-txt small { color: var(--muted); font-weight: 400; font-size: 12px; }
#mdText { white-space: pre-line; }
.md-input { width: 100%; padding: 10px 12px; font: 600 18px/1.2 'Russo One', sans-serif; letter-spacing: .08em; text-align: center; text-transform: uppercase; border: 2px solid var(--line-2); border-radius: 10px; color: var(--ink); background: var(--surface); }
.md-input:focus { outline: none; border-color: var(--accent); }
@media (max-height: 520px) { .cl-txt small { font-size: 10px; } .md-input { padding: 7px 10px; font-size: 15px; } }

/* ============ тёмная тема: те же переменные, другие значения ============ */
:root[data-theme="dark"] {
  --bg: #0f1b2d;
  --bg-rgb: 15,27,45;
  --panel: #18243a;
  --panel-2: #1f2d47;
  --surface: #18243a;
  --line: #2a3a58;
  --line-2: #3b4f74;
  --accent: #3b97f5;
  --accent-d: #8cc4ff;
  --ink: #e8eef8;
  --text: #e8eef8;
  --text-2: #c2cde0;
  --muted: #8fa1bd;
  --track: #2a3a58;
  --track-2: #3a4c6e;
  --disabled: #3a4760;
  --gold-soft: #3a2f14;
  --good-d: #4fd3a2;
  --gold-d: #f2c14e;
  color-scheme: dark;
}
:root[data-theme="dark"] .panel, :root[data-theme="dark"] .bnav, :root[data-theme="dark"] .ibtn,
:root[data-theme="dark"] .chip, :root[data-theme="dark"] .card, :root[data-theme="dark"] .sc { box-shadow: 0 4px 16px rgba(0,0,0,.35); }
:root[data-theme="dark"] .logo { color: #e8eef8; }
/* ============ обучение: подсветка и пузырь ============ */
.coach { position: fixed; inset: 0; z-index: 80; }
.coach-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10,16,28,.62); transition: all .25s ease; pointer-events: none; outline: 3px solid var(--gold); }
.coach-bubble { position: fixed; max-width: min(360px, calc(100vw - 16px)); padding: 12px 14px; background: var(--panel); color: var(--text); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.coach-bubble p { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 10px; }
.coach-btns { display: flex; gap: 8px; justify-content: flex-end; }
.coach-btns .sbtn, .coach-btns .cta { padding: 8px 14px; font-size: 13px; }
.cx-tour { grid-column: 1 / -1; justify-self: start; margin-bottom: 6px; }
@media (max-height: 520px) {
  .coach-bubble { padding: 8px 10px; max-width: min(320px, calc(100vw - 16px)); }
  .coach-bubble p { font-size: 12.5px; margin-bottom: 6px; }
  .coach-btns .sbtn, .coach-btns .cta { padding: 5px 10px; font-size: 11.5px; }
  #scrSettings .hint.small { display: none; }        /* описание графики — ради места под строку «Тема» */
}
/* читаемость: цветной текст — тёмные/светлые варианты под тему; неактивные кнопки контрастнее */
.md-st em u, .pf-tag, .pf-chip.on, .node small.next, .ar-up small.next { color: var(--good-d); }
.pf-u-top span { color: var(--gold-d); }
.cta:disabled { background: var(--track); color: var(--muted); }
.playbtn .x2 { background: #c28400; }
.md-on { background: #139063; }
.ac.done .sbtn, .ms.done .sbtn { color: var(--good-d); }
/* уведомление: всегда тёмная плашка с белым текстом (в тёмной теме — чуть светлее фона) */
#toast { background: #1d2533; color: #fff; border-color: #1d2533; }
:root[data-theme="dark"] #toast { background: #2c3d5c; border-color: #3b4f74; color: #fff; }
/* затемнение под окнами в тёмной теме — тёмное, а не серое */
:root[data-theme="dark"] .screen.dim, :root[data-theme="dark"] .modal { background: rgba(4,9,18,.66); }
@media (max-height: 380px) {
  #scrSettings .row { padding: 2px 0; }
  #scrSettings .panel { padding-top: 6px; padding-bottom: 6px; }
  #scrSettings .ver { display: none; }
}
/* ============ сюжетные сцены ============ */
.cs { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4,9,18,.72); }
.cs-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; width: min(760px, 100%); padding: 18px; background: var(--panel); color: var(--text); border-radius: 18px; box-shadow: 0 16px 48px rgba(0,0,0,.4); }
.cs-art { width: 280px; height: 210px; border-radius: 14px; }
.cs-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cs-title { color: var(--accent-d); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-family: 'Russo One', sans-serif; font-weight: 400; }
.cs-who { font-family: 'Russo One', sans-serif; font-weight: 400; font-size: 20px; }
.cs-text { font-size: 16px; line-height: 1.5; min-height: 5.4em; color: var(--text-2); }
.cs-btns { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.cs-dots { margin-right: auto; color: var(--muted); font-size: 12px; }
.cs-btns .sbtn, .cs-btns .cta { padding: 9px 16px; font-size: 14px; }
.cx-hero { grid-column: 1 / -1; }
.cx-scenes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.cx-scene { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; text-transform: none; letter-spacing: 0; }
@media (max-height: 520px) {
  .cs { padding: 8px; }
  .cs-card { gap: 12px; padding: 12px; }
  .cs-art { width: 200px; height: 150px; }
  .cs-who { font-size: 16px; }
  .cs-text { font-size: 13.5px; line-height: 1.4; min-height: 4.2em; }
  .cs-btns .sbtn, .cs-btns .cta { padding: 6px 12px; font-size: 12px; }
  .cx-scene { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 560px) { .cs-card { grid-template-columns: 1fr; } .cs-art { justify-self: center; } }

/* ============ 3.5: цифры уведомлений, логотип-кнопка, бонус дня ============ */
.nb { position: absolute; top: 1px; right: calc(50% - 26px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-style: normal; font-family: 'Russo One'; font-size: 11px; line-height: 18px; text-align: center;
  color: #fff; background: var(--danger); box-shadow: 0 0 0 2px var(--panel); pointer-events: none; }
.nb.in { position: static; display: inline-block; margin-left: 6px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; box-shadow: none; vertical-align: 1px; }
.tabs button .nb.in { vertical-align: 2px; }
.logobtn { cursor: pointer; border-radius: 10px; transition: transform .15s; -webkit-tap-highlight-color: transparent; }
.logobtn:active { transform: scale(.97); }
.logobtn .sub::after { content: ' ›'; letter-spacing: 0; }
.hqchip.dailychip > span:first-child { color: var(--danger); animation: giftPulse 1.4s ease-in-out infinite; }
.hqchip.dailychip { border-color: rgba(224,58,92,.45); white-space: nowrap; }
@keyframes giftPulse { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.14) rotate(-8deg); } }
@media (max-height: 500px) {
  .nb { top: -2px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; right: calc(50% - 22px); }
}
/* Мир Стейтленда в Справочнике */
.cx-world { display: grid; gap: 8px; }
.cx-lore { margin: 0; line-height: 1.45; font-size: 13px; }
.cx-facs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cx-fac { display: flex; gap: 10px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--fc); border-radius: 8px; }
.cx-fac canvas { flex: none; width: 46px; height: 46px; }
.cx-fac b { display: block; font-size: 14px; }
.cx-fac small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.cx-fac i { font-style: normal; color: var(--fc); font-weight: 600; font-size: 12px; }

/* ============ испытание недели ============ */
.wkbtn { position: relative; border-color: rgba(217,154,18,.55) !important; }
.wkbtn > span:first-child { color: var(--gold) !important; }
.wkbtn .nb { top: -7px; right: -7px; }
.wk-goal.done { opacity: .6; }
.wk-goal.done .ico { color: var(--ok, #16a06e); }
.wk-goal small { display: block !important; }
.md-group { display: block; padding: 6px 4px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
/* список обновлений */
.cl-ver .cx-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.cl-ver .cx-h small { color: var(--muted); }
.cl-part { margin-top: 6px; }
.cl-part b { font-size: 13px; }
.cl-part.add b { color: var(--ok, #16a06e); }
.cl-part.imp b { color: var(--accent); }
.cl-part.rem b { color: var(--danger); }
.cl-part ul { margin: 3px 0 0 18px; padding: 0; font-size: 13px; line-height: 1.4; }
.cl-modal { text-align: left; max-height: 52vh; overflow-y: auto; }
.cl-modal .cl-ver { background: none; border: 0; padding: 0; }
.cl-modal .cl-ver > .cx-h { display: none; }
.wallet .chip { cursor: pointer; }
.wallet .chip:active { transform: scale(.95); }

/* ============ 3.8: портреты и герои ============ */
.foe canvas { width: 34px; height: 34px; flex: none; }
.cx-fac canvas { width: 56px; height: 56px; }
.hr-card .md-head canvas { width: 118px; height: 118px; }
.md-row canvas[data-p] { width: 46px; height: 46px; }
.hr-abil { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.hr-abil > .ico { font-size: 22px; color: var(--gold); flex: none; margin-top: 2px; }
.hr-abil b { display: block; font-size: 14px; }
.hr-abil small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.brhero { margin-bottom: 6px; }
.hr-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.hr-pick button { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: none; border: 2px solid transparent; opacity: .55; }
.hr-pick button.on { opacity: 1; border-color: var(--gold); }
.hr-pick canvas { width: 100%; height: 100%; display: block; }
.hr-pick em { position: absolute; right: -4px; bottom: -4px; min-width: 16px; height: 16px; border-radius: 8px; font-style: normal; font-size: 10px; line-height: 16px; text-align: center; color: #fff; background: var(--accent); }
.hr-pick .hr-more { display: grid; place-items: center; opacity: 1; border: 1px dashed var(--line-2); font-size: 20px; color: var(--muted); }
.hero-card canvas { width: 30px; height: 30px; display: block; margin: 0 auto 2px; }
.hero-card { border-color: var(--gold) !important; }

/* ============ карта Стейтленда ============ */
.cq { display: flex; gap: 10px; height: min(74vh, 560px); }
.cq-map { position: relative; flex: 1; min-width: 0; border-radius: 12px; background: var(--water, #d5e5f4); overflow: hidden; }
:root[data-theme="dark"] .cq-map { background: #0f1b2d; }
.cq-map canvas { display: block; }
.cq-head { position: absolute; left: 8px; top: 8px; padding: 4px 10px; border-radius: 8px; background: var(--panel); font-size: 12px; color: var(--muted); }
.cq-head b { color: var(--text); }
.cq-panel { width: 230px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.cq-top { display: flex; gap: 10px; align-items: center; }
.cq-top canvas { width: 54px; height: 54px; flex: none; }
.cq-top b { display: block; font-size: 16px; }
.cq-top small { display: block; font-size: 12px; }
.cq-diff { color: var(--gold); letter-spacing: 1px; }
.cq-txt { margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.cq-rw { display: flex; flex-wrap: wrap; gap: 4px; }
.cq-panel .cta { margin-top: auto; }
.cq-done { display: grid; gap: 4px; justify-items: center; text-align: center; }
.cq-done .ico { font-size: 34px; color: var(--gold); }
@media (max-height: 500px) { .cq { height: calc(100vh - 86px); } .cq-panel { width: 200px; } .cq-txt { font-size: 12px; } }
/* цели-звёзды (испытание недели, задачи) — не «новинки»; названия задач видны всегда */
.nt.wk-goal b::before { content: none; }
.nt.help b::before { content: none; }
.lv.task .t { display: block !important; font-size: 12px; line-height: 1.2; }
.proto.fixed { cursor: default; }
.cl-ver { display: block !important; }

/* ============ испытание недели: два режима ============ */
.wk-cards { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.wk-card { display: flex; gap: 12px; text-align: left; padding: 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); align-items: flex-start; }
.wk-card:disabled { opacity: .7; }
.wk-ico { font-size: 30px; color: var(--gold); flex: none; }
.wk-card small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.wk-card b { display: block; font-size: 17px; margin: 2px 0 4px; }
.wk-card p { margin: 0 0 6px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.wk-card em { font-style: normal; font-size: 12px; color: var(--gold); }
.wk-track { display: flex; align-items: center; gap: 4px; margin: 6px 0; flex-wrap: wrap; }
.wk-stage { display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.wk-stage b { display: grid; place-items: center; width: 26px; height: 26px; margin: 0; border-radius: 50%; background: var(--track); font-size: 13px; }
.wk-stage.cur { border-color: var(--gold); }
.wk-stage.done b { background: #16a06e; color: #fff; }
.wk-stage.crate b { background: none; color: var(--gold); font-size: 20px; }
.wk-stage small { font-size: 10px; text-transform: none; letter-spacing: 0; }
.wk-stage em i { display: inline-block; width: 8px; height: 8px; margin: 0 1px; border-radius: 2px; transform: rotate(45deg); }
.wk-arrow { color: var(--muted); }
@media (max-height: 500px) { .wk-card p { display: none; } .wk-card { padding: 10px; } }

/* ============ новости и обратная связь ============ */
.nw-write { white-space: nowrap; }
.nw-body { display: grid; gap: 8px; }
.nw-item p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; }
.nw-item .cx-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.nw-item .cx-h small { color: var(--muted); white-space: nowrap; }
.nw-item.reply { border-left: 4px solid var(--accent); }
.nw-item .muted { color: var(--muted); }
.fb-text { width: 100%; min-height: 110px; resize: vertical; margin: 10px 0; font: inherit; padding: 10px; }
#fbKind { justify-content: center; }
#mNews { position: relative; }
#mNews .nb { top: -4px; right: -4px; }

/* ============ «Рубеж» ============ */
.td-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.td-pick button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.td-pick button { display: grid; justify-items: center; gap: 1px; padding: 5px 2px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.td-pick button span { font-size: 18px; color: var(--accent); display: grid; }
.td-pick button b { font-size: 10px; line-height: 1.1; }
.td-pick button em { font-style: normal; font-size: 11px; color: var(--gold); font-family: 'Russo One'; }
.td-pick button:disabled { opacity: .45; }
#basePanel #tdSell { margin-top: 4px; }
.fb-text { text-transform: none !important; letter-spacing: normal !important; text-align: left !important; font-size: 14px !important; }

/* «Рубеж»: снабжение и жизни крупно, справка по врагам */
.tdchips { display: flex; gap: 6px; }
.tdc { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(29,37,51,.12); }
.tdc > span { font-size: 18px; display: grid; }
.tdc b { font-family: 'Russo One'; font-weight: 400; font-size: 18px; }
.tdc small { font-size: 10px; color: var(--muted); }
.tdc.gold > span { color: var(--gold); }
.tdc.life > span { color: #d8263c; }
.tdc.life.low { animation: tdLow 0.9s infinite; border-color: #d8263c; }
@keyframes tdLow { 50% { box-shadow: 0 0 0 4px rgba(216,38,60,.35); } }
.tdc.bump { animation: tdBump .35s ease-out; }
@keyframes tdBump { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (max-height: 500px) { .tdc small { display: none; } .tdc b { font-size: 15px; } .tdc { padding: 3px 8px; } }
.tdf { display: grid; gap: 4px; width: 100%; }
.tdf-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr auto; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 8px; background: var(--panel-2); border-left: 4px solid #d8324f; font-size: 12px; }
.tdf-row small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.tdf-row span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; }
.tdf-row em { font-style: normal; color: #d8263c; font-family: 'Russo One'; }
.tdf-bar { display: inline-block; width: 40px; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.tdf-bar i { display: block; height: 100%; background: var(--accent); }
.tdf-fast { border-left-color: #e89a0c; } .tdf-swarm { border-left-color: #16a06e; } .tdf-armor { border-left-color: #5d6b82; } .tdf-heavy { border-left-color: #8e1f37; } .tdf-air { border-left-color: #2a8cf2; }
@media (max-height: 500px) { .tdf-row small { display: none; } }
/* колонки брифинга не раздвигаются содержимым (справка по врагам, выбор карты) */
.panel.brief > * { min-width: 0; }
.tdf-row { grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr)) auto; }
.tdf-bar { width: 100%; max-width: 40px; flex: 1; }

/* «Рубеж»: 8 стратегий, строка героя про «Рубеж», навыки в брифинге */
.stg.n8 { grid-template-columns: repeat(8, 1fr); }
.stg button b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hr-td { margin-top: 4px; color: var(--accent) !important; display: flex !important; align-items: center; gap: 4px; }
.hr-td .ico { font-size: 13px; }
.protos .proto.on { cursor: default; }
.protos div.proto em .ico { font-size: 11px; vertical-align: -1px; }
@media (max-width: 700px) { .stg.n8 { grid-template-columns: repeat(4, 1fr); } }

/* «Рубеж»: панель площадки — полные названия, карточка модели с подтверждением */
.bpanel.tdpanel { width: 264px; }
.tdpanel .td-pick { grid-template-columns: 1fr 1fr; gap: 5px; }
.tdpanel .td-pick button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; justify-items: start; gap: 6px; padding: 7px 8px; text-align: left; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.tdpanel .td-pick button b { font-size: 12.5px; white-space: normal; overflow: visible; }
.tdpanel .td-pick button.poor { opacity: .55; }
.tdpanel .td-pick button.poor em { color: #d8263c; }
.tdhint { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; text-align: center; }
.tdk { display: grid; grid-template-columns: 74px 1fr 54px; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.tdk span { color: var(--muted); font-weight: 400; }
.tdk > i { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.tdk > i > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #6cc4ff); border-radius: 3px; }
.tdk b { text-align: right; }
.tdtags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.tdtags em { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(47,143,232,.14); color: var(--accent); }
.tdok { display: grid; grid-template-columns: 44px 1fr; gap: 6px; margin-top: 6px; }
.tdok button { width: auto; }
#tdOk { background: #16a06e; border-color: #16a06e; color: #fff; font-weight: 700; }
#tdOk:disabled { background: var(--track); border-color: var(--line); color: var(--muted); }
.tdneed { display: block; margin-top: 4px; color: #d8263c; font-size: 11px; text-align: center; }
@media (max-height: 500px) {
  .bpanel.tdpanel { width: 250px; }
  .tdpanel .td-pick button { padding: 5px 6px; }
  .tdpanel .td-pick button b { font-size: 11.5px; }
  .tdpanel p { font-size: 11px; }
}

/* «Рубеж»: панель площадки помещается на экране, названия не вылезают */
#basePanel { z-index: 20; }
.bpanel.tdpanel { overflow-y: auto; overscroll-behavior: contain; }
.tdpanel .td-pick { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tdpanel .td-pick button { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; row-gap: 0; min-width: 0; }
.tdpanel .td-pick button span { grid-row: 1 / 3; }
.tdpanel .td-pick button b { min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }
.tdpanel .td-pick button em { grid-column: 2; font-size: 11px; }
.tdpanel .tdk { grid-template-columns: 64px minmax(0, 1fr) 46px; }
.tdpanel .tdok button { min-width: 0; white-space: nowrap; }
@media (max-height: 500px) {
  .bpanel.tdpanel { width: 236px; padding: 8px; }
  .tdpanel .hd { margin-bottom: 3px; }
  .tdpanel .hd b { font-size: 13px; }
  .tdpanel p { font-size: 10.5px; margin-bottom: 4px; line-height: 1.25; }
  .tdpanel .tdk { margin: 1px 0; font-size: 11px; }
  .tdpanel .tdtags { margin: 3px 0; }
  .tdpanel .tdhint { display: none; }
  .tdpanel .td-pick button { padding: 4px 5px; }
  .tdpanel .td-pick button b { font-size: 11px; }
  .tdpanel .tdok { margin-top: 4px; }
}

/* «Оборона»: крупные кнопки режимов */
.dmodes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; padding: 8px 0; }
.dmodes button { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  padding: 12px 14px; min-height: 64px; border-radius: 12px; background: var(--panel-2); border: 1.5px solid var(--line); color: var(--text); }
.dmodes button .ico { grid-row: 1 / 3; font-size: 26px; color: var(--accent); }
.dmodes button b { font-family: 'Russo One'; font-weight: 400; font-size: 16px; line-height: 1.1; }
.dmodes button small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.2; }
.dmodes button.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(47,143,232,.35); }
.dmodes button.on .ico, .dmodes button.on small { color: #fff; }
.dmodes button.locked { opacity: .5; }
.dmodes button.locked .ico { color: var(--muted); }
@media (max-height: 500px) {
  .dmodes { gap: 5px; padding: 4px 0; }
  .dmodes button { min-height: 48px; padding: 7px 9px; column-gap: 7px; }
  .dmodes button .ico { font-size: 20px; }
  .dmodes button b { font-size: 13px; }
  .dmodes button small { font-size: 10px; }
}

/* «Рубеж»: стратегии — 4×2 карточки: иконка сверху, название, коротко плюс и минус */
.tds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.tds button { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; text-align: center;
  padding: 7px 4px 8px; border-radius: 10px; background: var(--panel-2); border: 1.5px solid var(--line); color: var(--text); min-width: 0; }
.tds button .ico { font-size: 24px; color: var(--accent); margin-bottom: 1px; }
.tds button b { font-size: 12.5px; line-height: 1.1; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tds button small { font-size: 10.5px; line-height: 1.2; color: var(--muted); font-weight: 400; max-width: 100%; }
.tds button.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(47,143,232,.3); }
.tds button.on .ico, .tds button.on small { color: #fff; }
.tds button.locked { opacity: .5; }
.tds button.locked .ico { color: var(--muted); }
@media (max-height: 500px) {
  .tds { gap: 4px; margin-top: 3px; }
  .tds button { padding: 4px 2px 5px; gap: 1px; }
  .tds button .ico { font-size: 17px; }
  .tds button b { font-size: 10.5px; }
  .tds button small { font-size: 8.5px; line-height: 1.15; }
}

/* Главное меню: карточки режимов — свой цвет, иконка на плашке, мягкое свечение в углу */
#scrMenu .expedbtn, #scrMenu .defbtn { --mc: 138,90,216; isolation: isolate; border-width: 1.5px; border-color: rgba(var(--mc), .6);
  background: radial-gradient(120px 90px at 100% 100%, rgba(var(--mc), .22), rgba(var(--mc), 0) 70%), linear-gradient(135deg, rgba(var(--mc), .16), rgba(var(--mc), .04) 55%), var(--panel);
  box-shadow: 0 4px 14px rgba(var(--mc), .18), inset 0 1px 0 rgba(255,255,255,.08); min-width: 0; }
#scrMenu .defbtn { --mc: 224,58,92; }
#scrMenu .wkbtn { --mc: 217,154,18; }
#scrMenu .expedbtn > span:nth-child(2), #scrMenu .defbtn > span:nth-child(2) { min-width: 0; flex: 1 1 auto; }
#scrMenu .expedbtn b, #scrMenu .defbtn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
#scrMenu .expedbtn > span:first-child, #scrMenu .defbtn > span:first-child {
  width: 42px; height: 42px; flex: none; place-items: center; border-radius: 12px; color: #fff !important;
  background: linear-gradient(145deg, rgba(var(--mc), 1), rgba(var(--mc), .72)); box-shadow: 0 3px 8px rgba(var(--mc), .4), inset 0 1px 0 rgba(255,255,255,.3); font-size: 22px; }
#scrMenu .playbtn { background: linear-gradient(135deg, #4aa8ff, #2f8fe8 45%, #1f6fcf); box-shadow: 0 4px 0 var(--accent-d), 0 8px 22px rgba(47,143,232,.35); }
#scrMenu .playbtn > span:first-child { width: 48px; height: 48px; flex: none; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
@media (max-height: 500px) {
  #scrMenu .expedbtn > span:first-child, #scrMenu .defbtn > span:first-child { width: 32px; height: 32px; border-radius: 9px; font-size: 17px; }
  #scrMenu .playbtn > span:first-child { width: 36px; height: 36px; }
}

/* Бой: карточки навыков, протоколов и героя — мягкий градиент, иконка со свечением */
#hud .card { background: linear-gradient(160deg, rgba(47,143,232,.12), rgba(47,143,232,0) 60%), var(--panel); box-shadow: 0 3px 10px rgba(29,37,51,.14), inset 0 1px 0 rgba(255,255,255,.08); }
#hud .card > .ico { filter: drop-shadow(0 2px 4px rgba(47,143,232,.35)); }
#hud .card.skill { border-color: rgba(47,143,232,.45); }
#hud .card.arm { box-shadow: 0 0 0 2px var(--gold), 0 6px 16px rgba(217,154,18,.35); }
#hud .air .card { background: linear-gradient(160deg, rgba(224,106,18,.14), rgba(224,106,18,0) 60%), var(--panel); }
/* три карточки режимов — поровну, «В бой» — по содержимому */
#scrMenu .mplay > .expedbtn, #scrMenu .mplay > .defbtn { flex: 1 1 0; min-width: 0; max-width: 330px; }
#scrMenu .mplay > .playbtn { flex: 0 1 auto; }
#scrMenu .expedbtn { text-align: left; }

/* единые карточки выбора в брифинге: стратегии, протоколы, навыки, бустеры */
.tds { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important; }
.tds button { position: relative; }
.tds button em.cost { position: absolute; top: 4px; right: 6px; font-style: normal; font-family: 'Russo One'; font-size: 11px; color: var(--gold); display: flex; align-items: center; gap: 1px; }
.tds button em.cost .ico { font-size: 11px; }
.tds button.on em.cost { color: #fff; }
.tds button small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-height: 500px) { .tds { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; } .tds button em.cost { font-size: 9.5px; top: 2px; right: 4px; } }

/* заставка студии BlackBox */
#splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #1b1410 0%, #0a0a0c 60%, #050506 100%); transition: opacity .45s; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .sp-in { display: grid; justify-items: center; gap: 14px; animation: spIn 1.1s cubic-bezier(.2,.8,.2,1) both; }
#splash img { width: min(150px, 28vmin); height: auto; filter: drop-shadow(0 0 22px rgba(255,110,20,.55)) drop-shadow(0 0 60px rgba(255,90,0,.25)); animation: spGlow 2.2s ease-in-out infinite alternate; }
#splash b { font-family: 'Exo 2', sans-serif; font-weight: 600; letter-spacing: .6em; margin-right: -.6em; color: #f2f2f2; font-size: min(26px, 5.5vmin); }
#splash small { color: #8a8f99; letter-spacing: .3em; margin-right: -.3em; text-transform: uppercase; font-size: min(12px, 3vmin); animation: spIn 1.1s .5s both; }
@keyframes spIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes spGlow { from { filter: drop-shadow(0 0 16px rgba(255,110,20,.4)) drop-shadow(0 0 40px rgba(255,90,0,.15)); } to { filter: drop-shadow(0 0 26px rgba(255,120,30,.7)) drop-shadow(0 0 70px rgba(255,90,0,.3)); } }
/* настройки: разработчик */
.row.about img { width: 28px; height: auto; filter: drop-shadow(0 0 6px rgba(255,110,20,.45)); }
.btnlink { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); font-size: 14px; text-decoration: none; font-weight: 600; }

/* главное меню: «В бой» — красная; три карточки режимов одного размера и ниже «В бой» */
#scrMenu .playbtn { background: linear-gradient(135deg, #ff6a7c, #e03a5c 50%, #b8243f) !important; box-shadow: 0 4px 0 #8f1c33, 0 8px 22px rgba(224,58,92,.38) !important; }
#scrMenu .playbtn:active { box-shadow: 0 1px 0 #8f1c33 !important; }
#scrMenu .playbtn .x2 { background: var(--gold) !important; }
#scrMenu .mplay { align-items: flex-end; }
#scrMenu .mplay > .expedbtn, #scrMenu .mplay > .defbtn { flex: 1 1 0; max-width: 300px; height: 66px; padding-top: 6px; padding-bottom: 6px; }
@media (max-height: 500px) { #scrMenu .mplay > .expedbtn, #scrMenu .mplay > .defbtn { height: 52px; } }
#scrMenu .mplay > .expedbtn small, #scrMenu .mplay > .defbtn small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; }

/* дуэль с другом */
.duel-entry { display: flex; align-items: center; gap: 12px; width: 100%; margin: 4px 0 8px; padding: 10px 14px; border-radius: 12px; text-align: left; color: #fff;
  background: linear-gradient(135deg, #ff6a7c, #e03a5c 55%, #8a5ad8); box-shadow: 0 4px 14px rgba(224,58,92,.3); border: 0; }
.duel-entry .ico { font-size: 26px; }
.duel-entry b { display: block; font-family: 'Russo One'; font-weight: 400; font-size: 16px; }
.duel-entry small { display: block; opacity: .85; font-size: 12px; }
.duel .brtext { text-align: left; }
.duel-map { border: 0; padding: 6px 0; flex-wrap: wrap; }
.duel-go { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.duel-go button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.duel-code { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.duel-code b { width: 58px; height: 70px; display: grid; place-items: center; font-family: 'Russo One'; font-weight: 400; font-size: 40px; border-radius: 12px;
  background: var(--panel-2); border: 2px solid var(--accent); color: var(--text); }
.duel-wait { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.duel-input { font-family: 'Russo One'; font-size: 34px; letter-spacing: .5em; text-align: center; max-width: 240px; margin: 8px auto; display: block; }
@media (max-height: 500px) { .duel-code b { width: 44px; height: 52px; font-size: 30px; } .duel-input { font-size: 26px; } .duel-entry { padding: 7px 10px; } }

/* логотип студии в плоском стиле игры: изометрический куб, оранжевые рёбра, «B» на боковой грани */
.bb-logo { width: 34px; height: 34px; flex: none; margin-right: 2px; overflow: visible; filter: drop-shadow(0 2px 3px rgba(29,37,51,.25)); }
.bb-logo .bb-t { fill: #3c4556; } .bb-logo .bb-l { fill: #1d2533; } .bb-logo .bb-r { fill: #2a3242; }
.bb-logo .bb-e { fill: none; stroke: #ff7a1a; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.bb-logo .bb-b { font-family: 'Russo One', sans-serif; font-size: 7.6px; fill: #ff9a3c; }
