/* ============================================================
   Палитра: выцветший хаки, ржавчина, грязное стекло.
   Внешних шрифтов нет — только системные.
   ============================================================ */
:root {
  --bg: #0b0e0c; --panel: #151a15; --panel-2: #1d241c; --line: #2f3a2c; --line-hot: #6b7a4a;
  --ink: #d8dcc8; --ink-dim: #8e9880; --rust: #b5541f; --rust-2: #8a3c14;
  --blood: #8e1f16; --amber: #d9a441; --toxic: #8fae3c; --cold: #6a89a8;
  --font: "Segoe UI Semibold", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Consolas", "SF Mono", "Roboto Mono", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
/* атрибут hidden сильнее любых display: иначе .panel { display: flex } его перебивал */
[hidden] { display: none !important; }
/* патроны: в магазине / в запасе; перезарядка — полоской */
.hud-ammo { margin-left: 8px; font: 700 12px var(--mono); color: #f2d27a; }
.hud-ammo.empty { color: #ff8a70; }
/* номер версии в главном меню */
.menu-ver { position: absolute; right: 14px; bottom: max(10px, env(safe-area-inset-bottom)); font: 11px var(--mono);
  color: var(--ink-dim); opacity: .75; letter-spacing: .06em; pointer-events: none; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  /* touch-action здесь НЕ ставим: значение предка пересекается со значением
     потомка, и none запрещал бы прокрутку внутри списков интерфейса.
     Страница всё равно не скроллится — overflow: hidden и overscroll-behavior. */
}
canvas#game { display: block; position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
/* жесты запрещены там, где играют, и разрешены там, где листают */
.hud, .touch-bar, .touch-btn, .joystick, .aim-zone { touch-action: none; }
.screen { touch-action: pan-y; }

/* ==== экраны ==== */
.screen {
  position: fixed; inset: 0; z-index: 10; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  text-align: center;
}
.screen.active { display: flex; }
.screen.overlay {
  background: radial-gradient(120% 80% at 50% 0%, rgba(30,36,26,.72), rgba(6,8,6,.94) 70%), rgba(6,8,6,.9);
  backdrop-filter: blur(3px);
  overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain;
}
#screen-loading { background: radial-gradient(130% 95% at 50% 8%, #22291d 0%, #0b0e0c 62%), var(--bg); }
/* меню и выбор черт — прозрачные: за ними идёт живой город */
#screen-menu, #screen-traits {
  background: linear-gradient(180deg, rgba(8,11,8,.82) 0%, rgba(8,11,8,.55) 45%, rgba(8,11,8,.88) 100%);
}
#screen-menu .logo, #screen-menu .records, #screen-menu .menu-foot { filter: drop-shadow(0 4px 14px rgba(0,0,0,.9)); }
#screen-traits { background: radial-gradient(130% 95% at 50% 8%, rgba(34,41,29,.86) 0%, rgba(11,14,12,.95) 62%); }

h1 { font-size: clamp(32px, 8vw, 68px); margin: 0; letter-spacing: .14em; text-transform: uppercase; font-weight: 800;
     color: #e6e4d2; text-shadow: 0 0 1px #000, 0 3px 0 #1a1f16, 0 6px 22px rgba(0,0,0,.8); }
.subtitle { font-family: var(--mono); font-size: clamp(11px, 2.7vw, 15px); letter-spacing: .38em;
            text-transform: uppercase; color: var(--rust); padding-left: .38em; }
h2 { font-size: clamp(18px, 4.6vw, 28px); margin: 0; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; }
h3 { font-size: 14px; margin: 0; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.hint { color: var(--ink-dim); font-size: 13px; margin: 0; font-family: var(--mono); }

.logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-mark { width: 62px; height: 62px; border-radius: 3px; display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #b8901e 0 12px, #16160f 12px 24px);
  box-shadow: 0 0 0 2px #0b0e0c, 0 0 34px rgba(190,140,30,.26), inset 0 0 24px rgba(0,0,0,.6); }
.biohazard { font-size: 32px; color: #10130d; }

/* ==== кнопки ==== */
.btn {
  appearance: none; position: relative;
  border: 1px solid rgba(216,220,200,.16);
  background: linear-gradient(180deg, #27301f 0%, #1a2116 55%, #141a12 100%);
  color: var(--ink);
  padding: 12px 24px; border-radius: 9px;
  font-size: 13.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer; min-width: 168px; min-height: 46px; font-family: var(--font);
  transition: transform .07s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, filter .16s ease;
  box-shadow: 0 3px 0 rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn::after {                                   /* мягкий блик сверху */
  content: ''; position: absolute; inset: 1px 1px auto; height: 42%;
  border-radius: 8px 8px 0 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0));
}
.btn:hover { border-color: rgba(143,174,60,.55); color: #fff; filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.55), inset 0 2px 5px rgba(0,0,0,.45); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-main {
  background: linear-gradient(180deg, #d0662a 0%, var(--rust) 45%, #7d3411 100%);
  border-color: rgba(255,170,90,.5); color: #fff4e8; font-size: 16px; padding: 15px 32px;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
  box-shadow: 0 4px 0 #5e2409, inset 0 1px 0 rgba(255,255,255,.22), 0 6px 18px rgba(181,84,31,.22);
}
.btn-main:hover { filter: brightness(1.1); box-shadow: 0 4px 0 #5e2409, inset 0 1px 0 rgba(255,255,255,.28), 0 8px 26px rgba(181,84,31,.38); }
.btn-main:active { transform: translateY(4px); box-shadow: 0 0 0 #5e2409, inset 0 2px 6px rgba(0,0,0,.4); }

.btn-reward {
  background: linear-gradient(180deg, #5b8330 0%, #3f6021 50%, #2a4214 100%);
  border-color: rgba(160,205,90,.55); color: #f0f7e0;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 4px 0 #1f3210, inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-reward:active { transform: translateY(4px); box-shadow: 0 0 0 #1f3210, inset 0 2px 6px rgba(0,0,0,.4); }

.btn-icon { min-width: 46px; width: 46px; height: 46px; padding: 0; font-size: 16px; border-radius: 50%; }
.btn-sm { min-width: 0; min-height: 34px; padding: 7px 14px; font-size: 11px; letter-spacing: .07em; border-radius: 17px; }
.btn[disabled] { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.menu-foot { display: flex; gap: 8px; }
.bar { width: min(330px, 70vw); height: 9px; background: #10140f; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--rust-2), var(--amber)); transition: width .18s; }

.records, .results { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }
.rec { background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 3px; padding: 6px 16px; min-width: 96px; }
.rec span { display: block; font-size: 10px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .14em; font-family: var(--mono); }
.rec b { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--amber); font-family: var(--mono); }
.new-record { width: 100%; color: var(--amber); font-weight: 800; letter-spacing: .2em; font-family: var(--mono); font-size: 12.5px; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ==== черты ==== */
.trait-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 7px;
              max-width: 760px; width: 100%; max-height: 56vh; overflow-y: auto; padding: 2px;
              touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.trait-list.small { max-height: none; }
.trait { display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
         background: rgba(0,0,0,.34); border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px;
         transition: border-color .15s, background .15s; }
.trait:hover { border-color: var(--line-hot); }
.trait.on { border-color: var(--toxic); background: rgba(143,174,60,.12); }
.trait-ic { font-size: 19px; width: 24px; text-align: center; flex: 0 0 auto; }
.trait-body { display: flex; flex-direction: column; min-width: 0; }
.trait-body b { font-size: 13px; }
.trait-body i { font-size: 11.5px; color: var(--ink-dim); font-style: normal; font-family: var(--mono); }
.trait-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: center; }
.counter { font-family: var(--mono); color: var(--amber); font-size: 13px; }

/* ==== HUD ==== */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; display: none;
       padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); }
.hud.active { display: block; }
.hud-top { display: flex; align-items: flex-start; gap: 10px; max-width: 1080px; margin: 0 auto; }
.hud-top .btn { pointer-events: auto; }

.vitals { display: flex; flex-direction: column; gap: 3px; flex: 0 1 230px; }
.vital { display: flex; align-items: center; gap: 5px; }
/* подпись и число у каждой полоски: сразу видно, что это и сколько осталось */
.vlbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim);
        width: 66px; flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; }
.vnum { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 9px;
        line-height: 1; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; font-weight: 700; }
.vital.low .vlbl { color: #ffb4a6; }
.vital.low .track { border-color: #9a3a2a; box-shadow: 0 0 6px rgba(200,60,40,.5); }
@media (max-width: 620px), (max-height: 470px) { .vlbl { display: none; } .vnum { font-size: 8px; } }
.vi { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 2px; }
.vi-hp { background: var(--blood); } .vi-food { background: var(--amber); } .vi-stam { background: var(--cold); }
.vi-thirst { background: #4fa3b8; }
.track { flex: 1; height: 12px; background: #0d100c; border: 1px solid #232a20; border-radius: 2px; overflow: hidden; }
.fill { height: 100%; transition: width .15s linear; }
.fill.hp { background: linear-gradient(180deg,#b6382c,var(--blood)); }
.fill.food { background: linear-gradient(180deg,#e0b95a,#9b7a24); }
.fill.stam { background: linear-gradient(180deg,#7fa2c4,#41627f); }
.fill.thirst { background: linear-gradient(180deg,#6cc0d4,#2f7586); }
/* состояния под полосками: кровь, заражение, паника… */
.statuses { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; min-height: 0; }
.st-chip { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
           padding: 1px 5px; border-radius: 2px; background: rgba(8,10,8,.7); border: 1px solid #2c3428; color: var(--ink-dim); }
.st-chip.bad { color: #ffb4a6; border-color: #7a2a20; }
.st-chip.warn { color: #f0d08a; border-color: #6a5420; }
.st-chip.pulse { animation: stpulse 1.1s ease-in-out infinite; }
@keyframes stpulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .st-chip.pulse { animation: none; } }
/* сон: экран темнеет, часы бегут */
.sleep-veil { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
              gap: 8px; background: rgba(4,6,10,.72); color: #c8d0e0; font-family: var(--mono); pointer-events: none; }
.sleep-veil.show { display: flex; }
.sleep-veil b { font-size: 26px; letter-spacing: .4em; opacity: .8; }
.sleep-veil span { font-size: 14px; color: var(--ink-dim); }

.clock-box { display: flex; flex-direction: column; gap: 3px; margin: 0 auto; min-width: 128px; }
.clock-row { display: flex; align-items: baseline; gap: 8px; justify-content: center; }
.clock-row b { font-family: var(--mono); font-size: 19px; color: var(--ink); }
.clock-row span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); letter-spacing: .14em; }
.day-track { height: 5px; background: #0d100c; border: 1px solid #232a20; border-radius: 2px; overflow: hidden; }
.day-track div { height: 100%; transition: width .3s linear; }

.hud-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.stat { display: flex; align-items: center; gap: 5px; background: rgba(8,10,8,.6); border: 1px solid #22291f;
        border-radius: 2px; padding: 5px 9px; font-size: 13px; font-weight: 700; font-family: var(--mono); }
.ic-skull { width: 11px; height: 11px; background: #b9bfa8; border-radius: 45% 45% 30% 30%; display: inline-block; }
.ic-play { width: 0; height: 0; border-left: 11px solid #e7f0d4; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* справа от миникарты: её сторона в render.js — min(ширина, высота) × 0.17 в пределах 96–132 px */
.hud-bottom { position: absolute; left: calc(22px + clamp(96px, 17vmin, 132px)); bottom: max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
.weapon-box { background: rgba(8,10,8,.6); border: 1px solid #22291f; border-radius: 2px; padding: 5px 10px; font-size: 13px; font-family: var(--mono); }
.cond-track { height: 3px; background: #0d100c; margin-top: 3px; }
.cond-track div { height: 100%; background: var(--toxic); }
.weight-box { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); padding-left: 2px; }

.hud-hint { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
            background: rgba(8,10,8,.86); border: 1px solid #5a5030; border-radius: 4px;
            padding: 8px 16px; font-family: var(--mono); font-size: 14px; color: #f0c860;
            opacity: 0; transition: opacity .15s; white-space: nowrap; }
.hud-hint.show { opacity: 1; }
/* клавиша на кнопках HUD — только на ПК */
.btn-icon kbd { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font: 700 8.5px var(--mono);
  background: #12160f; border: 1px solid #4a5440; color: #d8dcc8; border-radius: 3px; padding: 1px 3px; line-height: 1; }
html.touch .btn-icon kbd { display: none; }
/* подсказка по ходу игры: крупно, сверху, сама исчезает */
.tip-box { position: absolute; left: 50%; top: 92px; transform: translate(-50%, -6px); max-width: min(560px, 86vw);
  background: rgba(10,13,9,.92); border: 1px solid #6a5a2a; border-left: 4px solid var(--amber); border-radius: 4px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .25s, transform .25s; }
.tip-box.show { opacity: 1; transform: translate(-50%, 0); }
.tip-box b { font: 700 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.tip-box span { font-size: 14px; line-height: 1.4; color: #eef0e4; }
.tip-box kbd, .keys-legend kbd { font: 700 11px var(--mono); background: #1c2218; border: 1px solid #5a6450; border-bottom-width: 2px;
  border-radius: 3px; padding: 0 5px; color: #fff; }
/* шпаргалка клавиш в углу на ПК */
.keys-legend { position: absolute; right: 10px; bottom: 10px; display: grid; grid-template-columns: auto auto; gap: 3px 8px;
  background: rgba(8,10,8,.72); border: 1px solid #2c3428; border-radius: 4px; padding: 8px 10px;
  font-size: 11.5px; color: var(--ink-dim); align-items: center; }
.keys-legend span:nth-child(odd) { text-align: right; }
.keys-legend .kl-foot { grid-column: 1 / -1; font-size: 10px; text-align: center; opacity: .7; }
html.touch .keys-legend:not(.admin) { display: none; }
/* на админ-карте — список экспонатов: номер и название, листается */
.keys-legend.admin { top: 120px; bottom: 10px; overflow-y: auto; align-content: start; pointer-events: auto;
  grid-template-columns: 34px auto; max-width: 300px; font-size: 11px; color: var(--ink); touch-action: pan-y; }
.keys-legend.admin span:nth-child(odd) { text-align: left; }
.keys-legend .kl-title { grid-column: 1 / -1; font: 700 11px var(--mono); color: var(--amber); letter-spacing: .08em; margin-bottom: 4px; }
.keys-legend .kl-n { font: 700 11px var(--mono); color: #f2d27a; text-align: right !important; }
.keys-legend.hide { display: none; }
/* на большом экране интерфейс крупнее: иначе на 1080p окна мелкие */
html.desktop .hud-top, html.desktop .hud-bottom, html.desktop .hud-hint, html.desktop .tip-box,
html.desktop .keys-legend, html.desktop .wave-toast, html.desktop .screen { zoom: var(--ui, 1); }
/* на ПК миникарта до 190 px, а блок оружия зумится — отступ делим на зум */
html.desktop .hud-bottom { left: calc((22px + clamp(96px, 17vmin, 190px)) / var(--ui, 1)); }
html.desktop #screen-inv { align-items: center; justify-content: center; }
html.desktop #screen-inv .panels { justify-content: center; margin: 0 auto; }
html:not(.touch) .hud-hint::before { content: 'E'; display: inline-block; margin-right: 8px; padding: 0 5px;
  border: 1px solid var(--amber); border-radius: 2px; font-size: 11px; line-height: 16px; }
.wave-toast { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-family: var(--mono);
              font-size: clamp(18px, 4.6vw, 32px); font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
              opacity: 0; transition: opacity .4s; text-shadow: 0 0 22px rgba(0,0,0,.9); color: var(--amber); }
.wave-toast.show { opacity: .95; }

/* ==== экранные кнопки ====
   Нижний правый угол оставлен пустым: там лежит большой палец,
   который тянет стик прицела и бьёт по отпусканию. */
.touch-bar {
  position: fixed; right: max(12px, env(safe-area-inset-right));
  bottom: 182px;                      /* ровно над зоной атаки, а не поверх неё */
  z-index: 7; display: none;
  flex-direction: row-reverse; flex-wrap: wrap-reverse;
  width: 126px; justify-content: flex-end; align-content: flex-end;
  gap: 10px; touch-action: none;
}
html.touch .touch-bar.active { display: flex; }

.touch-btn {
  width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid rgba(216,220,200,.18);
  background: radial-gradient(120% 120% at 32% 26%, rgba(62,74,52,.95), rgba(16,21,15,.92));
  color: var(--ink); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; cursor: pointer;
  font-family: var(--font); backdrop-filter: blur(5px);
  box-shadow: 0 4px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .06s, box-shadow .06s, border-color .15s, background .15s;
}
.touch-btn.big {                       /* «Действие» выделено цветом, а не размером */
  border-color: rgba(217,164,65,.45);
  background: radial-gradient(120% 120% at 32% 26%, rgba(120,92,38,.95), rgba(40,29,12,.92));
}
.touch-btn span { font-size: 20px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.touch-btn i { font-size: 8px; font-style: normal; letter-spacing: .08em; text-transform: uppercase;
               color: var(--ink-dim); transition: color .15s; }
.touch-btn:hover { border-color: rgba(216,220,200,.34); }
.touch-btn.on {
  border-color: var(--toxic);
  background: radial-gradient(120% 120% at 32% 26%, rgba(150,186,70,.65), rgba(58,78,24,.85));
  box-shadow: 0 4px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), 0 0 18px rgba(143,174,60,.35);
}
.touch-btn.on i { color: #eef6d6; }
.touch-btn:active { transform: translateY(4px); box-shadow: 0 0 0 rgba(0,0,0,.5), inset 0 2px 6px rgba(0,0,0,.45); }

/* подсказка, где держать палец для атаки */
.aim-zone {
  position: fixed; right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 148px; height: 148px; border-radius: 50%;
  border: 1px dashed rgba(217,164,65,.22);
  display: none; z-index: 5; pointer-events: none;
  align-items: center; justify-content: center;
}
.aim-zone span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(217,164,65,.35);
}
.aim-zone span::before { content: 'АТАКА'; }
:root[lang="en"] .aim-zone span::before { content: 'ATTACK'; }
html.touch .aim-zone.active { display: flex; }
/* справка показывает управление только для своего устройства */
html.touch .only-desktop, html:not(.touch) .only-touch { display: none; }
/* ==== рюкзак ==== */
.panels { display: flex; gap: 10px; width: 100%; max-width: 880px; align-items: stretch;
           justify-content: flex-start; flex-wrap: wrap; }
/* рюкзак прижат к левому верхнему углу, обзор остаётся открытым */
#screen-inv { justify-content: flex-start; align-items: flex-start;
              padding-top: max(52px, calc(env(safe-area-inset-top) + 52px)); padding-left: 14px;
              padding-bottom: 84px;
              background: linear-gradient(90deg, rgba(6,8,6,.92) 0%, rgba(6,8,6,.72) 55%, rgba(6,8,6,.3) 100%); }
/* рюкзак + контейнер + действия должны уместиться в один ряд */
#screen-inv .panels { max-width: 900px; flex-wrap: nowrap; }
#screen-inv .panel { flex: 1 1 0; min-width: 0; max-width: 340px; }
#screen-inv .act-col { flex: 0 0 176px; max-width: 176px; }
/* кнопка закрытия закреплена внизу, под неё зарезервирован отступ у экрана */
#screen-inv > .btn { position: fixed; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }

.panel { flex: 1 1 320px; max-width: 430px; background: rgba(10,13,10,.9); border: 1px solid var(--line);
         border-radius: 3px; padding: 11px; display: flex; flex-direction: column; gap: 7px; min-height: 260px; max-height: 62vh; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meta-line { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.meta-line b { color: var(--amber); }
.hands-row { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); text-align: left;
             border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.hands-row b { color: var(--ink); }
.list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; text-align: left;
        touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid transparent;
        border-radius: 2px; background: rgba(255,255,255,.03); cursor: pointer; }
.item:hover { border-color: var(--line-hot); }
.item.sel { border-color: var(--amber); background: rgba(217,164,65,.12); }
.item.eq { box-shadow: inset 3px 0 0 var(--toxic); }
.item-kind { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.k-weapon { background: #aab0b8; } .k-food { background: var(--amber); }
.k-med { background: #d8dcd0; } .k-misc { background: #8a8272; }
.item-name { flex: 1; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.item-w { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.item-cond { display: inline-block; width: 34px; height: 3px; background: #0d100c; }
.item-cond i { display: block; height: 100%; background: var(--toxic); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; min-height: 34px; }
.empty { color: var(--ink-dim); font-family: var(--mono); font-size: 12px; padding: 10px; text-align: center; }

/* ==== состояние ==== */
.skills { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 620px; }
.skill { flex: 1 1 260px; background: rgba(0,0,0,.34); border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; text-align: left; }
.skill-top { display: flex; justify-content: space-between; font-size: 13px; }
.skill-top span { font-family: var(--mono); color: var(--amber); }
.skill-bar { height: 6px; background: #0d100c; border: 1px solid #232a20; margin: 5px 0; }
.skill-bar i { display: block; height: 100%; background: linear-gradient(90deg,#5d7a2a,var(--toxic)); }
.skill-hint { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }

.help-body { max-width: 470px; color: #aeb69c; font-size: 13.5px; line-height: 1.6; text-align: left;
             max-height: 62vh; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain;
             -webkit-overflow-scrolling: touch; }
.help-body b { color: var(--ink); }
.help-body p { margin: 7px 0; }

/* ==== стики ==== */
.joystick { position: fixed; width: 126px; height: 126px; border-radius: 50%;
            border: 1px solid rgba(216,220,200,.2); background: rgba(216,220,200,.05);
            display: none; z-index: 6; pointer-events: none; transform: translate(-50%, -50%); }
.joystick.active { display: block; }
.joystick.aim { border-color: rgba(217,164,65,.35); }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
            border-radius: 50%; background: rgba(216,220,200,.24); border: 1px solid rgba(216,220,200,.3); }
.joystick.aim .joy-knob { background: rgba(217,164,65,.28); border-color: rgba(217,164,65,.45); }

@media (max-width: 620px) {
  .btn { min-width: 140px; font-size: 13px; padding: 10px 16px; }
  .btn-main { font-size: 15px; padding: 12px 22px; }
  .vitals { flex-basis: 120px; }
  .clock-row b { font-size: 16px; }
  .panel { min-height: 210px; max-height: 54vh; padding: 9px; }
  .touch-btn { width: 52px; height: 52px; }
  .touch-bar { bottom: 152px; gap: 8px; width: 112px; }
  .aim-zone { width: 118px; height: 118px; }
  .trait-list { grid-template-columns: 1fr; max-height: 46vh; }
}
@media (max-height: 470px) {
  /* низкий экран: подписи убираем, кнопки мельче */
  .touch-bar { bottom: 128px; gap: 7px; width: 103px; }
  .touch-btn { width: 48px; height: 48px; }
  .touch-btn i { display: none; }
  .touch-btn span { font-size: 18px; }
  .aim-zone { width: 96px; height: 96px; }
  .logo-mark { width: 42px; height: 42px; } .biohazard { font-size: 22px; }
  h1 { font-size: 28px; } .screen { gap: 8px; }
  .panel { max-height: 64vh; }
  .trait-list { max-height: 40vh; }
}

/* вспышка правого стика в момент удара */
.joystick.aim.fired { border-color: var(--amber); background: rgba(217,164,65,.14); display: block; }

/* ==== пиксельные иконки предметов ==== */
.item-ic { width: 24px; height: 24px; flex: 0 0 auto; background-size: contain;
           background-repeat: no-repeat; background-position: center; }
.fresh { display: inline-block; width: 30px; height: 4px; background: #0d100c; vertical-align: middle; }
.fresh i { display: block; height: 100%; }
.fresh.ok i { background: var(--toxic); }
.fresh.warn i { background: var(--amber); }
.fresh.rotten { width: auto; height: auto; background: none; font-family: var(--mono);
                font-size: 10px; color: var(--blood); letter-spacing: .06em; }
.flash-box { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); padding-left: 2px; }
.flash-box.on { color: var(--amber); }

/* панель обыскиваемого тела */
#cont-panel.corpse { border-color: #5a2a26; box-shadow: inset 0 0 40px rgba(120,20,16,.12); }
#cont-panel.corpse h3 { color: #b5665c; }

/* где находится выживший */
.place-row { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
             color: var(--ink-dim); text-align: center; transition: color .2s; }
.place-row.inside { color: var(--amber); }

/* ==== слоты оружия ==== */
.slots { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap;
         border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.slot { flex: 1 1 108px; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 4px;
        border: 1px dashed var(--line); background: rgba(0,0,0,.25); cursor: pointer; min-width: 0;
        transition: border-color .15s, background .15s; }
.slot:hover { border-color: var(--line-hot); }
.slot.filled { border-style: solid; border-color: var(--toxic); background: rgba(143,174,60,.1); }
.slot-ic { width: 26px; height: 26px; flex: 0 0 auto; background-size: contain; background-repeat: no-repeat;
           background-position: center; }
.slot-lbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
            color: var(--ink-dim); }
.slot b { font-size: 12.5px; margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis;
          white-space: nowrap; }
.slot-swap { align-self: center; min-width: 0; padding: 6px 9px; flex: 0 0 auto; }
.cont-acts { display: flex; gap: 5px; }

/* ==== справочник предметов ==== */
.codex-tabs { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.codex-tabs .btn.on { border-color: var(--amber); color: #fff; background: rgba(217,164,65,.12); }
.codex-body { display: flex; gap: 10px; width: 100%; max-width: 820px; align-items: stretch;
              justify-content: center; flex-wrap: wrap; }
.codex-list { flex: 1 1 240px; max-width: 330px; max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
              display: flex; flex-direction: column; gap: 3px; background: rgba(10,13,10,.85);
              border: 1px solid var(--line); border-radius: 3px; padding: 8px;
              touch-action: pan-y; overscroll-behavior: contain; }
.codex-detail { flex: 1 1 300px; max-width: 420px; max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
                background: rgba(10,13,10,.85); border: 1px solid var(--line); border-radius: 3px;
                padding: 12px; text-align: left;
                touch-action: pan-y; overscroll-behavior: contain; }

.card-head { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line);
             padding-bottom: 8px; margin-bottom: 8px; }
.card-ic { width: 36px; height: 36px; flex: 0 0 auto; background-size: contain; background-repeat: no-repeat;
           background-position: center; }
.card-head b { display: block; font-size: 15px; }
.card-head i { font-size: 10.5px; font-style: normal; color: var(--ink-dim); font-family: var(--mono);
               letter-spacing: .12em; text-transform: uppercase; }
.card-purpose { font-size: 12.5px; color: var(--ink-dim); line-height: 1.45; margin-bottom: 8px; }
.card-rows { display: flex; flex-direction: column; gap: 2px; }
.crow { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px;
        padding: 3px 0; border-bottom: 1px dotted rgba(143,152,128,.18); }
.crow span { color: var(--ink-dim); }
.crow b { font-family: var(--mono); color: var(--amber); }
.card-src { margin-top: 9px; font-size: 11.5px; color: var(--ink-dim); line-height: 1.45; }
.card-src span { color: var(--ink); }
.item-info { border-top: 1px solid var(--line); padding-top: 8px; max-height: 30vh; overflow-y: auto;
             touch-action: pan-y; overscroll-behavior: contain; }
.item-info:empty { display: none; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 620px) {
  .codex-list { max-height: 26vh; }
  .codex-detail { max-height: 30vh; }
}

/* ==== колонка действий в рюкзаке, как в оригинале ==== */
.act-col {
  flex: 0 0 186px; max-width: 186px; display: flex; flex-direction: column; gap: 5px;
  background: rgba(10,13,10,.9); border: 1px solid var(--line); border-radius: 3px;
  padding: 10px; max-height: 62vh; overflow-y: auto;
  touch-action: pan-y; overscroll-behavior: contain;
}
.act-col > * { flex-shrink: 0; }      /* кнопок стало больше: колонка листается, а не сплющивает заголовок */
.act-sel {
  font-size: 12.5px; font-weight: 700; color: var(--amber); text-align: left;
  padding-bottom: 7px; border-bottom: 1px solid var(--line); margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.act-sel.empty-sel { color: var(--ink-dim); font-weight: 400; font-family: var(--mono); font-size: 11px; }
.btn.act {
  width: 100%; min-width: 0; text-align: left; padding: 10px 12px; border-radius: 7px;
  letter-spacing: .05em; font-size: 12px; min-height: 40px;
  background: linear-gradient(180deg, #3c4a30, #283220); border-color: rgba(170,200,110,.55); color: #f2f6e6;
  box-shadow: 0 3px 0 rgba(0,0,0,.55), inset 3px 0 0 var(--amber);
}
.btn.act:hover:not([disabled]) { border-color: var(--amber); filter: brightness(1.18); }
/* недоступное: прозрачное, пунктир, без тени — не спутать с рабочей кнопкой */
.btn.act[disabled] { background: transparent; border-style: dashed; border-color: rgba(120,130,110,.35);
  color: rgba(200,205,190,.38); box-shadow: none; opacity: 1; filter: none; }
.btn.act[disabled]::after { display: none; }
.btn.act.danger { border-color: rgba(142,31,22,.5); }
.btn.act.danger:hover:not([disabled]) { border-color: #c04a3a; color: #ffd9d2; }
.act-sep { height: 1px; background: var(--line); margin: 4px 0; }
.act-col .item-info { margin-top: 6px; max-height: none; border-top: 1px solid var(--line); padding-top: 8px; }

@media (max-width: 1040px) and (orientation: landscape) {
  #screen-inv .panels { max-width: none; width: 100%; }
  #screen-inv .panel { max-width: none; }
  #screen-inv .act-col { flex: 0 0 158px; max-width: 158px; }
  .act-col .item-info { display: none; }
  .btn.act { padding: 8px 9px; font-size: 11px; }
}
@media (max-width: 760px) and (orientation: landscape) {
  #screen-inv .act-col { flex: 0 0 136px; max-width: 136px; }
  .btn.act { font-size: 10.5px; letter-spacing: .02em; }
}
@media (max-width: 620px) {
  .act-col { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .act-sel { grid-column: 1 / -1; }
  .act-sep { display: none; }
}

/* ============================================================
   Книжная ориентация и узкие экраны: всё в одну колонку.
   Экран прокручивается, внизу зарезервировано место под кнопку —
   поэтому ничего не перекрывает друг друга.
   ============================================================ */
@media (orientation: portrait), (max-width: 700px) {
  .screen.overlay { justify-content: flex-start; }

  #screen-inv {
    align-items: stretch;
    padding: max(14px, env(safe-area-inset-top)) 12px 92px;
  }
  #screen-inv .panels { max-width: none; flex-direction: column; gap: 8px; }
  #screen-inv .panel { flex: none; max-height: 28vh; min-height: 104px; max-width: none; }
  #screen-inv > .btn {
    position: fixed; left: 12px; right: 12px; width: auto; min-width: 0;
    bottom: max(12px, env(safe-area-inset-bottom)); z-index: 12;
  }
  #screen-inv .panels { flex-wrap: wrap; }
  #screen-inv .panel, #screen-inv .act-col { flex: none; max-width: none; }
  .act-col { max-height: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .act-col .act-sel { grid-column: 1 / -1; }
  .act-col .item-info { display: none; }

  #screen-codex { padding: max(14px, env(safe-area-inset-top)) 12px 92px; }
  #screen-codex .codex-body { flex-direction: column; max-width: none; }
  #screen-codex .codex-list { max-width: none; max-height: 24vh; }
  #screen-codex .codex-detail { max-width: none; max-height: 34vh; }
  #screen-codex > .btn { position: fixed; left: 12px; right: 12px; width: auto; min-width: 0;
                         bottom: max(12px, env(safe-area-inset-bottom)); z-index: 12; }

  #screen-stats, #screen-over, #screen-help, #screen-traits { padding-bottom: 24px; }
  .trait-list { max-height: none; }
}

/* очень низкий экран: панели ещё ниже, чтобы влезали обе */
@media (max-height: 520px) and (orientation: landscape) {
  #screen-inv .panel { max-height: 46vh; }
  .act-col { max-height: 46vh; }
}

/* ============================================================
   Вывеска оцепления на главном экране.
   Жёсткие края, никаких скруглений — пиксельная эстетика.
   ============================================================ */
.sign { perspective: 700px; margin: 2px 0 4px; }
.sign-plate {
  position: relative; width: min(420px, 86vw);
  background:
    linear-gradient(180deg, #3a3f33 0%, #2b3028 42%, #222719 100%);
  border: 3px solid #14170f;
  box-shadow: 0 0 0 2px #4a5140 inset, 0 10px 0 rgba(0,0,0,.45), 0 16px 34px rgba(0,0,0,.55);
  padding: 0 0 6px;
  transform-origin: 50% -28px;
  animation: signDrop 1.05s cubic-bezier(.34,1.42,.5,1) .15s both,
             signSwing 3.4s ease-in-out 1.2s 2;
}
.sign-hazard {
  height: 11px;
  background: repeating-linear-gradient(45deg, #c8a01e 0 9px, #16180f 9px 18px);
  border-bottom: 2px solid #14170f;
  animation: hazardShift 2.4s steps(6) infinite;
}
.sign-hazard.bottom { border-bottom: 0; border-top: 2px solid #14170f; }
.sign-inner { padding: 9px 12px 8px; text-align: center; font-family: var(--mono); }
.sign-top { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 4px; }
.sign-top i { font-style: normal; font-size: 15px; color: #d9a441; }
.sign-top b { font-size: 12px; letter-spacing: .34em; color: #d9a441; }
.sign-main {
  font-size: clamp(16px, 4.4vw, 23px); font-weight: 800; letter-spacing: .16em; color: #e8e4d2;
  text-shadow: 0 2px 0 #14170f, 0 0 14px rgba(217,164,65,.22);
}
.sign-line { font-size: 10px; letter-spacing: .14em; color: #a8b096; margin-top: 5px; }
.sign-line.dim { color: #7b8470; }
.sign-small { font-size: 9px; letter-spacing: .2em; color: #6f7863; margin-top: 6px; }

.bolt { position: absolute; width: 7px; height: 7px; background: #6e7560;
        box-shadow: inset -1px -1px 0 #3a4032, 0 1px 0 #11140d; }
.bolt.tl { left: 6px; top: 6px; } .bolt.tr { right: 6px; top: 6px; }
.bolt.bl { left: 6px; bottom: 6px; } .bolt.br { right: 6px; bottom: 6px; }

/* красный штамп поверх — появляется ударом */
.sign-stamp {
  position: absolute; right: -6px; bottom: 12px;
  font-family: var(--mono); font-size: clamp(13px, 3.4vw, 18px); font-weight: 800;
  letter-spacing: .2em; color: #d8362a;
  border: 3px solid #d8362a; padding: 3px 10px;
  transform: rotate(-9deg); opacity: 0;
  text-shadow: 0 0 8px rgba(216,54,42,.5);
  box-shadow: 0 0 10px rgba(216,54,42,.25), inset 0 0 10px rgba(216,54,42,.18);
  animation: stampHit .34s cubic-bezier(.2,1.6,.4,1) 1.35s both,
             stampFlicker 5s steps(1) 1.9s infinite;
}

@keyframes signDrop {
  0%   { transform: translateY(-190%) rotate(-11deg); opacity: 0; }
  55%  { opacity: 1; }
  70%  { transform: translateY(6%) rotate(3deg); }
  85%  { transform: translateY(-2%) rotate(-1.6deg); }
  100% { transform: translateY(0) rotate(0); opacity: 1; }
}
@keyframes signSwing {
  0%, 100% { transform: rotate(0deg); }
  30%      { transform: rotate(.7deg); }
  65%      { transform: rotate(-.6deg); }
}
@keyframes hazardShift { from { background-position: 0 0; } to { background-position: 36px 0; } }
@keyframes stampHit {
  0%   { opacity: 0; transform: rotate(-9deg) scale(2.4); }
  70%  { opacity: 1; transform: rotate(-9deg) scale(.92); }
  100% { opacity: 1; transform: rotate(-9deg) scale(1); }
}
@keyframes stampFlicker {
  0%, 92%, 100% { opacity: 1; }
  94%           { opacity: .35; }
  96%           { opacity: 1; }
  97%           { opacity: .5; }
}
@media (prefers-reduced-motion: reduce) {
  .sign-plate, .sign-stamp, .sign-hazard { animation: none; opacity: 1; transform: none; }
}
@media (max-height: 560px) {
  .sign-line.dim, .sign-small { display: none; }
  .sign-inner { padding: 6px 10px; }
}
@media (max-height: 460px) { .sign { display: none; } }

/* ==== карта ==== */
.map-wrap { border: 1px solid var(--line); background: #0a0c09; padding: 6px; border-radius: 3px; }
#map-canvas { display: block; image-rendering: pixelated; max-width: 100%; height: auto; }
.map-legend { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
              font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 9px; height: 9px; display: inline-block; }
