/* Единый тёмный облик игры: сцена всегда ночная, интерфейс — стекло поверх 3D */
:root {
  --bg: #0a1215; --glass: rgba(9, 16, 20, .74); --edge: rgba(130, 200, 255, .16); --edge-hi: rgba(130, 200, 255, .38);
  --fg: #dbe8ee; --dim: #7f97a3; --gold: #f2c14e; --gold-deep: #b9862a; --cyan: #6ff3ff; --red: #ff5a4a; --green: #6be39a;
  --f-display: "Russo One", "Exo 2", system-ui, sans-serif; --f-ui: "Exo 2", system-ui, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); overflow: hidden; }
body { font-family: var(--f-ui); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; }
#view, #view canvas { position: absolute; inset: 0; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.gold { color: var(--gold); }

#hud-top, #hud-bot {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: clamp(10px, 2vw, 28px);
  padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 5;
}
#hud-top { top: 0; padding-block: max(8px, env(safe-area-inset-top, 0px)) 8px; border-bottom: 1px solid var(--edge); }
#hud-bot { bottom: 0; padding-block: 10px max(10px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--edge); gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-size: clamp(15px, 1.6vw, 21px); letter-spacing: .04em; white-space: nowrap; }
.brand em { font-style: normal; color: var(--gold); }
.logo { width: 22px; height: 24px; background: linear-gradient(160deg, var(--gold), var(--gold-deep)); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); box-shadow: 0 0 12px var(--gold); }
.stat { display: grid; gap: 2px; min-width: 0; flex: none; }
.stat label { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.stat label span { white-space: nowrap; color: var(--fg); letter-spacing: .02em; margin-left: 6px; font-variant-numeric: tabular-nums; }
.stat b { white-space: nowrap; font-family: var(--f-display); font-weight: 400; font-size: clamp(17px, 1.7vw, 22px); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat.hp { width: clamp(110px, 16vw, 200px); }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3fbf7a, var(--green)); box-shadow: 0 0 10px var(--green); transition: width .25s; }
.bar i[data-state="warn"] { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); box-shadow: 0 0 10px var(--gold); }
.bar i[data-state="crit"] { background: linear-gradient(90deg, #b8302a, var(--red)); box-shadow: 0 0 12px var(--red); }
.spacer { flex: 1; }
#hud-top .meta { display: grid; justify-items: end; font-size: 12px; font-weight: 600; color: var(--dim); white-space: nowrap; }
#s-sdk { font-size: 11px; font-weight: 400; }
#s-sdk[data-live="1"] { color: var(--green); }

.cards { display: flex; gap: 10px; min-width: 0; }
.card {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; height: 64px; min-width: 0;
  border-radius: 12px; border: 1px solid var(--edge); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.01));
  transition: border-color .15s, background .15s, transform .1s;
}
.card img { width: 56px; height: 56px; flex: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.card .meta { display: grid; text-align: left; gap: 2px; }
.card b { font-size: 15px; font-weight: 700; white-space: nowrap; }
.card .cost { font-size: 14px; font-weight: 700; color: var(--gold); }
.card kbd { position: absolute; top: 5px; right: 7px; font: 600 10px var(--f-ui); color: var(--dim); }
.card:hover:not(:disabled) { border-color: var(--edge-hi); background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.02)); }
.card:active:not(:disabled) { transform: translateY(1px); }
.card.sel { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 18px -2px var(--c); }
.card:disabled { opacity: .4; }

.aux { height: 64px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); display: grid; place-content: center; gap: 2px; font-size: 13px; font-weight: 700; }
.aux.sq { width: 58px; padding: 0; font-family: var(--f-display); font-size: 19px; font-weight: 400; }
.aux.sel { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 14px -4px var(--cyan); }
.aux:hover:not(:disabled) { border-color: var(--edge-hi); }
.aux:disabled { opacity: .4; }
#b-ad { margin-left: auto; }
.primary {
  height: 64px; width: 184px; flex: none; white-space: nowrap; overflow: hidden; padding: 0 18px; border-radius: 12px; border: 1px solid #ffe08a;
  background: linear-gradient(180deg, #f6cf62, #c8902c); color: #1d1404; display: grid; place-content: center; gap: 2px;
  box-shadow: 0 0 22px -6px var(--gold), inset 0 1px 0 rgba(255,255,255,.5);
}
.primary span { font-family: var(--f-display); font-size: 18px; letter-spacing: .02em; }
.primary small { font-size: 11.5px; font-weight: 700; opacity: .75; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.primary span, .primary small { display: block; text-align: center; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { background: rgba(255,255,255,.05); color: var(--dim); border-color: var(--edge); box-shadow: none; }

#hint {
  position: absolute; left: 50%; bottom: 104px; transform: translate(-50%, 8px); z-index: 4; pointer-events: none;
  padding: 7px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--edge); backdrop-filter: blur(8px);
  font-size: 14px; font-weight: 600; text-align: center; max-width: min(620px, calc(100vw - 32px)); width: max-content; box-sizing: border-box;
  opacity: 0; transition: opacity .2s, transform .2s;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }


#floats { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -50%); font: 700 15px var(--f-ui); color: var(--gold); text-shadow: 0 0 8px rgba(242,193,78,.7), 0 1px 2px #000; animation: rise .9s ease-out forwards; }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -36px; } }

#end { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(4, 8, 10, .7); background-image: linear-gradient(rgba(4,8,10,.3), rgba(4,8,10,.6)), var(--endbg, none); background-size: cover; background-position: center; }
.end-box { padding: 30px 40px; border-radius: 16px; background: var(--glass); border: 1px solid var(--edge-hi); text-align: center; display: grid; gap: 14px; justify-items: center; max-width: calc(100vw - 32px); box-sizing: border-box; }
.end-box h2 { margin: 0; font: 400 34px var(--f-display); letter-spacing: .03em; text-transform: uppercase; color: var(--red); text-shadow: 0 0 22px rgba(255,90,74,.6); }
.end-box h2[data-win="1"] { color: var(--gold); text-shadow: 0 0 22px rgba(242,193,78,.6); }
.end-box p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--dim); }
.end-box p b { color: var(--fg); }

#loading { position: absolute; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; background: var(--bg) var(--keyart, none) center / cover; transition: opacity .5s; }
#loading::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(5,8,12,.25), rgba(5,8,12,.85)); }
#loading > * { position: relative; }
.ld-logo { width: min(400px, 64vw, 56vh); filter: drop-shadow(0 12px 30px rgba(0,0,0,.75)); }
#loading.gone { opacity: 0; pointer-events: none; }
.ld-title { font: 400 34px var(--f-display); letter-spacing: .05em; }
.ld-title em { font-style: normal; color: var(--gold); }
.ld-motto { margin: 0; max-width: calc(100vw - 32px); font: 400 clamp(16px, 2vw, 22px) var(--f-display); color: var(--gold); letter-spacing: .05em; text-shadow: 0 2px 10px #000; }
#loading.tap { cursor: pointer; }
#loading.tap .ld-sub { font: 400 clamp(16px, 1.8vw, 20px) var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: #fff; animation: ldpulse 1.6s ease-in-out infinite; }
@keyframes ldpulse { 50% { opacity: .45; } }
.ld-sub { color: var(--fg); font-weight: 600; text-shadow: 0 1px 6px #000; }

.ad-stub { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(4, 8, 10, .9); }
.ad-box { padding: 28px 36px; border: 2px dashed var(--gold); border-radius: 14px; background: #0b1216; text-align: center; display: grid; gap: 8px; max-width: calc(100vw - 32px); box-sizing: border-box; }
.ad-tag { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.ad-title { font: 400 22px var(--f-display); color: var(--gold); }
.ad-count { font-size: 14px; }

@media (max-width: 900px) {
  .card { padding-right: 8px; } .card .meta b { display: none; } .card img { width: 48px; height: 48px; }
  .primary { width: 132px; padding: 0 10px; } .primary span { font-size: 15px; } #hud-top .meta { display: none; }
}
@media (max-height: 460px) {
  .card, .aux, .primary { height: 52px; } .card img { width: 44px; height: 44px; } #hint { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { .float { animation-duration: .01s; } #hint { transition: none; } }

/* кнопки в верхней панели */
.topbtn { position: relative; overflow: hidden; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); display: grid; align-content: center; justify-items: start; text-align: left; }
.topbtn span { font-size: 13px; font-weight: 700; }
.topbtn small { font-size: 10.5px; color: var(--dim); font-weight: 600; white-space: nowrap; }
.topbtn i { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.topbtn:hover { border-color: var(--edge-hi); }
.topbtn.busy { border-color: rgba(111,243,255,.5); }
.topbtn.busy small { color: var(--cyan); }
.warn { color: #d8ff6a; }

/* модальные окна */
.modal { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center; background: rgba(4, 8, 10, .55); padding: 16px; box-sizing: border-box; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-head h3 { margin: 0; font: 400 20px var(--f-display); letter-spacing: .03em; }
.x { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); font-size: 14px; }
.x:hover { border-color: var(--edge-hi); }
.m-note { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.5; }

.lab-box { width: min(520px, 100%); padding: 18px 20px; border-radius: 16px; background: rgba(9, 16, 20, .94); border: 1px solid var(--edge-hi); display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lab-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); }
.lab-row + .lab-row { margin-top: 8px; }
.lab-txt { flex: 1; display: grid; gap: 4px; min-width: 0; }
.lab-txt b { font-size: 15px; }
.lab-txt small { color: var(--dim); font-size: 12.5px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 18px; height: 5px; border-radius: 2px; background: rgba(255,255,255,.12); }
.pips i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.lab-row button { flex: none; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(242,193,78,.5); background: rgba(242,193,78,.1); color: var(--gold); font-weight: 700; font-size: 13px; white-space: nowrap; }
.lab-row button:hover:not(:disabled) { background: rgba(242,193,78,.18); }
.lab-row button:disabled { opacity: .4; }
.lab-row .done { font-size: 12.5px; font-weight: 700; color: var(--green); }
.prog { position: relative; width: 140px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.06); overflow: hidden; display: grid; place-items: center; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(111,243,255,.25), rgba(111,243,255,.55)); }
.prog span { position: relative; font-size: 12px; font-weight: 700; color: var(--cyan); }

.gal-box { width: min(1120px, 100%); height: min(680px, 100%); display: grid; grid-template-columns: 1fr 320px; border-radius: 16px; overflow: hidden; border: 1px solid var(--edge-hi); background: rgba(9, 16, 20, .96); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.gal-view { position: relative; min-width: 0; min-height: 0; cursor: grab; }
.gal-view canvas { position: absolute; inset: 0; display: block; touch-action: none; }
.gal-tip { position: absolute; left: 14px; bottom: 12px; font-size: 12px; color: var(--dim); pointer-events: none; z-index: 1; }
.gal-side { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-left: 1px solid var(--edge); min-height: 0; overflow-y: auto; }
#gal-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gal-item { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px; border-radius: 10px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); text-align: left; }
.gal-item img { grid-row: span 2; width: 40px; height: 40px; }
.gal-item span { font-size: 12.5px; font-weight: 700; line-height: 1.15; }
.gal-item small { font-size: 10.5px; color: var(--dim); }
.gal-item:hover { border-color: var(--edge-hi); }
.gal-item.sel { border-color: var(--gold); box-shadow: 0 0 12px -4px var(--gold); }
.gal-info { display: grid; gap: 8px; }
.gal-info h4 { margin: 0; font: 400 22px var(--f-display); color: var(--gold); }
.gal-info p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--dim); }
.gal-info p b { color: var(--fg); }
#gal-lv { display: flex; gap: 6px; }
#gal-lv:empty { display: none; }
#gal-lv button { flex: 1; height: 32px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); font-size: 12px; font-weight: 700; }
#gal-lv button.sel { border-color: var(--gold); color: var(--gold); }
@media (max-width: 760px) {
  .gal-box { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .gal-side { border-left: 0; border-top: 1px solid var(--edge); max-height: 46vh; }
  #gal-list { grid-template-columns: repeat(4, 1fr); }
  .gal-item { grid-template-columns: 1fr; justify-items: center; text-align: center; } .gal-item img { grid-row: auto; } .gal-item small { display: none; }
  .topbtn small { display: none; }
}

.float.myc { color: #b8ff6a; text-shadow: 0 0 8px rgba(160,255,90,.7), 0 1px 2px #000; font-size: 13px; }
.float.pol { color: #ffe066; text-shadow: 0 0 8px rgba(255,220,90,.7), 0 1px 2px #000; font-size: 13px; }
.pol { color: #ffe066; }
#legend {
  position: absolute; left: 14px; bottom: 98px; z-index: 4; width: 290px; display: grid; gap: 6px; pointer-events: none;
  padding: 9px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--edge); backdrop-filter: blur(8px);
  font-size: 12px; line-height: 1.35; color: var(--dim);
}
#legend b { color: #e8eef0; font-weight: 700; margin-right: 4px; }
#legend em { font-style: normal; color: #b8ff6a; }
.lg-row { display: grid; grid-template-columns: 12px 1fr; gap: 8px; align-items: start; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 3px; }
.lg-dot.myc { background: #9dff5a; box-shadow: 0 0 8px #9dff5a; }
.lg-dot.pol { background: #ffd84a; box-shadow: 0 0 8px #ffd84a; }
@media (max-width: 900px), (max-height: 520px) { #legend { display: none; } }

@media (max-width: 700px) {
  .brand > span { display: none; }
  .topbtn small { display: none; }
  #hud-top { gap: 10px; }
}
#b-snd.off { opacity: .5; }
#comms {
  position: absolute; left: 50%; top: 74px; z-index: 6; display: flex; gap: 12px; align-items: center; pointer-events: none;
  width: min(460px, calc(100vw - 32px)); box-sizing: border-box; padding: 8px 14px 8px 8px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--edge); border-left: 3px solid var(--c, var(--cyan)); backdrop-filter: blur(10px);
  opacity: 0; transform: translate(-50%, -8px); transition: opacity .3s, transform .3s;
}
#comms.show { opacity: 1; transform: translate(-50%, 0); }
#comms img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--edge-hi); }
#comms b { display: block; font: 400 14px var(--f-display); color: var(--c, var(--cyan)); letter-spacing: .03em; margin-bottom: 3px; }
#comms p { margin: 0; font-size: 13.5px; line-height: 1.4; }
#brief { z-index: 21; background: linear-gradient(rgba(4,8,10,.35), rgba(4,8,10,.75)), var(--hq) center/cover; }
.brief-box { width: min(860px, calc(100vw - 32px)); display: grid; grid-template-columns: 240px 1fr; gap: 22px; padding: 22px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--edge-hi); backdrop-filter: blur(6px); box-sizing: border-box; align-items: start; }
.brief-pt { display: grid; gap: 4px; }
.brief-pt img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--edge-hi); margin-bottom: 6px; }
.brief-pt b { font: 400 17px var(--f-display); color: var(--gold); }
.brief-pt small { color: var(--dim); font-size: 12.5px; }
.brief-txt h3 { margin: 0 0 10px; font: 400 26px var(--f-display); text-transform: uppercase; letter-spacing: .03em; }
.brief-txt p { margin: 0 0 12px; font-size: 15px; line-height: 1.55; color: #d6e0e4; }
.brief-txt .primary { margin-top: 6px; }
@media (max-width: 700px), (max-height: 520px) {
  .brief-box { grid-template-columns: 96px 1fr; gap: 12px; padding: 14px; }
  .brief-pt small, .brief-pt b { display: none; }
  .brief-txt h3 { font-size: 18px; } .brief-txt p { font-size: 13px; margin-bottom: 8px; }
  #comms { top: 60px; } #comms img { width: 48px; height: 48px; } #comms p { font-size: 12.5px; }
}
.bad { color: #ff7a6a; }
.float.bad { color: #ff7a6a; text-shadow: 0 0 8px rgba(255,90,74,.7), 0 1px 2px #000; font-size: 13px; }

/* кампания */
#camp { z-index: 22; background: #05080c; }
.camp-box { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.camp-map { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; border: 1px solid var(--edge-hi); background: var(--campbg) center/cover; overflow: hidden; align-self: center; box-shadow: 0 0 40px -10px rgba(80,180,255,.5); }
.camp-map .node { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid var(--gold); background: rgba(10,14,18,.85); color: var(--gold); font: 700 13px var(--f-ui, sans-serif); display: grid; place-items: center; padding: 0; box-shadow: 0 0 14px rgba(242,193,78,.7); animation: nodepulse 2s ease-in-out infinite; }
.camp-map .node:hover { transform: scale(1.15); background: rgba(242,193,78,.25); }
.camp-map .node.done { border-color: #8dffb0; color: #8dffb0; box-shadow: 0 0 12px rgba(93,255,154,.6); animation: none; }
.camp-map .node.locked { width: 16px; height: 16px; margin: -8px 0 0 -8px; font-size: 0; border: 1px solid rgba(111,243,255,.5); box-shadow: none; animation: none; background: rgba(10,14,18,.6); cursor: default; }
@keyframes nodepulse { 50% { box-shadow: 0 0 24px rgba(242,193,78,1); } }
.camp-side { display: grid; align-content: start; gap: 10px; padding: 18px; border-radius: 14px; background: var(--glass); border: 1px solid var(--edge-hi); overflow: auto; max-height: calc(100vh - 24px); box-sizing: border-box; }
.camp-side h3 { margin: 0; font: 400 26px var(--f-display); text-transform: uppercase; letter-spacing: .03em; color: var(--gold); }
.camp-act { margin: 0; color: var(--cyan); font-size: 13px; font-weight: 700; }
#camp-list { display: grid; gap: 8px; }
.camp-item { display: grid; gap: 3px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); }
.camp-item:hover { border-color: var(--edge-hi); background: rgba(255,255,255,.08); }
.camp-item b { font-size: 14px; } .camp-item small { font-size: 12px; color: var(--dim); line-height: 1.35; }
.camp-item i { font-style: normal; font-size: 12px; font-weight: 700; color: #8dffb0; }
@media (max-width: 860px) { .camp-box { grid-template-columns: 1fr; overflow: auto; } .camp-side { max-height: none; } }
/* брифинг миссии */
.br-meta { color: var(--cyan); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.br-goal { padding: 10px 12px; border-radius: 10px; background: rgba(242,193,78,.08); border: 1px solid rgba(242,193,78,.3); font-size: 14px !important; }
.br-goal b { color: var(--gold); }
.br-diff { display: flex; gap: 8px; margin: 4px 0 10px; }
.br-diff button { flex: 1; height: 34px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(255,255,255,.04); font-weight: 700; font-size: 13px; }
.br-diff button.sel { border-color: var(--edge-hi); background: rgba(255,255,255,.12); box-shadow: 0 0 12px -4px var(--cyan); }
.br-diff button[data-d="easy"] { color: #8dffb0; } .br-diff button[data-d="normal"] { color: var(--cyan); } .br-diff button[data-d="hard"] { color: var(--red); }
.br-btns, .end-btns { display: flex; gap: 10px; }
.br-btns .primary { flex: 1; margin-top: 0 !important; }
.br-btns, .end-btns { align-items: stretch; }
.br-btns .primary, .end-btns .primary { height: 64px; font: 400 24px var(--f-display); text-transform: uppercase; letter-spacing: .06em; }
.end-btns .primary { width: auto; min-width: 200px; padding: 0 28px; font-size: 20px; }
button.ghost.globe { width: 64px; height: 64px; padding: 0; flex: none; display: grid; place-items: center; color: var(--cyan); border-radius: 12px; }
button.ghost.globe:hover { color: #fff; }
@media (max-width: 520px) { .end-btns .primary { flex: 1; min-width: 0; padding: 0 14px; font-size: 16px; letter-spacing: .03em; } }
button.ghost { padding: 0 18px; height: 44px; border-radius: 10px; border: 1px solid var(--edge-hi); background: rgba(255,255,255,.05); font-weight: 700; }
button.ghost:hover { background: rgba(255,255,255,.1); }
/* карточки башен: компактные плитки фиксированной ширины; если все не влезают — быстрые слоты + разделы */
:root { --card-w: 78px; --card-h: 72px; }
.cards { flex: 1; gap: 6px; min-width: 0; }
.quick, .groups { display: flex; gap: 6px; }
.groups[hidden] { display: none; }
.quick.sep { padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--edge); }
.card, .grp { flex: none; width: var(--card-w); height: var(--card-h); padding: 4px 2px 5px; display: grid; justify-items: center; align-content: center; gap: 1px; }
.card[hidden], .grp[hidden] { display: none; }
.card img, .grp img { width: 40px; height: 40px; }
.card .meta, .grp .meta { display: grid; justify-items: center; text-align: center; gap: 0; }
.card b, .grp b { font-size: 11.5px; line-height: 1.15; white-space: nowrap; }
.card .cost, .grp .cost { font-size: 12px; line-height: 1.15; }
.card kbd { top: 3px; right: 5px; }
.grp {
  position: relative; border-radius: 12px; border: 1px dashed var(--edge-hi); background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.01));
  transition: border-color .15s, background .15s;
}
.grp img { filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.grp .cost { color: var(--dim); font-weight: 600; }
.grp .caret { position: absolute; top: 3px; right: 6px; font: 600 9px var(--f-ui); font-style: normal; color: var(--dim); transition: transform .15s; }
.grp:hover { border-color: var(--gold); }
.grp.open { border-style: solid; border-color: var(--gold); background: rgba(255,200,80,.1); }
.grp.open .caret { transform: rotate(180deg); color: var(--gold); }
.grp.sel { box-shadow: 0 0 0 1px var(--gold), 0 0 16px -3px var(--gold); }
.grp.poor img { opacity: .45; }
#tray {
  position: fixed; z-index: 6; padding: 6px 8px 8px; border-radius: 14px; border: 1px solid var(--edge-hi);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
#tray[hidden] { display: none; }
#tray small { display: block; margin: 0 2px 5px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.tray-row { display: flex; gap: 6px; }
#tray .card { width: 84px; }
#hud-bot .aux, #hud-bot .primary { flex: none; height: var(--card-h); }
@media (max-width: 900px) { :root { --card-w: 60px; } .card .meta b { display: none; } #tray .card .meta b { display: block; } .grp b { font-size: 10.5px; } }
@media (max-height: 460px) { :root { --card-h: 56px; --card-w: 64px; } .card img, .grp img { width: 32px; height: 32px; } .grp b { font-size: 10px; } }
@media (max-width: 760px) {
  #hud-bot { gap: 6px; } #hud-bot .aux { padding: 0 8px; font-size: 12px; } #hud-bot .aux.sq { width: 42px; font-size: 17px; }
  #hud-bot .primary { width: 116px; } .primary span { font-size: 14px; }
}
.camp-act-h { margin: 10px 0 2px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.camp-act-h:first-child { margin-top: 0; }

/* фон исследований */
#lab { background-image: linear-gradient(rgba(4,8,10,.35), rgba(4,8,10,.65)), var(--labbg, none); background-size: cover; background-position: center; }
.camp-side .m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
button.ghost.camp-menu { height: 34px; padding: 0 14px; }
.camp-act-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camp-act-h span { flex: 1; }
.camp-cine { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--edge-hi); background: rgba(242,193,78,.12); color: var(--gold); font: 700 12px var(--f-ui); cursor: pointer; }
.camp-cine:hover { background: rgba(242,193,78,.22); }

/* титульный экран */
#title { position: absolute; inset: 0; z-index: 24; display: flex; align-items: center; background: #05080c var(--menu, none) center / cover; }
#title::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,8,12,.82) 0%, rgba(5,8,12,.45) 38%, rgba(5,8,12,0) 60%); }
.tl-side { position: relative; width: min(400px, 38vw); margin-left: 6vw; display: grid; gap: 22px; }
.tl-top { display: grid; justify-items: center; gap: 6px; }
.tl-logo { width: min(100%, 52vh); filter: drop-shadow(0 12px 30px rgba(0,0,0,.7)); }
.tl-slogan { margin: 0; font: 400 clamp(15px, 1.6vw, 20px) var(--f-display); color: var(--gold); letter-spacing: .05em; text-shadow: 0 2px 8px #000; text-align: center; }
/* слоган в две строки: угроза роя приглушённо, ответ Бастиона крупным золотом */
.tl-slogan { display: grid; justify-items: center; gap: 4px; text-transform: uppercase; }
.tl-slogan .sl1 { display: flex; align-items: center; gap: 12px; font-size: clamp(13px, 1.25vw, 16px); letter-spacing: .22em; color: #ff9fcf; text-shadow: 0 0 12px rgba(255,80,160,.6), 0 2px 6px #000; }
.tl-slogan .sl1::before, .tl-slogan .sl1::after { content: ''; width: clamp(22px, 3vw, 44px); height: 1px; background: linear-gradient(90deg, rgba(255,159,207,0), #ff9fcf); }
.tl-slogan .sl1::after { transform: scaleX(-1); }
.tl-slogan .sl2 { font-size: clamp(22px, 2.5vw, 32px); letter-spacing: .07em; line-height: 1.1; color: #f6cf62; background: linear-gradient(180deg, #fff3c8 0%, #f6cf62 50%, #c8902c 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: none; filter: drop-shadow(0 0 10px rgba(242,193,78,.55)) drop-shadow(0 2px 3px rgba(0,0,0,.9)); }
html[lang="en"] .tl-slogan .sl1 { letter-spacing: .14em; white-space: nowrap; }
html[lang="en"] .tl-slogan .sl2 { font-size: clamp(20px, 2.2vw, 28px); letter-spacing: .04em; white-space: nowrap; }
.tl-btns { display: grid; gap: 10px; justify-items: stretch; width: min(320px, 100%); margin: 0 auto; }
.tl-btns .primary { width: 100%; }
.tl-btns button.ghost { height: 48px; font-size: 16px; background: rgba(5,9,12,.6); backdrop-filter: blur(6px); }
@media (orientation: portrait) {
  #title { background-image: var(--menuv, var(--menu)); align-items: stretch; }
  #title::before { background: linear-gradient(180deg, rgba(5,8,12,.55) 0%, rgba(5,8,12,0) 28%, rgba(5,8,12,0) 60%, rgba(5,8,12,.85) 100%); }
  .tl-side { width: 100%; margin: 0; padding: 4vh 16px 6vh; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; }
  .tl-logo { width: min(300px, 70vw); }
}
@media (max-height: 520px) and (orientation: landscape) { .tl-side { gap: 12px; } .tl-btns button.ghost { height: 40px; } .tl-btns .primary { height: 54px; } }

/* ролики */
#cine { position: absolute; inset: 0; z-index: 40; background: #000; overflow: hidden; cursor: pointer; user-select: none; }
#cn-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .7s; }
#cn-img.on { opacity: 1; }
#cn-img.kb { animation: cn-kb 14s ease-out forwards; }
@keyframes cn-kb { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
.cn-title { position: absolute; left: 16px; right: 16px; top: 7%; text-align: center; font: 400 clamp(20px, 3vw, 36px) var(--f-display); color: var(--gold); letter-spacing: .06em; text-shadow: 0 2px 14px #000, 0 0 30px rgba(0,0,0,.8); opacity: 0; transition: opacity .9s; pointer-events: none; }
.cn-title.on { opacity: 1; }
.cn-title.motto { padding: 22px 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); top: auto; bottom: 10%; font-size: clamp(22px, 3.4vw, 42px); letter-spacing: .04em; }
#cine.out { opacity: 0; pointer-events: none; transition: opacity 1.2s ease; }
.cn-sub { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); width: min(880px, calc(100vw - 32px)); box-sizing: border-box; display: flex; gap: 14px; align-items: center;
  padding: 12px 16px; border-radius: 14px; background: rgba(5,9,12,.8); border: 1px solid var(--edge); backdrop-filter: blur(6px); }
.cn-sub img { width: 62px; height: 62px; flex: none; border-radius: 10px; object-fit: cover; border: 2px solid var(--who, var(--edge-hi)); }
.cn-sub b { font: 400 15px var(--f-display); color: var(--who, var(--fg)); letter-spacing: .03em; }
.cn-sub p { margin: 4px 0 0; font-size: clamp(15px, 1.7vw, 19px); line-height: 1.45; color: var(--fg); }
.cn-sub.mind p { font-style: italic; color: #ffc6e2; letter-spacing: .02em; }
.cn-end { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; pointer-events: none; }
.cn-end img { width: min(360px, 60vw, 50vh); }
.cn-end p { margin: 0; font: 400 clamp(18px, 2.4vw, 28px) var(--f-display); color: var(--gold); letter-spacing: .3em; text-transform: uppercase; }
#cn-skip { position: absolute; top: 14px; right: 14px; z-index: 2; height: 38px; background: rgba(5,9,12,.6); }
.cn-tap { position: absolute; right: 18px; bottom: 1.4%; font-size: 12px; color: rgba(255,255,255,.45); pointer-events: none; }
@media (max-width: 640px) { .cn-sub { gap: 10px; padding: 10px 12px; bottom: 4%; } .cn-sub img { width: 46px; height: 46px; } .cn-tap { display: none; } }

/* загрузка миссии */
#mload { position: absolute; inset: 0; z-index: 26; display: flex; align-items: flex-end; justify-content: center; background: #05080c var(--mlbg, none) center / cover; }
#mload::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,8,12,0) 45%, rgba(5,8,12,.9) 100%); }
.ml-box { position: relative; width: min(720px, calc(100vw - 32px)); margin-bottom: 5vh; display: grid; gap: 10px; text-align: center; }
.ml-box small { color: var(--gold); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.ml-box h3 { margin: 0; font: 400 clamp(22px, 3vw, 34px) var(--f-display); color: var(--fg); text-shadow: 0 2px 10px #000; }
.ml-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.14); overflow: hidden; }
.ml-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
#mload.go .ml-bar i { width: 100%; transition: width 1.2s ease-out; }
.ml-box p { margin: 0; color: var(--fg); opacity: .9; font-size: 15px; line-height: 1.5; text-shadow: 0 1px 6px #000; }

/* иконки не сплющиваем: картинка вписывается в квадрат с сохранением пропорций */
.card img, .grp img, img[data-icon] { object-fit: contain; }
.camp-item.locked { opacity: .45; cursor: default; }
.camp-item.locked:hover { border-color: var(--edge); background: rgba(255,255,255,.03); }
.card img.long, .grp img.long { transform: rotate(-38deg) scale(1.28); }

/* шкала опыта в меню башни */

/* авторы музыки */
.tl-credits { position: absolute; left: 16px; right: 16px; bottom: 10px; margin: 0; font-size: 11px; color: rgba(255,255,255,.55); text-shadow: 0 1px 4px #000; text-align: left; }
@media (orientation: portrait) { .tl-credits { text-align: center; bottom: 6px; } }
.cn-credits { display: grid; gap: 4px; justify-items: center; margin-top: 10px; font-size: 13px; color: rgba(255,255,255,.75); text-align: center; }
.cn-credits b { font: 400 14px var(--f-display); color: var(--gold); letter-spacing: .1em; text-transform: uppercase; }
.cn-credits small { color: rgba(255,255,255,.45); }

/* карточка нового врага и разовые пояснения */
#foe { z-index: 16; }
.foe-box { width: min(560px, 100%); display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; padding: 18px 20px; border-radius: 16px; background: rgba(9, 16, 20, .94); border: 1px solid var(--edge-hi); box-shadow: 0 20px 60px rgba(0,0,0,.6); box-sizing: border-box; }
.foe-box > img { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; background: radial-gradient(circle, rgba(255,90,160,.2), rgba(0,0,0,0) 70%); filter: drop-shadow(0 6px 10px rgba(0,0,0,.6)); }
.foe-txt { display: grid; gap: 8px; min-width: 0; }
.foe-txt small { color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.foe-txt h3 { margin: 0; font: 400 24px var(--f-display); color: var(--gold); }
.foe-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.foe-tags:empty { display: none; }
.foe-tags span { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--edge-hi); font-size: 12px; font-weight: 700; color: var(--cyan); }
.foe-txt p { margin: 0; font-size: 14px; line-height: 1.5; color: #d6e0e4; }
.foe-tip { padding: 8px 10px; border-radius: 10px; background: rgba(242,193,78,.08); border: 1px solid rgba(242,193,78,.3); }
.foe-tip:empty { display: none; }
.foe-txt .primary { width: 100%; height: 48px; margin-top: 4px; }
@media (max-width: 520px), (max-height: 520px) {
  .foe-box { grid-template-columns: 84px 1fr; gap: 12px; padding: 14px; } .foe-box > img { width: 84px; height: 84px; }
  .foe-txt h3 { font-size: 19px; } .foe-txt p { font-size: 13px; } .foe-txt .primary { height: 42px; }
}
/* второй шанс за рекламу на экране поражения */
.revive { width: 100%; padding: 10px 16px; border-radius: 12px; border: 1px solid #8dffb0; background: rgba(93,255,154,.12); color: #8dffb0; display: grid; gap: 2px; justify-items: center; box-shadow: 0 0 22px -8px #5dff9a; }
.revive span { font: 400 20px var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.revive small { font-size: 12px; font-weight: 600; color: var(--fg); opacity: .8; }
.revive:hover:not(:disabled) { background: rgba(93,255,154,.2); }
.revive:disabled { opacity: .5; }

/* пауза */
.topbtn.pz-btn { width: 44px; padding: 0; justify-items: center; }
.topbtn.pz-btn span { font-size: 15px; letter-spacing: -.1em; }
.pz-box { width: min(340px, 100%); padding: 20px; border-radius: 16px; background: rgba(9, 16, 20, .95); border: 1px solid var(--edge-hi); display: grid; gap: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); text-align: center; }
.pz-box h3 { margin: 0; font: 400 26px var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.pz-box .primary { width: 100%; height: 56px; font: 400 20px var(--f-display); text-transform: uppercase; letter-spacing: .05em; }
.pz-box button.ghost { width: 100%; height: 46px; }
.pz-box button.pz-exit { color: #ff9a8e; border-color: rgba(255,90,74,.45); }
.pz-box button.armed { background: rgba(255,90,74,.22); border-color: var(--red); color: #fff; }
#pause { z-index: 19; }
/* на узком экране верхняя панель не влезает целиком: пауза встаёт первой, чтобы её всегда было видно */
@media (max-width: 760px) { #b-pause { order: -1; width: 40px; flex: none; } #hud-top .brand { display: none; } }

/* радиальное меню юнита: круглые кнопки-значки вокруг башни и маленькая плашка под ней */
#tmenu { position: absolute; z-index: 7; width: 0; height: 0; pointer-events: none; }
.tm-b { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; padding: 0; border-radius: 50%; pointer-events: auto;
  display: grid; place-items: center; background: rgba(9,16,20,.88); border: 1.5px solid var(--c); color: #e8eef0;
  box-shadow: 0 0 14px -4px var(--c), 0 4px 12px rgba(0,0,0,.55); backdrop-filter: blur(6px); animation: tmPop .16s ease-out both; }
.tm-b svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.tm-b small { position: absolute; top: 100%; left: 50%; transform: translate(-50%, -7px); padding: 1px 5px; border-radius: 7px; white-space: nowrap;
  font-size: 10.5px; font-weight: 800; line-height: 1.3; background: rgba(6,10,13,.92); border: 1px solid rgba(255,255,255,.14); color: #ffe7a8; pointer-events: none; }
.tm-b em { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -2px); font-style: normal; font-size: 11px; font-weight: 800; white-space: nowrap;
  color: var(--gold); text-shadow: 0 1px 3px #000, 0 0 6px #000; pointer-events: none; }
.tm-b.up { color: var(--gold); }
.tm-b.fix { color: #8dffb8; border-color: rgba(93,255,154,.7); box-shadow: 0 0 14px -4px #5dff9a, 0 4px 12px rgba(0,0,0,.55); }
.tm-b.sell { color: #ffd98a; }
.tm-b:hover:not(:disabled) { background: rgba(30,44,52,.95); transform: scale(1.08); }
.tm-b:disabled { opacity: .5; filter: grayscale(.6); }
@keyframes tmPop { from { opacity: 0; scale: .6; } }
.tm-pill { position: absolute; top: 34px; left: 0; transform: translateX(-50%); min-width: 116px; max-width: 170px; padding: 5px 8px 6px; border-radius: 9px;
  background: rgba(9,16,20,.86); border: 1px solid var(--c); pointer-events: auto; display: grid; gap: 3px; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.tm-title { font-size: 12px; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.tm-stats { display: grid; gap: 3px; }
.tm-bar { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; color: var(--dim); }
.tm-bar i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.tm-bar i b { display: block; height: 100%; border-radius: 3px; }
.tm-bar.hp i b { background: linear-gradient(90deg, #3fcf7a, #8dffb8); }
.tm-bar.hp.low i b { background: linear-gradient(90deg, #d8402e, #ff7a6a); }
.tm-bar.xp i b { background: linear-gradient(90deg, #4fb3ff, #6ff3ff); }
.tm-bar.xp.full i b { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.tm-bar.xp.full span { color: var(--gold); }
.tm-w { font-size: 10px; font-weight: 700; text-align: center; line-height: 1.2; }
.tm-w.bad { color: #ff7a6a; } .tm-w.warn { color: #d8ff6a; } .tm-w.pol { color: #ffe066; }

/* приближение карты */
#zoom { position: absolute; right: 10px; bottom: 120px; z-index: 6; display: grid; gap: 6px; }
#zoom button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--edge); background: rgba(9,16,20,.82); color: #e8eef0;
  font-size: 22px; font-weight: 700; line-height: 1; display: grid; place-items: center; backdrop-filter: blur(6px); }
#zoom button:hover:not(:disabled) { background: rgba(30,44,52,.95); }
#zoom button:disabled { opacity: .35; }
/* кнопка исследований: одна синяя колба; пока ничего не исследуется, мягко мерцает, напоминая о лаборатории */
.topbtn.lab-ic { width: 44px; padding: 0; justify-items: center; align-content: center; }
.topbtn.lab-ic span { display: flex; align-items: center; justify-content: center; line-height: 0; color: #5ab8ff; }
.topbtn.lab-ic svg { display: block; filter: drop-shadow(0 0 3px rgba(90,184,255,.55)); }
.topbtn.lab-ic.idle { animation: labglow 2.6s ease-in-out infinite; }
.topbtn.lab-ic.idle svg { animation: labicon 2.6s ease-in-out infinite; }
@keyframes labglow { 0%, 100% { box-shadow: 0 0 0 rgba(90,184,255,0); border-color: var(--edge); } 50% { box-shadow: 0 0 14px rgba(90,184,255,.45); border-color: rgba(90,184,255,.6); } }
@keyframes labicon { 0%, 100% { filter: drop-shadow(0 0 2px rgba(90,184,255,.4)); } 50% { filter: drop-shadow(0 0 7px rgba(120,200,255,.95)); } }
/* идёт исследование: по колбе бегает луч сканера, снизу поднимается уровень готовности */
.topbtn.lab-ic.scan { border-color: rgba(90,184,255,.6); background: linear-gradient(to top, rgba(90,184,255,.2) var(--p, 0%), rgba(255,255,255,.04) var(--p, 0%)); }
.topbtn.lab-ic.scan #lab-prog { display: none; }
.topbtn.lab-ic.scan::after { content: ''; position: absolute; left: 3px; right: 3px; top: 0; height: 12px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(90,184,255,0), rgba(90,184,255,.35) 78%, #c8f0ff 84%, #8fd6ff 92%, rgba(90,184,255,0));
  filter: drop-shadow(0 0 4px rgba(90,184,255,.9)); mix-blend-mode: screen; animation: labscan 1.5s linear infinite; }
.topbtn.lab-ic.scan svg { animation: labicon 1.5s ease-in-out infinite; }
@keyframes labscan { 0% { transform: translateY(-12px); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .topbtn.lab-ic.idle, .topbtn.lab-ic.idle svg , .topbtn.lab-ic.scan svg { animation: none; } .topbtn.lab-ic.scan::after { animation: none; display: none; } }

/* полноэкранный режим */
.fs-btn svg { display: block; }
.fs-btn .fs-off, body.is-fs .fs-btn .fs-on { display: none; }
body.is-fs .fs-btn .fs-off { display: inline; }
.topbtn.fs-btn span { display: flex; align-items: center; justify-content: center; line-height: 0; }
.tl-fs { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); z-index: 2; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #e8f4ff; background: rgba(5,9,12,.55); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(6px); cursor: pointer; }
.tl-fs:hover { border-color: rgba(255,255,255,.4); }

/* подсказка «поверните телефон» */
#rotate { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(4,7,10,.94); text-align: center; }
#rotate[hidden] { display: none; }
.rt-box { max-width: 300px; display: grid; justify-items: center; gap: 10px; color: #e8f4ff; }
.rt-box h3 { margin: 6px 0 0; font-size: 20px; }
.rt-box p { margin: 0; color: var(--dim, #9fb0bf); font-size: 14px; line-height: 1.4; }
.rt-box button { margin-top: 14px; height: 44px; padding: 0 18px; }
.rt-phone { width: 46px; height: 78px; border: 3px solid #6ff3ff; border-radius: 9px; position: relative; box-shadow: 0 0 14px rgba(111,243,255,.35); animation: rtturn 2.4s ease-in-out infinite; }
.rt-phone::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 12px; height: 3px; margin-left: -6px; border-radius: 2px; background: #6ff3ff; }
@keyframes rtturn { 0%, 25% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .rt-phone { animation: none; transform: rotate(-90deg); } }

/* «Отремонтировать всё» */
.topbtn.fix-ic { width: 44px; padding: 0; justify-items: center; align-content: center; overflow: visible; }
.topbtn.fix-ic span { display: flex; align-items: center; justify-content: center; line-height: 0; color: #5dff9a; }
.topbtn.fix-ic svg { display: block; filter: drop-shadow(0 0 3px rgba(93,255,154,.5)); transition: opacity .2s; }
.topbtn.fix-ic:not(.off):not(.poor) { border-color: rgba(93,255,154,.55); box-shadow: 0 0 10px rgba(93,255,154,.25); }
.topbtn.fix-ic.off span { color: #7d8a93; } .topbtn.fix-ic.off svg { filter: none; opacity: .55; }
.topbtn.fix-ic.poor span { color: #c9a24a; } .topbtn.fix-ic.poor svg { filter: none; }
#fix-n { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box; border-radius: 9px; background: #ff4a3a; color: #fff; font: 700 10.5px/17px inherit; text-align: center; box-shadow: 0 0 0 2px #0b1116; }
.topbtn.fix-ic.poor #fix-n { background: #8a6a2a; }

/* верхняя панель: кнопки-иконки не сжимаются; на средней ширине убираем название игры, чтобы всё влезло */
#hud-top .topbtn.lab-ic, #hud-top .topbtn.fix-ic, #hud-top .topbtn.pz-btn { flex: none; }
@media (max-width: 1040px) { #hud-top .brand { display: none; } }

/* бонусные удары справа */
#strikes { position: absolute; right: 10px; top: 50%; transform: translateY(-60%); z-index: 6; display: grid; gap: 10px; }
.strike { position: relative; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 13px; background: none; cursor: pointer; filter: drop-shadow(0 3px 6px rgba(0,0,0,.55)); transition: transform .12s, filter .2s; }
.strike img { width: 100%; height: 100%; display: block; }
.strike:hover:not(.empty) { transform: scale(1.06); }
.strike.on { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(255,120,60,.95)); animation: stOn 1s ease-in-out infinite; }
@keyframes stOn { 50% { filter: drop-shadow(0 0 4px rgba(255,120,60,.6)); } }
.strike.empty img { filter: grayscale(1) brightness(.55); }
.strike .st-n, .strike .st-ad { position: absolute; right: -5px; bottom: -5px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: #f0b43c; color: #1a1206; font: 800 12px/20px inherit; font-style: normal; text-align: center; box-shadow: 0 0 0 2px #0b1116; }
.strike.empty .st-n { background: #59636b; color: #dfe6ea; }
.strike .st-ad { background: #5dff9a; color: #06210f; font-size: 10px; }
.strike .st-k { position: absolute; left: 6px; right: 6px; bottom: -8px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.6); overflow: hidden; }
.strike .st-k u { display: block; height: 100%; width: 0; background: #6ff3ff; box-shadow: 0 0 6px #6ff3ff; text-decoration: none; }
body.aiming #view canvas { cursor: crosshair; }
@media (max-height: 520px) { .strike { width: 46px; height: 46px; } #strikes { gap: 9px; top: 68px; transform: none; } }
/* вспышка ядерного удара */
#flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: radial-gradient(circle, #fff 0%, #ffe6b0 45%, rgba(255,160,60,.6) 100%); opacity: 0; }
#flash.on { animation: nukeFlash 1.4s ease-out; }
@keyframes nukeFlash { 0% { opacity: 0; } 6% { opacity: .95; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #flash.on { animation-duration: .6s; } .strike.on { animation: none; } }

/* телефон горизонтально (низкий экран): всё компактнее, чтобы влезало и поле боя было крупнее */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --card-h: 46px; --card-w: 56px; }
  #hud-top { padding-block: max(4px, env(safe-area-inset-top, 0px)) 4px; gap: 12px; }
  #hud-bot { padding-block: 4px max(4px, env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .topbtn { height: 32px; } .topbtn.pz-btn, .topbtn.lab-ic { width: 36px; } .fs-btn:not(.tl-fs) { width: 36px; height: 32px; }
  .stat { gap: 0; } .stat label { font-size: 9px; } .stat b { font-size: 16px; } .stat.hp { width: clamp(90px, 14vw, 160px); } .bar { height: 5px; margin-top: 2px; }
  .card, .grp, .aux, .primary, #hud-bot .aux, #hud-bot .primary { height: 46px; } .card img, .grp img { width: 28px; height: 28px; }
  #hud-bot .aux.sq { width: 40px; } #hud-bot .primary { width: 112px; } .primary span { font-size: 14px; } .primary small { font-size: 10px; }
  #hint { bottom: 62px; font-size: 12px; padding: 6px 12px; }
  #zoom button { width: 34px; height: 34px; }
  #strikes { top: 48px; } .strike { width: 42px; height: 42px; }
  .modal { padding: 8px; }
  /* главное меню */
  .tl-side { gap: 8px; margin-left: 4vw; width: min(320px, 40vw); }
  .tl-top { gap: 2px; }
  .tl-logo { width: min(100%, 40vh); }
  .tl-slogan .sl1 { font-size: 11px; } .tl-slogan .sl2 { font-size: 19px; }
  html[lang="en"] .tl-slogan .sl2 { font-size: 18px; }
  .tl-btns { gap: 6px; } .tl-btns .primary { height: 44px; } .tl-btns button.ghost { height: 36px; font-size: 14px; }
  .tl-credits { left: auto; right: 12px; bottom: 6px; max-width: calc(100vw - min(320px, 40vw) - 8vw - 24px); font-size: 9.5px; text-align: right; }
  /* кампания: карта и список рядом, всё в высоту экрана */
  .camp-box { grid-template-columns: 1fr 230px; gap: 8px; width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: hidden; }
  .camp-map { max-height: calc(100vh - 16px); }
  .camp-map .node { width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: 11px; }
  .camp-map .node.locked { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
  .camp-side { max-height: calc(100vh - 16px); padding: 10px; gap: 6px; }
  .camp-side h3 { font-size: 18px; } button.ghost.camp-menu { height: 30px; padding: 0 10px; }
  .camp-item { padding: 7px 9px; } .camp-item b { font-size: 13px; } .camp-item small { font-size: 11px; }
  /* брифинг */
  .brief-box { grid-template-columns: 76px 1fr; gap: 10px; padding: 10px 12px; max-height: calc(100vh - 16px); overflow-y: auto; }
  .brief-txt h3 { font-size: 16px; margin-bottom: 6px; } .brief-txt p { font-size: 12px; line-height: 1.4; margin-bottom: 6px; }
  .br-goal { padding: 6px 10px; font-size: 12px !important; } .br-diff { margin: 2px 0 6px; } .br-diff button { height: 30px; font-size: 12px; }
  .br-btns .primary, .end-btns .primary { height: 46px; font-size: 20px; } .br-btns button.ghost, .end-btns button.ghost { height: 46px; }
  .lab-box { padding: 10px 14px; gap: 8px; max-height: calc(100vh - 16px); overflow-y: auto; box-sizing: border-box; }
  /* пауза */
  .pz-box { padding: 12px 16px; gap: 6px; max-height: calc(100vh - 16px); overflow-y: auto; box-sizing: border-box; }
  .pz-box h3 { font-size: 20px; } .pz-box .m-note { margin: 0; font-size: 11px; }
  .pz-box .primary { height: 42px; font-size: 17px; } .pz-box button.ghost { height: 36px; font-size: 14px; }
}

/* постройка касанием: круговое меню вокруг площадки */
#bmenu { position: absolute; z-index: 8; width: 0; height: 0; pointer-events: none; }
.bm-c { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; left: 0; top: 0; padding: 0; border-radius: 50%; pointer-events: auto;
  background: rgba(9,16,20,.88); border: 1.5px solid rgba(255,255,255,.35); color: #e8eef0; font-size: 15px; font-weight: 800; display: grid; place-items: center; }
.bm-b { position: absolute; width: 50px; height: 50px; margin: -25px 0 0 -25px; padding: 0; border-radius: 50%; pointer-events: auto;
  display: grid; place-items: center; background: rgba(9,16,20,.9); border: 1.5px solid var(--c, var(--edge-hi)); box-shadow: 0 0 14px -4px var(--c, var(--cyan)), 0 4px 12px rgba(0,0,0,.55);
  animation: bmIn .14s ease-out; }
.bm-b.grp { --c: var(--gold); }
.bm-b img { width: 38px; height: 38px; pointer-events: none; }
.bm-b em { position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, 1px); font-style: normal; font-size: 10.5px; font-weight: 800; white-space: nowrap;
  padding: 0 4px; border-radius: 5px; background: rgba(5,9,12,.78); color: #e8eef0; pointer-events: none; }
.bm-b small { position: absolute; top: 100%; left: 50%; transform: translate(-50%, -6px); padding: 1px 5px; border-radius: 7px; white-space: nowrap;
  font-size: 11px; font-weight: 800; background: rgba(5,9,12,.92); color: var(--gold); border: 1px solid rgba(242,193,78,.45); pointer-events: none; }
.bm-b.grp small { color: var(--dim); border-color: var(--edge); font-size: 10px; }
.bm-b.poor { filter: grayscale(.85) brightness(.6); }
.bm-b.poor small { color: #ff8a7a; border-color: rgba(255,90,74,.5); }
.bm-b:hover:not(.poor) { transform: scale(1.08); background: rgba(30,44,52,.95); }
@keyframes bmIn { from { opacity: 0; transform: scale(.6); } }
@media (prefers-reduced-motion: reduce) { .bm-b { animation: none; } }
/* на телефоне юниты ставятся касанием по площадке: карточки внизу не нужны, поле выше */
body.touch #cards, body.touch #tray { display: none !important; }
/* переключатель языка в главном меню */
.tl-lang { position: absolute; top: max(14px, env(safe-area-inset-top)); right: calc(max(14px, env(safe-area-inset-right)) + 54px); z-index: 2; height: 44px; min-width: 52px; padding: 0 10px; border-radius: 10px;
  background: rgba(5,9,12,.6); border: 1px solid rgba(255,255,255,.22); color: #e8eef0; font: 700 14px var(--f-ui, sans-serif); letter-spacing: .06em; backdrop-filter: blur(6px); }
.tl-lang::before { content: '🌐 '; }
.tl-lang:hover { border-color: rgba(255,255,255,.45); }
body.bm-open #hint { opacity: 0 !important; }

/* ---------- возвраты: Штаб, награда за вход, звёзды, бесконечная оборона ---------- */
.tl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tl-btns .tl-row button.ghost { display: grid; align-content: center; gap: 1px; line-height: 1.1; padding: 0 8px; }
.tl-two small { font-size: 11px; font-weight: 600; color: var(--gold); }
.tl-two small:empty { display: none; }
.tl-btns button.ghost:disabled { opacity: .55; }
.tl-btns button.ghost:disabled small { color: var(--dim); }
@media (max-height: 520px) and (orientation: landscape) { .tl-row { gap: 6px; } .tl-btns .tl-row button.ghost { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; } .tl-two small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
.stars { display: inline-flex; gap: 2px; vertical-align: -2px; }
.stars i { font-style: normal; color: rgba(255,255,255,.18); }
.stars i.on { color: var(--gold); text-shadow: 0 0 8px rgba(242,193,78,.7); }
.end-stars { display: block; margin-bottom: 6px; }
.end-stars .stars { gap: 10px; font-size: 44px; line-height: 1; }
.end-stars .stars i.on { animation: starpop .45s cubic-bezier(.3,1.6,.5,1) both; }
.end-stars .stars i:nth-child(2) { animation-delay: .18s; } .end-stars .stars i:nth-child(3) { animation-delay: .36s; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.camp-item i .stars { font-size: 12px; margin-right: 4px; }
.end-soc { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.end-soc button { height: 42px; padding: 0 18px; font-size: 14px; }
.end-soc button[hidden] { display: none; }
.hq-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.hq-have { margin-left: auto; font: 400 22px var(--f-display); color: var(--gold); text-shadow: 0 0 10px rgba(242,193,78,.5); }
.hq-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(242,193,78,.1); border: 1px solid rgba(242,193,78,.35); color: var(--gold); font-style: normal; font-size: 20px; }
.lab-row .done { color: var(--green); font-weight: 700; font-size: 13px; white-space: nowrap; }
.hq-h { margin: 6px 0 0; font: 400 16px var(--f-display); letter-spacing: .03em; color: var(--gold); }
.hq-task { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); }
.hq-task + .hq-task { margin-top: 6px; }
.hq-task .prog { position: relative; height: 18px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.hq-task .prog i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.hq-task .prog span { position: relative; display: block; text-align: center; font-size: 11.5px; font-weight: 700; line-height: 18px; color: #fff; text-shadow: 0 1px 2px #000; }
.hq-task.ok { border-color: rgba(107,227,154,.45); }
.hq-task.ok .prog i { background: var(--green); }
.hq-rw { flex: none; min-width: 44px; text-align: right; color: var(--gold); }
.hq-task.ok .hq-rw { color: var(--green); }
.dl-box { width: min(620px, 100%); text-align: center; }
.dl-box h3 { margin: 0; font: 400 26px var(--f-display); text-transform: uppercase; color: var(--gold); text-shadow: 0 0 18px rgba(242,193,78,.5); }
.dl-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dl-day { display: grid; gap: 4px; padding: 10px 2px; border-radius: 10px; border: 1px solid var(--edge); background: rgba(255,255,255,.03); }
.dl-day small { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.dl-day b { font-size: 15px; color: var(--fg); white-space: nowrap; }
.dl-day.got { opacity: .45; }
.dl-day.now { border-color: var(--gold); background: rgba(242,193,78,.12); box-shadow: 0 0 18px -4px var(--gold); transform: scale(1.06); }
.dl-day.now b { color: var(--gold); }
.dl-day:last-child b { color: var(--gold); }
.dl-btns { display: flex; gap: 10px; justify-content: center; }
.dl-btns .primary { width: auto; min-width: 180px; padding: 0 24px; height: 52px; font-size: 18px; }
.dl-btns .ghost { height: 52px; padding: 0 18px; }
.dl-btns .ghost[hidden] { display: none; }
@media (max-height: 460px) { .hq-box, .dl-box { padding: 12px 14px; gap: 8px; } .dl-day { padding: 6px 2px; } .lab-row { padding: 8px 10px; } .dl-btns .primary, .dl-btns .ghost { height: 42px; } }
@media (max-width: 520px) { .dl-days { grid-template-columns: repeat(4, 1fr); } }
#hq, #daily { z-index: 30; }
.hq-task .prog { width: auto; flex: none; } .hq-box .pips i { width: 26px; height: 6px; }
/* телефон горизонтально: нижняя панель столбиком справа, поле боя на всю высоту */
body.side-hud #hud-bot { left: auto; right: 0; bottom: 0; width: 104px; display: grid; grid-template-columns: 1fr 1fr; align-content: end; gap: 6px;
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) 6px; border-top: 0; border-left: 1px solid var(--edge); box-sizing: border-box; }
body.side-hud #hud-bot #cards { display: none; }
body.side-hud #hud-bot #b-ad, body.side-hud #hud-bot #b-wave { grid-column: 1 / -1; }
body.side-hud #hud-bot .aux, body.side-hud #hud-bot .aux.sq { width: auto; height: 42px; padding: 0 4px; }
body.side-hud #hud-bot .primary { width: auto; height: 76px; padding: 0 4px; }
body.side-hud #zoom { right: 114px; }
body.side-hud #strikes { right: 114px; }
body.side-hud #hint { bottom: 10px; margin-left: -52px; }
/* миссии-закрепления: точка поменьше между сюжетными миссиями */
.camp-map .node.side { width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: 11px; border-width: 1.5px; }
.camp-map .node.side.locked { width: 12px; height: 12px; margin: -6px 0 0 -6px; font-size: 0; border-width: 1px; }
.camp-item.side b { font-weight: 600; }
@media (max-width: 900px), (max-height: 520px) { .camp-map .node.side:not(.locked) { width: 20px; height: 20px; margin: -10px 0 0 -10px; font-size: 10px; } }
/* обучение: кнопка на титуле и панель подсказок под верхней полосой */
.tl-row.tl-row3 { grid-template-columns: 1fr 1fr 1fr; }
#coach { position: fixed; left: 50%; top: calc(var(--hudtop, 64px) + 10px); transform: translateX(-50%); z-index: 12; width: min(560px, calc(100vw - 32px)); padding: 10px 14px 10px; border-radius: 12px;
  background: rgba(10,14,18,.9); border: 1.5px solid var(--gold); box-shadow: 0 0 22px rgba(242,193,78,.35); pointer-events: none; display: grid; gap: 4px; }
#coach[hidden] { display: none; }
#coach small { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
#coach p { margin: 0; font-size: 15px; line-height: 1.35; color: #f3efe8; }
#coach button { pointer-events: auto; justify-self: end; height: 26px; padding: 0 10px; font-size: 11px; }
#coach.pop { animation: coachpop .35s ease-out; }
@keyframes coachpop { from { transform: translate(-50%, -8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (max-height: 520px) { #coach { width: min(440px, calc(100vw - 150px)); padding: 6px 10px; } body.side-hud #coach { margin-left: -52px; } #coach p { font-size: 13px; } #coach button { height: 22px; } }

/* ---- правки по итогам критика интерфейса ---- */
/* шапка кампании не обрезается: кнопки переносятся, колонка не раздувается */
.camp-side > * { min-width: 0; }
.camp-side .m-head { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.camp-side .m-head h3 { flex: 1 1 auto; font-size: 22px; }
.camp-act-h .camp-cine { flex: none; }
/* крестики закрытия и исследования крупнее под палец */
.x { width: 40px; height: 40px; font-size: 15px; }
.lab-row button { height: 42px; }
#zoom button { width: 40px; height: 40px; }
@media (max-height: 520px) and (orientation: landscape) {
  .topbtn { height: 38px; } .topbtn.pz-btn, .topbtn.lab-ic, .topbtn.fix-ic { width: 42px; } .fs-btn:not(.tl-fs) { width: 42px; height: 38px; }
  #hud-top { gap: 8px; }
  .stat label { font-size: 10px; letter-spacing: .06em; }
  #zoom button { width: 40px; height: 40px; }
  .camp-side .m-head h3 { font-size: 17px; }
  /* пауза: вторичные кнопки в два столбца, всё помещается без прокрутки */
  .pz-box { width: min(460px, 100%); grid-template-columns: 1fr 1fr; }
  .pz-box h3, .pz-box .m-note, .pz-box .primary { grid-column: 1 / -1; }
  .pz-box button.ghost { height: 40px; }
  /* Штаб: улучшения в два столбца */
  .hq-box { width: min(720px, 100%); }
  #hq-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #hq-rows .lab-row + .lab-row { margin-top: 0; }
  #hq-rows .lab-row { gap: 8px; padding: 8px; }
  #hq-rows .lab-row small { font-size: 11px; }
}
/* шапка кампании остаётся на месте, когда список прокручен к текущей миссии */
.camp-side .m-head { position: sticky; top: -18px; margin-top: -18px; padding-top: 18px; padding-bottom: 6px; z-index: 2; background: #0b1318; }
@media (max-height: 520px) and (orientation: landscape) { .camp-side .m-head { top: -10px; margin-top: -10px; padding-top: 10px; } }
@media (max-height: 520px) and (orientation: landscape) { .camp-side .m-head { flex-wrap: nowrap; gap: 6px; } .camp-side .m-head h3 { font-size: 15px; } button.ghost.camp-menu { padding: 0 8px; font-size: 12px; } }

.no-rewarded #b-ad, .no-rewarded #end-revive { display: none !important; }
