/* ---------- рамки и фактуры (SVG data-uri, собраны скриптом; править как обычный CSS) ---------- */
:root {
  --fr-card: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23fbe7a1'/%3E%3Cstop offset='.5' stop-color='%23c8962f'/%3E%3Cstop offset='1' stop-color='%236e4812'/%3E%3C/linearGradient%3E%3ClinearGradient id='i' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%236e665b'/%3E%3Cstop offset='.5' stop-color='%233b352f'/%3E%3Cstop offset='1' stop-color='%231d1915'/%3E%3C/linearGradient%3E%3C/defs%3E %3Crect x='1' y='1' width='94' height='94' rx='4' fill='none' stroke='%230a0806' stroke-width='2'/%3E %3Crect x='3.5' y='3.5' width='89' height='89' rx='3' fill='none' stroke='url(%23i)' stroke-width='5'/%3E %3Crect x='7.5' y='7.5' width='81' height='81' fill='none' stroke='url(%23g)' stroke-width='1.4' opacity='.85'/%3E %3Cg id='c'%3E%3Cpath d='M1 1 H19 L15 5 H5 V15 L1 19Z' fill='url(%23g)' stroke='%233a2606' stroke-width='.8'/%3E%3Ccircle cx='9' cy='9' r='2.6' fill='url(%23g)' stroke='%233a2606' stroke-width='.8'/%3E%3C/g%3E%3Cuse href='%23c' transform='translate(96 0) scale(-1 1)'/%3E%3Cuse href='%23c' transform='translate(0 96) scale(1 -1)'/%3E%3Cuse href='%23c' transform='translate(96 96) scale(-1 -1)'/%3E%3C/svg%3E");
  --fr-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23fbe7a1'/%3E%3Cstop offset='.5' stop-color='%23c8962f'/%3E%3Cstop offset='1' stop-color='%236e4812'/%3E%3C/linearGradient%3E%3ClinearGradient id='i' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%236e665b'/%3E%3Cstop offset='.5' stop-color='%233b352f'/%3E%3Cstop offset='1' stop-color='%231d1915'/%3E%3C/linearGradient%3E%3C/defs%3E %3Crect x='1' y='1' width='94' height='94' rx='3' fill='none' stroke='%230a0806' stroke-width='2'/%3E %3Crect x='3.5' y='3.5' width='89' height='89' fill='none' stroke='url(%23g)' stroke-width='3'/%3E %3Crect x='7' y='7' width='82' height='82' fill='none' stroke='url(%23i)' stroke-width='3'/%3E %3Crect x='9.5' y='9.5' width='77' height='77' fill='none' stroke='url(%23g)' stroke-width='1'/%3E %3Cg id='c'%3E%3Cpath d='M0 0 H24 L18 6 H6 V18 L0 24Z' fill='url(%23g)' stroke='%233a2606' stroke-width='.8'/%3E%3Cpath d='M12 4 L20 12 L12 20 L4 12Z' fill='%23a01c14' stroke='url(%23g)' stroke-width='1.6'/%3E%3C/g%3E%3Cuse href='%23c' transform='translate(96 0) scale(-1 1)'/%3E%3Cuse href='%23c' transform='translate(0 96) scale(1 -1)'/%3E%3Cuse href='%23c' transform='translate(96 96) scale(-1 -1)'/%3E%3C/svg%3E");
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --bricks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.35' stroke-width='2'%3E%3Cpath d='M0 1 H120 M0 31 H120 M1 1 V31 M61 1 V31 M31 31 V60 M91 31 V60'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.05' stroke-width='1'%3E%3Cpath d='M0 3 H120 M0 33 H120'/%3E%3C/g%3E%3C/svg%3E");
  --parch-fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.03 .9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .12 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23p)'/%3E%3C/svg%3E");
}
/* Драконья Корона — оформление меню: тёмный камень, кованый металл, золото, пергамент.
   Разделы «бой», «выбор усиления», «Легион» переопределяет hud.css (владелец — агент геймплея). */
:root {
  --bg: #100d0a; --panel: #231d17; --panel2: #2e2720; --line: #4a3c2c;
  --gold: #e9c46a; --gold2: #c8962f; --gold3: #7a5216; --text: #f1e6cf; --muted: #b5a68c; --good: #7bd88a; --bad: #ff6b5e;
  --blue: #4aa3ff; --red: #ff5a5a;
  --ink: #3a2612; --parch1: #efdcae; --parch2: #cfae6c;
  --stone: linear-gradient(180deg, #2f2a24 0%, #221d18 55%, #1a1612 100%);
  --f-head: 'Cormorant SC', 'Philosopher', Georgia, serif;
  --f-body: 'Philosopher', system-ui, 'Segoe UI', Roboto, sans-serif;
  --f-logo: 'Ruslan Display', 'Cormorant SC', serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; min-height: 100dvh; color: var(--text); overscroll-behavior: none;
  background: #0b0907 var(--noise); font: 15px/1.38 var(--f-body); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
[hidden] { display: none !important; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- каркас: верхняя планка, экран, нижняя каменная панель ---------- */
#app { display: flex; flex-direction: column; height: 100%; min-height: 100dvh; max-width: 980px; margin: 0 auto; position: relative;
  background:
    radial-gradient(ellipse 120% 50% at 50% 0%, rgba(150, 80, 20, .28), transparent 70%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .8), transparent 60%),
    var(--noise), var(--bricks), linear-gradient(#1b1713, #110e0b);
  box-shadow: 0 0 40px #000; }
.orientation-lock{display:none;position:fixed;inset:0;z-index:1000;align-items:center;justify-content:center;padding:calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));background:radial-gradient(circle at 50% 35%,#3b3024f2,#100d0bf8 70%);text-align:center}
.orientation-lock__panel{display:flex;flex-direction:column;align-items:center;gap:8px;max-width:300px;padding:26px 28px;border:1px solid #b18a4f;border-radius:16px;background:linear-gradient(145deg,#3b3024,#17140f);box-shadow:inset 0 0 0 3px #20190d,0 18px 50px #000b;color:var(--text)}
.orientation-lock__icon{font-size:48px;line-height:1;color:var(--gold);text-shadow:0 0 18px #e9c46a88;animation:orientation-pulse 2s ease-in-out infinite}
.orientation-lock strong{font:700 25px/1.1 var(--f-head);color:#f4d58d}.orientation-lock small{color:var(--muted);font-size:13px}
@keyframes orientation-pulse{50%{transform:rotate(90deg) scale(1.08);filter:drop-shadow(0 0 8px #e9c46a)}}
@media (orientation:portrait){.orientation-lock{display:flex}#app,#battle,#td{visibility:hidden}}
@supports not (height:100dvh){html,body,#app{min-height:100vh}}
.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top)); position: relative; z-index: 2;
  background: var(--noise), linear-gradient(#4a4239, #2a241e 60%, #1c1814);
  border-bottom: 2px solid var(--gold2); box-shadow: 0 1px 0 #000, 0 4px 12px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.12); }
.bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 4px; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.acc { display: flex; gap: 8px; align-items: center; }
.acc-lvl { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font: 700 16px/1 var(--f-body);
  background: radial-gradient(circle at 35% 30%, #fff1b8, #e0ad48 45%, #8a5a16 100%); color: #2a1a06;
  box-shadow: 0 0 0 2px #2a1d0c, 0 0 0 4px #a07428, 0 2px 6px #000; text-shadow: 0 1px 0 rgba(255,240,190,.6); }
.vip { background: linear-gradient(#ffe27a, #e09a1a); color: #2a1a08; font: 700 12px var(--f-body);
  padding: 2px 8px; border-radius: 4px; box-shadow: 0 0 0 1px #5a3a08, inset 0 1px 0 #fff6c8; }
.logo { font: 18px/1 var(--f-logo); letter-spacing: 1px; text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  color: #f2cf73; text-shadow: 0 1px 0 #000, 0 2px 0 #4a2e08, 0 0 14px rgba(255, 170, 60, .35); }
.money { display: flex; gap: 6px; }
.res { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px; font-size: 15px; border-radius: 4px;
  background: linear-gradient(#0e0b08, #1d1712); box-shadow: inset 0 2px 4px #000, 0 0 0 1px #6b5226, 0 1px 0 rgba(255,255,255,.08); }
.res b { color: var(--gold); font-weight: 700; }
#screen { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 22px; -webkit-overflow-scrolling: touch; }

.tabs { display: grid; grid-template-columns: repeat(6, 1fr); position: relative; z-index: 2;
  padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  background: var(--noise), var(--bricks), linear-gradient(#3a332b, #221d18 40%, #15110e);
  border-top: 2px solid var(--gold2); box-shadow: 0 -1px 0 #000, 0 -6px 14px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,240,190,.18); }
.tabs button { background: none; padding: 4px 0 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative;
  color: #a8987c; border-radius: 6px; transition: transform .08s; }
.tabs button i { font-style: normal; font-size: 21px; line-height: 1.15; filter: saturate(.55) brightness(.8); }
.tabs button span { font: 600 11px var(--f-body); letter-spacing: .2px; }
.tabs button:active { transform: translateY(1px); }
.tabs button.on { color: #ffe39a; background: radial-gradient(ellipse at 50% 40%, rgba(233, 196, 106, .28), transparent 70%);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.65), inset 0 0 0 1px rgba(233,196,106,.45); }
.tabs button.on i { filter: none; transform: scale(1.08); }
.tabs button.on::before { content: ''; position: absolute; top: -9px; left: 50%; width: 10px; height: 10px; transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #fbe7a1, #a07428); box-shadow: 0 0 0 1px #2a1d0c; }

/* ---------- типографика ---------- */
h2 { margin: 0 0 10px; font: 700 25px/1.1 var(--f-head); color: var(--gold); letter-spacing: .5px;
  text-shadow: 0 1px 0 #000, 0 2px 0 #3a2406, 0 0 16px rgba(240, 170, 60, .2); }
h3 { margin: 18px 0 8px; font: 700 18px/1.15 var(--f-head); color: #d9bf86; text-shadow: 0 1px 0 #000; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.sect { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; color: #d9bf86; font: 700 17px var(--f-head); letter-spacing: 1px; }
.sect::before, .sect::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--gold2)); }
.sect::after { background: linear-gradient(90deg, var(--gold2), transparent); }
.sect span::before, .sect span::after { content: '◆'; font-size: 9px; color: var(--gold2); margin: 0 8px; vertical-align: 2px; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 3px; font: 700 11px var(--f-body); vertical-align: 2px;
  background: #3a2f22; color: #e8d7b0; box-shadow: inset 0 0 0 1px #6b5226; }
.tag.ult { background: linear-gradient(#8a2a10, #5a1606); color: #ffd7a0; box-shadow: inset 0 0 0 1px #e07a3a; }

/* ---------- панели: камень в кованой раме ---------- */
.card { position: relative; padding: 12px; margin-bottom: 12px; color: var(--text);
  background: var(--noise), var(--stone); background-clip: padding-box;
  border: 12px solid transparent; border-image: var(--fr-card) 24 / 12px stretch;
  box-shadow: 0 6px 14px rgba(0,0,0,.55); }
button.card { display: flex; width: 100%; text-align: left; }

/* ---------- кнопки: золотые и каменные таблички ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 9px 16px; border-radius: 5px; font: 700 15px/1.15 var(--f-body); color: #2c1a05; letter-spacing: .2px;
  background: linear-gradient(180deg, #fff0b4 0%, #f0c968 22%, #d39d3c 50%, #b07a24 51%, #d6a44a 100%);
  border: 1px solid #4a2e08; text-shadow: 0 1px 0 rgba(255, 244, 200, .65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -2px 0 rgba(90,55,10,.55), 0 3px 0 #3a2406, 0 4px 8px rgba(0,0,0,.6);
  transition: transform .06s, box-shadow .06s, filter .1s; }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 2px 6px rgba(90,55,10,.6), 0 0 0 #3a2406, 0 1px 3px rgba(0,0,0,.6); }
.btn:disabled { filter: grayscale(1); opacity: .5; cursor: default; }
.btn.alt { color: #f0dfb8; text-shadow: 0 1px 0 #000;
  background: var(--noise), linear-gradient(180deg, #5c544a 0%, #3e3830 48%, #2b2620 52%, #37312a 100%);
  border-color: #0e0c0a; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 0 0 1px rgba(200,150,47,.35), 0 3px 0 #0b0907, 0 4px 8px rgba(0,0,0,.6); }
.btn.alt:active { box-shadow: inset 0 2px 6px rgba(0,0,0,.7), inset 0 0 0 1px rgba(200,150,47,.35); }
.btn.big { width: 100%; font-size: 20px; padding: 14px; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 4px; }
.btn.wide { width: 100%; }
.btn.go { font: 700 20px/1 var(--f-head); letter-spacing: 1px; padding: 12px 18px; color: #2a1404;
  background: linear-gradient(180deg, #fff4c4 0%, #ffd56a 25%, #e89a2a 52%, #c06a14 53%, #f0a640 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(120,50,0,.6), 0 3px 0 #4a1e02, 0 0 18px rgba(255,170,50,.45), 0 4px 10px rgba(0,0,0,.6);
  animation: goPulse 2.2s ease-in-out infinite; }
@keyframes goPulse { 50% { filter: brightness(1.12); } }

.chips { display: flex; gap: 8px; margin: 10px 0 12px; }
.chip { flex: 1; padding: 7px 4px; border-radius: 5px; font-size: 13px; line-height: 1.2; color: #e8d7b0;
  background: var(--noise), linear-gradient(#3a342c, #25201b); box-shadow: inset 0 0 0 1px #5a4630, 0 2px 0 #0b0907; }
.chip span { font-size: 11px; color: var(--muted); }
.chip.on { color: #2c1a05; background: linear-gradient(#ffe9a6, #d4a24a); box-shadow: inset 0 0 0 1px #6e4812, 0 0 10px rgba(233,196,106,.45), 0 2px 0 #3a2406; }
.chip.on span { color: #5a3a10; }

/* ---------- пергамент ---------- */
.parch { position: relative; color: var(--ink); padding: 14px 16px; margin: 0 0 12px; border-radius: 3px; font-size: 15px; line-height: 1.5;
  background: var(--parch-fiber), radial-gradient(ellipse at 50% 40%, var(--parch1) 0%, #e2c78e 60%, var(--parch2) 100%);
  box-shadow: inset 0 0 26px rgba(110, 70, 20, .55), inset 0 0 3px rgba(80,40,10,.6), 0 0 0 1px #6e4812, 0 4px 10px rgba(0,0,0,.6); }
.parch p { margin: 0 0 8px; } .parch p:last-child { margin-bottom: 0; }
.parch h3 { color: #5a2a0a; text-shadow: 0 1px 0 rgba(255,240,200,.6); margin: 2px 0 6px; font-size: 21px; }
.parch b { color: #6a2a08; }
.parch .muted, .parch small { color: #6a5434; }
.parch .motto { font-style: italic; text-align: right; color: #6a2a08; font-weight: 700; }
.drop::first-letter { float: left; font: 44px/0.9 var(--f-logo); color: #9a2a10; margin: 4px 6px 0 0; text-shadow: 0 1px 0 rgba(255,230,180,.7); }

/* ---------- портреты ---------- */
.portrait { width: 76px; height: 76px; object-fit: contain; display: block; margin: 0 auto 6px; border-radius: 50%;
  background: radial-gradient(circle at 50% 62%, #4a3a28, #17110c 75%);
  box-shadow: 0 0 0 2px #1a120a, 0 0 0 4px #c8962f, 0 0 0 5px #3a2606, 0 4px 10px rgba(0,0,0,.7), inset 0 0 12px #000; }
.portrait.big { width: 120px; height: 120px; margin-bottom: 8px; }
.portrait.xs { width: 34px; height: 34px; margin: 0; box-shadow: 0 0 0 1px #1a120a, 0 0 0 2px #c8962f; }
.power { font: 700 22px var(--f-head); color: #ffd668; margin: 4px 0 8px; text-shadow: 0 1px 0 #000, 0 0 10px rgba(255,200,80,.35); }
.power.sm { font-size: 17px; margin: 2px 0 6px; }

/* ---------- главный экран: зал героя ---------- */
.hall { display: grid; gap: 12px; }
.hall-hero { text-align: center; }
.throne { --hc: #e8833a; position: relative; height: 270px; overflow: hidden;
  border: 14px solid transparent; border-image: var(--fr-gold) 30 / 14px stretch;
  background: var(--noise), var(--bricks), linear-gradient(#2a241e, #15110d); background-clip: padding-box; box-shadow: 0 8px 18px rgba(0,0,0,.7); }
.throne::before { content: ''; position: absolute; left: 21%; right: 21%; top: 10px; bottom: 34px; border-radius: 999px 999px 0 0;
  background: radial-gradient(ellipse 70% 55% at 50% 72%, rgba(255, 190, 90, .35), transparent 70%), linear-gradient(#08060a, #1d140e);
  box-shadow: 0 0 0 7px #3b352f, 0 0 0 9px #c8962f, 0 0 0 11px #1a120a, inset 0 0 30px #000; }
.throne::after { content: ''; position: absolute; left: 50%; bottom: 40px; width: 220px; height: 200px; transform: translateX(-50%);
  background: radial-gradient(circle at 50% 60%, var(--hc), transparent 62%); opacity: .4; pointer-events: none; }
.flag { position: absolute; top: 0; width: 42px; height: 120px; z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 30%, transparent 70%, rgba(0,0,0,.35)), var(--hc);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); display: grid; place-items: center; font-size: 22px; filter: saturate(.8) brightness(.8); }
.flag::before { content: ''; position: absolute; inset: 4px 4px 22px; border: 1.5px solid rgba(255, 220, 140, .8); clip-path: inherit; }
.flag span { filter: drop-shadow(0 1px 1px #000); }
.flag.l { left: 4%; } .flag.r { right: 4%; }
.torch { position: absolute; top: 132px; width: 8px; height: 40px; background: linear-gradient(90deg, #3a2410, #7a4a20, #3a2410); border-radius: 2px; z-index: 1; }
.torch::before { content: ''; position: absolute; left: -6px; top: -4px; width: 20px; height: 8px; background: linear-gradient(#c8962f, #6e4812); border-radius: 2px; }
.torch i { position: absolute; left: 50%; bottom: 40px; width: 22px; height: 34px; transform: translateX(-50%); border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 75%, #fff7c0 0%, #ffcf4a 30%, #ff7a1a 62%, rgba(255, 60, 0, 0) 75%); animation: flicker 1.3s infinite alternate ease-in-out; transform-origin: 50% 100%; }
.torch i::after { content: ''; position: absolute; left: -30px; top: -20px; width: 82px; height: 82px; border-radius: 50%; background: radial-gradient(circle, rgba(255,150,40,.35), transparent 65%); }
.torch.l { left: 15%; } .torch.r { right: 15%; }
@keyframes flicker { 0% { transform: translateX(-50%) scale(1, 1); } 40% { transform: translateX(-52%) scale(.92, 1.08); } 70% { transform: translateX(-48%) scale(1.05, .94); } 100% { transform: translateX(-50%) scale(.97, 1.04); } }
.statue { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); background: none; padding: 0; z-index: 2; }
.statue img { display: block; height: 176px; filter: drop-shadow(0 6px 4px rgba(0,0,0,.8)) drop-shadow(0 0 14px rgba(255, 200, 120, .25)); }
.pedestal { position: absolute; left: 50%; bottom: 8px; width: 190px; height: 44px; transform: translateX(-50%); z-index: 1;
  background: var(--noise), linear-gradient(#6a625a, #3e3832 40%, #26221e); clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 2px 0 #c8962f; }
.pedestal::before { content: ''; position: absolute; left: 9%; right: 9%; top: 0; height: 4px; background: linear-gradient(90deg, #6e4812, #fbe7a1, #6e4812); }
.pedestal::after { content: ''; position: absolute; left: 50%; top: 13px; width: 16px; height: 16px; transform: translateX(-50%) rotate(45deg); background: linear-gradient(135deg, #fbe7a1, #8a5a16); box-shadow: 0 0 0 2px #1a120a; }
.nameplate { position: relative; margin: -10px auto 8px; max-width: 320px; padding: 8px 14px 6px; z-index: 3;
  background: var(--noise), linear-gradient(#3e372f, #221d18); border: 10px solid transparent; border-image: var(--fr-card) 24 / 10px stretch; background-clip: padding-box;
  box-shadow: 0 6px 12px rgba(0,0,0,.6); }
.nameplate b { display: block; font: 700 25px/1.05 var(--f-head); color: #ffe6a6; text-shadow: 0 1px 0 #000, 0 2px 0 #3a2406; }
.nameplate span { font-size: 13px; color: var(--muted); }
.nameplate q { display: block; font-style: italic; font-size: 13px; color: #d9bf86; margin-top: 2px; }
.nameplate .power { margin: 4px 0 0; }
.hall-btns { display: flex; gap: 8px; justify-content: center; margin-bottom: 4px; }
.crest { width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-size: 24px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4a3c2a, #17110c); box-shadow: 0 0 0 2px #1a120a, 0 0 0 4px #a07428, inset 0 0 10px #000; }
.rank b, .tut-card b, .lore-link b { font: 700 19px var(--f-head); color: #ffe6a6; }
.tut-card { background: var(--noise), linear-gradient(110deg, #3e2a12, #2a1d10 60%, #3a2410); animation: tutGlow 2.4s ease-in-out infinite; }
@keyframes tutGlow { 50% { box-shadow: 0 6px 14px rgba(0,0,0,.55), 0 0 18px rgba(233,196,106,.35); } }
.tut-card .btn { pointer-events: none; }
.lore-link .chev { font: 700 30px var(--f-head); color: var(--gold); }
.banner { background: var(--noise), linear-gradient(110deg, #5a2a0c, #9a4a16 60%, #c8862e); }
.banner b { color: #fff3c4; font-size: 16px; }

/* сцены-иллюстрации (SVG + спрайты игры) */
.scene { position: relative; overflow: hidden; background: #120d0a; }
.scene svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 22px rgba(0,0,0,.75); }
.scene .glow { animation: lavaGlow 2.6s ease-in-out infinite; }
@keyframes lavaGlow { 50% { opacity: .65; } }

/* карточки режимов */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.mode { position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; color: var(--text); min-width: 0;
  background: var(--noise), var(--stone); background-clip: padding-box; border: 10px solid transparent; border-image: var(--fr-card) 24 / 10px stretch;
  box-shadow: 0 6px 12px rgba(0,0,0,.55); transition: transform .08s; }
button.mode:active { transform: translateY(2px) scale(.99); }
.mode .scene { height: 92px; flex: none; }
.mode-txt { display: flex; flex-direction: column; gap: 2px; padding: 7px 8px 8px; flex: 1; }
.mode-txt small { font: 700 12px var(--f-head); color: #b0905a; letter-spacing: .6px; }
.mode-txt b { font: 700 20px/1.05 var(--f-head); color: #ffe39a; text-shadow: 0 1px 0 #000; }
.mode-txt span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.mode-txt .rec { color: #e8d7b0; margin-top: auto; padding-top: 4px; }
.mode .sub { display: flex; gap: 6px; padding: 0 8px 9px; }
.mode .sub .btn { flex: 1; }
.mode.main { grid-column: 1 / 3; border: 14px solid transparent; border-image: var(--fr-gold) 30 / 14px stretch; }
.mode.main .scene { height: 130px; }
.mode.main .mode-txt b { font-size: 25px; }
.go-tag { position: absolute; right: 8px; bottom: 10px; font: 700 17px var(--f-head); padding: 7px 16px; border-radius: 4px; color: #2a1404;
  background: linear-gradient(180deg, #fff4c4, #ffd56a 30%, #e89a2a 55%, #f0a640); box-shadow: inset 0 1px 0 #fff, 0 3px 0 #4a1e02, 0 0 14px rgba(255,170,50,.4); }
.train { overflow: hidden; }
.train > .scene { position: absolute; inset: 0; opacity: .38; }
.train-in { position: relative; display: flex; flex-direction: column; gap: 2px; }
.train-in b { font: 700 20px var(--f-head); color: #ffe39a; text-shadow: 0 1px 0 #000; }
.foot-row { margin-top: 6px; }

/* ---------- герои ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.hcard { text-align: center; padding: 10px 8px; margin: 0; display: flex; flex-direction: column; align-items: stretch; }
.hcard.sel { border-image: var(--fr-gold) 30 / 12px stretch; box-shadow: 0 0 16px rgba(233,196,106,.35), 0 6px 14px rgba(0,0,0,.55); }
.hcard.locked .portrait { filter: grayscale(.85) brightness(.65); }
.hc-face { background: none; padding: 2px 0; display: flex; flex-direction: column; align-items: center; color: inherit; }
.hc-face b { font: 700 17px/1.1 var(--f-head); color: #ffe6a6; }
.hc-face .muted { font-size: 12px; }
.sel-tag { position: absolute; top: -4px; left: -4px; z-index: 1; font: 700 11px var(--f-body); padding: 2px 8px; color: #2a1404;
  background: linear-gradient(#ffe9a6, #d4a24a); box-shadow: 0 2px 0 #3a2406; border-radius: 2px; }
.skl { display: flex; justify-content: center; gap: 3px; margin: 6px 0 8px; flex-wrap: wrap; }
.sk { width: 27px; height: 27px; padding: 0; display: grid; place-items: center; font-size: 17px; border-radius: 4px;
  background: radial-gradient(circle at 50% 40%, #3e3226, #15100b); box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #8a6a30, 0 2px 3px #000; }
.sk:active { transform: scale(.92); }
.sk.ult { box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #e07a3a, 0 0 8px rgba(255,120,40,.5); }
.sk.pas { border-radius: 50%; box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #6aa0c8, 0 2px 3px #000; }
.gear { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 8px; }
.gear .btn { padding: 5px 2px; font-size: 13px; line-height: 1.2; flex-direction: column; gap: 0; }
.gear .btn span { font-size: 10px; color: var(--muted); }
.tip { position: fixed; z-index: 60; padding: 10px 12px; font-size: 13px; line-height: 1.4; color: var(--ink); border-radius: 3px;
  background: var(--parch-fiber), radial-gradient(ellipse at 50% 40%, var(--parch1), var(--parch2));
  box-shadow: 0 0 0 1px #6e4812, 0 0 0 3px #2a1d0c, 0 0 0 4px #c8962f, 0 8px 18px rgba(0,0,0,.75); }
.tip b { font: 700 16px var(--f-head); color: #5a2a0a; }
.tip .facts span { background: rgba(90, 50, 10, .14); color: #4a2a0a; }

/* карточка героя */
.back { background: none; color: var(--gold); font: 700 17px var(--f-head); padding: 2px 0 8px; }
.hero-head { display: grid; grid-template-columns: 1fr; gap: 0; margin-bottom: 12px;
  border: 14px solid transparent; border-image: var(--fr-gold) 30 / 14px stretch; background: var(--noise), var(--stone); background-clip: padding-box; }
.hh-art .scene { height: 200px; }
.hh-txt { padding: 10px 12px 12px; text-align: center; }
.hh-txt h2 { font-size: 28px; margin-bottom: 2px; }
.hh-txt .power { margin: 6px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; margin-bottom: 4px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 4px; text-align: center;
  background: var(--noise), linear-gradient(#332c25, #1d1915); box-shadow: inset 0 0 0 1px #5a4630, inset 0 1px 0 rgba(255,255,255,.08), 0 2px 4px #000; }
.stat span { font-size: 18px; } .stat b { font: 700 19px var(--f-head); color: #ffe6a6; } .stat small { font-size: 11px; color: var(--muted); }
.skills-list { display: flex; flex-direction: column; gap: 10px; }
.skill-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; color: var(--ink); border-radius: 3px;
  background: var(--parch-fiber), radial-gradient(ellipse at 40% 30%, var(--parch1), #dcc088 70%, var(--parch2));
  box-shadow: inset 0 0 20px rgba(110,70,20,.45), 0 0 0 1px #6e4812, 0 4px 8px rgba(0,0,0,.55); }
.skill-row.is-ult { box-shadow: inset 0 0 20px rgba(150,50,10,.45), 0 0 0 2px #b0461a, 0 0 12px rgba(255,110,40,.35), 0 4px 8px rgba(0,0,0,.55); }
.skill-row.is-passive { background: var(--parch-fiber), radial-gradient(ellipse at 40% 30%, #e6e2c8, #c8c09a 70%, #a8a07a); }
.sk-ic { position: relative; flex: none; width: 54px; height: 54px; display: grid; place-items: center; font-size: 29px; border-radius: 5px;
  background: radial-gradient(circle at 50% 40%, #4a3a2a, #120d08); box-shadow: inset 0 0 0 2px #000, 0 0 0 3px #c8962f, 0 0 0 4px #3a2606, 0 3px 6px rgba(0,0,0,.6); }
.is-ult .sk-ic { box-shadow: inset 0 0 0 2px #000, 0 0 0 3px #e07a3a, 0 0 0 4px #3a1206, 0 0 12px rgba(255,120,40,.6); }
.is-passive .sk-ic { border-radius: 50%; box-shadow: inset 0 0 0 2px #000, 0 0 0 3px #7aa8c8, 0 0 0 4px #1a2a3a; }
.sk-ic em { position: absolute; right: -7px; bottom: -7px; min-width: 20px; height: 20px; padding: 0 4px; display: grid; place-items: center; border-radius: 10px;
  font: 700 12px var(--f-body); font-style: normal; color: #2c1a05; background: linear-gradient(#ffe9a6, #c8962f); box-shadow: 0 0 0 1px #3a2606; }
.sk-name { font: 700 19px/1.15 var(--f-head); color: #4a1e04; margin-bottom: 3px; }
.sk-desc { font-size: 14px; line-height: 1.42; margin-bottom: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px; }
.facts span { font-size: 12.5px; padding: 2px 7px; border-radius: 3px; background: rgba(60, 30, 5, .13); color: #3a2208; box-shadow: inset 0 0 0 1px rgba(110,70,20,.3); }
.facts span:first-letter { text-transform: uppercase; }
.facts i { font-style: normal; color: #1a5a12; font-weight: 700; }
.lvl-tab { margin-top: 8px; border-collapse: collapse; font-size: 12.5px; width: 100%; max-width: 380px; }
.lvl-tab th, .lvl-tab td { padding: 3px 6px; text-align: center; border: 1px solid rgba(110, 70, 20, .35); }
.lvl-tab th { font: 700 12px var(--f-body); color: #5a2a0a; background: rgba(110, 70, 20, .15); }
.lvl-tab td:first-child { font-weight: 700; color: #5a2a0a; }
.lvl-tab small { font-weight: 400; color: #7a5a34; }

/* ---------- гнездо, пропуск, магазин ---------- */
.nest-art { margin-bottom: 10px; border: 12px solid transparent; border-image: var(--fr-card) 24 / 12px stretch; }
.nest-art .scene { height: 150px; }
.egg-slot { display: flex; gap: 12px; align-items: center; }
.egg-ic { font-size: 34px; width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4a3c2a, #120d08); box-shadow: 0 0 0 2px #1a120a, 0 0 0 4px #8a6a30, inset 0 0 10px #000; }
.prog { height: 9px; background: #0a0806; border-radius: 2px; overflow: hidden; margin: 6px 0; box-shadow: inset 0 1px 3px #000, 0 0 0 1px #5a4630; }
.prog > div { height: 100%; background: linear-gradient(#ffe08a, #e0902a 60%, #b0601a); box-shadow: 0 0 8px rgba(255,170,60,.6); }
.rar-Обычный { color: #d0c8b8; } .rar-Редкий { color: #6fbcff; } .rar-Эпический { color: #c98aff; } .rar-Легендарный { color: #ffb43a; }
.pass-row { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.pass-lvl { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--f-head);
  background: radial-gradient(circle, #3a3028, #15100b); box-shadow: 0 0 0 2px #1a120a, 0 0 0 3px #5a4630; }
.pass-lvl.on { background: radial-gradient(circle at 35% 30%, #fff1b8, #e0ad48 50%, #8a5a16); color: #2a1a06; box-shadow: 0 0 0 2px #1a120a, 0 0 0 3px #c8962f, 0 0 8px rgba(233,196,106,.5); }
.pass-cell { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 46px; padding: 8px; font-size: 13px; border-radius: 4px;
  background: var(--noise), linear-gradient(#2e2721, #1d1915); box-shadow: inset 0 0 0 1px #4a3c2c, 0 2px 4px #000; }
.pass-cell.prem { background: var(--noise), linear-gradient(#3e2a12, #24180a); box-shadow: inset 0 0 0 1px #a07428, 0 2px 4px #000; }
.pass-cell.done { opacity: .45; }
.pack { text-align: center; position: relative; }
.pack .amt { font: 700 24px var(--f-head); color: var(--gold); margin: 4px 0 8px; }
.pack .tag { position: absolute; top: -6px; right: -6px; margin: 0; background: linear-gradient(#e04a3a, #9a1a10); color: #fff; box-shadow: 0 0 0 1px #3a0806; }
.bundle { background: var(--noise), linear-gradient(110deg, #3a2812, #24180a); }

/* ---------- летопись и «Как играть» ---------- */
.subtabs { margin-top: 2px; }
.lore-acts { margin: 0 0 14px; }
.chapter { margin-bottom: 18px; }
.ch-art { border: 12px solid transparent; border-image: var(--fr-card) 24 / 12px stretch; margin-bottom: -6px; position: relative; z-index: 1; }
.ch-art .scene { height: 150px; }
.ch-art.pic img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ch-num { font: 700 13px var(--f-head); color: #8a5a20; letter-spacing: 1.5px; text-transform: uppercase; }
.rules { margin: 6px 0 8px; padding-left: 0; list-style: none; }
.rules li { position: relative; padding-left: 20px; margin-bottom: 5px; font-size: 14px; line-height: 1.4; }
.rules li::before { content: '◆'; position: absolute; left: 3px; top: 1px; font-size: 10px; color: var(--gold2); }
.parch .rules li::before { color: #9a2a10; }
.howto { margin-bottom: 16px; }
.scheme { margin: 0 0 8px; border: 10px solid transparent; border-image: var(--fr-card) 24 / 10px stretch; background: #1a140e; }
.scheme svg { display: block; width: 100%; height: auto; font-family: var(--f-body); }

/* ---------- бой ---------- */
#battle { position: fixed; inset: 0; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 10; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.b-top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center;
  background: rgba(0,0,0,.55); padding: 4px 14px; border-radius: 12px; font-weight: 800; pointer-events: none; }
.b-top .k0 { color: var(--blue); font-size: 20px; } .b-top .k1 { color: var(--red); font-size: 20px; }
.b-hero { position: absolute; top: 8px; left: 10px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.b-lvl { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(#f6d47a, #b8862c); color: #2a1a08;
  display: grid; place-items: center; font-weight: 800; }
.b-bars { width: min(220px, 34vw); }
.b-hpbar { position: relative; height: 16px; background: rgba(0,0,0,.7); border-radius: 8px; overflow: hidden; }
.b-hpbar > div { height: 100%; background: linear-gradient(#7dff8f, #2fb24a); }
.b-hpbar span { position: absolute; inset: 0; font-size: 11px; text-align: center; line-height: 16px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.b-xpbar { height: 5px; background: rgba(0,0,0,.7); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.b-xpbar > div { height: 100%; background: #b388ff; }
.b-feed { position: absolute; top: 52px; left: 10px; font-size: 13px; pointer-events: none; text-shadow: 0 1px 3px #000; }
.b-feed div { background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 6px; margin-bottom: 3px; width: fit-content; }
.b-feed .good { color: #8dff9d; } .b-feed .bad { color: #ff8f86; }
.b-buff { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); background: rgba(160,60,10,.8); padding: 2px 10px;
  border-radius: 8px; font-size: 13px; display: none; pointer-events: none; }
.b-respawn { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; font-weight: 800;
  background: rgba(0,0,0,.6); padding: 10px 22px; border-radius: 14px; display: none; pointer-events: none; }
.b-skills { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 18px; display: grid;
  grid-template-columns: repeat(2, 68px); grid-template-rows: repeat(2, 68px); gap: 12px; }
.skill { position: relative; width: 68px; height: 68px; border-radius: 50%; background: rgba(40,28,16,.85); border: 3px solid var(--gold);
  font-size: 30px; display: grid; place-items: center; touch-action: none; }
.skill.ult { grid-column: 1 / 3; justify-self: center; width: 78px; height: 78px; border-color: #ff8a3a; font-size: 36px;
  box-shadow: 0 0 14px rgba(255,138,58,.5); }
.skill .cd { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 800; border-radius: 50%; }
.skill.cooling .cd, .skill.locked .cd { background: rgba(0,0,0,.65); }
.skill.locked .cd { font-size: 15px; }
.skill .key { position: absolute; bottom: -4px; right: -2px; font-size: 10px; background: #000; border-radius: 6px; padding: 0 4px; opacity: .6; }
.b-exit { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.5); width: 40px; height: 40px;
  border-radius: 50%; font-size: 18px; }
.b-hint { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255,255,255,.55);
  pointer-events: none; white-space: nowrap; animation: fade 1s 6s forwards; }
@keyframes fade { to { opacity: 0; } }
@media (max-height: 420px) {
  .b-skills { grid-template-columns: repeat(2, 58px); grid-template-rows: repeat(2, 58px); gap: 10px; bottom: 10px; }
  .skill { width: 58px; height: 58px; font-size: 26px; } .skill.ult { width: 66px; height: 66px; }
}

/* ---------- выбор усиления (Арена, Осада) ---------- */
.b-pick { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.65); z-index: 5; padding: 16px; }
.pick-title { font-size: 20px; font-weight: 800; color: var(--gold); margin-bottom: 14px; text-align: center; }
.pick-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pick-card { width: 150px; background: var(--panel); border: 2px solid var(--gold); border-radius: 14px; padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; touch-action: none; }
.pick-card .pick-ic { font-size: 34px; }
.pick-card span:last-child { font-size: 13px; color: var(--muted); }
@media (max-height: 420px) { .pick-card { width: 130px; padding: 8px 6px; } .pick-card .pick-ic { font-size: 26px; } }

/* ---------- Легион ---------- */
#td { position: fixed; inset: 0; background: #1a2416; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 10; }
#td-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.td-top { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: rgba(0,0,0,.55); padding: 6px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; pointer-events: none; width: fit-content; }
.td-top b { color: var(--gold); } .td-top .k0 b { color: var(--blue); } .td-top .k1 b { color: var(--red); }
.td-feed { top: auto; bottom: 10px; left: 10px; }
.td-side { position: absolute; right: 10px; bottom: 10px; width: 32%; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.td-label { font-size: 12px; color: var(--muted); }
.td-mercs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.td-merc { background: rgba(40,28,16,.9); border: 2px solid #c04ad0; border-radius: 10px; padding: 2px; display: flex; flex-direction: column;
  align-items: center; font-size: 11px; position: relative; touch-action: none; }
.td-merc img { width: 40px; height: 40px; }
.td-merc .inc { position: absolute; top: 2px; right: 4px; color: var(--good); font-weight: 700; }
.td-merc:disabled { opacity: .4; }
.td-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--gold); border-radius: 14px; padding: 12px; display: none; z-index: 6; }
.td-ph { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--gold); margin-bottom: 8px; }
.td-x { background: none; font-size: 18px; color: var(--muted); }
.td-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.td-unit { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 2px; display: flex; flex-direction: column;
  align-items: center; font-size: 11px; line-height: 1.2; }
.td-unit img { width: 48px; height: 48px; }
.td-unit span { color: var(--gold); }
.td-unit:disabled { opacity: .4; }


/* ---------- окно (modal): высота по экрану, содержимое прокручивается, кнопки всегда внизу ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 10, 0, .6), rgba(0, 0, 0, .86)); animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-box { display: flex; flex-direction: column; width: min(440px, 100%); text-align: center; position: relative;
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border: 16px solid transparent; border-image: var(--fr-gold) 30 / 16px stretch;
  background: var(--noise), linear-gradient(#2c261f, #1a1612); background-clip: padding-box; box-shadow: 0 12px 40px #000;
  animation: popIn .18s ease-out; }
@keyframes popIn { from { transform: scale(.94); opacity: 0; } }
.modal-box.wide { width: min(760px, 100%); }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px 12px 12px; }
.modal-body h2 { font-size: 27px; margin-top: 4px; }
.modal-body p { margin: 8px 0; }
.modal-foot { flex: none; display: flex; gap: 10px; justify-content: center; padding: 10px 10px 4px;
  border-top: 1px solid rgba(200, 150, 47, .45); box-shadow: 0 -8px 12px -8px rgba(0,0,0,.8); }
.modal-foot .btn { flex: 1 1 0; max-width: 240px; min-height: 44px; }
.modal-foot .btn.go { flex-grow: 1.6; }
.reward-list { display: flex; justify-content: center; gap: 16px; font-size: 19px; margin: 12px 0; flex-wrap: wrap; font-weight: 700; }
.result { font-size: 36px !important; letter-spacing: 2px; }
.result.win { color: #9ae88a; } .result.lose { color: #ff7a6a; }
.spinner { width: 54px; height: 54px; margin: 18px auto; border-radius: 50%; border: 4px solid #3a2f22; border-top-color: var(--gold); border-right-color: var(--gold2);
  animation: spin .9s linear infinite; box-shadow: 0 0 14px rgba(233,196,106,.3); }
@keyframes spin { to { transform: rotate(360deg); } }

/* окно перед боем */
.pre-head { position: relative; margin: -10px -12px 8px; }
.pre-head .scene { height: 120px; }
.pre-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; background: linear-gradient(transparent, rgba(10, 6, 2, .92)); }
.pre-title small { display: block; font: 700 13px var(--f-head); color: #d9b878; letter-spacing: 1px; }
.pre-title h2 { margin: 0; }
.modal-box .rules { text-align: left; margin: 4px 2px 10px; }
.teams { display: grid; grid-template-columns: 1fr; gap: 8px; }
.team { text-align: left; padding: 8px 10px; border-radius: 4px; border-left: 4px solid var(--blue);
  background: var(--noise), linear-gradient(90deg, rgba(40, 80, 140, .28), rgba(30, 25, 20, .9) 60%); box-shadow: inset 0 0 0 1px #3a3026; }
.team.red { border-left-color: var(--red); background: var(--noise), linear-gradient(90deg, rgba(150, 40, 30, .3), rgba(30, 25, 20, .9) 60%); }
.team-h { font: 700 15px var(--f-head); color: #e8d7b0; letter-spacing: .4px; }
.team .tm { margin-top: 6px; font-size: 14px; }
.modal-box .scene + h2 { margin-top: 10px; }
.modal-box > .modal-body > .scene { height: 110px; margin: -10px -12px 0; }

/* ---------- вступление (первый запуск) ---------- */
.intro { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; overflow: hidden; user-select: none; }
.intro .scene { position: absolute; left: 0; right: 0; top: 0; height: 68%; animation: kenburns 9s ease-out forwards; }
@media (orientation: landscape) { .intro .scene { height: 100%; } }
@keyframes kenburns { from { transform: scale(1.08); } to { transform: scale(1); } }
.intro .scene::after { box-shadow: inset 0 0 90px rgba(0,0,0,.9); }
.intro-txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px max(20px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: linear-gradient(transparent, rgba(0,0,0,.82) 32%, rgba(0,0,0,.94)); text-align: center; }
.intro-txt p { max-width: 640px; margin: 0 auto 14px; font: 400 21px/1.42 var(--f-body); text-shadow: 0 2px 4px #000; animation: rise .6s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.intro-title { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; font: 26px/1 var(--f-logo);
  color: #f2cf73; text-shadow: 0 2px 0 #000, 0 0 18px rgba(255,170,60,.5); pointer-events: none; }
.intro-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.intro-dots i { width: 8px; height: 8px; transform: rotate(45deg); background: #5a4630; }
.intro-dots i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.intro-row { display: flex; gap: 10px; justify-content: center; }
.intro-row .btn { min-width: 150px; }
.intro-skip { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 2; }
@media (orientation: landscape) and (max-height: 500px) {
  .intro-txt { padding-top: 30px; } .intro-txt p { font-size: 18px; margin-bottom: 8px; } .intro-title { font-size: 20px; }
}

/* ---------- обучение: подсказки поверх боя ---------- */
#tut { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.tut-panel { position: absolute; top: max(52px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(460px, 62vw); pointer-events: auto;
  padding: 9px 12px 9px; color: var(--ink); font-size: 14px; line-height: 1.38; border-radius: 3px;
  background: var(--parch-fiber), radial-gradient(ellipse at 50% 40%, var(--parch1), var(--parch2));
  box-shadow: inset 0 0 18px rgba(110,70,20,.5), 0 0 0 1px #6e4812, 0 0 0 3px #2a1d0c, 0 0 0 4px #c8962f, 0 8px 18px rgba(0,0,0,.7); animation: rise .3s ease-out; }
.tut-panel h4 { margin: 0 0 3px; font: 700 17px var(--f-head); color: #5a2a0a; }
.tut-panel .tut-n { float: right; font: 700 12px var(--f-body); color: #7a5a34; }
.tut-panel p { margin: 0; }
.tut-panel .tut-row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 7px; }
.tut-panel .btn { padding: 5px 10px; font-size: 13px; }
.tut-ring { position: absolute; border-radius: 50%; pointer-events: none; border: 3px solid #ffe08a;
  box-shadow: 0 0 0 4px rgba(255, 200, 80, .35), 0 0 22px 6px rgba(255, 200, 80, .55); animation: tutPulse 1s ease-in-out infinite; }
@keyframes tutPulse { 50% { transform: scale(1.12); opacity: .7; } }
.tut-arrow { position: absolute; width: 0; height: 0; pointer-events: none; }
.tut-arrow::before { content: '➜'; position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; display: grid; place-items: center;
  font-size: 40px; color: #ffd76a; text-shadow: 0 0 10px rgba(255,160,40,.9), 0 2px 0 #000; animation: tutNudge .8s ease-in-out infinite alternate; }
@keyframes tutNudge { to { translate: -8px 0; } }
.tut-zone { position: absolute; border: 3px dashed rgba(255, 224, 138, .8); border-radius: 18px; pointer-events: none; background: rgba(255, 224, 138, .07);
  display: grid; place-items: center; font: 700 16px var(--f-head); color: #ffe08a; text-shadow: 0 1px 2px #000; animation: tutPulse 1.4s ease-in-out infinite; }
.tut-done { color: #1a6a12; font-weight: 700; }

/* ---------- раскладки ---------- */
@media (min-width: 430px) { .logo { display: block; } }
@media (max-width: 429px) { .logo { display: none; } }
@media (max-width: 370px) {
  .tabs button span { font-size: 10px; } .tabs button i { font-size: 19px; }
  .res { padding: 3px 7px 3px 5px; font-size: 14px; }
}
/* широкий экран и альбомная ориентация: герой слева, испытания справа */
@media (min-width: 700px) {
  .hall { grid-template-columns: minmax(260px, 340px) 1fr; align-items: start; }
  .hall-hero { position: sticky; top: 0; }
  .hero-head { grid-template-columns: minmax(220px, 1fr) 1fr; align-items: center; }
  .hh-art .scene { height: 220px; }
  .modal-box.wide .teams { grid-template-columns: 1fr 1fr; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #screen { padding: 10px 12px 16px; }
  .bar { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .acc-lvl { width: 30px; height: 30px; font-size: 15px; }
  .tabs { padding-top: 3px; padding-bottom: max(3px, env(safe-area-inset-bottom)); }
  .tabs button { flex-direction: row; justify-content: center; gap: 6px; padding: 5px 0; }
  .tabs button i { font-size: 18px; }
  .tabs button.on::before { top: -6px; }
  .throne { height: 230px; } .statue img { height: 150px; }
  .torch { top: 100px; }
  .modal-box.wide { width: min(820px, 100%); }
  .modal-box { border-width: 12px; border-image-width: 12px; }
  .modal-body { padding: 6px 10px 8px; }
  .modal-body h2 { font-size: 23px; }
  .pre-head { margin: -6px -10px 6px; }
  .pre-head .scene { height: 72px; }
  .pre-title { padding-top: 10px; padding-bottom: 4px; }
  .modal-box .rules li { font-size: 13px; margin-bottom: 3px; }
  .teams { grid-template-columns: 1fr 1fr; }
  .team .tm { margin-top: 3px; }
  .modal-foot { padding-top: 6px; }
  .modal-foot .btn { min-height: 40px; }
  .btn.go { font-size: 18px; padding: 9px 16px; }
  .modal-box > .modal-body > .scene { height: 70px; margin: -6px -10px 0; }
}
@media (orientation: portrait) {
  .intro { background: radial-gradient(ellipse at 50% 30%, #2a1a12, #000 72%); }
  .intro .scene { top: 8%; height: min(58%, 110vw); }
  .intro-title { font-size: 21px; left: 16px; right: auto; top: max(20px, env(safe-area-inset-top)); }
}
.offers:empty { display: none; }
@media (min-width: 700px) { .offers.top { display: none; } }
@media (max-width: 699px) { .offers.side { display: none; } .throne { height: 244px; } .statue img { height: 156px; } .torch { top: 112px; } }
.nameplate { margin: -8px auto 8px; padding: 6px 10px 8px; }
.nameplate .power { margin: 2px 0 6px; }
.hall-btns { margin: 0; }
.intro .scene { -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
@media (orientation: landscape) and (max-height: 520px) {
  .pre-head { display: flex; align-items: stretch; background: rgba(0,0,0,.35); box-shadow: inset 0 -1px 0 rgba(200,150,47,.4); }
  .pre-head .scene { width: 190px; height: 76px; flex: none; }
  .pre-title { position: static; flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: left; padding: 4px 14px; background: none; }
}
.tut-panel.low { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); left: max(10px, env(safe-area-inset-left)); transform: none; width: min(300px, 38vw); }
@media (orientation: landscape) and (max-height: 520px) { .hh-art .scene { height: 170px; } .hh-txt h2 { font-size: 25px; } }

/* ---------- классы, роли, снаряжение (этап 1, 2026-11-03) ---------- */
.specs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 4px 0; }
.hh-txt .specs, .nameplate .specs { justify-content: flex-start; }
.spec { padding: 1px 7px; border-radius: 10px; font: 700 11px var(--f-body); border: 1px solid; white-space: nowrap; }
.spec-tank { color: #9fd0ff; border-color: #3d6f9a; background: rgba(40,80,130,.35); }
.spec-heal { color: #8ff0a0; border-color: #3a8a4a; background: rgba(30,100,50,.35); }
.spec-dps  { color: #ffb08a; border-color: #a0502a; background: rgba(130,50,20,.35); }
.cls-filter { flex-wrap: wrap; }
.cls-filter .chip { flex: 0 0 auto; padding: 6px 10px; }
.subtabs .chip { flex: 1; }
.prog.xp > div { background: linear-gradient(90deg, #6aa8ff, #b38cff); }
.muted.small, .small { font-size: 12px; }
.doll { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.slot { position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 8px; background: radial-gradient(#2a2016, #140e09); border: 2px dashed #5a4630; color: var(--muted); cursor: pointer; }
.slot .s-ic { font-size: 26px; opacity: .45; }
.slot small { font-size: 10px; line-height: 1.1; }
.slot.full { border: 2px solid var(--rc); box-shadow: inset 0 0 14px color-mix(in srgb, var(--rc) 45%, transparent), 0 0 8px color-mix(in srgb, var(--rc) 40%, transparent); color: var(--rc); }
.slot.full .s-ic { opacity: 1; }
.card.item { display: flex; gap: 10px; align-items: flex-start; border-left: 4px solid var(--rc); }
.it-ic { flex: 0 0 58px; height: 58px; display: flex; align-items: center; justify-content: center; font-size: 26px; border-radius: 6px;
  background: radial-gradient(color-mix(in srgb, var(--rc) 30%, #1a120b), #120c07); box-shadow: inset 0 0 0 2px var(--rc); }
.it-name { color: var(--rc); }
.it-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.facts .fx { color: #ffd27a; }
.drop { margin-top: 10px; text-align: left; }
.pass-card { width: 100%; text-align: left; }
.pass-card .chev { font: 700 30px var(--f-head); color: #ffe8c0; }
.doll { max-width: 420px; margin-left: auto; margin-right: auto; }
.card.item .facts span, .card .doll + p + .facts span { background: rgba(255, 220, 150, .08); color: #eadcbc; box-shadow: inset 0 0 0 1px rgba(233,196,106,.25); }
.card.item .facts span.fx, .card .facts span.fx { color: #ffd27a; }
.card.item .facts span:first-letter { text-transform: none; }

/* ---------- подземелья (этап 2, 2026-11-03) ---------- */
.dun-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
@media (max-width: 560px) { .dun-list { grid-template-columns: 1fr; } }
.dun-card { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 10px 10px; border-radius: 8px; text-align: left; cursor: pointer;
  color: var(--text); border: 2px solid #5a4630; background: linear-gradient(160deg, var(--dc1), var(--dc2)); box-shadow: inset 0 0 30px rgba(0,0,0,.55), 0 4px 10px rgba(0,0,0,.5); }
.dun-card.t-crypt { --dc1: #23302a; --dc2: #101612; --dcg: #7fd18a; }
.dun-card.t-fire  { --dc1: #3a1d10; --dc2: #170a05; --dcg: #ff7a2a; }
.dun-card.t-ice   { --dc1: #1c2c3a; --dc2: #0a1219; --dcg: #8fd8ff; }
.dun-card .dc-ic { font-size: 26px; filter: drop-shadow(0 0 8px var(--dcg)); }
.dun-card b { font: 700 16px var(--f-head); color: #f6e3b4; }
.dun-card small { color: var(--muted); font-size: 11.5px; }
.dun-card .dc-st { margin-top: 4px; font-size: 12px; color: var(--dcg); }
.dun-card.on { border-color: var(--dcg); box-shadow: 0 0 16px color-mix(in srgb, var(--dcg) 45%, transparent), inset 0 0 30px rgba(0,0,0,.5); }
.dun-card.locked { opacity: .5; cursor: default; }
.bots-check { display: flex; gap: 10px; align-items: center; margin: 4px 0 12px; font-size: 14px; color: var(--text); }
.bots-check input { width: 22px; height: 22px; accent-color: #d4a24a; flex: 0 0 auto; }
.go-dun { margin-bottom: 8px; }
.boss-card .bc-h { font: 700 18px var(--f-head); color: #ffcf8a; margin-bottom: 4px; }
.boss-card .rules { margin: 0 0 8px; padding-left: 18px; color: var(--text); font-size: 13.5px; }
.boss-card .rules li { margin: 3px 0; }
.loot-h { font: 700 13px var(--f-body); color: var(--gold); margin: 6px 0 4px; }
.loot-tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.loot-tab td { padding: 5px 6px; border-top: 1px solid rgba(233,196,106,.15); color: var(--text); }
.loot-tab td:last-child { text-align: right; white-space: nowrap; color: var(--gold); font-weight: 700; }
.loot-tab small { display: block; color: var(--muted); font-size: 11.5px; }
.loot-tab tr.mine td:first-child { box-shadow: inset 3px 0 0 #6dff8a; }
.row.books { flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- таланты (talents.js): дерево как в WoW ---------- */
.tal-tabs { display: flex; gap: 6px; margin: 10px 0; }
.tal-tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: 8px; cursor: pointer;
  color: #eadcbc; font: inherit; background: linear-gradient(#2a2016, #160f0a); box-shadow: inset 0 0 0 1px rgba(233,196,106,.25); }
.tal-tab span { font-size: 20px; } .tal-tab b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tal-tab small { color: #b49a6a; }
.tal-tab.on { background: linear-gradient(color-mix(in srgb, var(--bc) 45%, #2a2016), #160f0a); box-shadow: inset 0 0 0 2px var(--bc); }
.tal-board { position: relative; margin: 0 auto; max-width: 340px; aspect-ratio: 3 / 4; border-radius: 10px;
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--bc) 22%, transparent), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 6px, transparent 6px 12px), #120c08;
  box-shadow: inset 0 0 0 2px #3a2a12, inset 0 0 30px rgba(0,0,0,.8); }
.tal-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tal-lines line { stroke: #6b5a3a; stroke-width: 3; }
.tal-lines line.on { stroke: #ffd34d; }
.tal-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); place-items: center; }
.tal-need { grid-column: 1; justify-self: start; align-self: start; margin: 4px 0 0 6px; font-size: 10px; color: #8a7450; }
.tnode { position: relative; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 10px; cursor: pointer; font: inherit; color: #fff;
  background: radial-gradient(circle at 50% 35%, #4a3c2c, #18120d 80%); box-shadow: 0 0 0 2px #0b0805, 0 0 0 4px #4a3a1e, 0 4px 10px rgba(0,0,0,.6); }
.tnode .ti { font-size: 28px; line-height: 58px; }
.tnode .tr { position: absolute; right: -6px; bottom: -6px; min-width: 26px; padding: 1px 4px; border-radius: 8px; font-size: 11px; font-weight: 800;
  background: #0b0805; color: #8a7a5a; box-shadow: 0 0 0 1px #4a3a1e; }
.tnode.can { box-shadow: 0 0 0 2px #0b0805, 0 0 0 4px #3fa63a, 0 0 12px rgba(80,220,80,.45); }
.tnode.can .tr { color: #8dff7a; }
.tnode.got { box-shadow: 0 0 0 2px #0b0805, 0 0 0 4px #c9a24a, 0 0 12px rgba(255,200,80,.35); }
.tnode.got .tr, .tnode.full .tr { color: #ffd34d; }
.tnode.full { box-shadow: 0 0 0 2px #0b0805, 0 0 0 4px #ffd34d, 0 0 16px rgba(255,210,80,.55); }
.tnode.locked { filter: grayscale(1) brightness(.55); }
.tnode.big { width: 68px; height: 68px; border-radius: 50%; } .tnode.big .ti { line-height: 68px; font-size: 32px; }
.tnode.sel { outline: 3px solid #fff; outline-offset: 3px; }
.tal-info { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1px rgba(233,196,106,.25); display: grid; gap: 4px; }
.tal-card { min-width: 0; overflow: hidden; }

/* 3D-герой в карточке (вращение пальцем) */
.hh-art .v3d { position: relative; height: 360px; touch-action: none; cursor: grab;
  background: radial-gradient(circle at 50% 35%, #2a1f30, #0a0710 75%); border-radius: 10px; box-shadow: inset 0 0 40px rgba(0,0,0,.9), 0 0 0 2px #5a4320; }
.hh-art .v3d canvas { display: block; width: 100%; height: 100%; }
.hh-art .v3d small { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; color: rgba(255,230,180,.55); font-size: 11px; pointer-events: none; }
@media (orientation: landscape) and (max-height: 520px) { .hh-art .v3d { height: 300px; } }

/* таланты: раскладка в три колонки, цветные значки */
.tal-layout { display: grid; grid-template-columns: 1fr minmax(260px, 340px) 1fr; gap: 14px; align-items: start; }
.tal-side, .tal-info { padding: 14px; border-radius: 10px; display: grid; gap: 6px; justify-items: center; text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bc, var(--nc, #8a6a3a)) 28%, #1a120c), #120c08 70%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bc, var(--nc, #8a6a3a)) 70%, #000), 0 6px 18px rgba(0,0,0,.5); margin: 0; }
.tal-side-ic, .tal-info-ic { font-size: 54px; line-height: 1; filter: drop-shadow(0 0 12px var(--bc, var(--nc))); }
.tal-side b, .tal-info b { font-size: 18px; color: #ffe4a8; }
.tal-spent { font-size: 34px; font-weight: 800; color: #ffd34d; line-height: 1; } .tal-spent small { font-size: 12px; color: #b49a6a; font-weight: 400; }
.tal-free { margin-top: 6px; }
.tal-info { justify-items: stretch; text-align: left; } .tal-info-ic, .tal-info b, .tal-info > .muted:first-of-type { justify-self: center; text-align: center; }
.tnode { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--nc) 75%, #fff 10%), color-mix(in srgb, var(--nc) 35%, #000) 75%); }
.tnode .ti { filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
.tnode .tb { position: absolute; left: -7px; top: -7px; font-size: 16px; filter: drop-shadow(0 1px 2px #000); }
.tnode.locked { filter: grayscale(.85) brightness(.5); }
.tnode.big { background: radial-gradient(circle at 50% 30%, #ffe08a, #b06a10 55%, #3a1a04); }
@media (max-width: 760px), (orientation: portrait) { .tal-layout { grid-template-columns: 1fr; } .tal-side { order: -1; } }
.tal-layout .tal-board { width: 100%; margin: 0; }
.tal-layout { grid-template-columns: minmax(180px, 1fr) minmax(280px, 360px) minmax(180px, 1fr); }
@media (max-width: 760px), (orientation: portrait) { .tal-layout { grid-template-columns: 1fr; } }

/* группа подземелья: свои герои */
.party { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pslot { position: relative; width: 112px; min-height: 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border: 0; border-radius: 10px;
  font: inherit; color: #f3e2b4; background: linear-gradient(#2e2216, #150e08); box-shadow: inset 0 0 0 2px #6d5527; text-align: center; }
.pslot .portrait { width: 64px; height: 64px; object-fit: contain; }
.pslot b { font-size: 12px; line-height: 1.1; } .pslot small { font-size: 10px; color: #b49a6a; }
.pslot.me { box-shadow: inset 0 0 0 2px #ffd34d, 0 0 10px rgba(255,210,80,.4); }
.pslot.empty { justify-content: center; opacity: .7; } .pslot.empty span { font-size: 30px; }
.pslot .px { position: absolute; right: 4px; top: 2px; color: #ff8a7a; font-size: 13px; }
.pchips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pchip { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 0; border-radius: 22px; font: inherit; font-size: 13px; color: #eadcbc;
  background: #1e160e; box-shadow: inset 0 0 0 1px #6d5527; cursor: pointer; }
.pchip .portrait { width: 34px; height: 34px; object-fit: contain; border-radius: 50%; background: #2a1e12; }
.pchip span { display: flex; flex-direction: column; text-align: left; line-height: 1.1; } .pchip small { color: #b49a6a; font-size: 10px; }
.pchip.on { background: linear-gradient(#4a3818, #2a1e0c); box-shadow: inset 0 0 0 2px #ffd34d; }
.pchip:disabled { opacity: .4; }

/* гнездо: нарисованные драконы */
.nest-art.bgimg { height: 220px; border-radius: 12px; background-size: cover; background-position: center 60%; box-shadow: inset 0 0 40px rgba(0,0,0,.6), 0 0 0 2px #6d5527; margin-bottom: 10px; }
.dragon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.dcard { position: relative; padding: 8px 8px 10px; border-radius: 12px; text-align: center; display: grid; gap: 3px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--dc) 35%, #1a120c), #0e0906 75%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dc) 70%, #000), 0 0 18px color-mix(in srgb, var(--dc) 30%, transparent); }
.dcard img { width: 100%; height: 140px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
.dcard.none img { filter: brightness(.25) saturate(0) drop-shadow(0 0 1px #888); }
.dcard b { color: #ffe9b0; } .dcard .dbonus { font-size: 12px; color: #d8c8a0; }
.dcount, .dlock { position: absolute; right: 8px; top: 6px; font-weight: 800; color: #fff; text-shadow: 0 0 4px #000; font-size: 13px; }
.dlock { color: #aaa; font-weight: 400; }
.egg-ic img { width: 64px; height: 64px; object-fit: contain; }
.egg { filter: drop-shadow(0 0 8px var(--dc)); }

/* ---------- яркая тема: изумрудный замок и драконы (04.11) ---------- */
:root { --emer: #34e08f; --emer2: #13a86a; --emer3: #0b5a3a; }
#app { background:
    linear-gradient(180deg, rgba(10, 30, 22, .55) 0%, rgba(12, 10, 8, .78) 45%, rgba(10, 8, 6, .92) 100%),
    url(img/bg/castle1.webp) center top / cover no-repeat, #0b0907; }
.throne { background:
    linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(10, 8, 6, .85) 100%),
    url(img/bg/castle2.webp) center 35% / cover no-repeat !important;
  box-shadow: inset 0 0 0 2px var(--emer2), 0 0 24px rgba(52, 224, 143, .25) !important; }
.throne .torch, .throne .flag { opacity: .85; }
.statue img { filter: drop-shadow(0 0 18px rgba(255, 230, 150, .55)) drop-shadow(0 6px 10px #000); }
.sect span { color: #ffe6a0; text-shadow: 0 0 10px rgba(52, 224, 143, .45), 0 1px 0 #000; }
.sect::before, .sect::after { background: linear-gradient(90deg, transparent, var(--emer2), var(--gold2)) !important; }
.card { box-shadow: 0 0 0 1px rgba(52, 224, 143, .18), 0 6px 18px rgba(0,0,0,.55); }
.btn:not(.alt) { background: linear-gradient(#ffe48a, #f0b23a 45%, #c47a12) !important; box-shadow: 0 0 0 1px #5a3a08, 0 0 14px rgba(255, 190, 60, .45), inset 0 1px 0 #fff6c8 !important; }
.tabs button.on i, .tabs button[aria-current] i { filter: drop-shadow(0 0 8px var(--emer)) saturate(1.2); }
.bar { border-bottom-color: var(--emer2); }
.tabs { border-top-color: var(--emer2); }
.logo { background: linear-gradient(#fff4c0, #ffd34d 50%, #34e08f); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 2px 2px #000); }
#app { background:
    linear-gradient(180deg, rgba(6, 20, 14, .10) 0%, rgba(8, 10, 8, .35) 35%, rgba(10, 8, 6, .82) 75%, rgba(10, 8, 6, .95) 100%),
    url(img/bg/castle1.webp) center top / 100% auto no-repeat, #0b0907; }
.throne::before { background: radial-gradient(ellipse 70% 55% at 50% 72%, rgba(255, 200, 100, .35), transparent 70%), linear-gradient(rgba(8,6,10,.15), rgba(29,20,14,.55)) !important; }
.card, .mode, .modes > * { backdrop-filter: blur(2px); }
.card:not(.banner) { background-color: rgba(30, 24, 18, .82); }

/* нарисованные иконки предметов */
img.ii { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; display: block; }
img.ii.sm { width: 22px; height: 22px; display: inline-block; vertical-align: middle; border-radius: 4px; }
.loot-tab img.ii { width: 26px; height: 26px; display: inline-block; vertical-align: middle; }
.it-ic { overflow: hidden; }
.it-ic img.ii { box-shadow: 0 0 0 2px var(--rc, #888), 0 0 10px var(--rc, transparent); }
.slot .s-ic img.ii { width: 54px; height: 54px; margin: 0 auto; box-shadow: 0 0 0 2px var(--rc, #888); }

/* Пул умений героя: выбор в бой (этап 3 плана 08.11) */
.skill-row { position: relative; }
.skill-row .sk-pick { position: absolute; top: 8px; right: 8px; z-index: 1; }
.skill-row:has(.sk-pick) .sk-name { padding-right: 118px; }
.skill-row.is-off { filter: saturate(.55) brightness(.92); }

/* Кукла: силуэт героя по центру, ячейки на своих местах (план 08.11, п. 19) */
.doll2 { grid-template-columns: 1fr 1.25fr 1fr; grid-template-areas:
  "amulet head shoulders" "chest sil hands" "ring sil ring2" "weapon sil offhand" "legs feet belt"; max-width: 380px; position: relative; }
.doll2 .slot { aspect-ratio: auto; min-height: 66px; }
.doll-sil { grid-area: sil; display: grid; place-items: center; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, rgba(255,210,120,.18), transparent 70%); }
.doll-sil img { width: 100%; max-height: 230px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
.slot.locked { opacity: .5; border-style: dotted; cursor: default; }
.slot .set-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #6dff8a; box-shadow: 0 0 6px #6dff8a; }
.set-box { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: rgba(109,255,138,.06); box-shadow: inset 0 0 0 1px rgba(109,255,138,.3); font-size: 13px; }
.set-box .on { color: #9dffb0; } .set-box .off { color: var(--muted); }
.set-line { margin-top: 6px; font-size: 12px; color: #9dffb0; }
.cmp { margin: 6px 0; } .cmp .up { color: #8dff7a; } .cmp .down { color: #ff8a7a; }
.wear-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; text-align: left; }
.wear-row .row { display: flex; align-items: center; gap: 8px; }
.wr-face { width: 36px; height: 36px; object-fit: contain; }
.qm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.card.qm { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; text-align: center; }
.card.qm .s-ic { font-size: 26px; }

/* Замок: двор с площадками и зданиями (план 08.11, этап 6) */
.city { position: relative; width: 100%; aspect-ratio: 1376 / 768; border-radius: 12px; overflow: hidden; margin-bottom: 12px;
  box-shadow: 0 0 0 2px #2a1a08, 0 0 0 4px #c8962f, 0 8px 20px rgba(0,0,0,.6); }
.city-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bld { position: absolute; height: 24%; transform: translate(-50%, -82%); background: none; border: 0; padding: 0; cursor: pointer;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,.55)); transition: transform .15s; }
.bld:hover, .bld:active { transform: translate(-50%, -84%) scale(1.06); }
.bld img { height: 100%; width: auto; display: block; }
.bld-n { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 1px 7px; border-radius: 8px; font: 700 clamp(9px, 1.15vw, 13px) var(--f-body); color: #ffe9b0;
  background: rgba(20,12,4,.78); box-shadow: 0 0 0 1px #c8962f; white-space: nowrap; }
.bld-l { position: absolute; top: 8%; right: 12%; width: 20px; height: 20px; border-radius: 50%; font: 800 12px var(--f-body); font-style: normal;
  display: grid; place-items: center; color: #2c1a05; background: linear-gradient(#ffe9a6, #c8962f); box-shadow: 0 0 0 1px #3a2606; }
.bld.soon { height: auto; transform: translate(-50%, -50%); cursor: default; opacity: .8; }
.bld.soon .bld-n { position: static; transform: none; }
.bld-head { display: flex; gap: 12px; align-items: center; }
.bld-head img { width: 120px; height: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.tut-rules ul { margin: 6px 0 0 18px; padding: 0; font-size: 13px; }
.row.wrap { flex-wrap: wrap; gap: 8px; }

/* выбор языка на главном экране (п.35) */
.lang-row { gap: 10px; }
.lang-sel { background: #1d1610; color: #f3e9d8; border: 1px solid #6b5a3a; border-radius: 8px; padding: 6px 10px; font: inherit; }

/* нарисованные иконки умений (web/img/skills, tools/cut-skills.py) вместо эмодзи */
.skimg { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; pointer-events: none; }
.sk-ic span { display: block; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.skl .sk { overflow: hidden; padding: 0; }
.skl .sk .skimg { border-radius: inherit; }

/* нижней панели нет (09.11): разделы открываются из замка, назад — значок 🏰 вверху; настройки — ⚙ */
.tabs { display: none !important; }
.foot-row { display: none !important; }
.bar-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 19px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #4a3a24, #1c140c); border: 2px solid #c9a24a; box-shadow: 0 2px 6px rgba(0,0,0,.5); color: #fff; padding: 0; }
.bar-btn:active { transform: translateY(1px); }
.bar .acc { display: flex; align-items: center; gap: 8px; }
.bar .money { display: flex; align-items: center; gap: 8px; }

/* нарисованные значки: таланты, характеристики, пустые ячейки (09.11) */
.tnode .ti { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: inherit; line-height: 0 !important; }
.tnode .ti .skimg { width: 100%; height: 100%; }
.tal-info-ic .skimg { width: 64px; height: 64px; border-radius: 10px; }
.tal-info-ic:has(.skimg) { filter: none; }
.stimg { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.stat > span:has(.stimg) { display: block; width: 40px; height: 40px; margin: 0 auto 4px; }
.slot .s-ic:has(.stimg) { opacity: 1; width: 60%; aspect-ratio: 1; margin: 0 auto; display: block; }
.slot .s-ic .slotimg { border-radius: 6px; opacity: .85; }
.card.qm .s-ic:has(.stimg) { display: block; width: 44px; height: 44px; margin: 0 auto 4px; }
.tal-side-ic .skimg { width: 64px; height: 64px; border-radius: 10px; }
.tal-side-ic:has(.skimg) { filter: none; }
.tal-tabs button > span:has(.skimg) { display: block; width: 28px; height: 28px; margin: 0 auto; }
.tal-tabs .skimg { border-radius: 6px; }

/* живой замок (city.js): декор и слой эффектов */
.cdec { position: absolute; transform: translate(-50%, -96%); pointer-events: none; filter: drop-shadow(0 4px 3px rgba(0,0,0,.35)); }
.city-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 150; }
.bld { z-index: 50; }
.bld img { filter: drop-shadow(0 6px 6px rgba(0,0,0,.4)); }
.bld:not(.soon) img { animation: bld-breathe 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes bld-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012, 1.02); } }
@media (prefers-reduced-motion: reduce) { .bld:not(.soon) img { animation: none; } }
/* город — свой слой: здания и эффекты не проступают поверх окон и подсказок */
.city { isolation: isolate; z-index: 0; }
.modal { z-index: 1000; }
/* режимы открываются из зданий замка — на главном внизу их больше нет */
.hall-side > .sect, .hall-side > .modes, .hall-side > .card.train { display: none !important; }
h2 .slotimg { display: inline-block; margin-right: 6px; width: 1.4em; height: 1.4em; vertical-align: -0.3em; border-radius: 6px; }

/* Легион: свой герой-полководец на поле (п. 53) */
.td-champ-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.td-champ-row .btn { white-space: nowrap; }

/* Прокачка драконов (п. 55) */
.dup-head { display: flex; gap: 12px; align-items: center; }
.dup-head img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 0 10px var(--dc)); }
.dup-head h2 { margin: 0 0 2px; }
.dup-head .prog { margin: 4px 0; }
.dup-away { color: #bfe4ff; font-size: 13px; margin-top: 4px; }
.dup-tabs { margin: 10px 0 6px; }
.dup-list { display: flex; flex-direction: column; gap: 6px; }
.dup-list .card { align-items: center; gap: 10px; }
.dup-ic { font-size: 26px; width: 34px; text-align: center; }
.dup-tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dup-br { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.dup-pips { display: flex; gap: 4px; }
.dup-pips i { width: 12px; height: 12px; border-radius: 50%; background: #3a2c1a; border: 1px solid #8a6a3a; }
.dup-pips i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.dup-msg { background: rgba(255,211,77,.12); border: 1px solid var(--gold); border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; color: #ffe9a0; }
.dcard .dlvl { display: block; font-size: 12px; color: #ffe9a0; }
.dcard .btn { margin-top: 4px; }
@media (max-width: 560px) { .dup-tree { grid-template-columns: 1fr; } }

/* Условия уровня зданий (п. 56) */
.req-ok { color: var(--good); }
.req-no { color: #ffb07a; }

/* Изучение предметов лавки (п. 31) */
.rs-tier { margin: 6px 0; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 4px; }
.rs-it { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 10px; background: rgba(40,28,16,.9); border: 1px solid #8a6a3a; color: inherit; font-size: 11px; }
.rs-it .ic .it-pic, .rs-it .ic img { width: 40px; height: 40px; }
.rs-it .ic { font-size: 28px; }
.rs-it.done { border-color: var(--good); opacity: .85; }
.rs-it:disabled:not(.done) { opacity: .45; }
.it-pic { width: 1.5em; height: 1.5em; object-fit: contain; vertical-align: middle; }
.btn.locked { opacity: .55; }

/* 17.11: превью умения в подсказке */
.skill-clip{display:block;width:100%;aspect-ratio:640/404;object-fit:cover;border-radius:8px;margin:6px 0;background:#0a0d12;border:1px solid #b18a4f66}

/* 17.11: синематик (первый вход и Летопись) */
.cinematic{position:fixed;inset:0;z-index:2000;background:#000;display:flex;align-items:center;justify-content:center}
.cinematic video{width:100%;height:100%;object-fit:contain}
.cinematic .cine-skip{position:absolute;right:calc(14px + env(safe-area-inset-right));top:calc(10px + env(safe-area-inset-top));opacity:.8}
.cinematic .cine-tap{position:absolute;font-size:20px;padding:14px 28px}
.legend-cine{display:flex;align-items:center;gap:10px;justify-content:center;margin:6px 0 12px}

/* 17.11: нарисованные значки Легиона (web/img/legion/icon_*.webp) */
.td-unit img{width:56px;height:56px;border-radius:10px;object-fit:cover;border:1px solid #6fa8ff88;box-shadow:0 0 10px #3a7bff44}
.td-merc img{width:48px;height:48px;border-radius:10px;object-fit:cover;border:1px solid #ff6a6a88;box-shadow:0 0 10px #ff3a3a44}

/* 17.11: портреты обликов на плашках, кнопки «Породы драконов» и «Рамки портрета» */
.appearance-item .skin-ic{width:58px;height:58px;object-fit:cover;border-radius:10px;display:block;border:1px solid #c9a55a66}
.nest-breeds{float:right;margin:4px 0 0}
.achievement-frames-link{margin:8px 0}

.acc-lvl{cursor:pointer}

/* 17.11: иллюстрации «Как играть» */
.howto .scheme .howto-art{display:block;width:100%;aspect-ratio:16/6;object-fit:cover;border-radius:10px}
.appearance-item .breed-ic{object-fit:contain;background:radial-gradient(#ffffff14,#0000 70%)}
.treasury .treasury-ic{width:64px;height:64px;object-fit:contain;flex:none;filter:drop-shadow(0 4px 6px #0008)}
.treasury-dungeons{gap:8px;margin-top:6px}
.shop-frames .treasury-ic{width:64px;height:64px;object-fit:contain;flex:none}
.shop-frames{width:100%;text-align:left;gap:12px}

/* 17.11: нарисованные значки окна дракона */
.dup-ic .nest-ic{width:56px;height:56px;object-fit:contain;display:block;filter:drop-shadow(0 3px 4px #0009)}
.dup-br .dup-ic .nest-ic{width:64px;height:64px;margin:0 auto}

/* 17.11: мини-видео умения в карточке на странице героя */
.skill-row .sk-clip{flex:none;width:200px;align-self:center}
.skill-row .sk-clip .skill-clip{width:100%;aspect-ratio:640/288;border-radius:8px;display:block;background:#000;border:1px solid #c9a55a55}
@media (max-width:800px){.skill-row .sk-clip{width:150px}}
