:root { color-scheme: dark; --fg: #e8e6e1; --dim: #8a8781; --red: #ff3b3b; --sl: max(10px, env(safe-area-inset-left)); --sr: max(10px, env(safe-area-inset-right)); --st: max(10px, env(safe-area-inset-top)); --sb: max(10px, env(safe-area-inset-bottom)); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--fg); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; overscroll-behavior: none; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; }
input { -webkit-user-select: text; user-select: text; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- эффекты экрана */
#grain { position: fixed; inset: -50%; pointer-events: none; z-index: 1; opacity: 0; mix-blend-mode: overlay; }
body.retro #c { image-rendering: pixelated; }
body.retro #grain { opacity: 0.22; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(120, 0, 0, 0.85) 100%); }
body.calm #vignette { display: none; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 3; background: #600; opacity: 0; transition: opacity 0.4s; }
#blackout { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 3; transition: opacity 0.6s; }
#blackout.on { opacity: 1; transition: opacity 0.1s; }
body.asleep #blackout { opacity: 0.94; transition: opacity 1.6s; }
/* шкаф — щель, укрытие — край ткани, глазок — круг */
#slit { position: fixed; inset: 0; pointer-events: none; z-index: 3; display: none; }
body.inlocker #slit { display: block; background: linear-gradient(#000 0, #000 44%, transparent 46%, transparent 51%, #000 53%, #000 100%); }
body.covered #slit { display: block; background: radial-gradient(ellipse at 50% 62%, transparent 18%, rgba(0, 0, 0, 0.93) 66%); }
body.peek #slit { display: block; background: radial-gradient(circle at center, transparent 0, transparent 21%, #000 23%); }
/* край экрана: заметили / ищут / потеряли */
#alertedge { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0; transition: opacity 0.5s; }
#alertedge.a1 { opacity: 1; box-shadow: inset 0 0 70px 14px rgba(220, 30, 20, 0.7); animation: edge 0.7s ease-in-out infinite alternate; }
#alertedge.a2 { opacity: 1; box-shadow: inset 0 0 60px 8px rgba(220, 150, 30, 0.45); }
#alertedge.a3 { opacity: 1; box-shadow: inset 0 0 40px 4px rgba(150, 160, 170, 0.3); }
@keyframes edge { from { opacity: 0.55; } to { opacity: 1; } }
body.calm #alertedge.a1 { animation: none; }

/* ---------- интерфейс */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; font-size: 12px; }
#vitals { position: absolute; left: var(--sl); top: var(--st); width: 120px; display: grid; gap: 3px; }
.vb { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.vb i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; }
.vb.hp i { background: #c23a30; } .vb.stam i { background: #c9c9a0; }
#moods { position: absolute; left: var(--sl); top: calc(var(--st) + 16px); display: grid; gap: 3px; max-width: 230px; }
#moods div { background: rgba(0, 0, 0, 0.6); border-left: 3px solid #888; padding: 2px 7px; border-radius: 2px; font-size: 11.5px; line-height: 1.3; }
#moods div.warn { border-color: #d9a43a; } #moods div.bad { border-color: #e2412f; animation: low 1s steps(1) infinite; } #moods div.good { border-color: #5aa05a; }
#moods small { color: var(--dim); display: block; font-size: 10.5px; }
@keyframes low { 50% { border-color: #fff; } }
#task { position: absolute; right: var(--sr); top: var(--st); width: min(260px, 46vw);
  background: rgba(0, 0, 0, 0.55); border-left: 2px solid #8a1c1c; padding: 6px 9px; border-radius: 3px; }
#task .tt { font-weight: 600; font-size: 12px; } #task .tp { color: var(--dim); margin-top: 2px; }
#compass { margin-top: 4px; display: flex; align-items: center; gap: 6px; color: #d9b36a; }
#compass b { display: inline-block; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 13px solid #d9b36a; }
#minimap { position: absolute; right: var(--sr); top: calc(var(--st) + 92px); width: 150px; height: 150px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.5); }
body.touch #minimap { display: none; }
#status { position: absolute; right: var(--sr); top: calc(var(--st) + 248px); color: var(--dim); text-align: right; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
body.touch #status { top: calc(var(--st) + 92px); }
body.touch #radio { top: calc(var(--st) + 118px); }
#alert { position: absolute; left: 50%; top: 15%; transform: translateX(-50%); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 0 1px 4px #000; white-space: nowrap; }
#alert.a1 { color: #ff5a4a; font-weight: 700; } #alert.a2 { color: #ffc060; } #alert.a3 { color: #aab0b6; }
#radio { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); max-width: min(560px, 90vw); text-align: center;
  background: rgba(10, 20, 10, 0.75); border: 1px solid #2e4a2e; color: #b8f0b8; font-family: ui-monospace, Menlo, Consolas, monospace;
  padding: 6px 12px; border-radius: 4px; font-size: 13px; }
#toasts { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); display: grid; gap: 4px; justify-items: center; width: max-content; max-width: 92vw; }
#toasts div { background: rgba(0, 0, 0, 0.7); padding: 5px 12px; border-radius: 4px; font-size: 13px; animation: toast 3.2s forwards; text-align: center; }
@keyframes toast { 0% { opacity: 0; } 8%, 80% { opacity: 1; } 100% { opacity: 0; } }
#subs { position: absolute; left: 50%; bottom: 36%; transform: translateX(-50%); color: #d8d8d8; font-size: 12px; font-style: italic; text-shadow: 0 1px 3px #000; text-align: center; }
#hint { position: absolute; left: 50%; bottom: 29%; transform: translateX(-50%); color: #fff; text-shadow: 0 1px 3px #000; font-size: 13px; text-align: center; max-width: 92vw; }
#cross { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); }
#actbar { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); width: 160px; text-align: center; }
#actbar i { display: block; height: 4px; background: #e8e6e1; transform-origin: 0 50%; border-radius: 2px; }
#actbar span { font-size: 12px; color: #ddd; text-shadow: 0 1px 2px #000; }
/* пояс и руки */
#belt { position: absolute; left: 50%; bottom: calc(var(--sb) + 20px); transform: translateX(-50%); display: flex; gap: 5px; pointer-events: auto; }
#belt button { position: relative; width: 46px; height: 46px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.5); color: #eee; font-size: 20px; cursor: pointer; padding: 0; touch-action: none; }
#belt button.on { border-color: #f2d27a; background: rgba(242, 210, 122, 0.18); }
#belt small { position: absolute; left: 4px; top: 2px; font-size: 9px; color: var(--dim); }
#belt i { position: absolute; right: 4px; bottom: 2px; font-size: 10px; font-style: normal; color: #ddd; }
#hands { position: absolute; left: 50%; bottom: calc(var(--sb) + 72px); transform: translateX(-50%); color: #cfcabb; text-shadow: 0 1px 3px #000; white-space: nowrap; }
#noise { position: absolute; left: 50%; bottom: calc(var(--sb) + 2px); transform: translateX(-50%); font-size: 11px; color: var(--dim); white-space: nowrap; }
#noise.loud { color: #ff9a6a; }
#build { position: absolute; left: 50%; bottom: calc(var(--sb) + 96px); transform: translateX(-50%); background: rgba(0, 0, 0, 0.6); padding: 5px 10px; border-radius: 4px; text-align: center; max-width: 94vw; }
#build b { color: #f2d27a; }
body.touch #belt { left: auto; right: var(--sr); transform: none; bottom: calc(var(--sb) + 132px); }
body.touch #hands { left: auto; right: var(--sr); transform: none; bottom: calc(var(--sb) + 184px); }
body.touch #noise { bottom: auto; top: calc(var(--st) + 112px); left: auto; right: var(--sr); transform: none; }
body.touch #build { bottom: auto; top: 26%; }
#chatlog { position: absolute; left: var(--sl); bottom: calc(var(--sb) + 40px); width: min(360px, 60vw); display: grid; gap: 2px; }
body.touch #chatlog { bottom: 42%; width: min(300px, 56vw); }
#chatlog div { background: rgba(0, 0, 0, 0.5); padding: 2px 6px; border-radius: 3px; font-size: 12px; animation: chatfade 14s forwards; overflow-wrap: anywhere; }
#chatlog b { color: #d9b36a; font-weight: 600; }
#chatlog .wh { font-style: italic; color: #aaa; } #chatlog .sh { font-weight: 700; font-size: 13px; } #chatlog .rd { font-family: ui-monospace, Menlo, Consolas, monospace; color: #b8f0b8; } #chatlog .rd b { color: #7fd07f; } #chatlog .gs { color: #cfe; }
@keyframes chatfade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
#offer { position: absolute; left: 50%; top: 27%; transform: translateX(-50%); pointer-events: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  background: rgba(10, 10, 10, 0.88); border: 1px solid #5a4a20; border-radius: 8px; padding: 8px 12px; font-size: 13px; max-width: 92vw; }
#offer button { height: 34px; min-width: 56px; border-radius: 6px; border: 1px solid #444; background: #1c1c1c; color: #eee; cursor: pointer; }
#offer button[data-a="yes"] { background: #e8e6e1; color: #000; }
#admbtn, #pausebtn, #mapbtn, #bagbtn { position: absolute; pointer-events: auto; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.55); color: #ddd; border-radius: 5px; height: 30px; width: 34px; padding: 0; cursor: pointer; bottom: var(--sb); }
#pausebtn { right: var(--sr); } #mapbtn { right: calc(var(--sr) + 40px); } #bagbtn { right: calc(var(--sr) + 80px); } #admbtn { right: calc(var(--sr) + 120px); }
body.touch #pausebtn, body.touch #mapbtn, body.touch #admbtn { bottom: auto; top: calc(var(--st) + 64px); }
body.touch #admbtn { right: calc(var(--sr) + 80px); }
body.touch #bagbtn { display: none; }
#down { position: fixed; inset: 0; z-index: 6; pointer-events: none; background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.25) 30%, rgba(40, 0, 0, 0.8) 100%); text-align: center; padding-top: 16vh; }
#down p { margin: 4px 0; font-size: 13px; color: #d8c8c0; text-shadow: 0 1px 3px #000; }
#down .red { color: var(--red); font-size: 26px; font-weight: 800; letter-spacing: 0.05em; }
#downtime { font-size: 30px !important; font-weight: 800; color: #ffb0a0 !important; }

/* ---------- чат и короткие вопросы */
#chatbox { position: fixed; z-index: 9; left: var(--sl); bottom: calc(var(--sb) + 8px); width: min(420px, 80vw); }
body.touch #chatbox { bottom: auto; top: calc(var(--st) + 8px); }
#chatin { width: 100%; height: 36px; border-radius: 6px; border: 1px solid #444; background: rgba(0, 0, 0, 0.88); color: #fff; padding: 0 10px; font-size: 16px; }
.mini { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(320px, calc(100vw - 20px)); background: rgba(12, 12, 12, 0.96); border: 1px solid #2a2a2a; border-radius: 10px; padding: 10px; font-size: 13px; display: grid; gap: 8px; }
body.touch .mini { top: 34%; }
.ph { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.mini button { height: 34px; border-radius: 6px; border: 1px solid #333; background: #1a1a1a; color: #eee; cursor: pointer; padding: 0 12px; }
.mini button.on, .mini button[type="submit"], .mini button[data-a="ok"] { background: #e8e6e1; color: #000; }
.mini input { width: 100%; height: 38px; border-radius: 6px; border: 1px solid #444; background: #0c0c0c; color: #fff; padding: 0 10px; font-size: 16px; }
#chalkcv { width: 100%; aspect-ratio: 1; display: block; border-radius: 6px; border: 1px solid #333; touch-action: none; cursor: crosshair; }
#chalkdraw { display: grid; gap: 6px; }
#chalkdraw small { color: var(--dim); }

/* ---------- колесо действий */
#wheel { position: fixed; inset: 0; z-index: 8; background: radial-gradient(circle at center, rgba(0, 0, 0, 0.55) 0, rgba(0, 0, 0, 0.25) 60%); touch-action: none; }
#wheelt { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 13px; color: #ddd; text-shadow: 0 1px 3px #000; text-align: center; max-width: 150px; pointer-events: none; }
#wheel button { border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(8, 8, 8, 0.85); color: #eee; cursor: pointer; padding: 2px 4px; touch-action: none; }
#wheel button span { display: block; font-size: 20px; line-height: 1.1; }
#wheel button small { display: block; font-size: 10.5px; line-height: 1.1; color: #ccc; }
#wheel button.sel { border-color: #f2d27a; background: rgba(60, 50, 20, 0.95); }
#wheel button.off { opacity: 0.35; }
#wheel.ring #wheelb button { position: absolute; width: 84px; height: 66px; margin: -33px 0 0 -42px; border-radius: 14px; }
#wheel.sticky.ring #wheelb button:hover { border-color: #f2d27a; }
#wheel.list #wheelt { top: max(8vh, calc(var(--st) + 10px)); transform: translateX(-50%); font-size: 15px; }
#wheel.list #wheelb { position: absolute; left: 50%; top: calc(max(8vh, var(--st) + 10px) + 30px); bottom: var(--sb); transform: translateX(-50%); width: min(340px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 5px; overflow-y: auto; touch-action: pan-y; }
#wheel.list #wheelb button { display: flex; align-items: center; gap: 10px; min-height: 42px; border-radius: 9px; text-align: left; padding: 4px 12px; touch-action: pan-y; flex: none; }
#wheel.list #wheelb button small { font-size: 13px; color: #eee; }

/* ---------- сумка */
#bag { position: fixed; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, calc(100vw - 12px)); height: min(580px, calc(100vh - 12px)); height: min(580px, calc(100dvh - 12px));
  background: rgba(12, 12, 12, 0.96); border: 1px solid #2a2a2a; border-radius: 10px; display: flex; flex-direction: column; font-size: 13px; }
#bagtabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #222; overflow-x: auto; flex: none; touch-action: pan-x; }
#bagtabs button { height: 34px; border-radius: 7px; border: 1px solid #333; background: #181818; color: #ccc; padding: 0 11px; cursor: pointer; flex: none; }
#bagtabs button.on { background: #e8e6e1; color: #000; }
#bagtabs button[data-tab="close"] { margin-left: auto; }
#bagbody { flex: 1; overflow-y: auto; padding: 10px; touch-action: pan-y; display: flex; flex-direction: column; gap: 8px; }
#bagbody h3 { margin: 6px 0 0; font-size: 13px; color: #ddd; }
#bagbody p { margin: 0; } #bagbody ul { margin: 0; padding-left: 18px; } #bagbody li { margin-bottom: 3px; }
#bagbody .note { color: #d9b36a; }
#bagbody button { font-size: 13px; border-radius: 7px; border: 1px solid #333; background: #181818; color: #eee; cursor: pointer; }
.slots { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.slot { position: relative; width: 44px; height: 44px; border-radius: 8px; border: 1px dashed #3a3a3a; display: grid; place-items: center; font-size: 19px; color: #555; }
.slot.has { border-style: solid; border-color: #6a5a30; color: #eee; }
.slot small { position: absolute; left: 0; right: 0; top: -1px; text-align: center; font-size: 8.5px; color: var(--dim); }
.wt { margin-left: auto; color: var(--dim); } .wt.over { color: #ff9a6a; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 5px; }
.grid button { position: relative; height: 62px; padding: 4px 2px 2px; font-size: 20px !important; line-height: 1.1; overflow: hidden; }
.grid button i { position: absolute; right: 4px; top: 2px; font-size: 10.5px; font-style: normal; color: #ddd; }
.grid button small { display: block; font-size: 9.5px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid button.sel { border-color: #f2d27a !important; background: rgba(242, 210, 122, 0.12) !important; }
div.sel { border: 1px solid #3a3320; border-radius: 8px; padding: 8px; background: #141310; }
div.sel small { color: var(--dim); }
.acts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.acts button { min-height: 34px; padding: 0 10px; }
.rows { display: grid; gap: 5px; }
.rows button { display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left; min-height: 42px; padding: 6px 10px; }
.rows button.off { opacity: 0.45; }
.rows small { color: var(--dim); }
.bars { display: grid; gap: 5px; }
.bars > div { display: grid; grid-template-columns: 110px 1fr 34px; gap: 8px; align-items: center; }
.bars .vb { height: 7px; } .bars .vb i { background: #b9b59a; }
.bars .warn .vb i { background: #d9a43a; } .bars .bad .vb i { background: #e2412f; }
.bars small { color: var(--dim); text-align: right; }
.notes { display: grid; gap: 6px; }
.notes p { background: #14130f; border-left: 2px solid #4a4230; padding: 6px 9px; border-radius: 3px; color: #cfc8b4; font-style: italic; -webkit-user-select: text; user-select: text; }
.notes p.new { border-color: #f2d27a; color: #f0e8d0; }
@media (max-width: 520px) { .cols { grid-template-columns: 1fr; } #bagtabs { flex-wrap: wrap; overflow-x: visible; } #bagtabs button { padding: 0 9px; } }

/* ---------- телефон */
#touch { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#stick { position: absolute; width: 120px; height: 120px; margin: -60px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); opacity: 0; pointer-events: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
#stick.on { opacity: 1; }
#tbtns, #tbuild { position: absolute; right: var(--sr); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 54px); gap: 7px; pointer-events: auto; }
#tbuild { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 190px); grid-template-columns: repeat(3, auto); }
#touch button { height: 52px; min-width: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(0, 0, 0, 0.4); color: #eee; font-size: 18px; touch-action: none; }
#touch #tbuild button { border-radius: 10px; font-size: 13px; padding: 0 10px; height: 44px; }
#touch button.on { background: rgba(255, 255, 255, 0.28); }
#touch button[data-k="run"], #touch button[data-k="crouch"] { font-size: 12px; }

/* ---------- экраны */
.screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(0, 0, 0, 0.72); padding: 16px; overflow-y: auto; touch-action: pan-y; }
#menu { background: radial-gradient(ellipse at 50% 120%, rgba(27, 6, 6, 0.82) 0%, rgba(0, 0, 0, 0.9) 60%); }
.box { width: min(420px, 100%); display: grid; gap: 10px; text-align: center; }
.sub { color: var(--dim); font-size: 13px; margin: 0; }
.box input#name { height: 44px; border-radius: 6px; border: 1px solid #333; background: #0c0c0c; color: #fff; padding: 0 12px; font-size: 16px; text-align: center; }
.box button { height: 46px; border-radius: 6px; border: 0; background: #e8e6e1; color: #000; font-size: 16px; font-weight: 600; cursor: pointer; }
.box button:disabled { opacity: 0.5; }
.box details { text-align: left; font-size: 13px; color: #bbb; background: rgba(255, 255, 255, 0.03); border-radius: 6px; padding: 8px 12px; }
.box summary { cursor: pointer; color: #ddd; }
.box table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; } .box td, .box th { padding: 3px 4px; border-bottom: 1px solid #222; text-align: left; }
.back { color: var(--dim); font-size: 13px; text-decoration: none; }
.back:hover { color: #fff; }
.box label { display: flex; gap: 8px; align-items: center; justify-content: center; }

/* ---------- панель админа */
.panel { position: fixed; z-index: 11; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom));
  width: min(460px, calc(100vw - 16px)); overflow-y: auto; touch-action: pan-y; background: rgba(12, 12, 12, 0.95); border: 1px solid #2a2a2a; border-radius: 10px; padding: 10px; font-size: 13px; }
.panel .ph { margin-bottom: 8px; }
.panel button { height: 32px; border-radius: 6px; border: 1px solid #333; background: #1a1a1a; color: #eee; padding: 0 10px; cursor: pointer; }
.panel button:hover { background: #262626; }
.panel .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.panel .row.grid { display: grid; gap: 6px; }
.panel select, .panel input[type="range"], .panel input[type="number"] { background: #111; color: #eee; border: 1px solid #333; border-radius: 4px; }
.panel input[type="number"] { width: 70px; height: 30px; padding: 0 6px; }
.panel select { height: 30px; max-width: 220px; }
.panel .up { display: inline-flex; gap: 6px; align-items: center; }
.panel h3 { font-size: 13px; margin: 10px 0 6px; color: #ddd; }
.panel input#aradio { flex: 1; min-width: 160px; height: 32px; background: #111; color: #eee; border: 1px solid #333; border-radius: 6px; padding: 0 8px; }
#afaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-bottom: 10px; }
#afaces button { height: 70px; padding: 2px; overflow: hidden; display: grid; place-items: center; font-size: 11px; line-height: 1.1; word-break: break-word; }
#afaces img { max-width: 100%; max-height: 64px; display: block; }
#aspecies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
#aspecies button { height: 54px; display: grid; place-items: center; line-height: 1.2; }
#aspecies button.on { outline: 2px solid #ffd24a; }
#aspecies small { color: var(--dim); font-size: 10.5px; }
#asedit { border: 1px solid #333; border-radius: 8px; padding: 8px; margin-bottom: 10px; background: #151515; }
.chaos { margin: 8px 0; border: 1px dashed #4a3a5a; border-radius: 8px; padding: 6px 8px; }
.chaos summary { cursor: pointer; color: #c8b0e8; }

/* ---------- карта */
#mapview { position: fixed; inset: 0; z-index: 9; background: #08090a; }
#mapc { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#mapview.draw #mapc { cursor: crosshair; } #mapview.erase #mapc { cursor: cell; } #mapview.mark #mapc { cursor: copy; }
#maptools { position: absolute; left: 50%; bottom: var(--sb); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  background: rgba(15, 15, 15, 0.92); border: 1px solid #2a2a2a; border-radius: 10px; padding: 5px; max-width: calc(100vw - 16px); width: max-content; }
#maptools button, #maptools select, #maptools input { height: 34px; min-width: 34px; border-radius: 7px; border: 1px solid #333; background: #1a1a1a; color: #eee; font-size: 15px; cursor: pointer; padding: 0 8px; }
#maptools input { width: 140px; font-size: 13px; cursor: text; }
#maptools select { font-size: 13px; }
#maptools button.on { background: #e8e6e1; color: #000; }
#maptools .sw { display: inline-flex; gap: 3px; align-items: center; }
#maptools .sw button { min-width: 22px; width: 22px; height: 22px; padding: 0; border-radius: 50%; }
#maptools .sw button.on { outline: 2px solid #fff; }
#maplegend { position: absolute; left: var(--sl); top: var(--st); font-size: 12px; color: #aaa; background: rgba(0, 0, 0, 0.6); padding: 6px 9px; border-radius: 6px; line-height: 1.5; }
#maplegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
