/* «Некрополис» — DOM-интерфейс. Все размеры в логических px сцены 1600×900; слой масштабируется через --k. */
@font-face { font-family: 'NecroTitle'; src: url('fonts/AlegreyaSC-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'NecroTitle'; src: url('fonts/AlegreyaSC-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'NecroText'; src: url('fonts/AlegreyaSans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'NecroText'; src: url('fonts/AlegreyaSans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --k: 1;
  --ink: #120d22; --panel: #221936; --panel2: #2c2145; --rim: #6d5a92; --rim2: #3b2e58; --rim-hi: #a48fd0;
  --text: #efe6ff; --dim: #b4a6d6; --soul: #6ff2e2; --heart: #ff5a73; --gold: #ffd27a; --dark: #c86bff; --poison: #8be04e; --bad: #ff6b6b;
  --title: 'NecroTitle', 'Alegreya SC', Georgia, 'Times New Roman', serif;
  --body: 'NecroText', 'Alegreya Sans', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #07050d; }
#stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform: scale(var(--k)); transform-origin: 0 0;
  font-family: var(--body); color: var(--text); user-select: none; -webkit-user-select: none; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui .pass { pointer-events: none; }
#dev { pointer-events: none; position: absolute; left: 10px; bottom: 8px; font: 12px ui-monospace, Menlo, monospace; color: #fff; background: #0008; padding: 5px 8px; border-radius: 6px; opacity: .55; white-space: pre; display: none; }
#flash { pointer-events: none; position: absolute; right: 12px; bottom: 10px; font: 600 13px sans-serif; color: #9f9; background: #000a; padding: 4px 10px; border-radius: 6px; opacity: 0; transition: opacity .6s; }

/* каменная панель с двойной рамкой (как плашки на референсе) */
.frame { background: linear-gradient(180deg, var(--panel2), var(--panel) 60%, #1b1430);
  border: 3px solid var(--rim); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--rim2), inset 0 2px 0 3px #ffffff10, 0 6px 14px #0009; border-radius: 6px; }
.btn { font-family: var(--title); font-weight: 700; color: var(--text); cursor: pointer; border: 3px solid var(--rim); border-radius: 6px;
  background: linear-gradient(180deg, #3a2c5c, #251b3d); box-shadow: 0 0 0 2px var(--ink), inset 0 2px 0 #ffffff1c, 0 4px 0 #0c0818;
  transition: transform .06s, filter .12s; text-shadow: 0 2px 0 #0008; }
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 2px var(--ink), inset 0 2px 0 #ffffff1c, 0 2px 0 #0c0818; }
.btn.green { border-color: #3fb79c; background: linear-gradient(180deg, #1f5f57, #133c39); }
.btn.red { border-color: #b8536a; background: linear-gradient(180deg, #5a2233, #3a1522); }
.btn[disabled], .btn.off { filter: grayscale(.7) brightness(.6); cursor: default; }
.soul-ico { display: inline-block; width: 1em; height: 1.15em; vertical-align: -0.18em; background: radial-gradient(circle at 50% 70%, #e6fffb 0 18%, var(--soul) 30%, #1e8e86 62%, transparent 64%);
  clip-path: path('M8 1 C5 5 2 7 2 11 a6 6 0 0 0 12 0 C14 8 11 7 10 4 C9 6 9 7 8 7 C8 5 9 3 8 1Z'); transform-origin: 0 0; }
.heart-ico { color: var(--heart); }

/* верх */
#title { position: absolute; left: 612px; top: 2px; width: 340px; height: 52px; display: flex; align-items: center; justify-content: center;
  font: 700 34px var(--title); letter-spacing: 3px; color: #f2e6ff; text-shadow: 0 3px 0 #0009, 0 0 12px #b07cff55; pointer-events: none; }
#title::before, #title::after { content: '☠'; font-size: 20px; color: #cdb8ff; margin: 0 10px; opacity: .8; }
#title { overflow: hidden; white-space: nowrap; }
#title.narrow::before, #title.narrow::after { display: none; }
#title.tiny .nm { display: none; }
#title .pz { display: none; }
/* пауза (без меню): на месте заголовка — метка «Пауза», по краю экрана — золотая рамка; кнопки действий серые */
#ui.paused #title .nm { display: none; }
#ui.paused #title .pz { display: inline; color: var(--gold); letter-spacing: 6px; text-shadow: 0 3px 0 #0009, 0 0 18px #ffd27aaa; animation: pz 1.6s ease-in-out infinite; }
#ui.paused #title::before, #ui.paused #title::after { content: '❚❚'; color: var(--gold); font-size: 22px; letter-spacing: -2px; }
@keyframes pz { 50% { opacity: .55; } }
#ui.paused::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 4px; box-shadow: inset 0 0 0 3px #ffd27a99, inset 0 0 40px #ffd27a33; }
#ui.paused #panel :is(.tb, .perk, .move, .sell, .merge, .mgo, .batch-open, .tier, .batch-buy), #ui.paused #cards .card, #ui.paused #wavebtn, #ui.paused #grim .gb, #ui.paused #relics .rcard
  { filter: grayscale(.75) brightness(.6); cursor: not-allowed; animation: none; }
.pnote { margin-top: 7px; padding: 4px 8px; border: 2px solid #a8884a; border-radius: 5px; background: #2b2032; font: 700 14px/1.25 var(--body); color: var(--gold); }
#stats { position: absolute; right: 12px; top: 6px; display: flex; gap: 8px; align-items: stretch; }
/* скорость ×1 ×2 ×4 — три сомкнутых переключателя, активный подсвечен */
#speeds { display: flex; }
#speeds .sp { width: 40px; height: 44px; padding: 0; font: 700 17px var(--title); border-radius: 0; margin-left: -3px; color: var(--dim); }
#speeds .sp:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
#speeds .sp:last-child { border-radius: 0 6px 6px 0; }
#speeds .sp.on { position: relative; z-index: 1; border-color: var(--soul); color: #eafffb; background: linear-gradient(180deg, #2a8076, #164a46); text-shadow: 0 0 8px #6ff2e2aa; }
#seedbox { position: absolute; left: 12px; top: 6px; height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px; font: 700 19px var(--title); letter-spacing: 1px; color: var(--dim); white-space: nowrap; }
#seedbox span { color: var(--text); }
#stats .box { height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px; font: 700 22px var(--title); white-space: nowrap; }
#stats .box.wave { font-size: 19px; letter-spacing: 1px; }
#stats .box.souls { color: var(--soul); min-width: 112px; justify-content: center; }
#stats .box.hp { color: #ffe3e8; min-width: 90px; justify-content: center; }
#stats .box.hp.hurt { animation: hurt .45s; }
@keyframes hurt { 0%,100% { transform: none; } 20% { transform: translateX(-6px); background: #5a1a2a; } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
#stats .box.souls.gain { animation: gain .3s; }
@keyframes gain { 50% { transform: scale(1.08); filter: brightness(1.4); } }
#stats .ibtn { width: 44px; height: 44px; padding: 0; font-size: 20px; display: flex; align-items: center; justify-content: center; }
#stats .ibtn.on { border-color: var(--soul); color: var(--soul); }
#stats #b-pause.on { border-color: var(--gold); color: var(--gold); }
#stats #b-pause.on::before { content: ''; margin-left: 4px; border-left: 15px solid currentColor; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }

/* кнопка волны у ворот */
#wavebtn { position: absolute; left: 14px; top: 150px; width: 190px; height: 64px; padding: 6px 8px 7px; text-align: center; }
#wavebtn .l1 { font: 700 19px var(--title); }
#wavebtn .l2 { font: 15px var(--body); color: var(--dim); margin-top: 2px; }
#wavebtn.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--ink), 0 0 22px 4px #6ff2e2aa, inset 0 2px 0 #ffffff1c; } }
#wavebtn.hidden { display: none; }
#wave-losses { position: absolute; left: 14px; top: 62px; width: 198px; z-index: 3; font: 17px/1.2 var(--body); }
#wave-losses summary { padding: 6px 8px; cursor: pointer; color: var(--dim); }
#wave-losses summary strong, #wave-losses .breakdown b { color: var(--bad); }
#wave-losses summary span { display: block; }
#ui:has(.overlay.show) #wave-losses { visibility: hidden; }
#wave-losses .breakdown { position: absolute; left: 100%; top: -3px; margin-left: 7px; padding: 7px 10px; white-space: nowrap; }
#wave-losses .breakdown div { display: flex; justify-content: space-between; gap: 12px; }
#waveplate { position: absolute; left: 14px; top: 150px; width: 190px; height: 64px; padding: 8px 8px 7px; text-align: center; display: none; opacity: .9; }
#waveplate.show { display: block; }
#waveplate .l1 { font: 700 19px var(--title); color: var(--gold); }
#waveplate .l2 { font: 15px var(--body); color: var(--dim); margin-top: 2px; white-space: nowrap; }
/* автоплей — узкий переключатель справа от кнопки волны, в той же неигровой зоне (MAP.keepout) */
#autobtn { position: absolute; left: 210px; top: 150px; width: 42px; height: 64px; padding: 2px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--dim); }
#autobtn .ic { font: 700 21px/1 var(--body); }
#autobtn .tx, #autobtn .st { font: 700 10px/1.1 var(--title); letter-spacing: .5px; }
#autobtn.on { border-color: var(--soul); color: var(--soul); background: linear-gradient(180deg, #1f5f57, #133c39); text-shadow: 0 0 8px #6ff2e288; }

/* карточки строительства: все типы помещаются в зону интерфейса низа слева (8 клеток, MAP.keepout) */
#cards { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; padding: 8px 10px; }
.card { width: min(88px, calc((472px - (var(--n, 4) - 1) * 6px) / var(--n, 4))); height: 118px; position: relative; padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; cursor: pointer;
  border: 3px solid var(--rim); border-radius: 6px; background: linear-gradient(180deg, #2f2449, #1d1531); box-shadow: inset 0 0 0 2px var(--rim2); }
.card .pic { position: absolute; left: 0; right: 0; top: 5px; height: 52px; display: flex; align-items: flex-end; justify-content: center; }
.card .pic img { max-height: 52px; max-width: 74px; image-rendering: auto; filter: drop-shadow(0 3px 2px #0008); }
.card .rl { font: 11px/1.05 var(--body); color: var(--dim); white-space: nowrap; margin: 1px 0 1px; }
.card .pic .ph { width: 38px; height: 52px; border-radius: 4px 4px 8px 8px; }
.card .nm { font: 700 15px var(--title); letter-spacing: 0.5px; }
.card .pr { font: 700 16px var(--title); color: var(--soul); }
.card .key { position: absolute; left: 5px; top: 3px; font: 12px var(--body); color: var(--dim); opacity: .8; }
/* больше пяти типов башен: карточки уже, подписи мельче — полоса остаётся в своей зоне (8 клеток слева внизу) */
#cards.many .card { padding: 4px 2px 6px; }
#cards.many .card .pic img { max-width: 52px; max-height: 48px; }
#cards.many .card .nm { font-size: 10.5px; letter-spacing: 0; }
#cards.many .card .pr { font-size: 13px; white-space: nowrap; }
#cards.many .card .key { left: 3px; top: 2px; font-size: 10px; }
.card:hover { filter: brightness(1.2); }
.card.armed, .card.can.target { border-color: var(--soul); box-shadow: inset 0 0 0 2px var(--rim2), 0 0 14px #6ff2e288; }
.card.poor .pr { color: var(--bad); }
.card.poor { filter: saturate(.5) brightness(.75); }
.card .lock { display: none; position: absolute; right: 6px; top: 4px; font-size: 16px; }
.card.locked { filter: grayscale(1) brightness(.55); }
.card.locked .lock { display: block; }
.card.locked .pr { visibility: hidden; }

/* панель клетки и башни: место подбирает ui.js (placePanel) — рядом с клеткой, мимо дороги и плашек */
#panel { position: absolute; left: 12px; top: 60px; width: 276px; padding: 8px 10px 10px; display: none; }
#panel.show { display: block; }
#panel.moving { width: 250px; }
#panel .x { position: absolute; right: 5px; top: 5px; width: 26px; height: 26px; padding: 0; font: 700 16px var(--body); }
#panel .hd { display: flex; gap: 8px; align-items: center; padding-right: 26px; }
#panel .hd .pic { width: 38px; height: 46px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
#panel .hd .pic img { max-width: 38px; max-height: 46px; }
#panel .nm { font: 700 19px var(--title); letter-spacing: 1px; }
#panel .lv { margin-top: 1px; font: 700 12px var(--title); letter-spacing: .5px; color: var(--text); white-space: nowrap; }
#panel .lv .dt { font: 12px var(--body); letter-spacing: 0; color: var(--dim); }
#panel .st { margin: 5px 0 2px; font: 13px/1.25 var(--body); color: var(--dim); display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
#panel .st div { display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; }
#panel .st b { color: var(--text); font-weight: 700; }
#panel .desc { font: 14px/1.3 var(--body); color: var(--dim); margin: 6px 0 4px; }
#panel .tracks { margin: 6px 0 2px; display: flex; flex-direction: column; gap: 3px; }
#panel .tr { display: flex; align-items: center; gap: 4px; }
#panel .tn { width: 80px; flex: none; font: 700 12.5px var(--title); white-space: nowrap; }
#panel .tn .key { display: inline-block; width: 12px; font: 10px var(--body); color: var(--dim); }
#panel .pips { flex: 1; display: flex; gap: 2px; min-width: 0; }
#panel .pips i { width: 6px; height: 11px; border-radius: 2px; background: #140e22; box-shadow: inset 0 0 0 1px var(--rim2); }
#panel .pips.c6, #panel .pips.c7, #panel .pips.c8 { gap: 1px; } #panel .pips.c6 i, #panel .pips.c7 i, #panel .pips.c8 i { width: 5px; }
#panel .tr.dmg .pips i.on { background: #ff6b57; } #panel .tr.range .pips i.on { background: #73c7ff; } #panel .tr.rate .pips i.on { background: #ffd65a; }
#panel .tb { width: 112px; flex: none; height: 26px; padding: 0 4px; font: 700 12px var(--title); white-space: nowrap; }
#panel .tb .pr, #panel .perk .pr { color: var(--soul); }
#panel .tb.poor .pr, #panel .perk.poor .pr { color: var(--bad); }
#panel .batch-open { width: 100%; min-height: 24px; margin: 2px 0; padding: 1px 4px; font: 700 14px var(--body); }
#panel .batch-track { margin-top: 8px; }
#panel .batch-label { font: 700 15px var(--body); color: var(--text); }
#panel .batch-label span { color: var(--dim); font-weight: 400; }
#panel .tiers, #panel .batch-actions { display: flex; gap: 3px; margin-top: 3px; }
#panel .tier { flex: 1; min-width: 0; height: 32px; padding: 0; font: 700 17px var(--body); }
#panel .tier[aria-pressed="true"] { border-color: var(--soul); color: var(--soul); background: #183335; }
#panel .tier:disabled, #panel .batch-buy:disabled { opacity: .55; cursor: default; }
#panel .batch-balance { margin-top: 10px; font: 700 15px var(--body); color: var(--soul); }
#panel .batch-balance.bad { color: var(--bad); }
#panel .batch-actions .btn { padding: 2px 8px; min-height: 32px; font: 700 15px var(--body); }
#panel .batch-actions .batch-buy { flex: 1; }
#panel .ph { margin-top: 5px; font: 700 12px var(--title); letter-spacing: 1px; color: var(--text); }
#panel .ph .why { color: var(--gold); letter-spacing: 0; font-weight: 400; font-family: var(--body); }
#panel .ph .ok { color: var(--soul); letter-spacing: 0; font-weight: 400; font-family: var(--body); }
/* перки: на кнопке имя, что делает (одной строкой), значок и цена — три перка сравниваются без наведения */
#panel .perks { display: flex; gap: 4px; margin: 3px 0 2px; }
#panel .perk { flex: 1; min-width: 0; min-height: 54px; padding: 2px 2px; font: 700 10.5px/1.1 var(--title); letter-spacing: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center; }
#panel .perk .pa { font: 10.5px/1.1 var(--body); color: #d8ccf0; white-space: nowrap; text-shadow: none; }
#panel .perk .pf { display: flex; align-items: center; gap: 4px; font-size: 10.5px; }
#panel .perk .ic { font-size: 13px; line-height: 1; }
#panel .perk.chosen .pa { color: var(--gold); }
#panel .perk.chosen { border-color: var(--gold); color: var(--gold); filter: none; }
#panel .perk.locked { filter: grayscale(.8) brightness(.55); }
#panel .mg { display: flex; gap: 6px; margin-top: 5px; }
#panel .mg .btn { flex: 1; height: 28px; padding: 0 4px; font: 700 12.5px var(--title); white-space: nowrap; }
#panel .mvx { width: 100%; height: 30px; margin-top: 6px; font: 700 13px var(--title); }
#panel .mv { color: var(--soul); font-size: 13px; }
#panel .note { font: 14px/1.3 var(--body); color: var(--dim); }
#panel .bonus { margin-top: 6px; padding: 4px 8px; font: 700 15px/1.3 var(--body); border-left: 3px solid currentColor; background: #1a1229; }
#panel .bonus.mound { color: #ffb04f; }
#panel .bonus.well { color: var(--soul); }
#panel .bonus.cursed { color: #ff5a78; }
#panel .prices b.poor { color: var(--bad); }
#panel .prices b.up, .card .pr.up { color: #ff5a78; }
#panel .prices s.was { margin-right: 6px; color: var(--dim); }
#panel .prices .lk { opacity: .6; }
/* меню постройки: по строке на башню — имя, роль, цена */
#panel .st.prices { grid-template-columns: 1fr; row-gap: 1px; }
#panel .prices div { display: grid; grid-template-columns: 62px 1fr auto; gap: 6px; }
#panel.buildm { width: 330px; }
#panel .prices div i { font: 12px/1.3 var(--body); font-style: normal; color: var(--dim); white-space: normal; }
#panel .prices div span:first-child { color: var(--text); font: 700 12px/1.4 var(--title); }
#panel .role { margin: 3px 0 0; font: 13px/1.25 var(--body); color: var(--gold); }
#tip .full { margin: -2px 0 4px; font: 14px/1.3 var(--body); color: var(--gold); }
#panel .note.aura { margin-top: 6px; color: #ff7a88; }
#panel .note.aura b { color: #ffb0b8; }
/* слияние: имя гибрида, строка примеси, недействующие перки, кнопка и превью */
#panel .nm.hy { font-size: 15px; letter-spacing: .5px; white-space: nowrap; }
#panel .mixl { margin: 5px 0 2px; padding: 2px 6px; font: 13px/1.3 var(--body); border-left: 3px solid currentColor; background: #1a1229; }
#panel .mixl .ic { font-size: 14px; }
#panel .mixl i { color: var(--bad); font-style: normal; }
#panel .perk.dead .pn { text-decoration: line-through; }
#panel .merge { width: 100%; height: 28px; margin-top: 6px; padding: 0 4px; font: 700 12.5px var(--title); white-space: nowrap; }
#panel .pls { margin: 3px 0; font: 12.5px/1.3 var(--body); color: var(--soul); }
#panel .pls .dead { color: var(--bad); text-decoration: line-through; }
#panel .note.mgn { margin-top: 5px; font-size: 13px; }
#panel .mgo .pr { color: var(--soul); } #panel .mgo.poor .pr { color: var(--bad); }
#tip .row.bad { color: var(--bad); }
#panel .boost { margin: 4px 0 2px; padding: 2px 6px; font: 700 12.5px/1.3 var(--body); color: #ff7a88; border-left: 3px solid currentColor; background: #2a1020; white-space: nowrap; }

/* тултип */
#tip { position: absolute; max-width: 300px; padding: 10px 12px; font: 15px/1.35 var(--body); display: none; pointer-events: none; z-index: 5; }
#tip.show { display: block; }
#tip h4 { margin: 0 0 4px; font: 700 18px var(--title); }
#tip .row { color: var(--dim); }
#tip .row b { color: var(--text); }

/* тосты и подсказки обучения */
/* тосты: по одному, в верхней полосе на месте заголовка (ui.js: очередь) — поле, панели и разведку не закрывают */
#toasts { position: absolute; left: 560px; width: 440px; top: 2px; height: 52px; display: flex; justify-content: center; align-items: center; pointer-events: none; }
.toast { position: absolute; max-width: 440px; height: 50px; padding: 3px 18px; display: flex; flex-direction: column; justify-content: center; font: 700 19px/1.1 var(--title); letter-spacing: 1px; text-align: center; white-space: nowrap; animation: tin .25s ease-out; }
.toast.big { font-size: 22px; border-color: var(--soul); }
.toast.boss { border-color: #e0566f; color: #ffd9df; }
.toast small { display: block; font: 13px/1.15 var(--body); letter-spacing: 0; color: var(--dim); margin-top: 1px; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes tin { from { opacity: 0; } }   /* без сдвига: тост в верхней полосе не выходит за край экрана */
#ui.toasting #title { visibility: hidden; }
#coach { position: absolute; max-width: 320px; padding: 10px 14px; font: 16px/1.35 var(--body); border-color: var(--soul); display: none; pointer-events: none; animation: bob 1.6s ease-in-out infinite; }
#coach.show { display: block; }
@keyframes bob { 50% { transform: translateY(-5px); } }
/* подсказка обучения указывает на цель: линия со стрелкой от подсказки и пульсирующая рамка вокруг цели */
#coach-arrow { position: absolute; height: 6px; display: none; transform-origin: 0 50%; pointer-events: none;
  background: linear-gradient(90deg, #6ff2e200, #6ff2e2 30%); border-radius: 3px; filter: drop-shadow(0 0 4px #6ff2e2aa); }
#coach-arrow::after { content: ''; position: absolute; right: -4px; top: -6px; border-left: 14px solid var(--soul); border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
#coach-arrow.show, #coach-ring.show { display: block; }
#coach-ring { position: absolute; display: none; pointer-events: none; border: 3px solid var(--soul); border-radius: 8px; box-shadow: 0 0 14px #6ff2e2aa, inset 0 0 12px #6ff2e255; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 50% { opacity: .45; transform: scale(1.06); } }

/* оверлеи: меню, пауза, финал, новый враг */
.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #0c071899 0%, #07040fdd 75%); }
.overlay.show { display: flex; }
.overlay .box { width: 560px; padding: 26px 34px 30px; text-align: center; }
.overlay h1 { margin: 0; font: 700 72px var(--title); letter-spacing: 6px; color: #f3e8ff; text-shadow: 0 4px 0 #000a, 0 0 30px #b07cff88; }
.overlay h2 { margin: 0 0 6px; font: 700 40px var(--title); letter-spacing: 3px; }
.overlay p { font: 18px/1.45 var(--body); color: var(--dim); margin: 10px 0 18px; }
.overlay .col { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.overlay .col .btn { width: 300px; height: 54px; font-size: 22px; letter-spacing: 1px; }
.overlay .stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; text-align: left; width: 320px; margin: 8px auto 20px; font: 18px var(--body); color: var(--dim); }
.overlay .stats b { color: var(--text); text-align: right; }
#menu { background: linear-gradient(180deg, #07040f55, #07040fcc 80%); }
#menu .box { background: none; border: 0; box-shadow: none; width: 760px; }
#menu .sub { font: 20px var(--body); color: var(--dim); margin: 4px 0 30px; }
.overlay .col .btn.two { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.btn.two .l1 { font: 700 22px var(--title); line-height: 1.05; }
.btn.two .l2 { font: 15px var(--body); color: var(--dim); letter-spacing: 0; line-height: 1.1; }
#menu .seedrow { display: flex; gap: 12px; width: 300px; }
#menu .seedrow input { flex: 1; min-width: 0; height: 54px; padding: 0 14px; font: 700 22px var(--title); letter-spacing: 1px; color: var(--text);
  background: #120d22cc; border: 3px solid var(--rim2); border-radius: 6px; box-shadow: 0 0 0 2px var(--ink), inset 0 2px 6px #0008; outline: none;
  user-select: text; -webkit-user-select: text; }
#menu .seedrow input::placeholder { color: #8a7bab; font-weight: 400; }
#menu .seedrow input:focus { border-color: var(--rim-hi); }
#menu .col .seedrow .btn { width: 116px; flex: none; font-size: 19px; }
#menu .seednote { width: 380px; height: 22px; margin-top: -6px; font: 16px/22px var(--body); color: var(--dim); white-space: nowrap; }
#menu .seednote.bad { color: var(--bad); }
/* справка «Как играть»: темы слева, текст справа — окно влезает в 1280×720 */
#help { z-index: 20; }
#help .box { width: 880px; padding: 18px 24px 20px; text-align: left; }
#help h2 { text-align: center; margin-bottom: 12px; }
#help .hb { display: flex; gap: 18px; min-height: 340px; }
#help .ht { width: 210px; flex: none; display: flex; flex-direction: column; gap: 6px; }
#help .ht .btn { height: 42px; font-size: 17px; text-align: left; padding: 0 12px; white-space: nowrap; }
#help .ht .btn.on { border-color: var(--gold); color: var(--gold); }
#help .hc { flex: 1; min-width: 0; font: 17px/1.45 var(--body); color: var(--dim); }
#help .hc p { margin: 0 0 10px; font: inherit; color: inherit; }
#help .hc b { color: var(--text); }
#help .hroles { margin: 0 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; font-size: 15.5px; line-height: 1.3; }
#help .keys { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 12px; margin-bottom: 14px; font-size: 16px; align-items: baseline; }
#help .keys span { font: 700 15px var(--title); color: var(--gold); white-space: nowrap; }
#help .keys i { font-style: normal; }
#help .col { margin-top: 10px; }
#help .col .btn { width: 240px; height: 46px; font-size: 19px; }
.set { display: flex; align-items: center; justify-content: space-between; width: 340px; margin: 0 auto 14px; font: 18px var(--body); }
.set input[type=range] { width: 170px; accent-color: #8f6bd6; }
/* открытия: на экране итогов и экран открытий из меню */
#end .unlocks { margin: -6px auto 14px; width: 480px; }
/* поражение: кто отнял прочность склепа */
#end .leaks { margin: -8px auto 12px; width: 500px; }
#end .leaks .uh { font: 700 18px var(--title); letter-spacing: 1px; color: var(--bad); margin-bottom: 6px; }
#end .leaks .gl { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#end .leaks .lk { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 4px; border: 2px solid #6a2a3a; border-radius: 5px; background: #24121c; font: 15px var(--body); color: var(--text); white-space: nowrap; }
#end .leaks .lk .pic { width: 22px; height: 30px; display: flex; align-items: flex-end; justify-content: center; }
#end .leaks .lk .pic img { max-width: 22px; max-height: 30px; }
#end .leaks .lk b { color: var(--bad); font: 700 16px var(--title); }
.unlocks .uh, #meta .sh { font: 700 18px var(--title); letter-spacing: 1px; color: var(--gold); margin-bottom: 6px; }
.unlocks .gl { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.unlocks .got { padding: 4px 10px; border: 2px solid var(--rim2); border-radius: 5px; background: #1a1229; font: 15px/1.2 var(--body); color: var(--dim); }
.unlocks .got.new { border-color: var(--gold); color: var(--text); }
.unlocks .got small { display: block; font-size: 13px; color: var(--dim); }
.unlocks .got span { display: block; color: var(--text); }
.unlocks .try { display: block; margin: 4px auto 0; padding: 3px 9px; font: 700 15px var(--body); color: var(--text); }
#end > .box { max-height: 96%; overflow-y: auto; }
#end .box :is(.leaks, .unlocks, .stats) { max-width: 100%; }
#meta .box { width: 900px; padding: 18px 26px 22px; }
#meta h2 { margin-bottom: 10px; }
#meta .recs { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
#meta .recs div { flex: 1; padding: 5px 6px; border: 2px solid var(--rim2); border-radius: 5px; background: #1a1229; }
#meta .recs span { display: block; font: 14px var(--body); color: var(--dim); white-space: nowrap; }
#meta .recs b { font: 700 22px var(--title); color: var(--soul); }
#meta .sh { margin: 8px 0 5px; text-align: left; }
#meta .sh i { font: 15px var(--body); font-style: normal; color: var(--dim); letter-spacing: 0; }
#meta .chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#meta .chips.relic { grid-template-columns: repeat(5, 1fr); }
#meta .chip { padding: 4px 6px; border: 2px solid var(--rim2); border-radius: 5px; background: #1a1229; text-align: left; font: 14px/1.2 var(--body); min-width: 0; }
#meta .chip b { display: block; font: 700 14px var(--title); color: var(--text); }
#meta .chip.on { border-color: #3fb79c; }
#meta .chip.off b { color: var(--dim); }
#meta .chip small { display: block; font-size: 12.5px; color: var(--gold); }
#meta .achs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px 10px; text-align: left; }
#meta .ach { font: 13px/1.2 var(--body); color: var(--dim); opacity: .75; min-width: 0; }
#meta .ach b { font: 700 13.5px var(--title); color: var(--dim); }
#meta .ach small { display: block; font-size: 12.5px; }
#meta .ach.on { opacity: 1; }
#meta .ach.on b { color: var(--soul); }
#meta .row2 { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
#meta .row2 .btn { width: 240px; height: 50px; font-size: 21px; }
#newenemy .box { width: 520px; }
#newenemy .pic { height: 120px; display: flex; align-items: flex-end; justify-content: center; margin: 6px 0 4px; }
#newenemy .pic img { max-height: 110px; image-rendering: auto; }
#newenemy .tags { font: 15px var(--body); color: var(--soul); margin-top: -6px; }
#newenemy .trait { margin: 8px auto 0; padding: 3px 8px; max-width: 440px; border: 2px solid #8a6a3a; border-radius: 5px; background: #2b2032; font: 15px/1.3 var(--body); color: var(--gold); }
#newenemy .box.boss { border-color: #e0566f; box-shadow: 0 0 0 2px var(--ink), 0 0 30px #e0566f66, inset 0 0 0 2px var(--rim2); }
#newenemy .box.boss h2 { color: var(--bad); }
#newenemy .bnote { color: #ffb0b8; font-size: 16px; margin: -8px 0 16px; }

body.inmenu #title { display: none; }

/* разведка (live/scout.js): строка в верхней полосе HUD — поле не закрывает; компактная панель раскрывается под полосой только
   в паузе, её левый край (left) выбирает scout.js там, где под ней меньше всего дороги */
#scout { position: absolute; left: 222px; top: 6px; height: 44px; max-width: 382px; padding: 0 12px; display: none; align-items: center; gap: 9px;
  font: 700 16px var(--title); letter-spacing: .5px; white-space: nowrap; cursor: pointer; }
#scout.show { display: flex; }
#scout.live { cursor: default; }
#scout .k { color: var(--dim); }
#scout .tr { color: var(--gold); }
#scout .bad { color: var(--bad); }
#scout .ar { color: var(--soul); }
#scout b { color: var(--soul); }
#scout .hunt-live, #scout-panel .hunt-result { color: var(--gold); }
#scout-panel .hunt-offer { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; border-top: 1px solid var(--rim2); margin-top: 4px; padding: 6px 2px 0; }
#scout-panel .hunt-offer > b:first-child { color: var(--gold); font: 700 16px var(--title); }
#scout-panel .hunt-offer > span { grid-column: 1 / -1; grid-row: 2; }
#scout-panel .hunt-offer .btn { padding: 3px 8px; color: var(--soul); font: 700 15px var(--body); }
#scout-panel .hunt-result { padding-top: 4px; }
#scout-panel { position: absolute; left: 222px; top: 58px; width: 384px; padding: 5px 8px 7px; display: none; font: 14px/1.2 var(--body); color: var(--dim); }
#scout-panel.show { display: block; }
#scout-panel .hd { display: flex; align-items: center; gap: 4px; }
#scout-panel .tt { flex: 1; text-align: center; font: 700 18px var(--title); letter-spacing: 1px; color: var(--text); white-space: nowrap; }
#scout-panel .tt small { font: 14px var(--body); letter-spacing: 0; color: var(--dim); }
#scout-panel .nav { width: 28px; height: 28px; padding: 0; font: 700 15px var(--body); }
#scout-panel .bossline { margin: 3px 0 0; padding: 2px 4px 3px; text-align: center; font: 700 17px var(--title); letter-spacing: 1px; color: var(--bad); background: #3a1220; border-radius: 4px; }
#scout-panel .bossline small { display: block; font: 13px var(--body); letter-spacing: 0; color: #ffb0b8; }
#scout-panel.boss, #scout.boss { border-color: #e0566f; box-shadow: 0 0 0 2px var(--ink), 0 0 18px #e0566f88, inset 0 0 0 2px #5a2233; }
#scout-panel .power { margin: 4px 0 2px; padding: 2px 7px; border: 2px solid #8a3a4a; border-radius: 5px; background: #2b1622; color: #ffb0b8; font-weight: 700; cursor: help; }
#scout-panel .trait { margin: 4px 0 2px; padding: 3px 7px; border: 2px solid #8a6a3a; border-radius: 5px; background: #2b2032; color: var(--text); cursor: help; }
#scout-panel .trait b { color: var(--gold); font-family: var(--title); }
#scout-panel .sq { display: grid; grid-template-columns: 1fr 42px repeat(4, 34px); gap: 0 3px; align-items: center; padding: 1px 0; border-top: 1px solid #ffffff14; }
#scout-panel .sq[data-tip] { cursor: help; }
#scout-panel .sq > span { text-align: right; font-weight: 700; color: var(--text); font-size: 13px; }
#scout-panel .sq.head { border: 0; padding: 2px 0 0; font-size: 13px; }
#scout-panel .sq.head > span { color: var(--dim); font-weight: 400; }
#scout-panel .who { display: flex; align-items: center; gap: 4px; min-width: 0; }
#scout-panel .who .pic { width: 20px; height: 24px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
#scout-panel .who .pic img { max-width: 20px; max-height: 24px; }
#scout-panel .who .nm { font-weight: 700; color: var(--text); white-space: nowrap; }
#scout-panel .who .nm .ab { font-style: normal; color: var(--gold); margin-left: 2px; }
#scout-panel .who .n { color: var(--soul); font-weight: 700; white-space: nowrap; }
#scout-panel .sq.boss .who .nm { color: var(--bad); }
#scout-panel .extra { margin-top: 1px; font-size: 13px; }
#scout-panel .tot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; margin-top: 3px; padding-top: 3px; border-top: 2px solid var(--rim2); }
#scout-panel .tot b { color: var(--text); }
#scout-panel .tot i { font-style: normal; color: var(--dim); margin-left: 3px; }
#scout-tip { position: absolute; max-width: 280px; padding: 6px 10px; font: 15px/1.3 var(--body); display: none; pointer-events: none; z-index: 5; }
#scout-tip.show { display: block; }

/* Гримуар (live/grimoire.js): окно поверх поля, игра идёт; клик по затемнению вокруг закрывает */
#grim { position: absolute; inset: 0; display: none; background: #07040f55; }
#grim.show { display: block; }
#grim .gwin { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); width: 560px; padding: 10px 16px 12px; }
#grim .x { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; padding: 0; font: 700 16px var(--body); }
#grim .hd { display: flex; align-items: baseline; gap: 14px; padding-right: 30px; }
#grim .tt { font: 700 28px var(--title); letter-spacing: 3px; color: var(--gold); }
#grim .sl { font: 700 20px var(--title); color: var(--soul); }
#grim .sec { margin: 8px 0 3px; font: 700 13px var(--title); letter-spacing: 1.5px; color: var(--dim); border-bottom: 2px solid var(--rim2); }
#grim .gl { display: flex; align-items: center; gap: 8px; height: 34px; }
#grim .ln { flex: 1; min-width: 0; font: 700 16px var(--title); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
#grim .sw { width: 10px; height: 14px; border-radius: 2px; flex: none; }
#grim .pips { width: 76px; flex: none; display: flex; gap: 3px; }
#grim .pips i { width: 12px; height: 13px; border-radius: 2px; background: #140e22; box-shadow: inset 0 0 0 1px var(--rim2); }
#grim .gl.dmg .pips i.on { background: #ff6b57; } #grim .gl.range .pips i.on { background: #73c7ff; } #grim .gl.rate .pips i.on { background: #ffd65a; }
#grim .cur { width: 46px; flex: none; text-align: right; font: 700 15px var(--title); color: var(--text); }
#grim .gb { width: 150px; flex: none; height: 28px; padding: 0 6px; font: 700 14px var(--title); white-space: nowrap; }
#grim .gb .pr { color: var(--soul); }
#grim .gb.poor .pr { color: var(--bad); }
#grim .note { margin-top: 8px; min-height: 20px; font: 15px/1.3 var(--body); color: var(--dim); }
#stats #b-grim { color: var(--gold); }
#panel .grim { margin-top: 3px; font: 13px/1.25 var(--body); color: var(--gold); }
#panel .grim b { color: var(--text); }
/* реликвии (live/relics.js): экран выбора одной из трёх и значки взятых под кнопкой волны */
#relics .box.rbox { width: 900px; padding: 22px 26px 22px; }
#relics .rsub { font: 18px var(--body); color: var(--dim); }
#relics .rcards { display: flex; gap: 16px; margin: 18px 0 12px; align-items: stretch; }
#relics .rcard { position: relative; flex: 1 1 0; min-width: 0; min-height: 250px; padding: 14px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
#relics .rcard.rule { border-color: var(--gold); }
#relics .rcard .key { position: absolute; left: 8px; top: 6px; font: 700 15px var(--title); color: var(--dim); }
#relics .rcard .ic { font: 46px/1.1 var(--body); color: var(--soul); text-shadow: 0 0 14px #6ff2e288; }
#relics .rcard.rule .ic { color: var(--gold); text-shadow: 0 0 14px #ffd27a88; }
#relics .rcard .rn { font: 700 22px/1.15 var(--title); letter-spacing: .5px; }
#relics .rcard .rk { font: 700 13px var(--title); letter-spacing: 1px; text-transform: uppercase; color: var(--soul); }
#relics .rcard.rule .rk { color: var(--gold); }
#relics .rcard .rd { font: 400 17px/1.35 var(--body); color: var(--text); text-shadow: none; margin-top: 4px; }
#relics .rnote { font: 15px var(--body); color: var(--dim); }
/* значки реликвий — медальоны, не похожие на кнопки интерфейса: ромб с рамкой цвета вида (цифры — бирюза, правило — золото) */
#relicbar { position: absolute; left: 14px; top: 218px; width: 240px; height: 38px; display: none; gap: 2px; }
#relicbar.show { display: flex; }
#relicbar .rl { position: relative; width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; cursor: default; }
#relicbar .rl::before { content: ''; position: absolute; inset: 5px; transform: rotate(45deg); border: 3px solid #3fb79c; border-radius: 4px;
  background: radial-gradient(circle, #1f5f57, #0f2624 75%); box-shadow: 0 0 0 2px var(--ink), 0 0 10px #6ff2e255; }
#relicbar .rl.rule::before { border-color: #c9a254; background: radial-gradient(circle, #5a4320, #241a0c 75%); box-shadow: 0 0 0 2px var(--ink), 0 0 10px #ffd27a55; }
#relicbar .rl.more::before { border-color: var(--rim); background: var(--panel); }
#relicbar .rl span { position: relative; font: 18px/1 var(--body); color: #c8fff6; text-shadow: 0 0 6px #6ff2e2; }
#relicbar .rl.rule span { color: #ffe7a8; text-shadow: 0 0 6px #ffd27a; }
#relicbar .rl.more span { font: 700 13px var(--title); color: var(--text); text-shadow: none; }
#relicbar .rl.hid { display: none; }
#relic-tip { position: absolute; max-width: 300px; padding: 8px 12px 10px; font: 15px/1.35 var(--body); display: none; pointer-events: none; }
#relic-tip.show { display: block; }
#relic-tip h4 { margin: 0 0 2px; font: 700 18px var(--title); }
#relic-tip h4 + div + h4, #relic-tip div + h4 { margin-top: 6px; }
#relic-tip .rk { font: 700 12px var(--title); letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
