/* ==========================================================================
   TENSORA GAIDEN — БАШНЯ (tower.js). Строится на токенах arena_v2.css (--av2-*).
   Анимируются только transform / opacity.
   ========================================================================== */
.tw-screen { --tc: #94a3b8; --tc-rgb: 148, 163, 184; --tc-l: #cbd5e1; }
.tw-lr, .tw-map-g { --lc-rgb: 148, 163, 184; --lc-l: #cbd5e1; }
.tw-muted { color: var(--av2-muted, #94a3b8); }

/* ---------- hero ---------- */
.tw-hero {
    position: relative; overflow: hidden;
    padding: 14px 14px 12px; border-radius: 22px;
    border: 1px solid rgba(var(--tc-rgb), 0.55);
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(var(--tc-rgb), 0.38), transparent 62%),
        radial-gradient(80% 60% at 0% 100%, rgba(56, 189, 248, 0.12), transparent 60%),
        linear-gradient(165deg, #171a33, #0b0d1a 72%);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tw-hero-bg {
    position: absolute !important; inset: 0; z-index: 0; pointer-events: none;
    background-size: cover; background-position: center;
    transform: scale(1.06); opacity: 0.55;
}
.tw-hero::after {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        linear-gradient(180deg, rgba(8, 9, 20, 0.35) 0%, rgba(8, 9, 20, 0.55) 45%, rgba(8, 9, 20, 0.92) 100%),
        radial-gradient(120% 80% at 100% 0%, rgba(var(--tc-rgb), 0.35), transparent 60%);
}
.tw-hero > *:not(.tw-hero-bg):not(.tw-fx) { position: relative; z-index: 1; }
.tw-hero-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tw-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 99px;
    font-size: 11.5px; font-weight: 900; letter-spacing: 0.3px;
    background: rgba(var(--tc-rgb), 0.25);
    border: 1px solid rgba(var(--tc-rgb), 0.5); color: #fff;
}
.tw-chip.ghost { background: rgba(0, 0, 0, 0.28); border-color: rgba(255, 255, 255, 0.12); color: #cbd5e1; font-weight: 800; }
.tw-hero-main { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.tw-floor { display: flex; flex-direction: column; align-items: center; min-width: 92px; padding: 6px 10px; border-radius: 16px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.12); }
.tw-floor small { font-size: 10px; font-weight: 900; letter-spacing: 1.4px; color: var(--av2-muted, #94a3b8); }
.tw-floor b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 48px; line-height: 1; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 22px rgba(var(--tc-rgb), 0.7); }
.tw-floor em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--av2-muted, #94a3b8); }
.tw-tier { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tw-tier-ic { font-size: 30px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
.tw-tier b { display: block; font-size: 16px; font-weight: 900; color: #fff; }
.tw-tier small { display: block; font-size: 9.5px; font-weight: 900; letter-spacing: 1.2px; color: var(--tc-l); }
.tw-law { display: block; margin-top: 3px; font-size: 12px; font-weight: 700; color: #e2e8f0; line-height: 1.3; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.tw-floor.boss { border-color: rgba(255, 202, 40, 0.6); background: rgba(60, 40, 0, 0.45); }
.tw-floor.boss small { color: var(--av2-gold, #ffca28); }
.tw-segs { display: flex; gap: 3px; height: 9px; margin-top: 14px; }
.tw-segs i { position: relative; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
.tw-segs i b { position: absolute; inset: 0; background: var(--sc); transform-origin: left center; }
.tw-segs i.cur { outline: 1px solid rgba(255, 255, 255, 0.7); outline-offset: 1px; }
.tw-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.tw-stats > div { padding: 7px 4px; border-radius: 12px; text-align: center; background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.06); }
.tw-stats small { display: block; font-size: 9.5px; font-weight: 900; letter-spacing: 0.8px; color: var(--av2-muted, #94a3b8); }
.tw-stats b { display: block; margin-top: 2px; font-size: 17px; font-weight: 900; color: #fff; }
.tw-stats b.win { color: var(--av2-green, #4ade80); }
.tw-stats b.loss { color: var(--av2-red, #ff4d5e); }
.tw-prev { margin-top: 8px; font-size: 11.5px; font-weight: 700; color: var(--av2-muted, #94a3b8); }

/* ---------- keys ---------- */
.tw-keys { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 12px 12px 14px; }
.tw-keys-l { flex: 1; min-width: 0; }
.tw-keys-h { display: flex; justify-content: space-between; align-items: baseline; }
.tw-keys-h span { font-size: 13px; font-weight: 900; }
.tw-keys-h b { font-size: 18px; font-weight: 900; color: var(--av2-gold, #ffca28); }
.tw-keys-h b small { font-size: 12px; color: var(--av2-muted, #94a3b8); }
.tw-pips { display: flex; gap: 4px; margin-top: 6px; }
.tw-pips i { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.09); }
.tw-pips i.on { background: linear-gradient(90deg, #ffe082, #ffb300); }
.tw-pips i.on.extra { background: linear-gradient(90deg, #a7f3d0, #34d399); }
.tw-keys-sub { margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--av2-muted, #94a3b8); }
.tw-buy {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-width: 92px; min-height: 64px; padding: 6px 10px; border-radius: 14px; cursor: pointer;
    border: 1px solid rgba(255, 202, 40, 0.5); background: rgba(255, 202, 40, 0.1); color: #fff;
    transition: transform 0.12s var(--av2-ease, ease);
}
.tw-buy:active { transform: scale(0.95); }
.tw-buy[disabled] { opacity: 0.45; pointer-events: none; }
.tw-buy b { font-size: 15px; font-weight: 900; }
.tw-buy small { font-size: 12px; font-weight: 900; color: var(--av2-gold, #ffca28); }
.tw-buy em { font-style: normal; font-size: 9.5px; font-weight: 800; color: var(--av2-muted, #94a3b8); }
.tw-buy.is-busy { opacity: 0.7; pointer-events: none; }

/* ---------- floor card ---------- */
.tw-floorcard { margin-top: 12px; border-color: rgba(var(--tc-rgb), 0.35); }
.tw-floorcard.boss {
    border-color: rgba(255, 202, 40, 0.55);
    background: radial-gradient(120% 70% at 50% 0%, rgba(255, 202, 40, 0.14), transparent 60%), linear-gradient(160deg, rgba(40, 30, 50, 0.95), rgba(14, 14, 28, 0.97));
}
.tw-fc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tw-fc-head small { display: block; font-size: 10px; font-weight: 900; letter-spacing: 1.2px; color: var(--av2-muted, #94a3b8); }
.tw-floorcard.boss .tw-fc-head small { color: var(--av2-gold, #ffca28); }
.tw-fc-head b { display: block; margin-top: 2px; font-size: 17px; font-weight: 900; }
.tw-fc-tier { flex-shrink: 0; padding: 4px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(var(--tc-rgb), 0.45); }

.tw-unit {
    position: relative; flex: 0 1 64px; max-width: 64px; padding: 0; cursor: pointer;
    aspect-ratio: 5 / 7.4; border-radius: 11px; overflow: hidden;
    border: 2px solid var(--rar-c); background: #0b0d18; color: #fff;
    transition: transform 0.12s var(--av2-ease, ease);
}
.tw-unit:active { transform: scale(0.94); }
.tw-unit.guard { box-shadow: 0 0 0 2px rgba(255, 202, 40, 0.55), 0 6px 18px rgba(255, 160, 0, 0.35); }
.tw-unit-img { position: absolute; inset: 0; }
.tw-unit-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.tw-unit-role { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; border-radius: 6px; background: rgba(0, 0, 0, 0.75); border: 1px solid var(--role-c); }
.tw-unit-lvl { position: absolute; top: 2px; right: 2px; padding: 0 4px; border-radius: 5px; font-size: 9px; font-weight: 900; background: rgba(0, 0, 0, 0.75); }
.tw-unit-crown { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); font-size: 14px; filter: drop-shadow(0 1px 2px #000); }
.tw-unit-st { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; padding: 2px 3px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.9) 35%); }
.tw-unit-st b { font-size: 8.5px; font-weight: 900; line-height: 1.25; text-align: left; white-space: nowrap; }

.tw-vs { margin-top: 12px; }
.tw-vs-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--av2-muted, #94a3b8); }
.tw-vs-row b { color: #fff; font-weight: 900; }
.tw-vs-bar { position: relative; height: 6px; margin-top: 0; border-radius: 99px; overflow: hidden; background: linear-gradient(90deg, rgba(255, 77, 94, 0.5), rgba(255, 77, 94, 0.75)); }
.tw-vs-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #38bdf8, #60a5fa); border-right: 2px solid #fff; }
.tw-vs-v { margin-top: 5px; font-size: 12px; font-weight: 800; }
.tw-vs-v small { font-weight: 600; color: var(--av2-muted, #94a3b8); }
.tw-vs-v.ok { color: #86efac; }
.tw-vs-v.warn { color: #fde68a; }
.tw-vs-v.bad { color: #fda4af; }

.tw-reward { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 9px 10px; border-radius: 14px; background: rgba(255, 202, 40, 0.07); border: 1px solid rgba(255, 202, 40, 0.22); }
.tw-reward-k { flex-shrink: 0; font-size: 10.5px; font-weight: 900; letter-spacing: 0.8px; color: var(--av2-gold, #ffca28); text-transform: uppercase; }
.tw-rws { display: flex; flex-wrap: wrap; gap: 5px; }
.tw-rw { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 8px; font-size: 11.5px; font-weight: 900; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.1); white-space: nowrap; }
.tw-rw.prem { border-color: rgba(192, 132, 252, 0.5); color: #e9d5ff; }
.tw-rw.gem { border-color: rgba(96, 165, 250, 0.5); color: #bfdbfe; }
.tw-rw.xp { color: #fde68a; }

.tw-my { margin-top: 12px; }
.tw-warn { margin-top: 10px; padding: 9px 11px; border-radius: 12px; font-size: 12px; font-weight: 700; line-height: 1.4; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.35); color: #fde68a; }
.tw-cta { margin-top: 12px; }
.tw-floorcard.boss .tw-cta { background: linear-gradient(135deg, #ffd54f 0%, #ff6f00 100%); }
.tw-cta.is-busy { pointer-events: none; opacity: 0.8; }

/* ---------- ladder ---------- */
.tw-ladder { display: flex; flex-direction: column; gap: 4px; }
.tw-lr {
    display: grid; grid-template-columns: 40px minmax(0, auto) 1fr 28px; align-items: center; gap: 8px;
    min-height: 42px; padding: 4px 10px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--lc);
}
.tw-lr-n { font-family: 'Bangers', 'Outfit', cursive; font-size: 20px; letter-spacing: 0.5px; color: #fff; text-align: center; }
.tw-lr-t { font-size: 12px; font-weight: 800; white-space: nowrap; }
.tw-lr-t small { margin-left: 4px; font-weight: 700; color: var(--av2-muted, #94a3b8); }
.tw-lr-r { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.tw-lr-r .tw-rw { font-size: 10.5px; padding: 2px 5px; }
.tw-lr-s { text-align: center; font-size: 14px; }
.tw-lr.done { opacity: 0.55; }
.tw-lr.done .tw-lr-s { color: var(--av2-green, #4ade80); font-weight: 900; }
.tw-lr.cur { background: rgba(var(--lc-rgb), 0.25); border-color: rgba(var(--lc-rgb), 0.6); }
.tw-lr.lock .tw-lr-n { color: rgba(255, 255, 255, 0.5); }
.tw-lr.boss .tw-lr-t { color: var(--av2-gold, #ffca28); }
.tw-all { width: 100%; margin-top: 8px; }

/* ---------- milestones ---------- */
.tw-ms { display: flex; gap: 8px; width: 0; min-width: 100%; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.tw-ms::-webkit-scrollbar { display: none; }
.tw-ms-i {
    flex: 0 0 104px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 6px;
    border-radius: 14px; text-align: center;
    background: linear-gradient(160deg, rgba(34, 40, 74, 0.9), rgba(16, 18, 34, 0.95)); border: 1px solid rgba(255, 255, 255, 0.1);
}
.tw-ms-i small { font-size: 9px; font-weight: 900; letter-spacing: 1px; color: var(--av2-muted, #94a3b8); }
.tw-ms-i > b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 24px; line-height: 1; }
.tw-ms-i.big { border-color: rgba(192, 132, 252, 0.5); background: linear-gradient(160deg, rgba(60, 30, 90, 0.9), rgba(18, 12, 34, 0.95)); }
.tw-ms-r { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.tw-ms-r .tw-rw { font-size: 10px; padding: 2px 5px; }
.tw-ms-s { font-size: 10px; font-weight: 800; color: var(--av2-muted, #94a3b8); }
.tw-ms-i.done { opacity: 0.55; }
.tw-ms-i.done .tw-ms-s { color: var(--av2-green, #4ade80); }

/* ---------- rules ---------- */
.tw-rules { margin-top: 14px; padding: 12px 14px; }
.tw-rules summary { cursor: pointer; font-size: 13.5px; font-weight: 900; list-style: none; }
.tw-rules summary::-webkit-details-marker { display: none; }
.tw-rules summary::after { content: '›'; float: right; transform: rotate(90deg); transition: transform 0.2s; }
.tw-rules[open] summary::after { transform: rotate(-90deg); }
.tw-rules ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.tw-rules li { font-size: 12.5px; line-height: 1.45; color: #cbd5e1; }

/* ---------- sheets ---------- */
.tw-enemy-d { display: flex; gap: 12px; margin-top: 4px; }
.tw-enemy-d img { width: 96px; aspect-ratio: 5 / 7; object-fit: cover; object-position: top; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.14); }
.tw-enemy-s { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tw-enemy-s > div { padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.tw-enemy-s small { display: block; font-size: 9.5px; font-weight: 900; letter-spacing: 0.8px; color: var(--av2-muted, #94a3b8); }
.tw-enemy-s b { font-size: 14px; font-weight: 900; }
.tw-map { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding-right: 2px; }
.tw-map-g { display: flex; flex-direction: column; gap: 4px; }
.tw-map-h { position: sticky; top: 0; z-index: 1; padding: 6px 8px; border-radius: 10px; font-size: 13px; background: #121528; border: 1px solid rgba(var(--lc-rgb), 0.4); }
.tw-map-h small { display: block; font-size: 11px; font-weight: 700; color: var(--av2-muted, #94a3b8); }
.tw-lb-me { margin: 4px 0 10px; padding: 9px 12px; border-radius: 12px; font-size: 13px; font-weight: 700; background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.35); }
.tw-lb { display: flex; flex-direction: column; gap: 4px; max-height: 58vh; overflow-y: auto; }
.tw-lb-r { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; min-height: 42px; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.tw-lb-r.me { background: rgba(56, 189, 248, 0.14); border: 1px solid rgba(56, 189, 248, 0.4); }
.tw-lb-r .p { text-align: center; font-weight: 900; font-size: 15px; }
.tw-lb-r .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 13.5px; }
.tw-lb-r .f { font-weight: 900; color: var(--av2-gold, #ffca28); font-size: 13px; }

/* ---------- states ---------- */
.tw-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 16px; text-align: center; }
.tw-empty b { font-size: 16px; }
.tw-empty span { font-size: 13px; color: #cbd5e1; line-height: 1.45; }
.tw-done { margin-top: 12px; border-color: rgba(255, 202, 40, 0.5); }
.tw-skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.04); border-radius: 18px; }
.tw-skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); animation: tw-skel 1.3s infinite; }
@keyframes tw-skel { to { transform: translateX(100%); } }

/* ---------- entry points ---------- */
.av2-tile.tower {
    border-color: rgba(251, 191, 36, 0.45);
    background: radial-gradient(90% 80% at 100% 0%, rgba(251, 191, 36, 0.22), transparent 60%), linear-gradient(160deg, rgba(48, 36, 70, 0.92), rgba(16, 14, 30, 0.96));
}
.av2-tile.tower .badge { background: rgba(251, 191, 36, 0.16); color: #fde68a; border-color: rgba(251, 191, 36, 0.45); }
.activity-card.card-tower {
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(251, 191, 36, 0.32), transparent 60%),
        radial-gradient(90% 80% at 0% 100%, rgba(129, 140, 248, 0.28), transparent 60%),
        linear-gradient(160deg, #2a1f4a, #0f0d1e);
}

@media (prefers-reduced-motion: reduce) {
    .tw-skel::after { animation: none; }
}

/* ==========================================================================
   v2: поле боя, условия, Страж, атмосфера ярусов, арена боя
   ========================================================================== */
/* ---------- условия этажа ---------- */
.tw-req { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); }
.tw-req.none { display: flex; font-size: 12.5px; font-weight: 800; color: #cbd5e1; }
.tw-req.hard { border-color: rgba(255, 202, 40, 0.45); background: linear-gradient(160deg, rgba(255, 202, 40, 0.1), rgba(255, 202, 40, 0.02)); }
.tw-req.soft { border-color: rgba(251, 146, 60, 0.4); background: linear-gradient(160deg, rgba(251, 146, 60, 0.08), rgba(251, 146, 60, 0.02)); }
.tw-req.ok { border-color: rgba(74, 222, 128, 0.45); background: linear-gradient(160deg, rgba(74, 222, 128, 0.09), rgba(74, 222, 128, 0.02)); }
.tw-req-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tw-req-top b { font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.tw-req.hard .tw-req-top b { color: var(--av2-gold, #ffca28); }
.tw-req.soft .tw-req-top b { color: #fdba74; }
.tw-req .st { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.tw-req .st.ok { background: rgba(74, 222, 128, 0.16); color: #86efac; }
.tw-req .st.bad { background: rgba(255, 77, 94, 0.16); color: #fda4af; }
.tw-req ul, .tw-req-banner ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.tw-req li, .tw-req-banner li { display: flex; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 800; line-height: 1.3; }
.tw-req li i, .tw-req-banner li i { flex-shrink: 0; width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 900; }
.tw-req li.ok i, .tw-req-banner li.ok i { background: rgba(74, 222, 128, 0.2); color: #86efac; }
.tw-req li.bad i, .tw-req-banner li.bad i { background: rgba(255, 77, 94, 0.2); color: #fda4af; }
.tw-req li span, .tw-req-banner li span { flex: 1; }
.tw-req li small, .tw-req-banner li small { flex-shrink: 0; font-size: 11px; font-weight: 800; color: var(--av2-muted, #94a3b8); }
.tw-req-f { margin-top: 7px; font-size: 11.5px; font-weight: 700; color: #cbd5e1; line-height: 1.4; }

/* ---------- поле: враги сверху, ваш отряд снизу, фон яруса ---------- */
.tw-field {
    position: relative; overflow: hidden; margin-top: 12px; padding: 10px 8px;
    border-radius: 18px; border: 1px solid rgba(var(--fc-rgb), 0.35); background: #0a0c18;
}
.tw-field-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.4; transform: scale(1.08); }
.tw-field::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        linear-gradient(180deg, rgba(120, 10, 30, 0.35), transparent 30%, transparent 70%, rgba(10, 40, 90, 0.4)),
        radial-gradient(70% 50% at 50% 50%, transparent, rgba(5, 6, 14, 0.75));
}
.tw-field > *:not(.tw-field-bg):not(.tw-fx) { position: relative; z-index: 1; }
.tw-side { display: flex; flex-direction: column; gap: 6px; }
.tw-side-h { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; font-size: 11px; font-weight: 900; letter-spacing: 0.5px; text-shadow: 0 1px 3px #000; }
.tw-side.enemy .tw-side-h { color: #fda4af; }
.tw-side.mine .tw-side-h { color: #93c5fd; }
.tw-side-h small { font-weight: 700; margin-left: 4px; }
.tw-side-h b { font-weight: 900; color: #fff; }
.tw-side-chips { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.tw-row { display: flex; justify-content: center; gap: 6px; min-height: 20px; }
.tw-row-empty { color: rgba(255, 255, 255, 0.3); font-size: 12px; align-self: center; }
.tw-clash { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.tw-clash i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); }
.tw-clash span { font-family: 'Bangers', 'Outfit', cursive; font-size: 20px; letter-spacing: 1px; color: #fff; text-shadow: 0 0 12px rgba(var(--fc-rgb), 0.9), 0 2px 0 #000; }
.tw-unit { flex: 0 1 60px; max-width: 60px; }
.tw-unit.enemy { border-color: var(--rar-c); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.tw-unit.mine { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.tw-unit.off { border-color: #ff4d5e; }
.tw-unit.off .tw-unit-img img { filter: grayscale(0.7) brightness(0.7); }
.tw-unit-off { position: absolute; right: 2px; bottom: 30px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 900; background: #ff4d5e; color: #fff; }
.tw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tw-actions .av2-btn { min-height: 42px; font-size: 13px; padding: 0 8px; }

/* ---------- следующий Страж ---------- */
.tw-next {
    display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 11px 12px;
    border-radius: 16px; border: 1px dashed rgba(255, 202, 40, 0.45); background: rgba(255, 202, 40, 0.05);
}
.tw-next-ic { font-size: 24px; }
.tw-next small { display: block; font-size: 10px; font-weight: 900; letter-spacing: 1px; color: var(--av2-gold, #ffca28); }
.tw-next b { display: block; margin-top: 3px; font-size: 13px; font-weight: 800; line-height: 1.35; }
.tw-next em { display: block; margin-top: 3px; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--av2-muted, #94a3b8); }

/* ---------- баннер «новый ярус» ---------- */
.tw-tierup { position: fixed; inset: 0; z-index: 99999990; display: grid; place-items: center; background: rgba(4, 5, 12, 0.6); animation: tw-fade-in 0.25s ease both; }
.tw-tierup.out { animation: tw-fade-out 0.45s ease both; }
.tw-tierup-in {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 28px; border-radius: 22px; text-align: center;
    border: 1px solid rgba(var(--tc-rgb), 0.6); background: radial-gradient(120% 90% at 50% 0%, rgba(var(--tc-rgb), 0.35), rgba(10, 12, 26, 0.96) 70%);
    animation: tw-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.tw-tierup-in small { font-size: 11px; font-weight: 900; letter-spacing: 2px; color: var(--tc-l); }
.tw-tierup-in .ic { font-size: 54px; }
.tw-tierup-in b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 30px; letter-spacing: 1px; }
.tw-tierup-in em { font-style: normal; font-size: 13px; font-weight: 700; color: #e2e8f0; }
@keyframes tw-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tw-fade-out { to { opacity: 0; } }
@keyframes tw-pop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

/* ---------- частицы яруса ---------- */
.tw-fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.tw-fx i {
    position: absolute; left: var(--x); top: 0; width: calc(4px * var(--s)); height: calc(4px * var(--s));
    border-radius: 50%; background: var(--pc, #fff); opacity: 0;
    animation: tw-fall var(--d) linear var(--dl) infinite;
}
@keyframes tw-fall { 0% { transform: translate3d(0, -10%, 0); opacity: 0; } 15% { opacity: var(--po, 0.8); } 85% { opacity: var(--po, 0.8); } 100% { transform: translate3d(var(--dx, 0), 110vh, 0); opacity: 0; } }
@keyframes tw-rise { 0% { transform: translate3d(0, 0, 0); opacity: 0; } 20% { opacity: var(--po, 0.9); } 100% { transform: translate3d(var(--dx, 20px), -110%, 0); opacity: 0; } }
@keyframes tw-float { 0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.15; } 50% { transform: translate3d(var(--dx, 14px), -18px, 0); opacity: var(--po, 0.85); } }
@keyframes tw-twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: var(--po, 1); transform: scale(1.2); } }
.fx-dust i   { --pc: #e5e7eb; --po: 0.35; --dx: 30px; }
.fx-snow i   { --pc: #f0f9ff; --po: 0.9; --dx: -24px; }
.fx-embers i { --pc: #fb923c; --po: 0.95; top: auto; bottom: -6px; animation-name: tw-rise; box-shadow: 0 0 6px #f97316; }
.fx-sparks i { --pc: #fde047; --po: 1; top: auto; bottom: -6px; animation-name: tw-rise; width: calc(2px * var(--s)); height: calc(6px * var(--s)); border-radius: 2px; }
.fx-rain i   { --pc: #93c5fd; --po: 0.6; --dx: -40px; width: 1.5px; height: calc(16px * var(--s)); border-radius: 1px; animation-duration: calc(var(--d) / 4); }
.fx-motes i  { --pc: #c084fc; --po: 0.8; top: calc(var(--x) * 0.8); animation-name: tw-float; box-shadow: 0 0 8px #a855f7; }
.fx-spores i { --pc: #f9a8d4; --po: 0.8; top: calc(var(--x) * 0.7 + 10%); animation-name: tw-float; }
.fx-shards i { --pc: #a5f3fc; --po: 1; top: calc(var(--x) * 0.9); animation-name: tw-twinkle; border-radius: 1px; transform: rotate(45deg); }
.fx-void i   { --pc: #818cf8; --po: 0.7; top: auto; bottom: -6px; animation-name: tw-rise; --dx: -20px; box-shadow: 0 0 10px #6366f1; }
.fx-stars i  { --pc: #fde68a; --po: 1; top: calc(var(--x) * 0.85); animation-name: tw-twinkle; box-shadow: 0 0 8px #fbbf24; }

/* ---------- арена боя в цветах яруса ---------- */
.av2-battle > .tw-arena-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.av2-battle.tw-arena .av2-battle-bg {
    background:
        radial-gradient(90% 55% at 50% 0%, rgba(var(--ac-rgb), 0.28), transparent 70%),
        radial-gradient(90% 55% at 50% 100%, rgba(56, 189, 248, 0.16), transparent 70%),
        linear-gradient(180deg, rgba(7, 6, 14, 0.45), rgba(7, 6, 14, 0.82)),
        var(--pvp-arena-bg-image, none) center / cover no-repeat,
        #07060e;
}
.av2-battle.tw-arena-boss .av2-battle-bg { box-shadow: inset 0 0 120px rgba(255, 202, 40, 0.25); }
.av2-battle.tw-arena .av2-bt-mode { color: var(--ac-l); }
.tw-arena-intro {
    position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    text-align: center; pointer-events: none; overflow: hidden;
    background: radial-gradient(60% 40% at 50% 45%, rgba(var(--ac-rgb), 0.35), transparent 75%), rgba(4, 5, 12, 0.9);
    animation: tw-fade-in 0.2s ease both;
}
.tw-arena-intro.out { animation: tw-fade-out 0.5s ease both; }
.tw-arena-intro-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: 0.35; transform: scale(1.1); }
.tw-arena-intro small { font-size: 12px; font-weight: 900; letter-spacing: 3px; color: var(--ac-l); text-shadow: 0 2px 6px #000; }
.tw-arena-intro b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 96px; line-height: 0.9; color: #fff; text-shadow: 0 0 30px rgba(var(--ac-rgb), 0.9), 0 4px 0 #000; animation: tw-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.tw-arena-intro em { font-style: normal; font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 2px 6px #000; }

/* ---------- редактор отряда в режиме Башни ---------- */
.tw-req-banner { margin: 0 0 12px; padding: 11px 12px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); }
.tw-req-banner.hard { border-color: rgba(255, 202, 40, 0.5); background: rgba(255, 202, 40, 0.07); }
.tw-req-banner.soft { border-color: rgba(251, 146, 60, 0.45); background: rgba(251, 146, 60, 0.06); }
.tw-req-banner.ok { border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.07); }
.tw-req-banner.none { color: #cbd5e1; }
.tw-req-h { font-size: 12px; font-weight: 900; letter-spacing: 0.6px; }
.tw-req-banner.hard .tw-req-h { color: var(--av2-gold, #ffca28); }
.tw-req-banner.soft .tw-req-h { color: #fdba74; }
.tw-req-banner.ok .tw-req-h { color: #86efac; }
.av2-slot.tw-off { outline: 2px solid #ff4d5e; outline-offset: -2px; }
.av2-slot.tw-off img { filter: grayscale(0.6) brightness(0.75); }

/* ==========================================================================
   v3: сундуки Стражей, фрагменты карт, сцена открытия
   ========================================================================== */
.tw-rw.chest { cursor: pointer; border-color: var(--cc, #cd7f32); color: #fff; background: rgba(0, 0, 0, 0.35); font-family: inherit; }
.tw-rw.dim { opacity: 0.7; font-weight: 700; }
.tw-rw.decor { border-color: #f0abfc; color: #f5d0fe; }

/* иконка сундука (CSS, без картинок): --cc цвет, --cs размер */
.tw-chest-ic { position: relative; display: inline-block; width: var(--cs); height: calc(var(--cs) * 0.86); flex-shrink: 0; }
.tw-chest-ic i { position: absolute; display: block; }
.tw-chest-ic .box {
    left: 0; right: 0; bottom: 0; height: 58%; border-radius: 0 0 calc(var(--cs) * 0.1) calc(var(--cs) * 0.1);
    background: linear-gradient(180deg, var(--cc), #3b2a14 140%);
    box-shadow: inset 0 0 0 calc(var(--cs) * 0.04) rgba(0, 0, 0, 0.35), inset 0 calc(var(--cs) * -0.12) 0 rgba(0, 0, 0, 0.25);
}
.tw-chest-ic .box::before { content: ''; position: absolute; top: 0; bottom: 0; left: 18%; width: 12%; background: rgba(0, 0, 0, 0.28); box-shadow: calc(var(--cs) * 0.48) 0 0 rgba(0, 0, 0, 0.28); }
.tw-chest-ic .lid {
    left: 0; right: 0; top: 0; height: 44%; border-radius: calc(var(--cs) * 0.22) calc(var(--cs) * 0.22) calc(var(--cs) * 0.04) calc(var(--cs) * 0.04);
    background: linear-gradient(180deg, #fff 0%, var(--cc) 30%, #3b2a14 160%);
    box-shadow: inset 0 0 0 calc(var(--cs) * 0.04) rgba(0, 0, 0, 0.3);
    transform-origin: 10% 100%; transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tw-chest-ic .lock { left: 42%; width: 16%; top: 34%; height: 22%; border-radius: calc(var(--cs) * 0.04); background: #fde68a; box-shadow: 0 0 0 calc(var(--cs) * 0.02) rgba(0, 0, 0, 0.5); }
.tw-chest-ic.open .lid { transform: translateY(-14%) rotate(-28deg); }
.tw-chest-ic.open .lock { opacity: 0; }

.tw-ms-i { cursor: pointer; font-family: inherit; color: #fff; gap: 5px; }
.tw-ms-i small { letter-spacing: 0.6px; }
.tw-ms-i > b { font-family: inherit; font-size: 12px; font-weight: 900; line-height: 1.2; }
.tw-ms-i.t-silver { border-color: rgba(203, 213, 225, 0.45); }
.tw-ms-i.t-gold { border-color: rgba(250, 204, 21, 0.5); background: linear-gradient(160deg, rgba(70, 55, 10, 0.9), rgba(20, 16, 6, 0.95)); }
.tw-ms-i.t-mythic { border-color: rgba(192, 132, 252, 0.55); background: linear-gradient(160deg, rgba(60, 30, 90, 0.9), rgba(18, 12, 34, 0.95)); }
.tw-ms-i.t-crown { border-color: rgba(251, 191, 36, 0.8); background: radial-gradient(90% 70% at 50% 0%, rgba(251, 191, 36, 0.3), rgba(30, 20, 6, 0.95)); }
.tw-ms-i.done { opacity: 0.75; }

/* пул сундука */
.tw-pool-g { margin: 2px 0 8px; padding: 8px 10px; border-radius: 12px; font-size: 12.5px; font-weight: 700; background: rgba(74, 222, 128, 0.08); border: 1px solid rgba(74, 222, 128, 0.3); }
.tw-pool { display: flex; flex-direction: column; gap: 4px; }
.tw-pool-r { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; padding: 4px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-size: 13px; font-weight: 800; }
.tw-pool-r small { flex-shrink: 0; font-size: 11px; font-weight: 800; color: var(--av2-muted, #94a3b8); }
.tw-pool-h { margin: 10px 2px 6px; font-size: 11px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--av2-muted, #94a3b8); }
.tw-pool-ch { position: relative; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 104px; }
.tw-pool-ch i { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--av2-gold, #ffca28); transform-origin: right center; opacity: 0.8; }
.tw-pool-r.rare .tw-pool-ch i { background: #f0abfc; }
.tw-pool-note { margin-top: 8px; font-size: 12px; line-height: 1.4; }
.tw-pool-r.decor { background: linear-gradient(90deg, rgba(240, 171, 252, 0.16), rgba(240, 171, 252, 0.04)); color: #f5d0fe; }

/* фрагменты */
.tw-frags { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.tw-frag { display: grid; grid-template-columns: 96px 1fr 54px 78px; align-items: center; gap: 8px; }
.tw-frag-n { font-size: 12.5px; font-weight: 900; color: var(--fc); white-space: nowrap; }
.tw-frag-bar { position: relative; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.tw-frag-bar i { position: absolute; inset: 0; background: var(--fc); transform-origin: left center; }
.tw-frag-c { font-size: 12px; font-weight: 900; text-align: right; }
.tw-frag-b { min-height: 34px; border-radius: 10px; border: 1px solid var(--fc); background: rgba(255, 255, 255, 0.05); color: #fff; font-size: 12px; font-weight: 900; cursor: pointer; font-family: inherit; }
.tw-frag-b:disabled { opacity: 0.35; pointer-events: none; }
.tw-frag-b.is-busy { opacity: 0.6; pointer-events: none; }
.tw-frags-note { font-size: 11.5px; line-height: 1.4; }

/* карточки добычи */
.tw-loot { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tw-loot-i {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 14px; text-align: center;
    background: linear-gradient(160deg, rgba(34, 40, 74, 0.95), rgba(14, 16, 30, 0.98)); border: 1px solid rgba(255, 255, 255, 0.12);
    animation: tw-loot-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(var(--i, 0) * 0.14s);
}
.tw-loot-pic { width: 60px; height: 72px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.tw-loot-pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tw-loot-pic .ic { font-size: 34px; }
.tw-loot-i b { font-size: 12.5px; font-weight: 900; line-height: 1.2; word-break: break-word; }
.tw-loot-i small { font-size: 10.5px; font-weight: 700; color: var(--av2-muted, #94a3b8); line-height: 1.2; }
.tw-loot-i.r-rare { border-color: #38bdf8; }
.tw-loot-i.r-epic { border-color: #c084fc; box-shadow: 0 0 16px rgba(192, 132, 252, 0.35); }
.tw-loot-i.r-legendary { border-color: #ffca28; box-shadow: 0 0 22px rgba(255, 202, 40, 0.45); }
.tw-loot-i.f-epic { border-color: rgba(171, 71, 188, 0.7); }
.tw-loot-i.f-legendary { border-color: rgba(255, 213, 79, 0.8); }
.tw-loot-i.decor { border-color: #f0abfc; background: linear-gradient(160deg, rgba(110, 30, 120, 0.95), rgba(30, 10, 40, 0.98)); box-shadow: 0 0 26px rgba(240, 171, 252, 0.55); }
@keyframes tw-loot-in { from { opacity: 0; transform: translateY(18px) scale(0.6); } to { opacity: 1; transform: none; } }

/* сцена открытия */
.tw-chest-scene {
    position: fixed; inset: 0; z-index: 2147482000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    padding: calc(var(--av2-safe-top, 0px) + 16px) 16px calc(var(--av2-safe-bottom, 0px) + 20px); overflow-y: auto;
    background: radial-gradient(70% 45% at 50% 38%, rgba(255, 255, 255, 0.07), transparent 70%), rgba(5, 6, 14, 0.97);
    animation: tw-fade-in 0.25s ease both; color: #fff;
}
.tw-chest-scene.out { animation: tw-fade-out 0.3s ease both; }
.tw-cs-rays {
    position: absolute; left: 50%; top: 40%; width: 640px; height: 640px; margin: -320px 0 0 -320px; pointer-events: none; opacity: 0;
    background: repeating-conic-gradient(from 0deg, var(--cc) 0deg 6deg, transparent 6deg 22deg);
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 65%); mask-image: radial-gradient(circle, #000 0%, transparent 65%);
}
.tw-chest-scene.is-open .tw-cs-rays { opacity: 0.35; animation: tw-spin 14s linear infinite; }
.tw-chest-scene.rare-legendary .tw-cs-rays { --cc: #ffca28; opacity: 0.55; }
.tw-chest-scene.rare-decor .tw-cs-rays { --cc: #f0abfc; opacity: 0.6; }
@keyframes tw-spin { to { transform: rotate(360deg); } }
.tw-cs-title { position: relative; text-align: center; }
.tw-cs-title small { display: block; font-size: 11px; font-weight: 900; letter-spacing: 2px; color: var(--cc); }
.tw-cs-title b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 32px; letter-spacing: 1px; }
.tw-cs-chest { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: #fff; cursor: pointer; font-family: inherit; }
.tw-cs-chest .tw-chest-ic { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px var(--cc)); }
.tw-cs-chest:not(.opened) .tw-chest-ic { animation: tw-bob 1.8s ease-in-out infinite; }
.tw-cs-chest.shake .tw-chest-ic { animation: tw-shake 0.85s linear both; }
.tw-cs-chest.opened .tw-chest-ic .lid { transform: translateY(-12%) rotate(-24deg); }
.tw-cs-chest.opened .tw-chest-ic .lock { opacity: 0; }
.tw-cs-chest.opened .tw-chest-ic { width: 92px !important; height: 79px !important; }
.tw-cs-chest.opened { margin-top: 34px; }
.tw-cs-hint { font-size: 13px; font-weight: 800; color: #cbd5e1; animation: tw-pulse 1.4s ease-in-out infinite; }
.tw-cs-chest.opened .tw-cs-hint, .tw-cs-chest.shake .tw-cs-hint { display: none; }
.tw-cs-loot { position: relative; width: 100%; max-width: 420px; }
.tw-cs-actions { position: relative; width: 100%; max-width: 420px; }
.tw-cs-actions .av2-btn { width: 100%; }
@keyframes tw-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes tw-shake {
    0%, 100% { transform: none; } 10% { transform: rotate(-5deg) scale(1.02); } 20% { transform: rotate(5deg) scale(1.04); }
    30% { transform: rotate(-7deg) scale(1.05); } 40% { transform: rotate(7deg) scale(1.07); } 50% { transform: rotate(-9deg) scale(1.08); }
    60% { transform: rotate(9deg) scale(1.1); } 70% { transform: rotate(-6deg) scale(1.12); } 85% { transform: rotate(3deg) scale(1.14); }
}
@keyframes tw-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .tw-fx, .tw-arena-intro { display: none; }
    .tw-loot-i, .tw-cs-chest .tw-chest-ic, .tw-cs-rays { animation: none !important; }
    .tw-tierup, .tw-tierup-in { animation: none; }
}

/* ==========================================================================
   v7: боссы каждые 10 этажей (миньоны, умения, ярость)
   ========================================================================== */
.tw-unit.raid {
    flex: 0 1 112px; max-width: 112px; aspect-ratio: 5 / 6.4;
    border-color: #ff4d5e; box-shadow: 0 0 0 2px rgba(255, 77, 94, 0.35), 0 8px 24px rgba(255, 30, 60, 0.45);
    animation: tw-boss-breath 2.4s ease-in-out infinite;
}
.tw-unit.raid .tw-unit-img img { filter: saturate(1.2) contrast(1.05); }
.tw-unit.raid .tw-unit-lvl { background: #ff4d5e; color: #fff; letter-spacing: 0.5px; }
.tw-unit.raid .tw-unit-role { width: 22px; height: 22px; font-size: 14px; border-color: #ff4d5e; }
.tw-raid-name { position: absolute; left: 0; right: 0; bottom: 30px; display: flex; flex-direction: column; align-items: center; padding: 0 3px; text-align: center; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.tw-raid-name b { font-size: 11px; font-weight: 900; line-height: 1.1; }
.tw-raid-name small { font-size: 8.5px; font-weight: 800; color: #fda4af; }
.tw-unit.minion { flex-basis: 52px; max-width: 52px; opacity: 0.95; }
@keyframes tw-boss-breath { 0%, 100% { transform: none; } 50% { transform: scale(1.03); } }

.tw-bosspanel {
    display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 11px 12px; border-radius: 14px;
    border: 1px solid rgba(255, 77, 94, 0.5); background: linear-gradient(160deg, rgba(120, 15, 35, 0.35), rgba(30, 6, 14, 0.4));
}
.tw-bosspanel-ic { font-size: 30px; filter: drop-shadow(0 0 10px rgba(255, 77, 94, 0.7)); }
.tw-bosspanel small { display: block; font-size: 10px; font-weight: 900; letter-spacing: 1px; color: #fda4af; text-transform: uppercase; }
.tw-bosspanel b { display: block; margin-top: 1px; font-size: 16px; font-weight: 900; color: #fff; }
.tw-bosspanel span { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; line-height: 1.35; color: #e2e8f0; }
.tw-bosspanel i { font-style: normal; font-weight: 900; color: #fca5a5; }
.tw-next.boss { border-color: rgba(255, 77, 94, 0.55); background: rgba(255, 77, 94, 0.06); }
.tw-next.boss small { color: #fda4af; }
.tw-floorcard:has(.tw-bosspanel) { border-color: rgba(255, 77, 94, 0.55); background: radial-gradient(120% 70% at 50% 0%, rgba(255, 77, 94, 0.14), transparent 60%), linear-gradient(160deg, rgba(40, 14, 24, 0.95), rgba(14, 10, 22, 0.97)); }

/* босс в сцене боя Арены */
.av2-unit.tw-boss .av2-ucard { box-shadow: 0 0 0 2px #ff4d5e, 0 0 22px rgba(255, 50, 80, 0.55); }
.tw-boss-title {
    position: absolute; top: 4px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 6px; white-space: nowrap;
    font-size: 9px; font-weight: 900; letter-spacing: 0.6px; background: #ff4d5e; color: #fff; text-transform: uppercase; z-index: 2;
}
.av2-banner .chip.boss { background: #ff4d5e; color: #fff; }
@media (prefers-reduced-motion: reduce) { .tw-unit.raid { animation: none; } }

/* v8: фото боссов */
.tw-boss-img { display: block; flex: 0 0 auto; width: 56px; height: 74px; border-radius: 10px; overflow: hidden;
    border: 1.5px solid rgba(255, 77, 94, 0.7); box-shadow: 0 0 14px rgba(255, 77, 94, 0.35); background: #1a1220;
    font-size: 24px; line-height: 74px; text-align: center; }
.tw-boss-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.tw-next-ic.tw-boss-img { width: 42px; height: 56px; line-height: 56px; border-radius: 8px; }
.tw-unit.raid .tw-unit-img img { object-position: center 25%; }
.av2-unit.tw-boss .av2-ucard img { object-position: center 25%; }

/* v9: под боем приложение не рисуется (arena_v2.js AV2_BATTLE_PERF) */
body.av2-battling #app { visibility: hidden; }

/* v9: эффекты умений боссов (arena_v2.js TOWER_BOSS_FX) — только transform/opacity */
.av2-bfx-tint, .av2-bfx-quake { position: absolute; inset: 0; left: 0 !important; top: 0 !important; pointer-events: none; opacity: 0; }
.av2-bfx-tint {
    background: radial-gradient(circle at var(--bx) var(--by), rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 60px, rgba(5, 3, 10, 0.55) 70%),
                radial-gradient(circle at var(--bx) var(--by), transparent 0, transparent 75px, var(--c) 105px, transparent 58%);
    animation: av2-bfx-tint var(--d, 1.1s) ease-out forwards;
}
@keyframes av2-bfx-tint { 0% { opacity: 0; } 18% { opacity: 0.75; } 70% { opacity: 0.55; } 100% { opacity: 0; } }
.av2-bfx-title {
    position: absolute; z-index: 5; display: flex; align-items: center; gap: 8px; white-space: nowrap;
    padding: 8px 18px 8px 12px; border-radius: 14px;
    background: linear-gradient(90deg, rgba(10, 6, 16, 0.92), rgba(30, 8, 18, 0.92));
    border: 2px solid var(--c); box-shadow: 0 0 22px var(--c), 0 8px 18px rgba(0, 0, 0, 0.6);
    opacity: 0; transform: translate(-50%, -50%) scale(1.6);
    animation: av2-bfx-title var(--d, 1.15s) cubic-bezier(.2,.9,.3,1.2) forwards;
}
.av2-bfx-title i { font-style: normal; font-size: 26px; line-height: 1; }
.av2-bfx-title b { font-family: 'Bangers', 'Outfit', cursive; font-weight: 400; font-size: 26px; letter-spacing: 1.5px; line-height: 1; color: #fff; text-shadow: 0 0 10px var(--c), 0 2px 0 #000; }
@keyframes av2-bfx-title {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
    16% { opacity: 1; transform: translate(-50%, -50%) scale(0.96); }
    24% { transform: translate(-50%, -50%) scale(1); }
    78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -62%) scale(0.92); }
}
.av2-bfx-charge {
    position: absolute; width: var(--sz, 160px); height: var(--sz, 160px); border-radius: 50%;
    background: radial-gradient(circle, var(--c) 0%, rgba(0, 0, 0, 0) 68%);
    opacity: 0; transform: translate(-50%, -50%) scale(0.4);
    animation: av2-bfx-charge var(--d, 0.8s) ease-out forwards;
}
@keyframes av2-bfx-charge { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 40% { opacity: 0.55; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } }
.av2-bfx-wave {
    position: absolute; width: var(--sz, 320px); height: var(--sz, 320px); border-radius: 50%;
    border: 5px solid var(--c); box-shadow: 0 0 18px var(--c), inset 0 0 18px var(--c);
    opacity: 0; transform: translate(-50%, -50%) scale(0.08);
    animation: av2-bfx-wave var(--d, 0.7s) cubic-bezier(.15,.7,.3,1) forwards;
}
@keyframes av2-bfx-wave { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.08); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.av2-bfx-quake { background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, var(--c) 100%); mix-blend-mode: screen; animation: av2-bfx-flash var(--d, 0.76s) ease-out forwards; }
@keyframes av2-bfx-flash { 0% { opacity: 0; } 20% { opacity: 0.55; } 100% { opacity: 0; } }
.av2-bfx-reap {
    position: absolute; width: var(--sz, 150px); height: var(--sz, 150px); border-radius: 50%;
    border-top: 7px solid var(--c); border-right: 3px solid transparent; border-left: 3px solid transparent;
    filter: drop-shadow(0 0 8px var(--c));
    opacity: 0; transform: translate(-50%, -50%) rotate(-80deg) scale(0.8);
    animation: av2-bfx-reap var(--d, 0.62s) cubic-bezier(.3,.7,.2,1) forwards;
}
@keyframes av2-bfx-reap { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-80deg) scale(0.8); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(110deg) scale(1.15); } }
.av2-bfx-crater {
    position: absolute; width: var(--sz, 170px); height: var(--sz, 170px); border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, var(--c) 22%, rgba(0, 0, 0, 0) 66%);
    opacity: 0; transform: translate(-50%, -50%) scale(0.2);
    animation: av2-bfx-crater var(--d, 0.7s) ease-out forwards;
}
@keyframes av2-bfx-crater { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.2); } 35% { opacity: 0.95; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
.av2-bfx-ice {
    position: absolute; width: var(--sz, 130px); height: var(--sz, 130px); border-radius: 50%;
    border: 2px solid var(--c); background: radial-gradient(circle, rgba(0, 0, 0, 0) 45%, rgba(103, 232, 249, 0.45) 100%);
    box-shadow: 0 0 16px var(--c);
    opacity: 0; transform: translate(-50%, -50%) scale(0.4);
    animation: av2-bfx-ice var(--d, 0.76s) cubic-bezier(.2,.9,.3,1.2) forwards;
}
@keyframes av2-bfx-ice { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 0.9; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); } }
.av2-bfx-bolt { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.av2-bfx-bolt polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.av2-bfx-bolt .glow { stroke: var(--c); stroke-width: 9; opacity: 0.45; }
.av2-bfx-bolt .core { stroke: #fff; stroke-width: 2.5; }
/* ярость: постоянная красная аура (пульс — только opacity) */
.av2-unit.av2-enraged .av2-ucard { border-color: #ff2d45; }
.av2-unit.av2-enraged::after {
    content: ''; position: absolute; inset: -10px; z-index: -1; border-radius: 18px; pointer-events: none;
    background: radial-gradient(closest-side, rgba(255, 45, 69, 0.75), rgba(255, 45, 69, 0) 100%);
    animation: av2-bfx-rage 1.1s ease-in-out infinite alternate;
}
@keyframes av2-bfx-rage { from { opacity: 0.45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .av2-unit.av2-enraged::after { animation: none; } }

/* Боссы в списке этажей */
.tw-lr.has-boss { cursor: pointer; }
.tw-lr-boss { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.tw-lr-boss b { font-size: 12.5px; font-weight: 900; color: #fecaca; overflow: hidden; text-overflow: ellipsis; }
.tw-lr-bp { flex: 0 0 auto; width: 30px; height: 38px; border-radius: 7px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: rgba(255, 255, 255, 0.06); box-shadow: 0 0 0 1px rgba(255, 77, 94, 0.6); }
.tw-lr-bp img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tw-bs-law { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-size: 12.5px; line-height: 1.4; color: #cbd5e1; }
