:root {
  --bg: #0b0a14;
  --panel: rgba(16, 14, 30, 0.94);
  --line: #3a3460;
  --text: #e6e2f4;
  --dim: #9a94b8;
  --gold: #e8c45a;
  --cyan: #3af0ff;
  --pink: #ff4ad0;
  --aut: #e0353a;
  --dec: #9a4ae0;
  --neu: #a8a8b8;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 15px/1.35 "Ubuntu Mono", ui-monospace, monospace; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#cv { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: var(--text); background: #221d3c; border: 2px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; touch-action: manipulation; }
button:active, button.on { background: #3a2f6a; border-color: var(--cyan); }
button:disabled { opacity: 0.4; }
input, select { font: inherit; color: var(--text); background: #120f22; border: 2px solid var(--line); border-radius: 6px; padding: 8px; width: 100%; user-select: text; -webkit-user-select: text; }
input[type=range] { padding: 0; }
input[type=color] { width: 48px; height: 40px; padding: 2px; }
label { display: block; margin: 10px 0 4px; color: var(--dim); font-size: 13px; }
h1, h2 { font-family: "Press Start 2P", monospace; color: var(--gold); text-shadow: 3px 3px 0 #5a1f2b; margin: 0 0 12px; letter-spacing: 1px; }
h1 { font-size: clamp(20px, 6vw, 34px); text-align: center; }
h2 { font-size: clamp(13px, 3.4vw, 18px); }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; z-index: 20;
  background: radial-gradient(ellipse at 50% 30%, rgba(60, 40, 120, 0.35), rgba(5, 4, 12, 0.85)); touch-action: pan-y; }
.card { background: var(--panel); border: 3px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: 0 0 0 3px #000, 0 10px 40px #000; max-height: 100%; overflow-y: auto; }
.card.narrow { width: min(420px, 100%); }
.card.wide { width: min(860px, 100%); }
.lore { color: var(--dim); font-style: italic; text-align: center; }
.hint { color: var(--dim); font-size: 12px; margin-top: 6px; }
.err { color: #ff6a6a; min-height: 1.2em; margin-top: 8px; }
button.big { width: 100%; margin-top: 14px; padding: 14px; font-family: "Press Start 2P", monospace; font-size: 12px; background: #3a1f5a; border-color: var(--gold); }
button.small { padding: 6px 10px; font-size: 13px; }
.cr-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.cr-preview { text-align: center; }
#pv { width: 192px; height: 200px; image-rendering: pixelated; background: linear-gradient(#1a1630, #0e0c1c); border: 2px solid var(--line); border-radius: 8px; }
#pv-info { font-size: 12px; color: var(--dim); margin: 6px 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 8px 4px; font-size: 13px; }
.seg .aut.on { border-color: var(--aut); background: #4a1418; }
.seg .dec.on { border-color: var(--dec); background: #2e1448; }
.seg .neu.on { border-color: var(--neu); background: #34343e; }
.colors { display: flex; gap: 8px; align-items: center; }
.tag { background: #2a2450; border-radius: 4px; padding: 1px 6px; color: var(--cyan); font-size: 12px; }
.spark { margin-top: 10px; padding: 10px; border: 2px dashed var(--line); border-radius: 8px; color: var(--cyan); }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--gold); }
@media (max-width: 640px) {
  .cr-grid { grid-template-columns: 1fr; }
  #pv { width: 144px; height: 150px; }
}

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 8px; align-items: flex-start; pointer-events: none; }
#top > * { pointer-events: auto; }
#bars { background: rgba(10, 8, 20, 0.7); border: 2px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 170px; }
.bar { position: relative; height: 13px; background: #1a1428; border-radius: 3px; margin-bottom: 4px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: linear-gradient(90deg, #c0282c, #ff6a5a); transition: width .2s; }
.bar.en i { background: linear-gradient(90deg, #a02a90, var(--pink)); }
.bar.sta i { background: linear-gradient(90deg, #1a8a5a, #3cff9e); }
#buffs { font-size: 11px; color: var(--cyan); }
#buffs span { display: inline-block; background: #1e1a38; border-radius: 3px; padding: 0 4px; margin: 2px 2px 0 0; }
.bar.co i { background: linear-gradient(90deg, #6a3a1a, #d07a2a); }
.bar span { position: relative; z-index: 1; font-size: 10px; line-height: 13px; padding-left: 4px; text-shadow: 1px 1px 0 #000; }
#shanix { color: var(--gold); font-weight: bold; }
#loc { flex: 1; text-align: center; text-shadow: 2px 2px 0 #000; display: flex; flex-direction: column; font-size: 13px; pointer-events: none; }
#loc b { font-family: "Press Start 2P", monospace; font-size: 11px; color: var(--gold); }
#loc-z { color: var(--cyan); }
#topbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
#topbtns button { font-size: 20px; padding: 6px 9px; background: rgba(20, 16, 36, 0.8); }
#voice-btn.live { border-color: #3cff9e; background: #12402a; }
#voice-btn.talk { box-shadow: 0 0 10px #3cff9e; }
#chatlog { position: absolute; left: 8px; top: 120px; width: min(360px, 60vw); font-size: 13px; pointer-events: none; text-shadow: 1px 1px 0 #000, 0 0 3px #000; }
#chatlog div { margin-bottom: 2px; transition: opacity 1s; }
#chatlog .sys { color: var(--gold); }
#notices { position: absolute; top: 110px; left: 50%; transform: translateX(-50%); width: min(520px, 92vw); pointer-events: none; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#notices div { background: rgba(10, 8, 20, 0.85); border: 2px solid var(--line); border-radius: 6px; padding: 6px 10px; text-align: center; animation: fade 5s forwards; }
@keyframes fade { 0%, 80% { opacity: 1 } 100% { opacity: 0 } }
#hotbar { position: absolute; bottom: calc(8px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.slot { width: 52px; height: 52px; background: rgba(16, 12, 30, 0.85); border: 2px solid var(--line); border-radius: 6px; position: relative; display: flex; align-items: center; justify-content: center; padding: 0; }
.slot img { width: var(--ic48, 36px); height: var(--ic48, 36px); image-rendering: var(--icr48, pixelated); pointer-events: none; }
.slot .n { position: absolute; right: 3px; bottom: 1px; font-size: 12px; text-shadow: 1px 1px 0 #000; pointer-events: none; }
.slot .k { position: absolute; left: 3px; top: 0; font-size: 10px; color: var(--dim); pointer-events: none; }
.slot .dur { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; background: #3cff9e; pointer-events: none; }
.slot.sel { border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }
.slot.focus { border-color: var(--cyan); }
#buildbar { position: absolute; bottom: calc(68px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(16, 12, 30, 0.9); border: 2px solid var(--gold); border-radius: 8px; padding: 6px 8px; white-space: nowrap; }
#buildbar img { width: 32px; height: 32px; image-rendering: pixelated; }
#buildbar button { padding: 6px 8px; font-size: 13px; }
#buildbar button.on, button.ob-help.on { background: #3a5a20; border-color: #9aff6a; color: #e8ffd8; }
#touch { display: none; }
body.touch #touch { display: block; }
body.touch #ptt { display: none; }
#joy { position: absolute; left: 18px; bottom: calc(80px + var(--safe-b)); width: 140px; height: 140px; border-radius: 50%; background: rgba(40, 30, 80, 0.35); border: 2px solid rgba(120, 100, 200, 0.5); touch-action: none; }
#knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(160, 140, 255, 0.6); border: 2px solid #fff4; pointer-events: none; }
#abtns { position: absolute; right: 12px; bottom: calc(76px + var(--safe-b)); display: grid; grid-template-columns: repeat(3, 58px); gap: 8px; }
#abtns button { width: 58px; height: 58px; border-radius: 50%; font-size: 24px; padding: 0; background: rgba(30, 24, 60, 0.7); }
#abtns button.sm { font-size: 20px; }
#abtns button { touch-action: none; -webkit-user-select: none; user-select: none; }
#abtns button.pressed { filter: brightness(1.5); transform: scale(0.94); }
#abtns button.atk { background: rgba(120, 30, 40, 0.75); border-color: #ff6a5a; }
#ptt.on { background: #12402a; border-color: #3cff9e; }
/* походка: бег/форсаж (крупнее, справа) и присед (рядом, меньше) — в правом нижнем углу под большим
   пальцем; кнопки действий подняты на ряд выше, чтобы ничего не перекрывать */
#gaitbtns { position: absolute; right: 12px; bottom: calc(76px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end; }
#gaitbtns button { border-radius: 50%; padding: 0; background: rgba(30, 24, 60, 0.7); touch-action: none; -webkit-user-select: none; user-select: none; }
#btn-run { width: 70px; height: 70px; display: grid; gap: 2px; place-content: center; justify-items: center; font-size: 30px; line-height: 1; }
#btn-run span { pointer-events: none; }
#btn-run-label { font: 700 10px/1.1 system-ui, sans-serif; }
#btn-crouch { width: 56px; height: 56px; font-size: 24px; }
#gaitbtns button.on, #gaitbtns button.pressed { background: #12402a; border-color: #3cff9e; box-shadow: 0 0 10px #3cff9e88; }
#btn-run.on, #btn-run.pressed { background: #5a2a08; border-color: #ffb04a; box-shadow: 0 0 10px #ffb04a88; }
#btn-run.latched { outline: 3px solid #ffb04a; outline-offset: 2px; }
#btn-run.tired { opacity: 0.45; }
body.touch #abtns { bottom: calc(76px + 70px + 10px + var(--safe-b)); }
body:not(.touch) #hotbar .slot { width: 56px; height: 56px; }
@media (max-width: 640px) {
  #bars { width: 120px; }
  #topbtns { max-width: 130px; }
  #topbtns button { font-size: 17px; padding: 4px 6px; }
  #loc { font-size: 11px; }
  #loc b { font-size: 9px; }
  .slot { width: 44px; height: 44px; }
  .slot img { width: var(--ic40, 30px); height: var(--ic40, 30px); image-rendering: var(--icr40, pixelated); }
  #chatlog { top: 150px; font-size: 12px; }
}

/* ---- панели ---- */
#panel { position: fixed; z-index: 15; right: 12px; top: 64px; bottom: calc(76px + var(--safe-b)); width: min(500px, calc(100vw - 24px)); background: var(--panel); border: 3px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 0 0 3px #000; }
.phead { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.phead b { font-family: "Press Start 2P", monospace; font-size: 11px; color: var(--gold); }
#p-body { overflow-y: auto; padding: 10px; touch-action: pan-y; flex: 1; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tabs button { padding: 5px 8px; font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; padding: 4px; font-size: 11px; text-align: center; min-height: 86px; }
.tile img { width: 40px; height: 40px; image-rendering: pixelated; margin-bottom: 3px; pointer-events: none; }
.tile small { color: var(--dim); pointer-events: none; }
.tile span { pointer-events: none; }
.invgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.invgrid .slot { width: auto; aspect-ratio: 1; height: auto; min-width: 0; }
.invgrid .slot img { max-width: calc(100% - 2px); max-height: calc(100% - 2px); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.desc { margin-top: 8px; color: var(--dim); min-height: 2.5em; }
.mlist button { display: block; width: 100%; text-align: left; margin-bottom: 6px; }
.sec { color: var(--gold); margin: 12px 0 6px; font-weight: bold; }
.keys { color: var(--dim); font-size: 13px; }
.keys b { color: var(--text); }

/* ---- диалог в духе ретро-RPG ---- */
#dialog { position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); bottom: calc(80px + var(--safe-b)); width: min(680px, calc(100vw - 20px)); background: #000; border: 4px solid #fff; padding: 12px; display: flex; gap: 12px; cursor: pointer; }
#dlg-face { width: 72px; height: 108px; image-rendering: pixelated; flex: none; }
.dlg-text { flex: 1; position: relative; }
#dlg-name { font-family: "Press Start 2P", monospace; font-size: 10px; color: var(--gold); }
#dlg-line { font-family: "Press Start 2P", monospace; font-size: 12px; line-height: 1.8; margin: 8px 0 0; min-height: 4em; }
.dlg-more { position: absolute; right: 0; bottom: 0; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0 } }
#chatbox select { width: 110px; flex: none; }

/* ---- редактор внешности ---- */
.cr-grid { grid-template-columns: 260px 1fr; }
#pv { width: 240px; height: 210px; }
.cr-preview { position: sticky; top: 0; align-self: start; }
.pv-btns { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.steps { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.steps button { padding: 6px 8px; font-size: 13px; flex: 1 1 auto; }
.steps button.done { border-color: #3a6a4a; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.cards button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; font-size: 12px; text-align: center; }
.cards button img { width: 48px; height: 64px; image-rendering: pixelated; pointer-events: none; }
.cards button small { color: var(--dim); font-size: 11px; pointer-events: none; }
.cards button b, .cards button span { pointer-events: none; }
.cards.fac { grid-template-columns: repeat(3, 1fr); }
.cards.fac button { padding: 8px 6px; }
.cards.fac .ins { width: 26px; height: 26px; border-radius: 4px; transform: rotate(45deg); margin: 4px; }
.cards.presets { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.cards.presets .sw { display: flex; height: 22px; width: 100%; border-radius: 4px; overflow: hidden; pointer-events: none; }
.cards.presets .sw i { flex: 1; }
.cards.mode { grid-template-columns: 1fr 1fr; }
.cards.mode button { align-items: flex-start; text-align: left; padding: 10px; }
.cards button.on { border-color: var(--gold); background: #3a2f6a; box-shadow: 0 0 8px rgba(232,196,90,.4); }
.cpick { display: flex; flex-direction: column; align-items: center; margin: 0; font-size: 12px; }
.sizes { margin-top: 8px; }
.sizes button { font-size: 12px; line-height: 1.2; }
#h-table { margin-top: 10px; font-size: 13px; }
#h-table div { padding: 3px 0; border-bottom: 1px dashed #2a2450; }
#h-table .y { color: #3cff9e; } #h-table .n { color: #ff6a6a; }
.step-nav { display: flex; justify-content: space-between; margin-top: 14px; }
@media (max-width: 640px) {
  .cr-grid { grid-template-columns: 1fr; }
  .cr-preview { position: static; }
  #pv { width: 200px; height: 175px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .cards.fac { grid-template-columns: 1fr; }
  .cards.fac button { flex-direction: row; text-align: left; }
}

/* ---- чат ---- */
#chat-btn { position: relative; }
.badge { position: absolute; top: -6px; right: -6px; background: #ff3a5a; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 5px; min-width: 18px; line-height: 18px; }
#chatpanel { position: fixed; z-index: 17; left: 8px; bottom: calc(8px + var(--safe-b)); width: min(440px, calc(100vw - 16px)); height: min(420px, 60vh);
  background: var(--panel); border: 3px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 0 0 3px #000; }
.ctabs { display: flex; gap: 3px; padding: 6px; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.ctabs button { padding: 4px 8px; font-size: 12px; }
.ctabs .cx { margin-left: auto; }
#chat-hist { flex: 1; overflow-y: auto; padding: 6px 8px; font-size: 14px; touch-action: pan-y; user-select: text; -webkit-user-select: text; }
#chat-hist div { margin-bottom: 3px; word-wrap: break-word; }
#chat-hist .t { color: #6a6488; font-size: 11px; margin-right: 4px; }
#chat-hist .nm { cursor: pointer; }
#chat-hist .pm { background: #2a1a3a; border-radius: 4px; padding: 1px 4px; }
#chat-quick { display: flex; gap: 4px; padding: 4px 6px; overflow-x: auto; }
#chat-quick button { padding: 4px 8px; font-size: 12px; white-space: nowrap; flex: none; }
.crow { display: flex; gap: 6px; padding: 6px; border-top: 2px solid var(--line); }
.crow select { width: 96px; flex: none; }
body.chat-open #chatlog { display: none; }
@media (max-width: 640px) { #chatpanel { height: 55vh; } }

/* ---- приложение и полный экран ---- */
.appbtns { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.appbtns button { flex: 1; }
body.standalone .fsb, body.no-fs .fsb, body.standalone .inst { display: none !important; }
#installbar { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 112px); left: 50%; transform: translateX(-50%); z-index: 6; width: min(520px, calc(100vw - 16px));
  display: flex; gap: 6px; align-items: center; background: rgba(30, 20, 60, 0.95); border: 2px solid var(--gold); border-radius: 8px; padding: 8px; font-size: 13px; }
#installbar span { flex: 1; }
#installbar button { padding: 6px 8px; font-size: 13px; flex: none; }

/* ---- раскладка без наложений ---- */
#top { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-right: calc(8px + env(safe-area-inset-right, 0px)); box-sizing: border-box; max-width: 100vw; }
#topbtns { min-width: 0; flex-shrink: 1; flex-wrap: wrap; }
body.chat-open #touch, body.chat-open #hotbar { display: none; }
body.touch #buildbar { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 112px); max-width: calc(100vw - 16px); overflow-x: auto; }
body.touch #notices { top: calc(env(safe-area-inset-top, 0px) + 160px); }
body.touch #chatlog { top: auto; bottom: calc(240px + var(--safe-b)); max-height: 30vh; overflow: hidden; }
@media (max-width: 640px) and (orientation: portrait) {
  #top { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 4px 8px; }
  #bars { grid-column: 1; grid-row: 1; width: auto; min-width: 0; }
  #topbtns { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 220px; width: 100%; justify-self: end; gap: 4px; }
  #topbtns button { font-size: 16px; padding: 3px; min-width: 0; min-height: 36px; }
  #loc { grid-column: 1 / -1; grid-row: 2; width: auto; min-width: 0; margin-top: 2px; }
  #joy { width: 120px; height: 120px; left: 12px; bottom: calc(66px + var(--safe-b)); }
  #knob { left: 35px; top: 35px; }
  #abtns { grid-template-columns: repeat(4, minmax(0, 48px)); gap: 6px; right: 8px; bottom: calc(66px + var(--safe-b)); }
  #abtns button { width: 48px; height: 48px; font-size: 21px; }
  #abtns button.sm { font-size: 17px; }
  #gaitbtns { right: 8px; bottom: calc(66px + var(--safe-b)); gap: 8px; }
  #btn-run { width: 64px; height: 64px; font-size: 27px; }
  #btn-crouch { width: 52px; height: 52px; font-size: 22px; }
  body.touch #abtns { bottom: calc(66px + 64px + 8px + var(--safe-b)); }
  #hotbar { gap: 3px; }
  .slot { width: 42px; height: 42px; }
}
@media (max-width: 359px) and (orientation: portrait) {
  #abtns { grid-template-columns: repeat(4, 44px); gap: 5px; }
  #abtns button { width: 44px; height: 44px; }
  #joy { width: 106px; height: 106px; }
  #knob { left: 28px; top: 28px; }
}
/* телефон боком: низкий экран — кнопки в два ряда, хотбар по центру между ними */
@media (max-height: 500px) {
  #top { padding-top: 4px; }
  #bars { width: 128px; padding: 4px 6px; }
  .bar { height: 10px; margin-bottom: 2px; }
  .bar span { font-size: 9px; line-height: 10px; }
  #buffs { display: none; }
  #topbtns { max-width: none; flex-wrap: nowrap; }
  #topbtns button { font-size: 16px; padding: 3px 7px; }
  #joy { width: 110px; height: 110px; left: max(10px, env(safe-area-inset-left, 0px)); bottom: 10px; }
  #knob { left: 30px; top: 30px; }
  #abtns { grid-template-columns: repeat(4, 48px); gap: 5px; right: max(8px, env(safe-area-inset-right, 0px)); bottom: 8px; }
  #abtns button { width: 48px; height: 48px; font-size: 19px; }
  #abtns button.sm { font-size: 16px; }
  #gaitbtns { right: max(8px, env(safe-area-inset-right, 0px)); bottom: 8px; gap: 6px; }
  #btn-run { width: 56px; height: 56px; font-size: 24px; }
  #btn-crouch { width: 46px; height: 46px; font-size: 19px; }
  body.touch #abtns { bottom: calc(8px + 56px + 6px); }
  #hotbar { bottom: 6px; }
  .slot { width: 40px; height: 40px; }
  .slot img { width: var(--ic36, 28px); height: var(--ic36, 28px); image-rendering: var(--icr36, pixelated); }
  body.touch #chatlog { bottom: 120px; max-height: 25vh; }
  body.touch #buildbar, #installbar { top: 64px; }
  body.touch #notices { top: 64px; }
  #panel { top: 52px; bottom: 6px; }
  #dialog { bottom: 6px; }
  #chatpanel { height: calc(100vh - 16px); }
}
@media (orientation: landscape) and (min-width: 700px) and (max-height: 500px) {
  body.touch #abtns { grid-template-columns: repeat(6, 48px); }
}


/* ---- уточнения раскладки (без наложений) ---- */
#shanix .tag { font-size: 10px; font-weight: normal; }
#installbar { top: calc(env(safe-area-inset-top, 0px) + 8px); left: auto; right: 8px; transform: none; width: auto; max-width: min(420px, calc(100vw - 16px)); z-index: 7; padding: 6px 8px; }
body.touch #notices { top: 26%; }
body.touch #notices div { font-size: 13px; padding: 5px 8px; }
body.touch #chatlog { width: 46vw; font-size: 12px; }
.ctabs button { padding: 4px 7px; }
@media (max-width: 640px) {
  .ctabs button { font-size: 11px; padding: 3px 6px; }
  .cr-preview #spark, .cr-preview .hint { display: none; }
  #pv { width: 168px; height: 147px; }
  .cr-preview button.big { margin-top: 8px; padding: 10px; }
  .card.wide { padding: 12px; }
  #installbar span { font-size: 12px; }
}
@media (max-width: 640px) and (orientation: portrait) {
  #bars { width: 126px; }
  #loc { font-size: 10px; }
}
#installbar { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); flex-direction: column; text-align: center; padding: 14px; gap: 10px; width: min(320px, calc(100vw - 32px)); box-shadow: 0 0 0 3px #000, 0 10px 40px #000; z-index: 18; }
#installbar span { font-size: 14px !important; }
#installbar button { width: 100%; padding: 10px; }
@media (max-height: 500px) { .bar span { font-size: 8px; } }

/* ---- меню по Esc ---- */
#escmenu { z-index: 19; background: rgba(5, 4, 12, 0.75); }
#escmenu.top { z-index: 25; }
.card.menu { width: min(760px, 100%); }
.mhead { display: flex; justify-content: space-between; align-items: center; }
.mhead h2 { margin: 0; }
.mtabs { margin: 10px 0; }
.mtabs button { padding: 8px 12px; font-size: 14px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.mgrid button { text-align: left; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mgrid button.go { border-color: var(--gold); background: #3a1f5a; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px; border: 2px solid #5a5288; border-bottom-width: 4px; border-radius: 5px; background: #1e1a38; color: #fff; font: bold 12px "Ubuntu Mono", monospace; text-align: center; }
.kcols { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.kgroup h3 { margin: 4px 0 6px; color: var(--gold); font-size: 14px; }
.kgroup div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 0; border-bottom: 1px dashed #2a2450; }
.kgroup span { margin-left: 8px; color: var(--dim); flex: 1; min-width: 140px; }
.kgroup code { color: var(--cyan); }
#m-howto p { margin: 0 0 10px; }
#keyhint { position: absolute; left: 8px; bottom: calc(10px + var(--safe-b)); font-size: 12px; color: var(--dim); background: rgba(10, 8, 20, 0.7); border-radius: 6px; padding: 4px 8px; pointer-events: none; }
body.touch #keyhint { display: none !important; }
body.touch .kgroup:not(:last-child) { opacity: 0.6; }
@media (max-width: 640px) { .kcols { grid-template-columns: 1fr; } .mgrid { grid-template-columns: 1fr 1fr; } .mgrid button { font-size: 13px; padding: 8px; } }

#m-online .orow { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px dashed #2a2450; flex-wrap: wrap; }
#m-online .orow b { flex: 1; min-width: 120px; }
#m-online .orow small { color: var(--dim); }
#m-online button { padding: 5px 10px; font-size: 13px; width: auto; display: inline-block; margin: 0; }

.micbar { height: 16px; background: #120f22; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.micbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1a8a5a, #3cff9e, #ffe03a, #ff4a3a); transition: width .06s; }
#mic-state { min-height: 1.4em; margin: 6px 0; }

.micbar { position: relative; }
#mic-vad { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 9%; }
#mic-heard { font-weight: bold; }
#mic-heard.on { color: #3cff9e; }
.devrow { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.devrow label { margin: 0; white-space: nowrap; }
.devrow select { flex: 1; min-width: 0; }
#onair { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 74px); background: #b0182a; color: #fff;
  font: bold 13px "Ubuntu Mono", monospace; padding: 4px 12px; border-radius: 14px; box-shadow: 0 0 12px #ff3a5a; animation: blink 1s infinite; pointer-events: none; }

.sline { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.sline label { margin: 0; min-width: 11em; white-space: nowrap; }
.sline .micbar, .sline input[type=range] { flex: 1; min-width: 0; }
.sline span { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
#snd-vad { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 9%; }
@media (max-width: 520px) { .sline { flex-wrap: wrap; } .sline label { min-width: 100%; } }

.stabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 10px; }
.stabs button { padding: 6px 10px; font-size: 13px; }
.stabs button.on { border-color: #5ff; color: #aff; }
.binds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 8px 0; }
.binds div { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.binds button { min-width: 6.5em; padding: 4px 8px; }
.binds button.wait { border-color: #ffe03a; color: #ffe03a; }
.sline input[type=checkbox] { width: 20px; height: 20px; }
.sline select { flex: 1; min-width: 0; }
#fps { position: fixed; left: 8px; bottom: calc(42px + var(--safe-b, 0px)); z-index: 50; font: 11px/1.3 monospace; color: #3cff9e; background: rgba(0,0,0,.55); padding: 2px 5px; pointer-events: none; white-space: pre; border-radius: 3px; }
#fps.fps-mid { color: #ffd84a; }
#fps.fps-bad { color: #ff6a5a; }
/* телефон: слева под кнопкой вида (внизу — панель предметов и джойстик, сверху — кнопки), мельче, с переносом */
@media (pointer: coarse), (max-width: 700px) { #fps { bottom: auto; top: calc(150px + env(safe-area-inset-top, 0px)); font-size: 9px; max-width: 62vw; white-space: pre-wrap; opacity: .85; } }

/* ---- Шкалы: металлическая рамка, деления, «призрак» урона, пульс на низком уровне */
#bars { min-width: 190px; }
.bar { height: 16px; border-radius: 4px; margin-bottom: 4px; background: linear-gradient(#0d0a18, #1e1830); border: 1px solid #3a3352; box-shadow: inset 0 1px 3px #000, 0 0 0 1px #00000080; display: flex; align-items: center; }
.bar i, .bar u { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.bar u { background: rgba(255,240,200,.45); transition: width .9s ease-in .25s; width: 100%; }
.bar i { transition: width .15s; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.25); }
.bar.hp i { background: linear-gradient(180deg, #ff8a7a, #d0302c 55%, #8a1a1a); }
.bar.en i { background: linear-gradient(180deg, #ff9af0, #c03aa8 55%, #6a1a60); }
.bar.sta i { background: linear-gradient(180deg, #8affc6, #22b070 55%, #10603a); }
.bar.co i { background: linear-gradient(180deg, #f0a050, #a85a1a 55%, #5a2a0a); }
.bar::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.35) calc(10% - 1px) 10%); pointer-events: none; }
.bar .ic { position: relative; z-index: 2; width: 16px; text-align: center; font-size: 10px; text-shadow: 0 0 3px #000; }
.bar span { z-index: 2; padding-left: 2px; font-size: 10px; line-height: 16px; flex: 1; }
.bar em { position: relative; z-index: 2; font-style: normal; font-size: 10px; padding-right: 5px; text-shadow: 1px 1px 0 #000; font-variant-numeric: tabular-nums; }
.bar.low { animation: lowpulse 0.9s ease-in-out infinite; }
@keyframes lowpulse { 50% { box-shadow: 0 0 8px 2px rgba(255,60,60,.8), inset 0 1px 3px #000; border-color: #ff5050; } }
@media (max-width: 700px) { #bars { min-width: 140px; } .bar { height: 12px; } .bar span, .bar em { font-size: 8px; line-height: 12px; } .bar .ic { font-size: 8px; width: 12px; } }

/* ---- Карточки товаров и рецептов */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.card { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 8px; background: linear-gradient(160deg, #1d1830, #120f20); border: 1px solid #3a3352; border-radius: 8px; }
.card:hover:not([disabled]) { border-color: #5ff; box-shadow: 0 0 10px rgba(80,255,255,.25); }
.card.off { opacity: .55; }
.card .ci { flex: none; width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center; background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), #0a0814 70%); border: 1px solid #2a2440; }
.card .ci img { width: var(--ic48, 44px); height: var(--ic48, 44px); image-rendering: var(--icr48, pixelated); }
.card .cb { flex: 1; min-width: 0; }
.card .cb b { display: block; font-size: 13px; }
.card .cb small { display: block; color: #9a94b4; font-size: 10px; margin-top: 3px; line-height: 1.25; }
.props { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.pr { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #2a2440; color: #d8d2f0; }
.pr.en { background: #4a1a44; } .pr.hp { background: #4a1a1a; } .pr.st { background: #134a30; } .pr.bf { background: #3a3a10; color: #ffe08a; }
.price { margin-top: 5px; font-weight: bold; color: #ffe03a; }
.price.no { color: #ff6a6a; }
.need { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.need span { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; padding: 1px 4px 1px 1px; border-radius: 4px; background: #1a3a26; color: #8affc6; }
.need span.no { background: #3a1a1a; color: #ff8a8a; }
.need img { width: var(--ic24, 18px); height: var(--ic24, 18px); image-rendering: var(--icr24, pixelated); }
.cnt { float: right; color: #ffe03a; font-weight: bold; }

/* ---- Пиксельный стиль шкал */
.bar.hp .ic { background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%208%208%27%20shape-rendering%3D%27crispEdges%27%3E%3Crect%20x%3D%272%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%272%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%270%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%271%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%272%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%274%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%275%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%270%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%271%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%272%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%273%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%274%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%275%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%270%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%271%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%272%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%274%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%275%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%272%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ff3a2a%27/%3E%3Crect%20x%3D%272%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3Crect%20x%3D%273%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffd0c8%27/%3E%3C/svg%3E") center/12px 12px no-repeat; color: transparent; image-rendering: pixelated; }
.bar.en .ic { background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%208%208%27%20shape-rendering%3D%27crispEdges%27%3E%3Crect%20x%3D%273%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%274%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%272%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%273%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%271%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%272%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%273%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%276%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%270%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%271%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%272%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%273%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%276%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%277%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%270%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%271%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%272%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%273%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%276%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%277%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%271%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%272%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%276%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%272%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%273%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%274%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23d040b8%27/%3E%3Crect%20x%3D%275%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%273%27%20y%3D%277%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3Crect%20x%3D%274%27%20y%3D%277%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23ffb0f0%27/%3E%3C/svg%3E") center/12px 12px no-repeat; color: transparent; image-rendering: pixelated; }
.bar.sta .ic { background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%208%208%27%20shape-rendering%3D%27crispEdges%27%3E%3Crect%20x%3D%274%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%273%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%274%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%272%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%273%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%274%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%271%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%272%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%273%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%274%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%275%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%276%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%273%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%274%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%275%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%2330d080%27/%3E%3Crect%20x%3D%274%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3Crect%20x%3D%273%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23c8ffe0%27/%3E%3C/svg%3E") center/12px 12px no-repeat; color: transparent; image-rendering: pixelated; }
.bar.co .ic { background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%208%208%27%20shape-rendering%3D%27crispEdges%27%3E%3Crect%20x%3D%272%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%275%27%20y%3D%270%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%271%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%272%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%273%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%274%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%275%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%276%27%20y%3D%271%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%270%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%271%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%272%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%273%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%274%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%275%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%276%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%277%27%20y%3D%272%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%271%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%272%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%275%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%276%27%20y%3D%273%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%271%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%272%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%275%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%276%27%20y%3D%274%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%270%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%271%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%272%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%273%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%274%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%235a2a0a%27/%3E%3Crect%20x%3D%275%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%276%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%277%27%20y%3D%275%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%271%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%272%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%273%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%274%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%275%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23a85a1a%27/%3E%3Crect%20x%3D%276%27%20y%3D%276%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%272%27%20y%3D%277%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3Crect%20x%3D%275%27%20y%3D%277%27%20width%3D%271%27%20height%3D%271%27%20fill%3D%27%23f0a050%27/%3E%3C/svg%3E") center/12px 12px no-repeat; color: transparent; image-rendering: pixelated; }
.bar { border-radius: 0; border: 2px solid #0a0812; box-shadow: 0 0 0 2px #4a4266, inset 0 0 0 1px #000; image-rendering: pixelated; }
.bar i, .bar u { border-radius: 0; }
.bar.hp i { background: linear-gradient(180deg, #ff9a8a 0 25%, #e0402c 25% 70%, #9a1a1a 70%); }
.bar.en i { background: linear-gradient(180deg, #ffb0f0 0 25%, #c83ab0 25% 70%, #6a1a60 70%); }
.bar.sta i { background: linear-gradient(180deg, #a0ffd0 0 25%, #22b070 25% 70%, #10603a 70%); }
.bar.co i { background: linear-gradient(180deg, #ffc070 0 25%, #b0601a 25% 70%, #5a2a0a 70%); }
.bar u { background: #f8f0d8; opacity: .55; transition: width .9s steps(12) .25s; }
.bar i { transition: width .15s steps(6); box-shadow: none; }
.bar::after { background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0,0,0,.45) calc(10% - 2px) 10%); }
.bar span, .bar em { font-family: 'Press Start 2P', 'Ubuntu Mono', monospace; font-size: 7px; letter-spacing: .5px; }
.bar.low { animation: lowpulse 0.8s steps(2) infinite; }
@keyframes lowpulse { 50% { box-shadow: 0 0 0 2px #ff3a3a, inset 0 0 0 1px #000; } }
.card, .card .ci, .pr, .need span { border-radius: 0; }
.card { border: 2px solid #3a3352; box-shadow: 0 0 0 2px #0a0812; }
.card .ci { border: 2px solid #2a2440; background: #0a0814; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.price, .cnt { font-family: 'Press Start 2P', monospace; font-size: 9px; }
#topbtns button.on, #abtns button.on { background: #3a2f6a; border-color: #ffe9a8; box-shadow: 0 0 8px rgba(255,233,168,.45); }

/* ---- Главное меню (menu.rs): фон рисуется на #cv */
.screen > .card, #mainmenu .card, #editor .card.ed { display: block; }
#mainmenu { background: none; align-items: flex-start; }
.mm-wrap { width: min(1040px, 100%); margin: auto; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.mm-title { font-size: clamp(22px, 6vw, 46px); text-shadow: 4px 4px 0 #5a1f2b, 0 0 30px rgba(255,200,120,.35); margin: 8px 0 0; }
#mm-login { align-self: center; background: rgba(16,14,30,.86); }
.mm-cols { display: grid; grid-template-columns: 250px minmax(0, 680px); gap: 14px; align-items: start; }
.mm-btns { display: flex; flex-direction: column; gap: 8px; }
.mm-btns button { text-align: left; padding: 11px 14px; background: rgba(26,22,48,.88); backdrop-filter: blur(2px); }
.mm-btns button small { display: block; color: var(--dim); font-size: 12px; }
.mm-btns button.go { border-color: var(--gold); background: rgba(58,31,90,.92); font-family: "Press Start 2P", monospace; font-size: 12px; line-height: 1.6; }
.mm-pane { background: rgba(16,14,30,.8); min-height: 200px; }
.mm-pane:hover { border-color: var(--line) !important; box-shadow: 0 0 0 2px #0a0812 !important; }
.chars { display: grid; gap: 8px; }
.ch { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 2px solid var(--line); border-radius: 8px; background: rgba(26,22,48,.7); }
.ch.last { border-color: var(--gold); }
.ch img { width: 64px; height: 96px; image-rendering: pixelated; object-fit: contain; }
.ch .chi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ch .chi small { color: var(--dim); font-size: 12px; }
.ch .chb { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ch .chb button { padding: 6px 8px; font-size: 13px; }
.ch .chb .go { grid-column: 1 / -1; border-color: var(--gold); background: #3a1f5a; }
.ch .chb .del:hover { border-color: #ff6a6a; }
.ch.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 6px; gap: 0; border-style: dashed; color: var(--dim); }
.ch.empty span { font-size: 22px; color: var(--cyan); }
.srv { padding: 10px; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; }
.srv.on { border-color: var(--cyan); }
.srv small { display: block; color: var(--dim); }
.credits p { margin: 6px 0; }
@media (max-width: 720px) {
  .mm-cols { grid-template-columns: 1fr; }
  .mm-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .mm-btns .go { grid-column: 1 / -1; }
  .ch { grid-template-columns: 48px 1fr; }
  .ch img { width: 48px; height: 72px; }
  .ch .chb { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .ch .chb .go { grid-column: auto; }
}

/* ---- Редактор персонажа (editor.rs) */
#editor { background: rgba(5,4,12,.55); align-items: flex-start; }
.card.ed { width: min(1180px, 100%); margin: auto; background: rgba(16,14,30,.95); }
.ed-head { display: flex; justify-content: space-between; align-items: center; }
.ed-head h2 { margin: 0; }
.ed-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; margin-top: 10px; }
.ed-left { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; align-self: start; }
#ed-pv { width: 360px; height: 420px; touch-action: none; cursor: grab; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 40%, #2a2350, #0e0c1c); border: 2px solid var(--line); border-radius: 8px; align-self: center; }
.ed-info { font-size: 13px; color: var(--text); }
.budget { position: relative; height: 22px; background: #1a1428; border: 2px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.budget i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #2a8a5a, #3cff9e); opacity: .45; }
.budget.over i { background: linear-gradient(90deg, #8a2a2a, #ff6a6a); opacity: .7; }
.budget span { position: relative; z-index: 1; font-size: 12px; padding-left: 6px; line-height: 18px; }
.ed-stats { font-size: 12px; max-height: 180px; overflow-y: auto; }
.ed-stats div { padding: 3px 0; border-bottom: 1px dashed #2a2450; }
.ed-stats small { display: block; color: #8affc6; }
#ed-done.dim { opacity: .5; }
.ed-tabs button.on { border-color: var(--gold); }
#editor .cards { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
#editor .cards.fac { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#editor .cards button { min-width: 0; overflow-wrap: anywhere; }
#editor .cards.mode { grid-template-columns: 1fr 1fr; }
#editor .cards.presets { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
#editor .cards.specs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#editor .cards.specs button { align-items: flex-start; text-align: left; }
#editor .cards small.bon { color: var(--cyan); }
#editor .cards button img { width: 48px; height: 72px; object-fit: contain; }
.ed-parts { display: grid; grid-template-columns: 210px 1fr; gap: 10px; }
.ed-slots { display: flex; flex-direction: column; gap: 3px; max-height: 70vh; overflow-y: auto; }
.ed-slots button { display: flex; gap: 8px; align-items: center; text-align: left; padding: 5px 8px; }
.ed-slots button * { pointer-events: none; }
.ed-slots .si { width: 22px; text-align: center; color: var(--gold); font-size: 16px; }
.ed-slots small { display: block; color: var(--dim); font-size: 11px; }
.ed-slots button.on { border-color: var(--gold); background: #3a2f6a; }
#editor .cards.opts { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
#editor .cards.opts button { position: relative; justify-content: flex-start; }
#editor .cards.opts .cost { font-size: 11px; color: var(--gold); }
#editor .cards.opts small.eff { color: #8affc6; }
#editor .cards.opts small.who { color: var(--cyan); }
#editor .cards.opts small.warn { color: #ffb05a; }
#editor .cards.opts button.locked { opacity: .45; }
#editor .cards.opts .lock { position: absolute; top: 4px; right: 6px; font-style: normal; }
#ed-htable { margin-top: 10px; font-size: 13px; }
#ed-htable div { padding: 3px 0; border-bottom: 1px dashed #2a2450; }
#ed-htable .y { color: #3cff9e; } #ed-htable .n { color: #ff6a6a; }
.ptools { display: flex; flex-direction: column; gap: 6px; }
.ptools .seg { flex-wrap: wrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.swatches input[type=color] { width: 40px; height: 32px; }
.swatches i { width: 24px; height: 24px; border: 2px solid #0a0812; box-shadow: 0 0 0 1px #4a4266; cursor: pointer; }
.swatches i.on { box-shadow: 0 0 0 2px var(--gold); }
.pwrap { margin-top: 8px; max-height: 70vh; overflow: auto; background: #0c0a18; border: 2px solid var(--line); border-radius: 6px; padding: 6px; text-align: center; touch-action: none; }
#ed-paint { image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.skrows { display: grid; gap: 4px; }
.skrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; }
.skrow .pips { color: var(--gold); letter-spacing: 2px; min-width: 4em; text-align: center; }
@media (max-width: 760px) {
  .ed-grid { grid-template-columns: 1fr; }
  .ed-left { position: static; }
  .ed-parts { grid-template-columns: 1fr; }
  .ed-slots { flex-direction: row; overflow-x: auto; max-height: none; }
  .ed-slots button { flex: none; }
  #ed-pv { width: auto; height: 30vh; aspect-ratio: 300 / 340; }
  #ed-pane button, #ed-pane input, #ed-pane select, #ed-tabs button { scroll-margin-top: calc(26vh + 120px); scroll-margin-bottom: 80px; }
  .ed-left { position: static; flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 6px; align-items: start; }
  .ed-left > #ed-pv { grid-row: 1 / span 6; }
  .ed-left > .seg { flex-wrap: wrap; }
  .ed-left > .seg button { flex: 1 1 40%; min-width: 0; }
  #editor button { min-width: 0; }
  #editor { width: 100vw; left: 0; }
  #editor, #editor > .card.ed, .ed-grid, .ed-right { max-width: 100vw; overflow-x: hidden; }
  .ed-left .ed-stats, .ed-left #ed-info, .ed-left #ed-hint { display: none; }
  .ed-left .seg button { padding: 4px 6px; font-size: 11px; min-height: 30px; }
  .ed-left .budget { height: 18px; margin-top: 0; }
  .ed-left .budget span { font-size: 10px; line-height: 14px; }
  .ed-save { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(16,14,30,.97); border-top: 2px solid var(--line); }
  .ed-save button { min-height: 44px; font-size: 12px; }
  #editor { padding: 0; }
  #editor > .card.ed { display: flex; flex-direction: column; height: 100dvh; padding: 6px 8px 64px; overflow: hidden; border-radius: 0; }
  .ed-head { flex-wrap: wrap; gap: 4px; }
  .ed-head h2 { font-size: 12px; flex: 1 1 50%; min-width: 0; overflow-wrap: anywhere; }
  .ed-hbtns { flex: none; }
  .ed-hbtns button { padding: 6px 9px; min-width: 0; margin: 0; }
  .ed-dirty { font-size: 10px; order: 3; flex-basis: 100%; }
  .ed-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
  .ed-right { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .ed-tabs { flex: none; overflow-x: auto; flex-wrap: nowrap; }
  .ed-tabs button { flex: none; }
  #ed-pane { flex: 1; min-height: 0; overflow-y: auto; }
  .ed-saved, #ed-err { font-size: 11px; }
}
#snd-custom .cm { flex: 1; text-align: left; color: var(--dim); }
#snd-custom .fbtn { margin: 0; min-width: 0; cursor: pointer; border: 2px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.pgrid { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.pgrid .pwrap { margin-top: 0; }
.ed-grid > *, .mm-cols > * { min-width: 0; }
#editor .cards.opts button img { width: 96px; height: 96px; }
@media (max-width: 760px) {
  .pgrid { grid-template-columns: 1fr; }
  #editor .cards.fac { grid-template-columns: 1fr; }
  .card.ed { padding: 10px; }
  #editor { padding: 6px; }
}

#mm-toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; max-width: min(92vw, 640px); padding: 12px 18px; background: #2a0f18; border: 2px solid #ff5a6a; box-shadow: 0 0 0 2px #0a0812, 0 6px 24px rgba(0,0,0,.6); color: #ffd6da; font-family: 'Press Start 2P', monospace; font-size: 11px; line-height: 1.6; text-align: center; }
/* ---- «Анатомия»: скелет, модули, альтмод */
.ed-head { gap: 10px; }
.ed-head h2 { flex: 1; }
.ed-hbtns { display: flex; gap: 4px; }
.ed-dirty { color: #ffb05a; font-size: 12px; }
.ed-save { display: grid; grid-template-columns: auto 1fr; gap: 6px; }
.ed-save button { margin: 0; }
.ed-saved { font-size: 13px; min-height: 1em; }
.ed-saved .ok { color: #3cff9e; } .ed-saved .wait { color: var(--gold); }
#ed-pane { max-height: calc(100vh - 140px); overflow-y: auto; padding-right: 4px; }
#editor .cards.thumbs { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
#editor .cards.thumbs.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
#editor .cards.thumbs button { position: relative; padding: 4px; gap: 2px; justify-content: flex-start; }
#editor .cards.thumbs button img.th { width: 96px; height: 96px; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 45%, #2a2350, #0e0c1c); border-radius: 6px; object-fit: contain; }
#editor .cards.thumbs.small button img.th { width: 72px; height: 72px; }
#editor .cards.thumbs button b { font-size: 12px; line-height: 1.15; }
#editor .cards.thumbs button small { font-size: 11px; color: var(--dim); }
#editor .cards.thumbs .cost { font-size: 10px; color: var(--gold); }
#editor .cards.thumbs button.locked { opacity: .45; }
#editor .cards.thumbs .lock { position: absolute; top: 2px; right: 4px; font-style: normal; }
#editor .cards.thumbs button.on { border-color: var(--gold); background: #3a2f6a; }
.modcats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.modcats button { display: flex; align-items: center; gap: 4px; padding: 4px 8px; margin: 0; min-width: 0; }
.modcats button.on { border-color: var(--gold); background: #3a2f6a; }
.modcats .si { color: var(--gold); }
#ed-search, #ed-asearch { width: 100%; margin: 4px 0; }
.bones { display: flex; flex-wrap: wrap; gap: 3px; max-height: 220px; overflow-y: auto; }
.bones button { margin: 0; padding: 3px 8px; font-size: 12px; min-width: 0; text-align: left; }
.bones button.on { border-color: var(--gold); background: #3a2f6a; }
.sline { display: grid; grid-template-columns: 150px 1fr 92px; gap: 6px; align-items: center; font-size: 12px; }
.sline label { margin: 0; }
.sline span { color: var(--gold); text-align: right; }
.scheme { display: grid; gap: 3px; }
.srow { display: grid; grid-template-columns: 130px 44px auto 1fr; gap: 6px; align-items: center; font-size: 12px; }
.srow input[type=color] { width: 44px; height: 26px; padding: 0; }
.srow .pal { display: flex; flex-wrap: wrap; gap: 2px; }
.srow .pal i { width: 14px; height: 14px; border: 1px solid #0a0812; cursor: pointer; }
.srow button { margin: 0; padding: 2px 6px; }
.srow button.on { border-color: var(--gold); }
label.chk { display: flex; gap: 6px; align-items: center; }
.card-stats { display: grid; gap: 2px; font-size: 12px; margin: 4px 0; }
.card-stats > div { display: grid; grid-template-columns: 150px 1fr; gap: 6px; align-items: center; }
.card-stats .ab { display: block; color: var(--cyan); }
.card-stats .bar { display: block; height: 8px; background: #1a1428; border: 1px solid #3a3460; border-radius: 3px; overflow: hidden; box-shadow: none; }
.card-stats .bar i { display: block; position: static; height: 100%; background: linear-gradient(90deg, #2a8a5a, #3cff9e); }
.module-info { display: grid; gap: 4px; margin: 4px 0; text-align: left; line-height: 1.35; }
.module-info > span { display: block; overflow-wrap: anywhere; }
.ed-tip { position: fixed; z-index: 60; max-width: 320px; background: rgba(12,10,24,.97); border: 2px solid var(--gold); border-radius: 8px; padding: 8px 10px; font-size: 12px; pointer-events: none; box-shadow: 0 6px 24px #000a; }
[data-tip] { -webkit-touch-callout: none; user-select: none; }
#ed-tip-close { display: none; }
.ed-tip.touch-tip {
  left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom)); margin-inline: auto; width: auto; max-width: 420px;
  max-height: min(55vh, 360px); max-height: min(55dvh, 360px);
  display: flex; flex-direction: column; gap: 4px; padding: 4px 10px 10px;
  pointer-events: auto; font-size: 14px;
}
.ed-tip.touch-tip #ed-tip-close {
  display: block; align-self: flex-end; flex: none;
  width: 44px; min-width: 44px; height: 44px; padding: 0; margin: 0; font-size: 19px;
}
.ed-tip.touch-tip #ed-tip-body {
  min-height: 0; overflow: auto; overflow-wrap: anywhere;
  overscroll-behavior: contain; touch-action: pan-y;
}
.ed-tip .card-stats > div { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ed-tip b { font-size: 14px; color: var(--gold); }
.ed-tip .tc { color: var(--dim); }
.ed-tip .eff { color: #8affc6; }
.ed-tip .up { color: #3cff9e; } .ed-tip .down { color: #ff8a6a; }
.ed-tip .diff { margin-top: 4px; border-top: 1px dashed #3a3460; padding-top: 4px; }
/* пропорции: подпись, −, ползунок, +, число; крупная «ручка» для пальца */
.props { display: grid; gap: 2px; }
.props .pname { color: var(--cyan); font-size: 12px; margin-top: 6px; }
.sline.pline { grid-template-columns: 170px 30px 1fr 30px 86px; }
.sline.pline .pm { margin: 0; padding: 0; min-width: 0; width: 30px; height: 30px; font-size: 16px; line-height: 1; }
#editor input[type=range] { height: 30px; touch-action: pan-y; }
#editor input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; }
#editor input[type=range]::-moz-range-thumb { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .sline.pline { grid-template-columns: 40px 1fr 40px 90px; }
  .sline.pline label { grid-column: 1 / -1; }
  .sline.pline .pm { width: 40px; height: 36px; }
  #editor input[type=range] { height: 36px; }
  .sline { grid-template-columns: 1fr 1.4fr 84px; }
  .srow { grid-template-columns: 1fr 40px auto; }
  .srow .pal { grid-column: 1 / -1; }
  #editor .cards.thumbs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  #editor .cards.thumbs button img.th { width: 84px; height: 84px; }
  .card-stats > div { grid-template-columns: 1fr 1fr; }
}
/* космос: свои кнопки на телефоне (круиз, цель, добыча), наземные — прячутся */
.sp-only { display: none !important; }
body.space .sp-only { display: inline-block !important; }
body.space .gnd-only { display: none !important; }

/* скины и заведения */
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.skin { display: grid; grid-template-columns: 48px 1fr; gap: 4px 6px; align-items: center; border: 2px solid var(--line); border-radius: 6px; padding: 4px; }
.skin img { width: 48px; height: 72px; image-rendering: pixelated; grid-row: span 2; }
.skin b { font-size: 12px; overflow-wrap: anywhere; }
.skin .skb { display: flex; flex-wrap: wrap; gap: 3px; }
.skin .skb button { margin: 0; padding: 6px 8px; min-height: 36px; }
.skimp { display: flex; gap: 6px; margin-top: 6px; }
.skimp input { flex: 1; }
.skinnote { color: var(--gold); }
.shopbox { border: 2px solid var(--gold); border-radius: 6px; padding: 6px; font-size: 12px; display: grid; gap: 2px; }
.shopbox small { color: var(--dim); }
.shopbox .down { color: #ff8a6a; }

#editor .cards.thumbs button.nonecard .none { display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; font-size: 40px; color: #ff8a6a; background: #0e0c1c; border-radius: 6px; }
.installed { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.installed span { display: inline-flex; gap: 2px; }
.installed span.on button { border-color: var(--gold); }
.installed button { margin: 0; min-height: 34px; }
.budget.over span { color: #ffb0a0; }
@media (max-width: 760px) { #editor .cards.thumbs button.nonecard .none { width: 84px; height: 84px; } }

/* расширенный вид редактора (editor/big.rs) */
.ed-bigbtn { display: block; width: 100%; margin: 4px 0 0; padding: 8px 10px; border: 2px solid var(--gold); color: var(--gold); background: #2a2148; font-weight: bold; min-height: 40px; }
.ed-bigbtn:hover { background: #3a2f6a; }
#ed-big { position: fixed; inset: 0; z-index: 70; background: #0b0918; display: flex; flex-direction: column; color: #e8e4f0; }
#ed-big.hidden { display: none; }
body.eb-open { overflow: hidden; }
.eb-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--line); background: #15112a; }
.eb-head .seg { margin: 0; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.eb-head .seg button { margin: 0; padding: 6px 10px; min-height: 36px; }
.eb-head .seg button.on { border-color: var(--gold); background: #3a2f6a; color: var(--gold); }
.eb-head select { min-height: 36px; }
.eb-hb { margin-left: auto; display: flex; gap: 4px; }
.eb-hb button { margin: 0; min-height: 36px; min-width: 40px; }
.eb-close { border-color: #ff8a6a !important; }
.eb-body { flex: 1; display: flex; min-height: 0; }
.eb-view { flex: 1; position: relative; min-width: 0; }
#ed-bigcv { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; image-rendering: pixelated; }
.eb-status { position: absolute; left: 8px; top: 8px; right: 8px; pointer-events: none; font-size: 13px; text-shadow: 0 1px 2px #000; }
.eb-status button { pointer-events: auto; margin: 0 0 0 6px; }
.eb-status b { color: var(--gold); }
.eb-hint { pointer-events: none; position: absolute; left: 50%; top: 34px; transform: translateX(-50%); max-width: min(520px, 92%); background: rgba(12,10,24,.95); border: 2px solid var(--gold); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.eb-hint.hidden { display: none; }
.eb-hint button { margin: 6px 0 0; pointer-events: auto; }
.eb-vbtn { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; }
.eb-vbtn button { margin: 0; min-width: 44px; min-height: 44px; font-size: 18px; }
.eb-side { width: 400px; overflow-y: auto; padding: 8px 10px; border-left: 2px solid var(--line); background: #120f22; }
.eb-side .bones { max-height: 160px; }
.eb-sw i { width: 24px; height: 24px; }
.eb-sw i.on { outline: 2px solid var(--gold); }
.eb-pats { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 4px; }
.eb-pats button { margin: 0; padding: 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.eb-pats button img { width: 44px; height: 44px; image-rendering: pixelated; border-radius: 4px; }
.eb-pats button small { font-size: 10px; }
.eb-pats button.on { border-color: var(--gold); background: #3a2f6a; }
/* выбранная наклейка: крупная красная «Удалить»; ✕ у каждой в списке */
.eb-delbig { display: block; width: 100%; margin: 4px 0 8px; padding: 10px; background: #b8262a; border-color: #ff6a5a; color: #fff; font-size: 15px; font-weight: bold; min-height: 44px; }
.eb-delbig:hover { background: #d8343a; }
.eb-ditem { display: inline-flex; align-items: stretch; gap: 2px; }
.eb-ditem .eb-dx { min-width: 32px; padding: 0 6px; color: #ff8a7a; }
/* каталог «Навесного»: крупные картинки деталей */
.eb-gpics { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.eb-gpics button img { width: 72px; height: 72px; background: radial-gradient(circle, #2e2758 0%, #15122a 75%); }
.eb-gpics button small { font-size: 11px; line-height: 1.15; text-align: center; }
@media (max-width: 760px) {
  .eb-body { flex-direction: column; }
  .eb-view { flex: none; height: 56vh; }
  .eb-side { width: auto; flex: 1; border-left: none; border-top: 2px solid var(--line); }
  .eb-head .seg button { padding: 6px 8px; font-size: 13px; }
  .eb-hb .small { font-size: 13px; }
}

/* главное меню → «Разработка» */
.dev-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dev-card { background: rgba(20, 16, 40, .7); border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.dev-card p { margin: 6px 0; }
.dev-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dev-list { margin: 6px 0 0; padding-left: 18px; }
.dev-list li { margin: 4px 0; }
.dev-where, .dev-how { color: #9fe8ff; }
.dev-badge { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid; }
.dev-badge.on { color: #65dfad; } .dev-badge.off { color: #ff9a5a; }
.dev-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.dev-stats div { background: rgba(0, 0, 0, .25); border-radius: 6px; padding: 4px 8px; min-width: 90px; }
.dev-stats small { display: block; opacity: .75; font-size: 11px; } .dev-stats b { font-size: 16px; }
.dev-spark { display: block; max-width: 100%; }

/* особые способности альтмода */
#abtns button.abil { background: rgba(40, 70, 130, 0.8); border-color: #6ab0ff; }
#abil-hud { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); gap: 6px; z-index: 30; pointer-events: none; }
/* способностей формы бывает много (модули) — на узком экране значки мельче */
@media (max-width: 520px) { #abil-hud { gap: 4px; max-width: 60vw; } #abil-hud .ab { width: 26px !important; height: 26px !important; font-size: 15px !important; } }
#abil-hud .ab { position: relative; width: 34px; height: 34px; border-radius: 8px; background: rgba(20, 24, 40, 0.75); border: 2px solid #4a5a80; color: #dfe8ff; font-size: 20px; display: flex; align-items: center; justify-content: center; }
#abil-hud .ab.last { border-color: #9ac8ff; }
#abil-hud .ab.on { border-color: #ffd04a; box-shadow: 0 0 8px #ffd04a; }
#abil-hud .ab i { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); border-radius: 6px; font-style: normal; font-size: 14px; display: flex; align-items: center; justify-content: center; }
/* колесо способностей (G / ✦): радиальное, секторы-лепестки, в центре — выбранная способность */
#abil-wheel {
  position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.82);
  width: min(400px, calc(100vw - 28px), calc(100dvh - 120px)); aspect-ratio: 1; z-index: 60;
  touch-action: none; user-select: none; -webkit-user-select: none;
  opacity: 0; visibility: hidden; transition: opacity .15s ease-out, transform .15s ease-out, visibility 0s linear .15s;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .7));
}
#abil-wheel.aw2-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); transition: opacity .16s ease-out, transform .18s cubic-bezier(.2, 1.4, .4, 1), visibility 0s; }
#abil-wheel[data-double=true] { width: min(470px, calc(100vw - 16px), calc(100dvh - 96px)); }
@media (pointer: coarse) and (orientation: portrait) { #abil-wheel { top: 37%; width: min(400px, calc(100vw - 52px)); } #abil-wheel[data-double=true] { width: min(470px, calc(100vw - 20px)); } }
@media (pointer: coarse) and (orientation: landscape) { #abil-wheel { top: 47%; width: min(400px, calc(100dvh - 40px)); } #abil-wheel[data-double=true] { width: min(470px, calc(100dvh - 24px)); } }
#abil-wheel .aw2-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#abil-wheel .aw2-bg { fill: rgba(8, 12, 26, .78); stroke: #2c4b7a; stroke-width: 1.4; }
#abil-wheel .aw2-split { fill: none; stroke: rgba(58, 240, 255, .25); stroke-width: .8; stroke-dasharray: 2 2; pointer-events: none; }
#abil-wheel .aw2-hub { fill: rgba(10, 14, 30, .96); stroke: var(--cyan); stroke-width: 1.6; pointer-events: none; }
#abil-wheel .aw2-sec { fill: rgba(28, 44, 82, .92); fill-rule: evenodd; stroke: #5a86c8; stroke-width: 1.2; stroke-linejoin: round; transition: fill .08s, stroke .08s; }
#abil-wheel .aw2-sec.aw2-last { stroke: #9ac8ff; }
#abil-wheel .aw2-sec.aw2-on { fill: rgba(86, 70, 20, .95); stroke: #ffd04a; }
#abil-wheel .aw2-sec.aw2-off { fill: rgba(26, 28, 38, .92); stroke: #3c4258; }
#abil-wheel .aw2-sec.aw2-sel { fill: rgba(30, 120, 150, .95); stroke: var(--cyan); stroke-width: 2.4; }
#abil-wheel .aw2-sec.aw2-off.aw2-sel { fill: rgba(70, 40, 40, .95); stroke: #ff8a6a; }
#abil-wheel .aw2-lab {
  position: absolute; transform: translate(-50%, -50%); width: 21%; padding: 0; margin: 0;
  background: none; border: 0; color: #e8f2ff; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  text-shadow: 0 1px 0 #000, 0 0 4px #000, 1px 0 0 #000, -1px 0 0 #000;
}
#abil-wheel[data-double=true] .aw2-lab[data-ring="1"] { width: 14%; }
#abil-wheel .aw2-lab b { font-size: clamp(18px, 6.6cqw, 28px); font-weight: normal; line-height: 1; filter: drop-shadow(0 0 2px #000); }
#abil-wheel .aw2-lab small { font-size: clamp(10px, 2.9cqw, 12px); line-height: 1.05; overflow-wrap: anywhere; max-height: 2.2em; overflow: hidden; }
#abil-wheel .aw2-lab u { text-decoration: none; font-size: 10px; color: #ffb08a; }
#abil-wheel .aw2-lab.aw2-off { opacity: .55; }
#abil-wheel .aw2-lab.aw2-on small { color: #ffe08a; }
#abil-wheel .aw2-lab.aw2-sel { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
#abil-wheel .aw2-lab.aw2-sel small { color: #fff; }
#abil-wheel { container-type: inline-size; }
#abil-wheel .aw2-c {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 31%; max-height: 32%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; color: #dfe8ff; pointer-events: none; overflow: hidden;
}
#abil-wheel[data-double=true] .aw2-c { width: 31%; }
#abil-wheel .aw2-c i { font-style: normal; font-size: clamp(16px, 5cqw, 22px); line-height: 1; }
#abil-wheel .aw2-c b { font-family: "Press Start 2P", monospace; font-size: clamp(7px, 2.2cqw, 10px); line-height: 1.35; color: var(--gold); text-shadow: 2px 2px 0 #5a1f2b; }
#abil-wheel .aw2-c small { font-size: clamp(8px, 2.3cqw, 10px); line-height: 1.15; color: #b8c6e6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#abil-wheel .aw2-c em { font-style: normal; font-size: clamp(9px, 2.5cqw, 11px); color: var(--cyan); }
#abil-wheel .aw2-c em.aw2-why { color: #ff9a7a; }
#abil-wheel .aw2-c em.aw2-onx { color: #ffd04a; }
@media (prefers-reduced-motion: reduce) { #abil-wheel, #abil-wheel.aw2-open { transition: none; } }
#tape-menu { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); width: min(92vw, 380px); max-height: 70vh; overflow: auto; background: rgba(14, 16, 28, 0.95); border: 2px solid #5a7ab0; border-radius: 12px; padding: 10px; z-index: 61; color: #fff; }
#tape-menu .tm-h { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 8px; }
#tape-menu .tm-l { display: flex; flex-direction: column; gap: 4px; }
#tape-menu .tm-l button { text-align: left; }
#tape-menu .tm-n { font-size: 12px; opacity: 0.75; margin-top: 8px; }
#tape-menu .tm-row { display: flex; gap: 4px; }
#tape-menu .tm-row button:first-child { flex: 1; text-align: left; }
/* лента новостей разработки */
.dev-post { background: linear-gradient(180deg, rgba(34, 26, 70, .85), rgba(18, 14, 36, .85)); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.dev-post h3 { margin: 6px 0 8px; font-size: 18px; color: #ffe08a; }
.dev-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dev-date { font-size: 12px; color: #9fe8ff; background: rgba(58, 240, 255, .12); border-radius: 10px; padding: 1px 8px; }
.dev-tag { font-size: 12px; color: #c9b8ff; }
.dev-tag.soon { color: #ffc03a; border: 1px solid #ffc03a; border-radius: 10px; padding: 0 8px; }
.dev-gallery { display: grid; gap: 8px; margin: 8px 0; }
.dev-gallery.n2 { grid-template-columns: 1fr 1fr; } .dev-gallery.n3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .dev-gallery.n2, .dev-gallery.n3 { grid-template-columns: 1fr; } }
.dev-fig { margin: 6px 0; } .dev-fig img { width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; background: #0d0a1c; }
.dev-fig figcaption { font-size: 12px; opacity: .8; margin-top: 3px; }
.dev-zoom { position: fixed; inset: 0; z-index: 99999; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out; }
.dev-zoom img { max-width: 100%; max-height: 100%; image-rendering: auto; }
/* ===== Телефон и планшет: редактор (итог; перекрывает правила выше) ===== */
.pvbox { display: flex; flex-direction: column; gap: 6px; position: relative; }
.pvbox .seg i { font-style: normal; }
.ed-bigbtn .short, .ed-bigbtn .ico { display: none; }
@media (max-width: 760px), (max-height: 520px) {
  #editor > .card.ed { padding: 4px 6px calc(64px + env(safe-area-inset-bottom)) !important; padding-left: max(6px, env(safe-area-inset-left)) !important; padding-right: max(6px, env(safe-area-inset-right)) !important; }
  .ed-head { flex-wrap: nowrap; gap: 6px; min-height: 48px; }
  .ed-head h2 { font-size: 13px; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ed-dirty { display: none; }
  .ed-hbtns { display: flex; gap: 4px; }
  .ed-hbtns button { min-width: 44px !important; min-height: 44px; padding: 0 !important; font-size: 18px; }
  /* превью: на всю ширину, кнопки — поверх него крупными значками */
  .ed-left { display: flex !important; flex-direction: column; gap: 4px; flex: none; }
  .pvbox { display: block; position: relative; }
  .ed-left #ed-pv, .ed-left > .pvbox > #ed-pv { display: block; width: 100% !important; height: 34vh !important; aspect-ratio: auto !important; border-radius: 10px; }
  .pvbox .seg { position: absolute; display: flex; flex-direction: column; gap: 4px; margin: 0; z-index: 2; }
  .pvbox .pvanim { left: 6px; top: 6px; }
  .pvbox .pvrot { right: 6px; top: 6px; }
  .pvbox .seg button { flex: none !important; width: 44px; min-width: 44px !important; height: 44px; min-height: 44px; padding: 0 !important; margin: 0; font-size: 18px !important; background: rgba(20,16,40,.82); }
  .pvbox .seg button span, .pvbox .pvz { display: none; }
  .pvbox .ed-bigbtn { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: auto; margin: 0; z-index: 2; min-height: 44px; padding: 0 16px; font-size: 14px; border-radius: 22px; background: rgba(42,33,72,.92); box-shadow: 0 2px 10px #000a; }
  .ed-bigbtn #ed-bigbtn-t { display: none; }
  .ed-bigbtn .short { display: inline; }
  .ed-left .ed-stats, .ed-left #ed-info, .ed-left #ed-hint, .ed-left #ed-saved { display: none; }
  .ed-left .budget { height: 22px; margin: 0; }
  .ed-left .budget span { font-size: 12px; line-height: 18px; }
  /* вкладки — одна полоса, листается пальцем; содержимое — единственная прокрутка */
  .ed-tabs { display: flex; flex-wrap: nowrap !important; overflow-x: auto; gap: 4px; margin: 4px 0; padding-bottom: 2px; scrollbar-width: none; }
  .ed-tabs::-webkit-scrollbar { display: none; }
  .ed-tabs button { flex: none; min-height: 44px; padding: 0 12px; font-size: 14px; }
  #ed-pane { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 12px; }
  #ed-pane button, #ed-pane select, #ed-pane input:not([type=range]):not([type=checkbox]):not([type=color]) { min-height: 44px; font-size: 14px; }
  #ed-pane .seg button { min-height: 44px; }
  #ed-pane .bones button { min-height: 40px; font-size: 13px; }
  #ed-pane .swatches i, .eb-sw i { width: 32px; height: 32px; }
  #ed-pane .sline { grid-template-columns: 1fr; gap: 2px; font-size: 14px; }
  #ed-pane .sline label { grid-column: 1 / -1; }
  #ed-pane .sline span { text-align: left; }
  #ed-pane .sline.pline, .eb-side .sline.pline { grid-template-columns: 44px 1fr 44px 92px; font-size: 14px; }
  .sline.pline .pm { width: 44px !important; height: 44px !important; }
  .ed-save { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; }
  .ed-save button { min-height: 48px; font-size: 14px; margin: 0; }
  .skrow { grid-template-columns: 1fr 44px 44px; }
  .skrow button { min-height: 44px; }
  .hint { font-size: 13px; }
}
/* телефон боком: превью слева во всю высоту, справа вкладки и настройки */
@media (max-height: 520px) and (orientation: landscape) {
  #editor > .card.ed { padding-bottom: 6px !important; }
  .ed-grid { flex-direction: row !important; gap: 8px; }
  .ed-left { width: 42vw; flex: none; height: 100%; }
  .ed-left #ed-pv, .ed-left > .pvbox > #ed-pv { height: calc(100dvh - 120px) !important; }
  .ed-right { flex: 1; min-width: 0; }
  .ed-save { position: static !important; padding: 0 !important; border: 0 !important; background: none !important; }
  .ed-left .budget { display: none; }
  .ed-head { min-height: 44px; }
}
/* расширенный вид на телефоне: шапка в одну строку, модель крупно, настройки — нижняя панель */
.eb-head .eb-close { margin: 0; min-height: 40px; }
.eb-head .eb-modes { flex: 1; }
.eb-head .seg i { font-style: normal; }
.eb-sidew { display: flex; flex-direction: column; min-height: 0; }
.eb-sheet { display: none; }
.eb-altsel { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.eb-altsel select { min-height: 40px; }
.eb-vbtn button { margin: 0; min-width: 44px; min-height: 44px; font-size: 18px; background: rgba(20,16,40,.82); }
.eb-hint { z-index: 4; }
.eb-status { z-index: 3; }
@media (max-width: 760px), (max-height: 520px) {
  #ed-big { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .eb-head { flex-wrap: nowrap; gap: 4px; padding: 4px; }
  .eb-head .eb-close { flex: none; width: 48px; min-width: 48px; min-height: 44px; padding: 0; font-size: 18px; }
  .eb-head .eb-close span, .eb-head .eb-kind span { display: none; }
  .eb-head .seg { flex-wrap: nowrap; gap: 3px; }
  .eb-head .eb-modes { flex: 1; min-width: 0; }
  .eb-head .eb-modes button { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; font-size: 13px; white-space: nowrap; }
  .eb-head .eb-kind button { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 18px; }
  .eb-status { font-size: 13px; top: 4px; left: 6px; right: 6px; }
  .eb-hint { top: 40px; font-size: 13px; max-width: 94%; }
  .eb-vbtn { left: 4px; right: 4px; bottom: 4px; justify-content: center; gap: 4px; }
  .eb-vbtn button { flex: 1; max-width: 52px; min-width: 0; }
  .eb-side { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .eb-side button, .eb-side select { min-height: 44px; font-size: 14px; }
  .eb-side .bones button { min-height: 40px; font-size: 13px; }
  .eb-side .sline { grid-template-columns: 1fr; gap: 2px; font-size: 14px; }
  .eb-side .sline label { grid-column: 1 / -1; }
  .eb-pats { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .eb-pats button small { font-size: 11px; }
}
@media (max-width: 760px) and (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
  .eb-body { flex-direction: column; }
  .eb-view { flex: none; height: 54dvh; transition: height .2s; }
  .eb-sidew { flex: 1; border-top: 2px solid var(--line); background: #120f22; }
  .eb-sheet { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; min-height: 36px; border: 0; border-radius: 0; background: #1a1530; font-size: 13px; color: var(--gold); }
  .eb-sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: #5a5080; }
  .eb-side { flex: 1; width: auto; border: 0; }
  #ed-big.sheet-full .eb-view { height: 28dvh; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .eb-body { flex-direction: row; }
  .eb-view { flex: 1; height: auto; }
  .eb-sidew { width: 46vw; flex: none; border-left: 2px solid var(--line); }
  .eb-side { width: auto; flex: 1; border: 0; }
  .eb-sheet { display: none; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .eb-side, .eb-sidew { width: 340px; }
  .ed-grid { grid-template-columns: 320px 1fr; }
  #ed-pv { width: 300px; height: 360px; }
}
.eb-sidew > .eb-side { flex: 1; min-height: 0; }
@media (max-width: 760px), (max-height: 520px) {
  #editor > .card.ed { width: 100vw !important; max-width: 100vw !important; box-sizing: border-box; margin: 0; }
  .ed-grid, .ed-right { width: 100%; max-width: 100%; box-sizing: border-box; }
  .ed-left { align-self: stretch !important; width: 100%; }
  .ed-head h2 { min-width: 0; }
  .pvbox .ed-bigbtn { white-space: nowrap; }
  .eb-head .eb-modes button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 12px; line-height: 1.1; min-height: 48px; }
  .eb-head .eb-modes button i { font-size: 17px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .ed-left { width: 40vw !important; }
  .ed-left #ed-pv, .ed-left > .pvbox > #ed-pv { height: calc(100dvh - 128px) !important; }
  .ed-save { grid-template-columns: 1fr 1.6fr; }
  .ed-save button { min-height: 44px; font-size: 12px; }
}
@media (max-width: 760px), (max-height: 520px) {
  .ed-left { align-items: stretch !important; }
  .pvbox { width: 100%; }
  .ed-head { width: 100%; box-sizing: border-box; }
  .ed-head h2 { flex: 1 1 0 !important; min-width: 0 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .ed-hbtns { flex: 0 0 auto !important; }
}
@media (max-width: 760px) and (min-height: 521px) {
  .ed-left #ed-pv, .ed-left > .pvbox > #ed-pv { height: 30vh !important; }
  #ed-budget > * + * { display: none; }
  .ed-tabs { margin: 2px 0; }
  .eb-vbtn { left: auto; right: 4px; top: 56px; bottom: auto; flex-direction: column; }
  .eb-vbtn button { width: 44px; max-width: 44px; height: 42px; min-height: 42px; flex: none; }
  .eb-status { right: 54px; }
}
@media (max-width: 760px) and (max-height: 700px) and (min-height: 521px) {
  .ed-left #ed-pv, .ed-left > .pvbox > #ed-pv { height: 27vh !important; }
}
@media (max-width: 760px) and (min-height: 521px) {
  .pvbox .seg { flex-direction: row !important; }
  .pvbox .pvanim { left: 6px; top: 6px; }
  .pvbox .pvrot { right: 6px; top: 6px; }
  .pvbox .seg button { width: 42px; min-width: 42px !important; height: 42px; min-height: 42px; }
  .eb-vbtn button[data-act^="eb-turn"], .eb-vbtn button[data-act^="eb-tilt"] { display: none; }
}
/* планшеты и любые сенсорные экраны: цели касания не меньше 40 px */
@media (pointer: coarse) {
  #editor button, #ed-big button, #editor select, #ed-big select { min-height: 40px; }
  .sline.pline .pm { width: 40px; height: 40px; }
  #editor .swatches i, #ed-big .swatches i { width: 30px; height: 30px; }
}
@media (max-width: 760px) and (min-height: 521px) {
  /* анимации — внизу слева, поворот — вверху справа, «во весь экран» — внизу справа: модель свободна */
  .pvbox .pvanim { left: 6px; top: auto; bottom: 6px; }
  .pvbox .pvrot { right: 6px; top: 6px; }
  .pvbox .ed-bigbtn { left: auto; right: 6px; bottom: 6px; transform: none; padding: 0 12px; font-size: 13px; }
}
@media (max-width: 760px) and (min-height: 521px) {
  .pvbox .ed-bigbtn { left: 6px; right: auto; top: 6px; bottom: auto; }
}
@media (max-width: 760px) and (min-height: 521px) {
  .pvbox .pvrot button[data-act="ed-rot:0"] { display: none; }
  .pvbox .ed-bigbtn { padding: 0 10px; }
}
@media (max-width: 760px) and (min-height: 521px) {
  /* «во весь экран» на телефоне — значок в углу (не закрывает модель) */
  .pvbox .ed-bigbtn { width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 12px; font-size: 22px; }
  .pvbox .ed-bigbtn .short { display: none; }
  .pvbox .ed-bigbtn .ico { display: inline; }
}
@media (max-width: 760px) and (min-height: 521px) {
  /* значки — по краям колонками, середина превью — роботу */
  .pvbox .pvanim { display: grid !important; grid-template-columns: 42px 42px; gap: 4px; left: 6px; top: 58px; bottom: auto; }
  .pvbox .pvrot { flex-direction: column !important; right: 6px; top: 6px; }
  .pvbox .ed-bigbtn { left: 6px; top: 6px; }
}
label.chk { justify-content: flex-start; text-align: left; }
label.chk input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 0; }

/* выбор этажа стройки у разложенного крана */
#crane-hud { position: fixed; right: 12px; bottom: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 31; }
#crane-hud.hidden { display: none; }
#crane-hud button { width: 48px; height: 44px; font-size: 20px; border-radius: 10px; background: rgba(60,50,10,0.85); border: 2px solid #ffd04a; color: #ffe08a; }
#crane-hud span { font-size: 12px; color: #ffe08a; text-shadow: 0 1px 2px #000; }
/* значение ползунка + ↺ сброс к значению по умолчанию */
.sline .sv { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.sline .sv > span { min-width: 0; white-space: nowrap; }
.sline .rst, .hrow .rst { margin: 0; padding: 0; width: 30px; min-width: 30px; height: 30px; font-size: 15px; line-height: 1; opacity: .75; }
.sline .rst:hover, .hrow .rst:hover { opacity: 1; }
.hrow { display: flex; gap: 6px; align-items: center; }
.hrow input[type=range] { flex: 1; min-width: 0; }
#ed-pane .sline .sv { justify-content: flex-start; }
@media (pointer: coarse) { .sline .rst, .hrow .rst { width: 40px; min-width: 40px; height: 36px; } }
/* расширенный вид: список деталей альтмода/робота — выбрать, скрыть (призрак) */
.eb-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.eb-chip { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #1a1630; }
.eb-chip.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.eb-chip.ghost .nm { opacity: .45; font-style: italic; }
.eb-chip button { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 4px 8px; font-size: 12px; min-height: 32px; }
.eb-chip .eye { border-left: 1px solid var(--line); padding: 4px 6px; min-width: 32px; }
button.danger { border-color: #c0404a; color: #ff9aa0; }
@media (pointer: coarse) { .eb-chip button { min-height: 40px; } .eb-chip .eye { min-width: 40px; } }
@media (min-width: 761px) { .eb-side .sline.pline { grid-template-columns: minmax(84px, 118px) 30px 1fr 30px 86px; } .eb-side .sline.pline label { white-space: normal; line-height: 1.15; } }
.eb-det { margin: 4px 0 6px; }
.eb-det summary { cursor: pointer; color: var(--muted, #9a96c0); font-size: 12px; padding: 6px 0; }
@media (pointer: coarse) { .eb-det summary { padding: 10px 0; font-size: 14px; } }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap > button { flex: 1 1 auto; }
/* код скина внизу редактора */
.ed-code { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ed-code label { display: block; font-size: 12px; margin: 0 0 4px; }
.ed-coderow { display: flex; gap: 6px; margin: 4px 0; }
.ed-coderow input { flex: 1; min-width: 0; font-family: monospace; font-size: 16px; letter-spacing: 1px; text-transform: uppercase; }
.ed-coderow button { margin: 0; flex: 1 1 auto; white-space: nowrap; }
@media (pointer: coarse) { .ed-coderow button, .ed-coderow input { min-height: 44px; } }
/* настоящие эмблемы фракций (mm_shared::emblem::svg) */
.cards.fac .ins.ins-real { transform: none; border-radius: 0; background: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
/* наклейки: выбор эмблемы */
.eb-embs { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.eb-embs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; min-width: 76px; min-height: 44px; }
.eb-embs button small { font-size: 11px; }
.eb-dlist { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.eb-dlist button { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 4px 8px; font-size: 12px; }
/* ветка ed-modules: внутренние системы (без 3D-модели — значок), раздел заметен */
#editor .cards.thumbs button .intico { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; font-size: 46px; line-height: 1; background: radial-gradient(ellipse at 50% 45%, #1f3a4a, #0b1218); border: 1px solid #3a7090; border-radius: 6px; color: #9fe0ff; text-shadow: 0 0 10px #3ab0ff; }
#editor .cards.thumbs.small button .intico { width: 72px; height: 72px; font-size: 34px; }
#editor .modcats button.intcat { border-color: #3a90c0; box-shadow: inset 0 0 0 1px #3a90c0; color: #aee6ff; }
#editor .inthead, #eb-side .inthead { padding: 8px 10px; margin: 4px 0; border: 1px solid #3a7090; border-radius: 8px; background: #0f1c24; font-size: 13px; line-height: 1.4; }
#editor .inthead .intcells, #eb-side .inthead .intcells { display: inline-flex; gap: 3px; vertical-align: middle; margin: 0 4px; }
#editor .inthead .intcells i, #eb-side .inthead .intcells i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #3a7090; display: inline-block; }
#editor .inthead .intcells i.on, #eb-side .inthead .intcells i.on { background: #3ab0ff; }
#eb-side .intlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
#eb-side .intlist button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 64px; font-size: 11px; }
#eb-side .intlist button .ii { font-size: 26px; line-height: 1; color: #9fe0ff; }
#eb-side .intlist button.on { border-color: #3ab0ff; background: #12324a; }

/* ---- перевозка и захват (ветка ed-grab, grab_ui.rs) */
#grab-hud { position: fixed; left: 50%; bottom: calc(126px + var(--safe-b)); transform: translateX(-50%); z-index: 31; display: flex; flex-direction: column; gap: 4px; align-items: center; max-width: min(94vw, 520px); pointer-events: none; }
#grab-hud > div { pointer-events: auto; background: rgba(14, 18, 30, 0.86); border: 1px solid #4a6a9a; border-radius: 10px; padding: 5px 10px; color: #e8f0ff; font-size: 13px; text-align: center; }
#grab-hud .gh-t { font-weight: bold; }
#grab-hud button { pointer-events: auto; margin: 3px 3px 0; min-height: 36px; padding: 4px 12px; }
#grab-hud .gh-c { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
#grab-hud .gh-ask { border-color: #ffb03a; }
#grab-hud .gh-say { display: flex; flex-direction: column; gap: 4px; width: min(94vw, 520px); box-sizing: border-box; }
#grab-hud .gh-say-hints { display: flex; flex-wrap: wrap; justify-content: center; }
#grab-hud .gh-say-hints button { font-size: 12px; min-height: 34px; }
#grab-hud .gh-say-row { display: flex; gap: 4px; align-items: center; }
#grab-hud .gh-say-row input { flex: 1; min-width: 0; min-height: 36px; font-size: 16px; background: #0c1220; color: #e8f0ff; border: 1px solid #4a6a9a; border-radius: 6px; padding: 0 8px; }
#grab-hud b.bad, #cargo-win b.bad { color: #ff6a5a; }
#grab-hud b.ok { color: #6aff9a; }
#grab-hud b.warn, #cargo-win b.warn { color: #ffc04a; }
#grab-hud b.cyan { color: #6ae8ff; }
#cargo-win { position: fixed; right: 12px; top: 70px; width: min(94vw, 420px); max-height: 74vh; overflow: auto; background: rgba(12, 15, 26, 0.96); border: 2px solid #5a7ab0; border-radius: 12px; padding: 10px; z-index: 62; color: #fff; box-sizing: border-box; }
#cargo-win .cw-h { display: flex; justify-content: space-between; align-items: center; font-size: 16px; margin-bottom: 6px; }
#cargo-win .cw-s { margin-top: 10px; font-weight: bold; color: #9ac8ff; font-size: 13px; }
#cargo-win .cw-n { font-size: 12px; opacity: 0.8; margin: 4px 0; }
#cargo-win .cw-r { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); flex-wrap: wrap; }
#cargo-win .cw-r small { display: block; font-size: 11px; opacity: 0.75; }
#cargo-win .cw-b { display: flex; gap: 4px; flex-wrap: wrap; }
#cargo-win button { min-height: 38px; padding: 4px 10px; }
#cargo-win .cw-cfg { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 4px 0; }
#cargo-win .cw-cfg label { display: flex; align-items: center; gap: 4px; min-height: 32px; }
#cargo-win .cw-cfg input { width: 20px; height: 20px; }
#abtns button.grab { background: rgba(130, 70, 30, 0.85); border-color: #ffb06a; }
@media (max-width: 600px) { #cargo-win { right: 3vw; top: 56px; } #grab-hud { top: 54px; } }
#cap-menu { position: fixed; left: 50%; top: 12%; transform: translateX(-50%); width: min(94vw, 380px); max-height: 76vh; overflow: auto; background: rgba(14, 12, 22, 0.97); border: 2px solid #c0704a; border-radius: 12px; padding: 10px; z-index: 63; color: #fff; box-sizing: border-box; }
#cap-menu .cw-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#cap-menu .cm-l { display: flex; flex-direction: column; gap: 6px; }
#cap-menu .cm-l button { min-height: 44px; text-align: left; padding: 6px 12px; font-size: 15px; }
#cap-menu .cm-l button[disabled] { opacity: 0.45; }
#cap-menu .cm-l small { display: block; font-size: 11px; opacity: 0.85; }
@media (max-width: 600px) { #grab-hud { top: 34vh; bottom: auto; } }
#eb-side .intlist { display: grid; grid-template-columns: 1fr; gap: 6px; }
#eb-side .intlist button.intcard { position: relative; display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; min-height: 56px; text-align: left; font-size: 12px; line-height: 1.35; white-space: normal; }
#eb-side .intlist .intcard .ii { flex: 0 0 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 26px; line-height: 1; color: #9fe0ff; background: radial-gradient(ellipse at 50% 45%, #1f3a4a, #0b1218); border: 1px solid #3a7090; border-radius: 6px; text-shadow: 0 0 8px #3ab0ff; }
#eb-side .intlist .intcard .ib { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#eb-side .intlist .intcard b { font-size: 13px; }
#eb-side .intlist .intcard .cost { color: #8aa; font-size: 11px; }
#eb-side .intlist .intcard .idesc { color: #cfd8dc; }
#eb-side .intlist .intcard .eff { color: #9fe0ff; }
#eb-side .intlist .intcard .tc { color: #8aa; font-size: 11px; }
#eb-side .intlist .intcard .ist { font-size: 11px; color: #3ab0ff; }
#eb-side .intlist .intcard .ist.no { color: #a88; }
#eb-side .intlist button.intcard.on { border-color: #3ab0ff; background: #12324a; box-shadow: inset 3px 0 0 #3ab0ff; }
#eb-side .intlist button.intcard.on::after { content: "✓"; position: absolute; top: 4px; right: 6px; font: bold 14px/1 "Ubuntu Mono", monospace; color: #3ab0ff; }
#eb-side .intlist button.intcard.dim { opacity: .6; }

/* Account sign-in in the main menu. */
.login-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
#login-methods button { min-width: 0; min-height: 64px; text-align: left; margin: 0; }
.login-methods strong, .login-methods span { display: block; line-height: 1.3; }
.login-methods span { font-size: .875rem; color: #ccc2e1; margin-top: .2rem; }
#login-methods button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: #302657; }
.login-form-title { font: inherit; font-weight: 700; margin: 12px 0 0; }
#mm-login button:focus-visible { outline: 2px solid #ffda63; outline-offset: 2px; }
#login-code input { width: 100%; min-height: 44px; font-size: 16px; }
#login-create-account, #login-email-back-to-password { min-height: 44px; margin-top: 6px; }
@media (max-width: 390px) {
  .login-methods { grid-template-columns: 1fr; }
  #login-methods button { min-height: 52px; }
}
.login-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.login-choices button { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0; }
.login-choices button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: #302657; }
#login-email-form input { width: 100%; min-height: 44px; font-size: 16px; }
#login-email-submit { min-height: 44px; }
#login-email-result { margin: 6px 0; overflow-wrap: anywhere; }
#login-email-result:empty { margin: 0; }
#login-email-result.err { color: #ff898d; }
#login-email-destination { overflow-wrap: anywhere; }

/* Фон меню (menubg.rs / menubg.js): подписи тел и подпись облёта — под экранами меню */
#mm-bglabels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#mm-bglabels span { position: absolute; left: 0; top: 0; white-space: nowrap; opacity: 0; will-change: transform;
  font: 9px/1 "Press Start 2P", monospace; color: #e6eeff; letter-spacing: .04em;
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.9); transition: opacity .4s; }
#mm-bglabels span.k0 { color: #ffe0a0; font-size: 10px; }
#mm-bglabels span.k2 { color: rgba(200,215,240,.9); font-size: 8px; }
#mm-bglabels span.k3 { color: #a0ebff; font: 600 11px/1 "Ubuntu Mono", monospace; letter-spacing: 0; }
#mm-bglabels span.k4 { color: #ffe03a; font: 600 11px/1 "Ubuntu Mono", monospace; letter-spacing: 0; }
#mm-bgcap { position: fixed; left: max(18px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 1;
  max-width: min(380px, 70vw); pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .45s, transform .45s;
  padding: 10px 14px 11px; border-left: 2px solid rgba(255,218,99,.8); background: linear-gradient(90deg, rgba(8,6,20,.62), rgba(8,6,20,0));
  color: #dfe6ff; text-shadow: 0 1px 2px #000; }
#mm-bgcap.on { opacity: 1; transform: none; }
#mm-bgcap b { display: block; font: 13px/1.3 "Press Start 2P", monospace; color: #ffda63; }
#mm-bgcap span { display: block; margin-top: 5px; font: 12px/1.3 "Ubuntu Mono", monospace; color: #9fe8ff; }
#mm-bgcap p { margin: 6px 0 0; font: 13px/1.35 system-ui, sans-serif; color: rgba(225,232,255,.85); }
@media (max-width: 700px) { #mm-bgcap p { display: none; } #mm-bglabels span.k3, #mm-bglabels span.k4 { display: none; } }

/* ---- Главное меню 2026-11: стекло поверх живой системы, галерея справа */
#mainmenu { padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% -10%, rgba(40,26,90,.25), rgba(4,3,10,0) 60%); }
#mainmenu .mm-wrap { width: min(1280px, 100%); max-width: none; gap: 16px; }
#mainmenu .mm-title { position: relative; margin: 6px 0 0; font-size: clamp(22px, 5.4vw, 52px); letter-spacing: .08em; color: #ffe08a;
  background: linear-gradient(180deg, #fff3c4 0%, #ffd25a 45%, #f08a2a 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(3px 3px 0 #4a1830) drop-shadow(0 0 22px rgba(255,190,90,.35)); }
#mainmenu .mm-title::after { content: "живая система Горнила · 3D-бета"; display: block; margin-top: 10px; font: 600 12px/1 "Ubuntu Mono", monospace;
  letter-spacing: .35em; text-transform: uppercase; color: rgba(160,235,255,.75); -webkit-text-fill-color: rgba(160,235,255,.75); filter: none; }
#mainmenu .card { background: linear-gradient(180deg, rgba(22,18,44,.72), rgba(12,10,26,.78)); border: 1px solid rgba(150,130,230,.28);
  border-radius: 16px; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 50px rgba(0,0,0,.55); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); }
#mm-login { width: min(460px, 100%); }
#mainmenu .mm-cols { grid-template-columns: 230px minmax(0, 1fr) 280px; gap: 16px; }
#mainmenu .mm-btns { gap: 7px; }
#mainmenu .mm-btns button { border-radius: 12px; border: 1px solid rgba(150,130,230,.3); background: rgba(20,16,40,.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .15s, border-color .15s, transform .15s; min-height: 44px; }
#mainmenu .mm-btns button:hover { background: rgba(48,38,96,.8); border-color: rgba(160,235,255,.5); transform: translateX(2px); }
#mainmenu .mm-btns button.on { border-color: var(--cyan); background: rgba(40,60,110,.7); box-shadow: inset 3px 0 0 var(--cyan); }
#mainmenu .mm-btns button.go { border: 1px solid #ffd25a; background: linear-gradient(135deg, rgba(120,60,160,.92), rgba(70,30,110,.92)); box-shadow: 0 0 22px rgba(255,200,90,.25); }
#mainmenu .mm-btns button.go:hover { box-shadow: 0 0 30px rgba(255,200,90,.45); }
#mainmenu .mm-pane { background: linear-gradient(180deg, rgba(18,15,38,.78), rgba(10,8,22,.84)); }
#mainmenu .ch { border-radius: 14px; border: 1px solid rgba(150,130,230,.28); background: linear-gradient(90deg, rgba(40,32,80,.55), rgba(20,16,40,.55)); transition: border-color .15s, box-shadow .15s; }
#mainmenu .ch:not(.empty):hover { border-color: rgba(160,235,255,.55); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
#mainmenu .ch.last { border-color: #ffd25a; box-shadow: 0 0 0 1px rgba(255,210,90,.35), 0 0 24px rgba(255,200,90,.15); }
#mainmenu .ch img { background: radial-gradient(circle at 50% 60%, rgba(120,100,220,.35), rgba(0,0,0,0) 70%); border-radius: 10px; }
#mainmenu .ch .chb button { border-radius: 9px; }
#mainmenu .ch .chb .galtg { grid-column: 1 / -1; font-size: 12px; color: var(--dim); border-style: dashed; }
#mainmenu .ch .chb .galtg.on { color: #a0ebff; border-color: rgba(160,235,255,.45); border-style: solid; }
#mainmenu .ch.empty { border-style: dashed; background: rgba(20,16,40,.35); }
#mainmenu input { border-radius: 9px; background: rgba(10,8,24,.7); border-color: rgba(150,130,230,.4); }
#mainmenu #login-methods button, #mainmenu .login-choices button { border-radius: 12px; }
#mainmenu button.big { border-radius: 12px; background: linear-gradient(135deg, #7a3cb0, #4a1f80); border-color: #ffd25a; }

/* Галерея (showcase.rs) */
.mm-gal { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gal-head b { font: 11px/1.4 "Press Start 2P", monospace; color: var(--gold); }
.gal-head small { color: var(--dim); font-size: 12px; }
.gal-kinds { display: flex; gap: 5px; flex-wrap: wrap; }
.gal-kinds button { flex: 1 1 auto; padding: 5px 7px; font-size: 12px; border-radius: 9px; border-width: 1px; min-height: 32px; }
.gal-kinds button i { display: block; font-style: normal; font-size: 10px; color: var(--dim); }
.gal-kinds button.on { border-color: var(--cyan); background: rgba(40,60,110,.7); }
.gal-car { position: relative; }
.gal-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-it { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px 12px;
  border-radius: 14px; border: 1px solid rgba(150,130,230,.3); background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--fc, #8a7af0) 30%, transparent), rgba(14,12,30,.6) 70%);
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--fc, #8a7af0) 70%, transparent); }
.gal-it:hover { border-color: rgba(160,235,255,.6); }
.gal-im { width: 100%; height: 190px; display: grid; place-items: center; font-size: 34px; color: var(--cyan); }
.gal-im img { max-width: 100%; max-height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity .3s; }
.gal-im img.ok { opacity: 1; }
.gal-it b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-it small { color: var(--dim); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-arr { position: absolute; top: 40%; z-index: 2; width: 32px; height: 44px; padding: 0; border-radius: 10px; border-width: 1px; background: rgba(12,10,26,.75); font-size: 22px; line-height: 1; }
.gal-arr.l { left: -6px; } .gal-arr.r { right: -6px; }
.gal-n { text-align: center; margin: 0; }
@media (max-width: 1100px) {
  #mainmenu .mm-cols { grid-template-columns: 220px minmax(0, 1fr); }
  .mm-gal { grid-column: 1 / -1; }
  .gal-it { flex-basis: 150px; }
  .gal-im { height: 130px; }
}
@media (max-width: 720px) {
  #mainmenu .mm-cols { grid-template-columns: 1fr; }
  #mainmenu .mm-title::after { font-size: 10px; letter-spacing: .2em; }
  .gal-it { flex-basis: 128px; }
  .gal-im { height: 110px; }
  .gal-arr { display: none; }
}

/* Карточка галереи */
#galcard { z-index: 40; }
.gc { position: relative; width: min(980px, 100%); max-height: calc(100vh - 32px); display: block; padding: 0 !important; overflow: hidden;
  background: linear-gradient(180deg, rgba(22,18,44,.95), rgba(10,8,22,.97)); border: 1px solid rgba(150,130,230,.35); border-radius: 18px; }
.gc-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.gc-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); max-height: calc(100vh - 34px); }
.gc-view { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: radial-gradient(circle at 50% 45%, #2c2458, #0b0918 75%); }
#gc-cv { width: 100%; aspect-ratio: 56 / 44; image-rendering: pixelated; cursor: grab; touch-action: none; }
#gc-cv.insp { cursor: crosshair; }
.gc-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.gc-tools button { flex: 1 1 auto; border-radius: 10px; border-width: 1px; min-height: 40px; }
.gc-tools button.on { border-color: var(--cyan); background: rgba(40,60,110,.8); }
.gc-info { position: relative; overflow-y: auto; padding: 18px 18px 22px; }
.gc-info h2 { margin: 0 46px 4px 0; font-size: clamp(14px, 2.4vw, 18px); }
.gc-by { color: #a0ebff; font-size: 13px; }
.gc-meta { color: var(--dim); font-size: 13px; margin: 6px 0 10px; }
.gc-info .sec { margin: 14px 0 6px; font: 9px/1.4 "Press Start 2P", monospace; color: var(--gold); }
.gc-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 5px; }
.gc-sw { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 7px; align-items: center; padding: 5px 7px; text-align: left; border-radius: 9px; border-width: 1px; font-size: 11px; min-height: 0; }
.gc-sw i { grid-row: 1 / 3; width: 22px; height: 22px; border-radius: 6px; background: var(--c); box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset; }
.gc-sw span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-sw code { color: var(--dim); font: 11px "Ubuntu Mono", monospace; }
.gc-sw.copied { border-color: #7aff9a; }
.gc-copied { position: sticky; bottom: 0; margin-top: 10px; padding: 6px 10px; border-radius: 9px; background: rgba(40,120,70,.85); color: #eaffef; font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; }
.gc-copied.on { opacity: 1; }
.gc-part { margin: 8px 0; }
.gc-pcard, .gc-dec { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid rgba(160,235,255,.35); background: rgba(30,50,90,.35); }
.gc-pcard { grid-template-columns: 96px 1fr; border-color: rgba(255,210,90,.5); background: rgba(70,50,20,.25); }
.gc-pcard img { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 8px; background: #0b0918; }
.gc-pcard b, .gc-dec b { display: block; }
.gc-pcard small, .gc-dec small { display: block; color: var(--dim); font-size: 12px; margin-top: 3px; }
.gc-pcard button { margin-top: 8px; }
.gc-decals { display: grid; gap: 6px; }
.gc-dec { border-color: rgba(150,130,230,.3); background: rgba(20,16,40,.5); }
.gc-dec img { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 6px; background: repeating-conic-gradient(#2a2440 0 25%, #1a1630 0 50%) 0 0 / 10px 10px; }
@media (max-width: 760px) {
  .gc-body { grid-template-columns: 1fr; overflow-y: auto; }
  .gc-info { overflow: visible; }
}

/* Редактор: галочка галереи */
.ed-gal { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; color: var(--text); font-size: 13px; cursor: pointer; flex-wrap: wrap; }
.ed-gal input { width: 18px; height: 18px; accent-color: #3af0ff; }
.ed-gal small { color: var(--dim); font-size: 11px; }
/* подпись облёта — только на экране входа и не на телефоне (после входа её закрывают колонки меню) */
body:has(#mm-main:not(.hidden)) #mm-bgcap { display: none; }
@media (max-width: 700px) { #mm-bgcap { display: none; } }
/* орбитальная стройка: готовность к полёту, подсказки блоков, нехватка материалов */
.tile.off { opacity: .45; }
.tile small.ob-hint { color: #8ad4ff; font-size: 10px; line-height: 1.15; }
.ob-check { margin: 6px 0; padding: 6px 8px; border: 1px solid #2a3a50; border-radius: 6px; background: rgba(20,32,48,.6); font-size: 12px; }
.ob-check div { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.ob-ok { color: #7dffa8; } .ob-no { color: #ff8a7a; }
.ob-help { margin: 0 0 6px; }
.web-help li { margin: 4px 0; line-height: 1.35; }
