/* АРХИПЕЛАГ — стили интерфейса. Пиксельный стиль: без сглаживания, толстые рамки, крупные кнопки под палец. */

:root {
  --font: 'Courier New', Courier, 'Lucida Console', monospace;
  --sea-deep: #0b1d2a;
  --sea: #1d6fa3;
  --sky: #7ec8f0;
  --sand: #e6d79a;
  --wood: #8d6b3e;
  --wood-dark: #553c22;
  --panel: rgba(10, 22, 34, 0.9);
  --panel-2: rgba(18, 36, 54, 0.92);
  --frame: #e6d79a;
  --frame-dark: #8d6b3e;
  --text: #f4f1e6;
  --muted: #a9b4bd;
  --gold: #ffcc33;
  --hp: #d23a4a;
  --stamina: #5fa63e;
  --hunger: #ff8a1a;
  --thirst: #3d8ad0;
  --sleep: #b48aff;
  --xp: #7ad9ff;
  --ok: #5fa63e;
  --bad: #d23a4a;
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
}

html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; background: var(--sea-deep); }
body {
  font-family: var(--font); font-weight: bold; color: var(--text); font-size: 17px;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; overscroll-behavior: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* 3D-канвас растягивается плавно (без pixelated): при качестве <100% нет крупной «лесенки». Пиксельные — только 2D-канвасы UI. */
canvas#game-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; image-rendering: auto; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

.layer { position: fixed; inset: 0; z-index: 10; }
.panel { z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(4, 10, 16, 0.55); pointer-events: auto; }
/* HUD не ловит мышь: на ПК клики идут в канвас/оверлей захвата; интерактивные элементы (хотбар, заклинания) — только на таче */
#hud { z-index: 10; pointer-events: none; }
#hud > * { pointer-events: none; }
body.touch .hud-bottom { pointer-events: auto; }
#touch-controls { z-index: 20; pointer-events: none; }
#menu { z-index: 40; }

/* Экран загрузки */
#loading {
  z-index: 100; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#0a1b33 0%, #17487a 60%, #0b3a5c 100%);
}
.loading-box { text-align: center; padding: 24px 32px; background: var(--panel); }
.loading-title { font-size: 42px; letter-spacing: 6px; color: var(--gold); text-shadow: 3px 3px 0 #000; margin-bottom: 12px; }
#loading-text { color: var(--muted); font-size: 18px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* Пиксельная рамка: четыре полосы без углов + внутренняя тёмная кайма */
.pix, .loading-box {
  box-shadow: -4px 0 0 0 var(--frame), 4px 0 0 0 var(--frame), 0 -4px 0 0 var(--frame), 0 4px 0 0 var(--frame),
              inset 0 0 0 2px var(--frame-dark);
}
.pix-dark {
  box-shadow: -3px 0 0 0 var(--frame-dark), 3px 0 0 0 var(--frame-dark), 0 -3px 0 0 var(--frame-dark), 0 3px 0 0 var(--frame-dark);
}

/* Кнопки */
button, .btn {
  font-family: var(--font); font-weight: bold; font-size: 19px; color: var(--text);
  background: var(--wood); border: 0; min-height: 50px; min-width: 50px; padding: 8px 16px; cursor: pointer;
  box-shadow: -3px 0 0 0 var(--wood-dark), 3px 0 0 0 var(--wood-dark), 0 -3px 0 0 var(--wood-dark), 0 3px 0 0 var(--wood-dark), inset 0 -4px 0 0 var(--wood-dark);
  margin: 3px; text-align: center; line-height: 1.2; touch-action: manipulation; position: relative;
}
button:hover, .btn:hover { background: #a67f4a; }
button:active, .btn:active { transform: translateY(2px); box-shadow: -3px 0 0 0 var(--wood-dark), 3px 0 0 0 var(--wood-dark), 0 -3px 0 0 var(--wood-dark), 0 3px 0 0 var(--wood-dark), inset 0 -1px 0 0 var(--wood-dark); }
button:disabled, .btn.disabled { opacity: 0.45; cursor: default; }
button.primary { background: #2f8a3a; box-shadow: -3px 0 0 0 #1c5a24, 3px 0 0 0 #1c5a24, 0 -3px 0 0 #1c5a24, 0 3px 0 0 #1c5a24, inset 0 -4px 0 0 #1c5a24; }
button.primary:hover { background: #3aa347; }
button.danger { background: #a0343f; box-shadow: -3px 0 0 0 #5c1c23, 3px 0 0 0 #5c1c23, 0 -3px 0 0 #5c1c23, 0 3px 0 0 #5c1c23, inset 0 -4px 0 0 #5c1c23; }
button.ghost { background: #2a3d4d; box-shadow: -3px 0 0 0 #16232d, 3px 0 0 0 #16232d, 0 -3px 0 0 #16232d, 0 3px 0 0 #16232d, inset 0 -4px 0 0 #16232d; }
button.small { min-height: 40px; min-width: 40px; padding: 4px 10px; font-size: 16px; }
button.icon { padding: 4px; width: 50px; font-size: 26px; }
button.active { background: #c9a04a; color: #1a1206; }

input[type=text], input[type=number], select {
  font-family: var(--font); font-weight: bold; font-size: 18px; color: var(--text); background: #101e2b;
  border: 0; padding: 10px 12px; min-height: 50px; outline: none;
  box-shadow: -3px 0 0 0 var(--frame-dark), 3px 0 0 0 var(--frame-dark), 0 -3px 0 0 var(--frame-dark), 0 3px 0 0 var(--frame-dark);
}
input[type=range] { width: 100%; height: 40px; accent-color: var(--gold); cursor: pointer; }
input[type=checkbox] { width: 30px; height: 30px; accent-color: var(--gold); cursor: pointer; }
select { cursor: pointer; min-width: 150px; }

.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: var(--wood) #101e2b; }
.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-track { background: #101e2b; }
.scroll::-webkit-scrollbar-thumb { background: var(--wood); }
.scroll-x { overflow-x: auto; overflow-y: hidden; touch-action: pan-x; }

.muted { color: var(--muted); font-weight: normal; }
.gold { color: var(--gold); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
.center { text-align: center; }

/* ======================= HUD ======================= */
#hud > * { position: absolute; }
.hud-tl { left: calc(10px + var(--sa-left)); top: calc(10px + var(--sa-top)); width: 240px; }
.hud-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 15px; }
.hud-bar .ico { width: 26px; text-align: center; font-size: 20px; filter: drop-shadow(1px 1px 0 #000); }
.hud-bar .track { flex: 1; height: 17px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 2px #000; position: relative; }
.hud-bar .fill { height: 100%; width: 100%; transition: width 0.15s linear; }
.hud-bar .fill.low { animation: blink 0.7s steps(2) infinite; }
.hud-bar .val { position: absolute; inset: 0; font-size: 14px; line-height: 17px; text-align: center; color: #fff; text-shadow: 1px 1px 0 #000; }
.hud-bar.hp .fill { background: var(--hp); } .hud-bar.stamina .fill { background: var(--stamina); }
.hud-bar.hunger .fill { background: var(--hunger); } .hud-bar.thirst .fill { background: var(--thirst); } .hud-bar.sleep .fill { background: var(--sleep); }
.hud-debuffs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.hud-debuff { background: rgba(120, 20, 30, 0.85); box-shadow: 0 0 0 2px #000; padding: 2px 7px; font-size: 14px; white-space: nowrap; }
.hud-debuff.good { background: rgba(30, 110, 40, 0.85); }
.hud-level { margin-top: 6px; font-size: 15px; text-shadow: 1px 1px 0 #000; }
.hud-level .track { height: 8px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 2px #000; margin-top: 3px; }
.hud-level .fill { height: 100%; background: var(--xp); width: 0; }
.hud-level { position: relative; }
.hud-level .fill.gain { animation: xpgain 0.5s steps(3); }
@keyframes xpgain { 50% { box-shadow: 0 0 0 2px #fff; filter: brightness(1.8); } }
.hud-xppop { position: absolute; right: 0; top: -4px; font-size: 15px; color: var(--xp); text-shadow: 1px 1px 0 #000; opacity: 0; pointer-events: none; }
.hud-xppop.on { animation: xppop 1.2s ease-out forwards; }
@keyframes xppop { 0% { opacity: 1; transform: translateY(6px); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
/* Бейдж состояния: бег / крадёшься */
.hud-state { display: inline-block; margin-top: 6px; padding: 2px 8px; font-size: 14px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 2px #000; text-shadow: 1px 1px 0 #000; }
.hud-state.run { color: #ffe08a; }
.hud-state.sneak { color: #9ad0ff; }
/* Трекер текущего задания под миникартой */
.hud-quest { margin-top: 6px; margin-left: auto; max-width: 210px; text-align: right; font-size: 14px; text-shadow: 1px 1px 0 #000; }
.hud-quest .qt { color: var(--gold); }
.hud-quest .qs { color: var(--sand); font-weight: normal; margin-top: 1px; }
/* Запас воздуха под водой */
.hud-breath { left: 50%; bottom: calc(92px + var(--sa-bottom)); transform: translateX(-50%); display: flex; gap: 4px; padding: 4px 8px; background: rgba(0, 0, 0, 0.45); box-shadow: 0 0 0 2px #000; }
.hud-breath i { width: 12px; height: 12px; border-radius: 50%; background: #9ad0ff; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.35); }
.hud-breath i.off { background: rgba(255, 255, 255, 0.15); box-shadow: none; }
.hud-breath.low i { animation: blink 0.5s steps(2) infinite; }
/* Направление урона: красная дуга по кругу вокруг центра */
.hud-dmgdir { left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(from calc(var(--a, 0deg) - 26deg), rgba(230, 40, 50, 0.9) 0 52deg, transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 94px, #000 96px, #000 120px, transparent 122px); mask: radial-gradient(circle, transparent 94px, #000 96px, #000 120px, transparent 122px); }
.hud-dmgdir.on { animation: dmgdir 0.9s ease-out forwards; }
@keyframes dmgdir { 0% { opacity: 1; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.08); } }
/* Полоса здоровья над врагом после удара */
.hud-ehp { left: 0; top: 0; transform: translate(-50%, -100%); text-align: center; font-size: 14px; text-shadow: 1px 1px 0 #000; pointer-events: none; white-space: nowrap; will-change: transform; }
.hud-ehp .track { width: 92px; height: 7px; margin: 2px auto 0; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 2px #000; }
.hud-ehp .fill { height: 100%; background: var(--hp); }
/* Карточка клавиш (ПК) */
.hud-keys { left: calc(12px + var(--sa-left)); bottom: calc(14px + var(--sa-bottom)); padding: 8px 12px; background: rgba(0, 0, 0, 0.62); box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--frame-dark); font-size: 14px; animation: msgin 0.2s steps(3); }
.hud-keys .kh { color: var(--gold); font-size: 15px; margin-bottom: 4px; text-shadow: 1px 1px 0 #000; }
.hud-keys .kr { display: flex; gap: 8px; line-height: 1.35; }
.hud-keys .kr b { color: var(--sand); min-width: 130px; }
.hud-keys .kr span { color: var(--text); font-weight: normal; }
/* Подсказки первых шагов (новая игра) */
.hud-tut { left: 50%; top: calc(100px + var(--sa-top)); transform: translateX(-50%); width: max-content; max-width: min(620px, 86vw); padding: 7px 16px; text-align: center;
  background: rgba(0, 0, 0, 0.68); box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--frame-dark); animation: msgin 0.25s steps(3); }
.hud-tut .n { color: var(--muted); font-size: 13px; font-weight: normal; margin-bottom: 2px; }
.hud-tut .x { font-size: 17px; line-height: 1.35; text-shadow: 1px 1px 0 #000; }
.hud-tut .x b { color: var(--gold); }
.hud-tut.ok { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--ok); }
.hud-tut.ok .x { color: var(--ok); }
.hud-msg.bump { animation: msgbump 0.18s steps(2); }
@keyframes msgbump { 50% { transform: scale(1.08); } }

.hud-tc { left: 50%; top: calc(8px + var(--sa-top)); transform: translateX(-50%); text-align: center; }
.hud-compass { display: block; width: 340px; height: 36px; background: rgba(0, 0, 0, 0.55); box-shadow: 0 0 0 2px #000; }
.hud-time { margin-top: 4px; font-size: 17px; text-shadow: 1px 1px 0 #000; }

.hud-tr { right: calc(10px + var(--sa-right)); top: calc(10px + var(--sa-top)); text-align: right; }
.hud-minimap { display: block; width: 150px; height: 150px; background: #071018; box-shadow: 0 0 0 3px var(--frame-dark), 0 0 0 5px #000; margin-left: auto; }
.hud-island { font-size: 15px; color: var(--muted); margin-top: 8px; text-shadow: 1px 1px 0 #000; max-width: 170px; margin-left: auto; }
.hud-fps { font-size: 14px; color: var(--muted); text-shadow: 1px 1px 0 #000; }

.hud-cross { left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); pointer-events: none; }
.hud-cross::before, .hud-cross::after { content: ''; position: absolute; background: #fff; mix-blend-mode: difference; }
.hud-cross::before { left: 8px; top: 0; width: 4px; height: 20px; }
.hud-cross::after { top: 8px; left: 0; width: 20px; height: 4px; }
.hud-cross.hit::before, .hud-cross.hit::after { background: var(--gold); mix-blend-mode: normal; }
/* Уголки вокруг прицела: существо в зоне удара. Красные — враг, жёлтые — нейтрал/зверь, голубые — NPC */
.hud-cross .t { position: absolute; width: 9px; height: 9px; border: 3px solid var(--bad); display: none; }
.hud-cross .t.tl { left: -12px; top: -12px; border-right: 0; border-bottom: 0; }
.hud-cross .t.tr { right: -12px; top: -12px; border-left: 0; border-bottom: 0; }
.hud-cross .t.bl { left: -12px; bottom: -12px; border-right: 0; border-top: 0; }
.hud-cross .t.br { right: -12px; bottom: -12px; border-left: 0; border-top: 0; }
.hud-cross.enemy .t, .hud-cross.mob .t, .hud-cross.npc .t { display: block; animation: ticks 0.12s steps(3); }
.hud-cross.enemy::before, .hud-cross.enemy::after { background: #ff3a3a; mix-blend-mode: normal; }
.hud-cross.mob .t { border-color: var(--gold); }
.hud-cross.mob::before, .hud-cross.mob::after { background: var(--gold); mix-blend-mode: normal; }
.hud-cross.npc .t { border-color: var(--xp); }
.hud-cross.npc::before, .hud-cross.npc::after { background: var(--xp); mix-blend-mode: normal; }
.hud-cross.far::before, .hud-cross.far::after { background: rgba(255, 255, 255, 0.45); mix-blend-mode: normal; }
@keyframes ticks { from { transform: scale(1.6); opacity: 0; } }
/* Маркер попадания: белый крест, золотой — крит, красный крупный — добил */
.hud-hitmark { left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); opacity: 0; pointer-events: none; }
.hud-hitmark::before, .hud-hitmark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 34px; height: 4px; margin: -2px 0 0 -17px; background: #fff; box-shadow: 0 0 0 1px #000; }
.hud-hitmark::before { transform: rotate(45deg); }
.hud-hitmark::after { transform: rotate(-45deg); }
.hud-hitmark.on { opacity: 1; animation: hm 0.15s steps(3); }
.hud-hitmark.crit::before, .hud-hitmark.crit::after { background: var(--gold); }
.hud-hitmark.kill::before, .hud-hitmark.kill::after { background: var(--bad); width: 48px; margin-left: -24px; height: 5px; }
@keyframes hm { from { transform: translate(-50%, -50%) scale(1.7); } to { transform: translate(-50%, -50%) scale(1); } }
/* Кольцо перезарядки удара справа от прицела: светлая часть — сколько ещё ждать */
.hud-cd { left: calc(50% + 24px); top: calc(50% - 10px); width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(rgba(255, 255, 255, 0.9) var(--p, 0%), rgba(0, 0, 0, 0.35) 0); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7); pointer-events: none; }
.hud-target { left: 50%; top: calc(50% + 26px); transform: translateX(-50%); text-align: center; font-size: 17px; text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.hud-target .track { width: 170px; height: 10px; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 2px #000; margin: 3px auto 0; }
.hud-target .fill { height: 100%; background: var(--hp); }
.hud-target .fill.mine { background: var(--gold); }
.hud-target .act { font-size: 15px; margin-top: 2px; color: var(--sand); }
.hud-target .act:empty { display: none; }
.hud-target .act.key { color: var(--gold); }
.hud-target .act.ok { color: #9ee27a; }
.hud-target .act.muted { color: var(--muted); }
.hud-bar .track.flash { animation: barflash 0.3s steps(2) 3; }
@keyframes barflash { 50% { box-shadow: 0 0 0 2px #fff; filter: brightness(1.7); } }

.hud-msgs { left: 50%; bottom: calc(110px + var(--sa-bottom)); transform: translateX(-50%); width: min(90vw, 640px); text-align: center; pointer-events: none; }
.hud-msg { display: inline-block; background: rgba(0, 0, 0, 0.7); box-shadow: 0 0 0 2px #000; padding: 7px 14px; margin: 2px; font-size: 18px; animation: msgin 0.2s steps(3); }
.hud-msg.out { opacity: 0; transition: opacity 0.4s; }
@keyframes msgin { from { transform: translateY(8px); opacity: 0; } }
.hud-bigmsg { left: 50%; top: 32%; transform: translateX(-50%); font-size: 36px; color: var(--gold); text-shadow: 3px 3px 0 #000; text-align: center; white-space: nowrap; animation: msgin 0.3s steps(4); }

.hud-bottom { left: 50%; bottom: calc(10px + var(--sa-bottom)); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 10px; }
.hud-hotbar { display: flex; gap: 3px; background: rgba(0, 0, 0, 0.5); padding: 3px; box-shadow: 0 0 0 2px #000; }
.hud-slot {
  width: 56px; height: 56px; background: rgba(40, 50, 60, 0.85); box-shadow: inset 0 0 0 2px #1a2430; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 30px; cursor: pointer; touch-action: manipulation;
}
.hud-slot.sel { box-shadow: inset 0 0 0 3px var(--gold); background: rgba(70, 80, 60, 0.95); }
.hud-slot .n { position: absolute; right: 3px; bottom: 1px; font-size: 14px; color: #fff; text-shadow: 1px 1px 0 #000; }
.hud-slot .k { position: absolute; left: 3px; top: 1px; font-size: 12px; color: var(--muted); }
.hud-slot .dur { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: #000; }
.hud-slot .dur i { display: block; height: 100%; background: var(--ok); }
.hud-slot .sq { width: 28px; height: 28px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4); }
.hud-slot.warn { animation: slotwarn 0.8s steps(2) infinite; }
@keyframes slotwarn { 50% { box-shadow: inset 0 0 0 3px var(--bad); } }
.hud-slot.sel { animation: slotpop 0.15s steps(3); }
@keyframes slotpop { 50% { transform: scale(1.1); } }
.hud-spells { display: flex; gap: 3px; background: rgba(20, 0, 40, 0.55); padding: 3px; box-shadow: 0 0 0 2px #000; }
.hud-spell { width: 52px; height: 52px; background: rgba(50, 30, 80, 0.85); box-shadow: inset 0 0 0 2px #2a1a44; position: relative; display: flex; align-items: center; justify-content: center; font-size: 27px; cursor: pointer; }
.hud-spell .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); height: 0; }
.hud-spell .cdt { position: absolute; left: 0; right: 0; bottom: 2px; font-size: 12px; text-align: center; color: var(--muted); }
.hud-spell .k { position: absolute; left: 3px; top: 1px; font-size: 12px; color: var(--muted); }
.hud-spell.empty { opacity: 0.5; }
.hud-hint { position: absolute; left: 0; right: 0; top: -28px; font-size: 18px; color: var(--gold); text-align: center; text-shadow: 2px 2px 0 #000; white-space: nowrap; opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.hud-hint.show { opacity: 1; transition: none; }

.hud-flash { inset: 0; background: radial-gradient(ellipse at center, rgba(200, 20, 30, 0) 40%, rgba(200, 20, 30, 0.75) 100%); opacity: 0; pointer-events: none; transition: opacity 0.5s; }
.hud-flash.on { opacity: 1; transition: opacity 0.05s; }
.hud-lowhp { inset: 0; background: radial-gradient(ellipse at center, rgba(120, 0, 0, 0) 55%, rgba(120, 0, 0, 0.6) 100%); pointer-events: none; animation: blink 1.4s steps(2) infinite; }
.hud-dmg { position: absolute; font-size: 22px; color: #fff; text-shadow: 2px 2px 0 #000; pointer-events: none; transform: translate(-50%, -50%); will-change: transform, opacity; }
.hud-dmg.crit { color: var(--gold); font-size: 28px; }

/* ======================= МЕНЮ ======================= */
#menu { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.menu-bg { position: absolute; inset: 0; background: linear-gradient(#08142b 0%, #1b4a80 38%, #5fb6e8 52%, #1d6fa3 54%, #14507a 75%, #0b2c45 100%); }
.menu-sun { position: absolute; left: 50%; top: 36%; width: 90px; height: 90px; margin-left: -45px; background: #ffd34a; box-shadow: 0 0 0 10px rgba(255, 211, 74, 0.35), 0 0 0 22px rgba(255, 211, 74, 0.15); }
.menu-horizon { position: absolute; left: 0; right: 0; top: 52%; height: 6px; background: #b6e4ff; opacity: 0.7; }
.menu-island { position: absolute; left: 62%; top: 49%; width: 180px; height: 24px; background: #2f7a3a; box-shadow: 0 -6px 0 0 #3f9a4a, 20px -12px 0 0 #2c6e36, 60px -6px 0 0 #3f9a4a, -20px 6px 0 0 #8a6a3a, 40px 6px 0 0 #a8865a; }
.menu-island::before { content: ''; position: absolute; left: 70px; top: -40px; width: 8px; height: 40px; background: #8a6a3a; box-shadow: -14px -6px 0 0 #3aa03a, 12px -6px 0 0 #3aa03a, -6px -12px 0 0 #4ab04a, 6px -12px 0 0 #4ab04a, 0 -16px 0 0 #3aa03a; }
.menu-waves { position: absolute; left: 0; right: 0; height: 40%; top: 55%; background-repeat: repeat-x; image-rendering: pixelated; pointer-events: none; }
.menu-waves.w1 { background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 40%, transparent 40% 100%); background-size: 64px 6px; background-position: 0 10%; animation: wave 6s linear infinite; }
.menu-waves.w2 { background-image: linear-gradient(90deg, transparent 0 30%, rgba(255, 255, 255, 0.28) 30% 60%, transparent 60% 100%); background-size: 96px 8px; background-position: 0 35%; animation: wave 9s linear infinite reverse; }
.menu-waves.w3 { background-image: linear-gradient(90deg, rgba(180, 230, 255, 0.35) 0 25%, transparent 25% 100%); background-size: 128px 10px; background-position: 0 65%; animation: wave 12s linear infinite; }
.menu-waves.w4 { background-image: linear-gradient(90deg, transparent 0 50%, rgba(255, 255, 255, 0.2) 50% 75%, transparent 75% 100%); background-size: 160px 12px; background-position: 0 95%; animation: wave 15s linear infinite reverse; }
@keyframes wave { from { background-position-x: 0; } to { background-position-x: 320px; } }
.menu-clouds { position: absolute; left: 0; right: 0; top: 8%; height: 30%; background-image:
  linear-gradient(90deg, transparent 0 10%, rgba(255, 255, 255, 0.85) 10% 24%, transparent 24% 60%, rgba(255, 255, 255, 0.7) 60% 68%, transparent 68%);
  background-size: 600px 14px; background-repeat: repeat-x; background-position: 0 40%; animation: wave 60s linear infinite; }
.menu-stars { position: absolute; inset: 0; background-image: radial-gradient(1.5px 1.5px at 20% 12%, #fff 100%, transparent 0), radial-gradient(1.5px 1.5px at 70% 8%, #fff 100%, transparent 0), radial-gradient(1.5px 1.5px at 45% 20%, #fff 100%, transparent 0), radial-gradient(1.5px 1.5px at 85% 22%, #fff 100%, transparent 0), radial-gradient(1.5px 1.5px at 10% 28%, #fff 100%, transparent 0); opacity: 0.6; }

.menu-box { position: relative; z-index: 2; background: rgba(10, 22, 34, 0.95); padding: 20px 26px; max-width: min(94vw, 620px); max-height: calc(100vh - 24px - var(--sa-top) - var(--sa-bottom)); display: flex; flex-direction: column; width: 480px; }
.menu-box.wide { width: 700px; max-width: min(96vw, 760px); }
.menu-title { font-size: 48px; letter-spacing: 8px; color: var(--gold); text-shadow: 4px 4px 0 #000, -2px -2px 0 #5a3a00; text-align: center; margin: 4px 0 0; line-height: 1; }
.menu-sub { text-align: center; color: var(--sand); font-size: 16px; letter-spacing: 1px; margin: 8px 0 14px; text-shadow: 2px 2px 0 #000; }
.menu-h { font-size: 28px; color: var(--gold); text-shadow: 3px 3px 0 #000; text-align: center; margin: 0 0 12px; letter-spacing: 2px; }
.menu-btns { display: flex; flex-direction: column; gap: 6px; }
.menu-btns button { width: 100%; font-size: 22px; min-height: 54px; }
.menu-body { flex: 1; min-height: 0; }
.menu-foot { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.menu-foot button { flex: 1; }
.menu-seed { display: flex; gap: 6px; margin-bottom: 8px; }
.menu-seed input { flex: 1; min-width: 0; }
.menu-version { position: absolute; right: calc(8px + var(--sa-right)); bottom: calc(6px + var(--sa-bottom)); font-size: 14px; color: rgba(255, 255, 255, 0.6); z-index: 2; }
.menu-about { font-size: 17px; line-height: 1.5; font-weight: normal; }
.menu-about p { margin: 0 0 8px; }
.menu-about b { color: var(--gold); }
.set-row { display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 17px; }
.set-row .lbl { grid-column: 1 / 3; display: flex; justify-content: space-between; }
.set-row .lbl span:last-child { color: var(--gold); }
.set-row input[type=range] { grid-column: 1 / 3; }
.set-row.check { grid-template-columns: 1fr auto; }
.save-slot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); cursor: pointer; }
.save-slot:hover { background: #1e3a55; }
.save-slot .num { font-size: 32px; color: var(--gold); width: 44px; text-align: center; }
.save-slot .info { flex: 1; font-size: 16px; }
.save-slot .info .t { font-size: 19px; }
.save-slot .info .d { color: var(--muted); font-weight: normal; font-size: 15px; }
.save-slot.empty .info { color: var(--muted); }
.death-cause { text-align: center; color: var(--muted); margin: 0 0 16px; font-size: 18px; }
.death-skull { font-size: 64px; text-align: center; margin: 6px 0; filter: drop-shadow(3px 3px 0 #000); }
.death-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.5), rgba(10, 0, 0, 0.9)); }
.island-intro { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; animation: intro 3s ease-in-out forwards; }
.island-intro .n { font-size: 46px; color: var(--gold); text-shadow: 4px 4px 0 #000; letter-spacing: 3px; padding: 0 12px; }
.island-intro .t { font-size: 20px; color: var(--sand); text-shadow: 2px 2px 0 #000; margin-top: 8px; padding: 0 20px; font-weight: normal; }
@keyframes intro { 0% { opacity: 0; transform: translateY(12px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ======================= ПАНЕЛИ ======================= */
.pbox { position: relative; background: var(--panel); display: flex; flex-direction: column; width: min(96vw, 1000px); height: min(92vh, 700px); max-height: calc(100vh - 16px - var(--sa-top) - var(--sa-bottom)); }
.phead { display: flex; align-items: center; gap: 4px; padding: 8px 8px 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.phead::-webkit-scrollbar { display: none; }
.ptab { flex: 1; min-width: 60px; min-height: 54px; padding: 4px 6px; font-size: 16px; background: #1c2f40; box-shadow: none; margin: 0; white-space: nowrap; }
.ptab .i { font-size: 24px; display: block; line-height: 1; }
.ptab .t { display: block; font-size: 13px; margin-top: 2px; }
.ptab.active { background: var(--wood); color: var(--text); box-shadow: inset 0 3px 0 0 var(--gold); }
.pclose { min-width: 54px; width: 54px; font-size: 26px; padding: 0; margin: 0 0 0 4px; flex: none; }
.pbody { flex: 1; min-height: 0; padding: 10px; position: relative; }
.ptitle { font-size: 20px; color: var(--gold); text-shadow: 2px 2px 0 #000; margin: 0 0 8px; }
.pfoot { padding: 6px 10px 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Инвентарь */
.inv-layout { display: flex; gap: 12px; height: 100%; }
.inv-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.inv-right { width: 270px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.inv-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.slot {
  aspect-ratio: 1; min-height: 44px; background: rgba(40, 50, 60, 0.9); box-shadow: inset 0 0 0 2px #1a2430; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 26px; cursor: pointer; touch-action: manipulation;
}
.slot.hot { box-shadow: inset 0 0 0 2px #4a5a3a; }
.slot.sel { box-shadow: inset 0 0 0 3px var(--gold); background: rgba(80, 80, 50, 0.95); }
.slot.drop-ok { box-shadow: inset 0 0 0 3px var(--ok); }
.slot .n { position: absolute; right: 3px; bottom: 1px; font-size: 14px; color: #fff; text-shadow: 1px 1px 0 #000; }
.slot .dur { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: #000; }
.slot .dur i { display: block; height: 100%; background: var(--ok); }
.slot .sq { width: 28px; height: 28px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4); }
.slot .lbl { position: absolute; left: 2px; top: 1px; font-size: 11px; color: var(--muted); }
.slot .eqn { position: absolute; left: 0; right: 0; bottom: 2px; font-size: 11px; color: var(--muted); text-align: center; }
.slot.empty-eq { font-size: 20px; opacity: 0.6; }
.eq-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.inv-weight { font-size: 16px; }
.inv-weight .track { height: 12px; background: #000; box-shadow: 0 0 0 2px #000; margin-top: 3px; }
.inv-weight .fill { height: 100%; background: var(--ok); }
.inv-weight .fill.heavy { background: var(--hunger); }
.inv-weight .fill.over { background: var(--bad); }
.inv-info { background: var(--panel-2); padding: 8px 10px; font-size: 16px; min-height: 60px; }
.inv-info .name { font-size: 19px; color: var(--gold); }
.inv-info .desc { color: var(--muted); font-weight: normal; margin-top: 2px; }
.inv-info .props { margin-top: 4px; font-size: 15px; color: var(--sand); }
.inv-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.inv-actions button { flex: 1; min-width: 110px; font-size: 16px; }
.inv-stats { font-size: 15px; color: var(--muted); line-height: 1.5; }
.drag-ghost { position: fixed; z-index: 99; pointer-events: none; font-size: 30px; transform: translate(-50%, -50%); filter: drop-shadow(2px 2px 0 #000); }

/* Крафт */
.craft-list { display: flex; flex-direction: column; gap: 6px; }
.craft-filter { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.craft-filter button { flex: 1; min-width: 70px; }
.recipe { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 6px 10px; }
.recipe.no { opacity: 0.55; }
.recipe .ric { font-size: 34px; width: 48px; text-align: center; flex: none; }
.recipe .rname { font-size: 17px; }
.recipe .ring { font-size: 15px; color: var(--muted); font-weight: normal; }
.recipe .ring b.bad { font-weight: bold; }
.recipe .rst { font-size: 14px; color: var(--sand); }
.recipe button { flex: none; }

/* Древо технологий и навыков */
.tree-wrap { position: relative; height: 100%; overflow: auto; touch-action: pan-x pan-y; } /* дерево крутится по обеим осям (перебивает .scroll-x) */
.tree { display: flex; gap: 16px; position: relative; min-height: 100%; padding: 4px 4px 12px; }
.tree-col { width: 230px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.tree-col h4 { margin: 0 0 4px; font-size: 16px; color: var(--gold); text-align: center; text-shadow: 2px 2px 0 #000; }
.node { position: relative; background: #12243a; padding: 6px 8px; font-size: 15px; box-shadow: inset 0 0 0 2px #1a2430; z-index: 1; }
.node .nn { font-size: 16px; }
.node .nd { color: var(--muted); font-weight: normal; margin: 2px 0; font-size: 14px; }
.node .nc { font-size: 14px; color: var(--sand); }
.node.done { box-shadow: inset 0 0 0 2px var(--ok); background: rgba(30, 70, 40, 0.8); }
.node.can { box-shadow: inset 0 0 0 2px var(--gold); }
.node.locked { opacity: 0.55; }
.node button { width: 100%; margin: 4px 0 0; }
.tree-lines { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
.skill-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 16px; }
.attr { display: flex; align-items: center; gap: 4px; background: var(--panel-2); padding: 2px 4px 2px 8px; }
.attr button { min-height: 40px; min-width: 40px; padding: 0; }

/* Заклинания */
.spell-sec { margin-bottom: 12px; }
.spell { display: flex; align-items: center; gap: 8px; background: var(--panel-2); padding: 6px 8px; margin-bottom: 4px; flex-wrap: wrap; }
.spell .sic { font-size: 32px; width: 44px; text-align: center; flex: none; }
.spell .sn { font-size: 17px; }
.spell .sd { color: var(--muted); font-weight: normal; font-size: 15px; }
.spell .rank { display: inline-block; min-width: 26px; text-align: center; padding: 1px 5px; font-size: 14px; color: #000; background: var(--sand); margin-right: 4px; }
.spell .rank.S { background: var(--gold); } .spell .rank.A { background: #ff8a5a; } .spell .rank.B { background: #b48aff; } .spell .rank.C { background: #7ad9ff; }
.spell .sbtns { display: flex; gap: 2px; margin-left: auto; }
.spell .sbtns button { min-width: 40px; }
.spell.locked { opacity: 0.6; }

/* Карта */
.map-box { width: min(98vw, 1000px); height: min(96vh, 720px); }
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-canvas:active { cursor: grabbing; }
.map-ui { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; z-index: 2; }
.map-ui button { margin: 0; }
.map-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.map-legend { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.6); padding: 6px 8px; font-size: 14px; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.map-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: middle; }
.map-info { position: absolute; right: 8px; top: 8px; width: 280px; background: rgba(0, 0, 0, 0.7); padding: 8px 10px; font-size: 15px; z-index: 2; }
.map-info .n { font-size: 19px; color: var(--gold); }
.map-info .t { color: var(--muted); font-weight: normal; margin: 4px 0; }
.map-info button { width: 100%; margin: 6px 0 0; }
.map-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 15px; color: var(--sand); background: rgba(0, 0, 0, 0.6); padding: 4px 10px; z-index: 2; white-space: nowrap; }

/* Диалог */
.dlg-box { width: min(96vw, 780px); height: auto; max-height: min(92vh, 640px); min-height: 280px; }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 4px; }
.dlg-portrait { width: 64px; height: 64px; flex: none; box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--frame-dark); position: relative; overflow: hidden; }
.dlg-portrait::after { content: ''; position: absolute; left: 16px; top: 18px; width: 9px; height: 9px; background: #000; box-shadow: 23px 0 0 0 #000; }
.dlg-name { font-size: 23px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.dlg-role { font-size: 15px; color: var(--muted); font-weight: normal; }
.dlg-text { padding: 8px 14px; font-size: 19px; line-height: 1.5; font-weight: normal; min-height: 60px; }
.dlg-opts { display: flex; flex-direction: column; gap: 4px; padding: 4px 10px 10px; }
.dlg-opts button { text-align: left; font-size: 18px; width: 100%; }
.dlg-opts button::before { content: '▸ '; color: var(--gold); }
.dlg-tabs { display: flex; gap: 4px; padding: 0 10px; }
.dlg-tabs button { flex: 1; }
.trade-row { display: flex; align-items: center; gap: 8px; background: var(--panel-2); padding: 6px 8px; margin-bottom: 4px; }
.trade-row .ic { font-size: 30px; width: 40px; text-align: center; }
.trade-row .tn { font-size: 17px; }
.trade-row .tp { font-size: 15px; color: var(--sand); }
.trade-row button { margin-left: auto; }
.quest { background: var(--panel-2); padding: 8px 10px; margin-bottom: 6px; }
.quest .qt { font-size: 17px; color: var(--gold); }
.quest .qt.main::before { content: '★ '; }
.quest .qd { font-size: 15px; color: var(--muted); font-weight: normal; margin: 2px 0 4px; }
.quest .qs { font-size: 15px; }
.quest .qs .cur { color: var(--sand); }
.quest .qs .done { color: var(--ok); text-decoration: line-through; }
.quest.done .qt { color: var(--ok); }

/* ======================= АДАПТИВ ======================= */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .hud-tl { width: 150px; }
  .hud-bar { margin-bottom: 3px; font-size: 14px; gap: 4px; }
  .hud-bar .ico { width: 20px; font-size: 16px; }
  .hud-bar .track { height: 14px; } .hud-bar .val { font-size: 12px; line-height: 14px; }
  .hud-debuff { font-size: 12px; padding: 1px 5px; }
  .hud-compass { width: 170px; height: 28px; }
  .hud-minimap { width: 100px; height: 100px; }
  .hud-time { font-size: 15px; }
  .hud-slot { width: min(56px, 11.4vw); height: min(56px, 11.4vw); font-size: 24px; }
  .hud-spell { width: 44px; height: 44px; font-size: 22px; }
  .hud-bottom { flex-direction: column; align-items: center; gap: 4px; }
  .hud-msgs { bottom: calc(140px + var(--sa-bottom)); }
  .hud-msg { font-size: 15px; }
  /* Тач в портрете: над хотбаром стоят УДАР/ПРЫЖОК — сообщения уходят в верхнюю треть, компас под ряд ☰🎒🗺 и правее полос */
  body.touch .hud-msgs { bottom: auto; top: calc(21% + var(--sa-top)); width: min(88vw, 520px); }
  body.touch .hud-tl { width: 140px; }
  body.touch .hud-tc { top: calc(56px + var(--sa-top)); left: calc(50% + 32px); }
  body.touch .hud-compass { width: 130px; }
  body.touch .hud-time { font-size: 14px; white-space: nowrap; }
  .hud-island, .hud-hint { font-size: 14px; }
  .hud-tut { max-width: 92vw; padding: 6px 12px; }
  .hud-tut .x { font-size: 15px; }
  body.touch .hud-tut { top: calc(33% + var(--sa-top)); }  /* тач в портрете: ниже сообщений, полос и миникарты */
  .hud-bigmsg { font-size: 26px; white-space: normal; width: 90vw; }
  .menu-title { font-size: 34px; letter-spacing: 5px; }
  .menu-sub { font-size: 14px; }
  .menu-box { padding: 14px 16px; width: 94vw; }
  .menu-btns button { font-size: 19px; min-height: 50px; }
  .menu-about, .set-row { font-size: 15px; }
  .pbody { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .inv-layout { flex-direction: column; height: auto; }
  .inv-right { width: auto; }
  .map-hint { white-space: normal; max-width: 80%; text-align: center; }
  .inv-grid { gap: 3px; }
  .slot { min-height: 38px; font-size: 24px; }
  .eq-grid { grid-template-columns: repeat(7, 1fr); }
  .tree-col { width: 190px; }
  .map-info { width: 210px; font-size: 14px; }
  .map-legend { display: none; }
  .ptab .t { font-size: 12px; }
  .ptab { min-width: 54px; }
  .dlg-text { font-size: 17px; }
  .dlg-opts button { font-size: 16px; }
}
@media (max-height: 460px) {
  /* Ландшафт телефона: всё ниже и плотнее */
  body { font-size: 15px; }
  .hud-tl { width: 150px; } .hud-bar { margin-bottom: 1px; } .hud-bar .track { height: 10px; } .hud-bar .val { display: none; }
  .hud-minimap { width: 80px; height: 80px; } .hud-island { display: none; }
  .hud-compass { width: 220px; height: 24px; } .hud-time { font-size: 14px; margin-top: 2px; }
  body.touch .hud-msgs { bottom: auto; top: calc(48px + var(--sa-top)); }
  .hud-slot { width: 44px; height: 44px; font-size: 22px; } .hud-spell { width: 40px; height: 40px; font-size: 20px; }
  .hud-bottom { flex-direction: row; gap: 6px; bottom: calc(4px + var(--sa-bottom)); }
  .hud-msgs { bottom: calc(84px + var(--sa-bottom)); }
  .hud-msg { font-size: 15px; }
  .hud-hint { top: -18px; font-size: 13px; }
  .hud-tut { top: calc(56px + var(--sa-top)); padding: 4px 10px; max-width: 64vw; }
  .hud-tut .n { display: none; }
  .hud-tut .x { font-size: 14px; }
  body.touch .hud-tut { top: calc(126px + var(--sa-top)); }
  .hud-level { display: none; }
  .menu-box { padding: 8px 14px; max-height: calc(100vh - 8px); width: 600px; max-width: 96vw; }
  .menu-title { font-size: 28px; letter-spacing: 4px; } .menu-sub { margin: 4px 0 6px; font-size: 13px; }
  .menu-seed { margin-bottom: 4px; } .menu-seed input { min-height: 40px; padding: 6px 10px; }
  .menu-btns { flex-direction: row; flex-wrap: wrap; gap: 2px; overflow-y: auto; min-height: 0; }
  .menu-btns button { width: calc(50% - 8px); font-size: 17px; min-height: 44px; padding: 4px 8px; }
  .menu-foot button { min-height: 44px; }
  .menu-h { font-size: 20px; margin-bottom: 6px; }
  .set-row { font-size: 15px; margin-bottom: 2px; }
  .pbox { height: calc(100vh - 8px); max-height: none; }
  .phead { padding-top: 4px; } .ptab { min-height: 44px; } .ptab .t { display: none; } .ptab .i { font-size: 22px; }
  .pbody { padding: 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .inv-layout { flex-direction: row; }
  .inv-right { width: 230px; }
  .slot { min-height: 34px; font-size: 20px; }
  .eq-grid { grid-template-columns: repeat(4, 1fr); }
  .map-box { height: calc(100vh - 8px); }
  .dlg-box { max-height: calc(100vh - 8px); }
  .dlg-text { font-size: 16px; min-height: 40px; padding: 4px 12px; }
  .dlg-opts button { min-height: 40px; font-size: 16px; }
}
body.touch .tc-attack { background: conic-gradient(rgba(255, 204, 51, 0.9) var(--p, 0%), rgba(120, 20, 20, 0.6) 0); flex-direction: column; gap: 0; }
body.touch .tc-attack .tc-ico { font-size: calc(26px * var(--tc-s)); line-height: 1; filter: drop-shadow(1px 1px 0 #000); }
body.touch .tc-attack .tc-lbl { font-size: calc(11px * var(--tc-s)); letter-spacing: 0.5px; }
body.touch .tc-attack.tc-enemy { box-shadow: 0 0 0 3px #000, 0 0 0 6px #ff3a3a, 0 0 18px #ff3a3a; }
body.touch .tc-attack.tc-enemy .tc-lbl { color: #ffd0d0; }
@media (max-height: 460px) { .hud-quest, .hud-state, .hud-keys { display: none; } }
@media (pointer: coarse) {
  .hud-slot, .slot { cursor: default; }
  /* цели под палец не меньше 44px (хотбар на 360px шире не влезает — остаётся как есть) */
  button.small, .attr button, .map-ui button, .map-zoom button, .dlg-tabs button { min-height: 44px; min-width: 44px; }
  .hud-spell { width: 44px; height: 44px; }
}
