/* TOADBREW — Alchemical Arena. Портрет под телефон; на десктопе — колонка телефона по центру. */
:root {
  --ink: #120c07;
  --wood: #5a3b20;
  --brass: #c9a24a;
  --brass-l: #f0d58a;
  --brass-d: #7a5a20;
  --panel: rgba(24, 18, 13, 0.93);
  --panel-b: #6b5432;
  --blue: #2f7fe0;
  --blue-l: #7fc4ff;
  --red: #d8433a;
  --hp: #e0453b;
  --text: #f4ecdc;
  --muted: #b5a68c;
  --font-h: 'Cinzel', Georgia, serif;
  --font-b: 'Lilita One', 'Arial Black', system-ui, sans-serif;
  --font: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0d0906; overflow: hidden; }
body { font-family: var(--font); color: var(--text); user-select: none; -webkit-user-select: none; touch-action: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; background: #1c140e; }

#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels > div { position: absolute; left: 0; top: 0; will-change: transform; }

/* ---------- шапка меты ---------- */
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 10px 4px; }
.logo { background: linear-gradient(#6e4826, #3d2512); border: 2px solid #2a170a; border-radius: 10px; padding: 3px 14px 4px; box-shadow: 0 4px 0 #22130a, 0 0 0 2px #9a7334 inset; transform: rotate(-1.5deg); }
.logo-a { font-family: var(--font-h); font-weight: 900; font-size: 26px; line-height: 1; color: var(--brass-l); -webkit-text-stroke: 1px #3a2208; text-shadow: 0 3px 0 #2a1606; letter-spacing: 1px; }
.flask-o { color: #5fb8ff; text-shadow: 0 0 8px rgba(95,184,255,0.8); }
.logo-b { font-family: var(--font-h); font-weight: 700; font-size: 10px; text-align: center; color: #f3e6c6; letter-spacing: 1.5px; }
.chip { background: linear-gradient(#3b2f22, #241b12); color: var(--text); border: 1.5px solid var(--panel-b); border-radius: 999px; padding: 5px 13px; font-weight: 900; font-size: 12px; }
.chip.wide { min-width: 220px; padding: 9px 18px; font-size: 15px; }
.chip.danger { border-color: #a5463b; color: #ffc0b8; }

/* ---------- экраны меты ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: stretch; padding: 78px 10px 92px; overflow-y: auto; touch-action: pan-y; gap: 8px; }
.screen.meta { background: radial-gradient(ellipse at 50% 30%, rgba(110,70,30,0.35), rgba(15,10,6,0.85) 75%); }
.sec-head { display: flex; justify-content: space-between; align-items: center; }
.plaque { font-family: var(--font-h); font-weight: 900; font-size: 26px; color: #f6ead0; background: linear-gradient(#3a2c1e, #1d150d); border: 2px solid var(--brass-d); border-radius: 6px; padding: 2px 18px; clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); text-shadow: 0 2px 0 #000; }
.plaque.sm { font-size: 17px; padding: 3px 16px; }
.counter { font-family: var(--font-h); font-weight: 700; font-size: 12px; color: #e8dcc0; background: rgba(20,14,9,0.9); border: 1.5px solid var(--brass-d); border-radius: 6px; padding: 5px 10px; }

.roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.card { position: relative; border: 2px solid #5b4a33; border-radius: 8px; background: linear-gradient(#3a2e22, #1c150e); padding: 0 0 4px; text-align: center; color: var(--text); overflow: hidden; }
.card canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; background: radial-gradient(circle at 50% 60%, #4d3b2a, #1f1710); }
.card.sel { border-color: var(--blue-l); box-shadow: 0 0 0 2px var(--blue), 0 0 16px rgba(80,160,255,0.65); }
.card .cicon { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 6px; background: rgba(15,10,6,0.8); border: 1.5px solid var(--brass-d); display: grid; place-items: center; font-size: 13px; }
.card .check { position: absolute; bottom: 30px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; display: none; place-items: center; font-weight: 900; font-size: 13px; }
.card.sel .check { display: grid; }
.card .cname { font-family: var(--font-h); font-weight: 700; font-size: 11.5px; margin-top: 3px; letter-spacing: 0.3px; }
.card .stars { font-size: 9px; color: var(--brass); letter-spacing: 2px; }

.pair { display: grid; grid-template-columns: 1fr 1.05fr 1fr; gap: 4px; align-items: end; }
.ped { text-align: center; }
.ped canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; }
.ped .pname { font-family: var(--font-h); font-weight: 700; font-size: 12px; background: linear-gradient(#24324a, #121a28); border: 1.5px solid #3c5f95; border-radius: 6px; padding: 3px 4px; margin-top: -10px; position: relative; }
.ped .pfl { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.ped .empty { color: var(--muted); font-weight: 800; font-size: 12px; padding: 50px 0; border: 2px dashed #5b4a33; border-radius: 8px; }
.syn { text-align: center; align-self: center; }
.syn .s-ic { font-size: 26px; background: linear-gradient(#2c5ea8, #173564); border: 2px solid #7fc4ff; border-radius: 12px; display: inline-block; padding: 4px 10px; box-shadow: 0 0 14px rgba(80,160,255,0.6); }
.syn .s-l { font-family: var(--font-b); color: var(--blue-l); font-size: 13px; margin-top: 4px; }
.syn .s-n { font-family: var(--font-h); font-weight: 900; font-size: 12px; color: #fff3d0; margin-top: 2px; }
.syn .s-d { font-size: 11px; font-weight: 800; color: #d8ccb2; margin-top: 3px; line-height: 1.25; background: rgba(15,10,6,0.75); border-radius: 6px; padding: 4px; }

/* ---------- алхимия ---------- */
.rack { display: grid; grid-template-columns: 0.85fr 1.6fr; gap: 6px; align-items: center; background: rgba(20,14,9,0.75); border: 1.5px solid var(--panel-b); border-radius: 10px; padding: 6px; }
.rack canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; }
.rack .rname { font-family: var(--font-h); font-weight: 700; font-size: 12px; text-align: center; margin-top: -6px; }
.seq-h { font-family: var(--font-h); font-weight: 700; font-size: 12px; color: #e8dcc0; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.slot { border: 2px solid #5b4a33; border-radius: 8px; background: linear-gradient(#2c2219, #17110b); padding: 3px 2px 4px; text-align: center; color: var(--text); }
.slot.pick { border-color: var(--blue-l); box-shadow: 0 0 10px rgba(80,160,255,0.6); }
.slot .sl { font-size: 9px; font-weight: 900; color: var(--muted); }
.slot canvas { width: 34px; height: 40px; }
.slot .ln { font-family: var(--font-b); font-size: 11px; }
.panel-box { background: rgba(20,14,9,0.85); border: 1.5px solid var(--panel-b); border-radius: 10px; padding: 7px; }
.box-head { font-family: var(--font-h); font-weight: 700; font-size: 13px; margin-bottom: 6px; color: #f2e5c6; }
.box-head span { display: block; font-family: var(--font); font-weight: 800; font-size: 11px; color: var(--muted); margin-top: 1px; }
.reactions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.rx { border: 1.5px solid #4a3b28; border-radius: 8px; padding: 5px 6px; background: rgba(10,7,4,0.7); opacity: 0.6; }
.rx.on { opacity: 1; border-color: #b3893d; box-shadow: 0 0 10px rgba(255,190,90,0.25) inset; }
.rx .rf { font-weight: 900; font-size: 11px; }
.rx .rn { font-family: var(--font-b); font-size: 15px; }
.rx .rd { font-size: 10.5px; font-weight: 800; color: #cbbd9f; line-height: 1.2; }
.rx .rv { font-size: 9.5px; font-weight: 900; color: var(--blue-l); }
.liquids { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.liq { border: 2px solid #5b4a33; border-radius: 8px; background: linear-gradient(#2c2219, #17110b); text-align: center; padding: 4px 2px; color: var(--text); }
.liq canvas { width: 34px; height: 40px; }
.liq .ln { font-family: var(--font-b); font-size: 12px; }
.liq .lh { font-size: 9.5px; font-weight: 800; color: var(--muted); }
.liq.armed { border-color: var(--blue-l); }

/* ---------- навигация ---------- */
.nav { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr 1.5fr 1fr 1fr; align-items: end; gap: 2px; padding: 0 4px max(6px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(20,14,9,0), #1a120b 30%); }
.tab { background: linear-gradient(#2b221a, #17110b); border: 1.5px solid #4a3b28; border-radius: 8px 8px 4px 4px; color: #cfc2a6; font-family: var(--font-b); font-size: 11px; padding: 4px 0 5px; display: flex; flex-direction: column; align-items: center; }
.tab .ti { font-size: 20px; line-height: 1.2; }
.tab.on { color: #fff; border-color: var(--blue-l); background: linear-gradient(#24477e, #142846); box-shadow: 0 -2px 0 var(--blue) inset; }
.tab:disabled { opacity: 0.45; }
.battle-btn { font-family: var(--font-b); font-size: 26px; color: #fff; padding: 10px 4px 12px; border-radius: 12px; border: 3px solid #c9a24a; background: linear-gradient(#3a8cff, #1e57c8 60%, #143b8a); text-shadow: 0 3px 0 #0b2456; box-shadow: 0 4px 0 #6a4f1c, 0 8px 20px rgba(0,0,0,0.5); margin-bottom: 2px; }
.battle-btn:disabled { filter: grayscale(0.8) brightness(0.7); }
.battle-btn span { font-size: 22px; }

/* ---------- бой ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud .top { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr); gap: 4px; padding: max(6px, env(safe-area-inset-top)) 6px 0; align-items: start; }
#hud .bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 6px max(6px, env(safe-area-inset-bottom)); }
.mine { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 5px; pointer-events: auto; }
.fcard { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 5px; align-items: center; background: var(--panel); border: 2px solid #3c5f95; border-radius: 8px; padding: 4px 6px 4px 4px; }
.fcard.enemy { border-color: #8f3a33; }
.fcard canvas { width: 38px; height: 38px; border-radius: 6px; background: #2a2016; border: 1.5px solid rgba(255,255,255,0.25); }
.fcard .fn { font-family: var(--font-h); font-weight: 700; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .hpb { height: 12px; background: #3a1712; border-radius: 3px; overflow: hidden; position: relative; margin: 2px 0; border: 1px solid #000; }
.fcard .hpb i { display: block; height: 100%; background: linear-gradient(#ff6a5a, var(--hp)); transition: width 0.25s; }
.fcard.mine-c .hpb i { background: linear-gradient(#6fb0ff, #2f7fe0); }
.fcard .hpb em { position: absolute; inset: 0; text-align: center; font-style: normal; font-size: 9.5px; font-weight: 900; line-height: 11px; text-shadow: 0 1px 2px #000; }
.fcard .ffl { display: flex; align-items: center; gap: 3px; min-height: 16px; }
.fcard .ffl canvas { width: 13px; height: 16px; border: none; background: none; border-radius: 0; }
.fcard .ffl canvas.on { width: 17px; height: 20px; filter: drop-shadow(0 0 4px rgba(255,240,180,0.9)); }
.fcard .sts { font-size: 10px; margin-left: auto; }
.fcard.done { opacity: 0.55; }
.fcard.dead { filter: grayscale(1) brightness(0.6); }
.fcard.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--blue), 0 0 12px rgba(80,160,255,0.7); }
.fcard .tag { font-size: 8.5px; font-weight: 900; color: var(--muted); margin-left: 4px; }
.round { text-align: center; background: linear-gradient(#4a3d30, #241b12); border: 2px solid var(--brass-d); border-radius: 8px 8px 16px 16px; padding: 3px 0 4px; }
.round-l { font-family: var(--font-h); font-weight: 700; font-size: 10px; color: #e2d4b4; }
.round-n { font-family: var(--font-b); font-size: 24px; line-height: 1; color: var(--brass-l); text-shadow: 0 2px 0 #000; }
.ovl { font-family: var(--font-b); font-size: 9px; color: #ffb06a; animation: ovl 0.7s ease-in-out infinite alternate; }
@keyframes ovl { to { color: #ff4a2e; } }
.actbar { display: grid; grid-template-columns: 44px 1fr 64px; gap: 6px; align-items: stretch; pointer-events: auto; }
.gear { border-radius: 10px; border: 2px solid #4a3b28; background: #241b12; color: #d6c8aa; font-size: 22px; }
.skip { border-radius: 10px; border: 2px solid #4a3b28; background: linear-gradient(#3a2e22, #1c150e); color: #e8dcc0; font-family: var(--font-b); font-size: 14px; }
.skip:disabled, .bottom.wait .skip { opacity: 0.4; }
.pvcard { background: var(--panel); border: 2px solid #4a6c9e; border-radius: 10px; padding: 5px 8px; min-height: 52px; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.pvcard .pv-fl { display: flex; gap: 2px; align-items: center; font-weight: 900; }
.pvcard .pv-fl canvas { width: 22px; height: 26px; }
.pvcard .pv-t { font-family: var(--font-b); font-size: 17px; line-height: 1.05; }
.pvcard .pv-d { font-size: 11px; font-weight: 800; color: #d0c3a6; line-height: 1.2; }
.pvcard .pv-h { font-family: var(--font-b); font-size: 12px; color: var(--blue-l); }
.timer { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.timer b { flex: 1; height: 6px; border-radius: 3px; background: rgba(10,7,4,0.85); overflow: hidden; border: 1px solid #4a3b28; }
.timer b i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3a8cff, #8fd0ff); }
.timer span { font-family: var(--font-b); font-size: 13px; min-width: 18px; }
.timer.low b i { background: linear-gradient(90deg, #ff4a3a, #ffa060); }
.timer.low span { color: #ff6b5a; }
.bottom.wait .timer { visibility: hidden; }

/* ---------- баннеры ---------- */
.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: var(--font-b); font-size: 38px; color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(0,0,0,0.6); pointer-events: none; opacity: 0; transform: scale(0.7); transition: opacity 0.2s, transform 0.25s cubic-bezier(.2,1.6,.4,1); z-index: 6; }
.banner.show { opacity: 1; transform: scale(1); }
.banner.p { color: var(--blue-l); } .banner.b { color: #ff9a8a; } .banner.gold { color: var(--brass-l); font-size: 44px; } .banner.rx { font-size: 46px; }
.banner small { display: block; font-size: 16px; -webkit-text-stroke: 1px var(--ink); margin-top: 3px; }

/* ---------- результат ---------- */
#result { justify-content: center; align-items: center; gap: 10px; padding: 30px 12px; background: radial-gradient(circle at 50% 30%, rgba(255,210,120,0.3), rgba(12,8,5,0.85) 70%); }
.res-title { font-family: var(--font-h); font-weight: 900; font-size: 54px; color: var(--brass-l); -webkit-text-stroke: 2px #2a1606; text-shadow: 0 5px 0 #2a1606; padding: 6px 26px; background: linear-gradient(#2c5ea8, #173564); border: 3px solid var(--brass); border-radius: 12px; clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%); }
#result.lose .res-title { background: linear-gradient(#7a2a24, #3e1210); color: #efe4d2; }
.res-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.res-team { background: var(--panel); border: 2px solid #3c5f95; border-radius: 10px; padding: 6px; }
.res-team.enemy { border-color: #8f3a33; }
.rt-h { font-family: var(--font-h); font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.rt-f { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rt-f div { text-align: center; font-family: var(--font-h); font-weight: 700; font-size: 9.5px; position: relative; }
.rt-f canvas { width: 100%; aspect-ratio: 1 / 1; height: auto; background: #2a2016; border-radius: 6px; }
.rt-f .x { position: absolute; top: 20%; left: 0; right: 0; font-size: 34px; color: #ff4a3a; font-family: var(--font-b); text-shadow: 0 2px 0 #000; }
.rt-f .gone canvas { filter: grayscale(1) brightness(0.6); }
.res-sub { font-weight: 800; color: #d8ccb2; text-align: center; font-size: 13px; }
.big-btn { min-width: 230px; font-family: var(--font-b); font-size: 26px; color: #fff; padding: 8px 26px 10px; border-radius: 12px; border: 3px solid var(--brass); background: linear-gradient(#3a8cff, #1e57c8 60%, #143b8a); text-shadow: 0 3px 0 #0b2456; box-shadow: 0 4px 0 #6a4f1c, 0 8px 22px rgba(0,0,0,0.45); }

.modal { position: absolute; inset: 0; background: rgba(5,3,2,0.72); display: grid; place-items: center; padding: 16px; z-index: 10; }
.panel { background: #1e1610; border: 2px solid var(--panel-b); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; max-width: 390px; }
.panel h2 { font-family: var(--font-h); font-weight: 900; margin: 0 0 4px; font-size: 24px; color: var(--brass-l); }
.panel.help { align-items: stretch; max-height: 90vh; overflow-y: auto; touch-action: pan-y; }
.panel.help p { margin: 0; font-size: 13.5px; line-height: 1.4; color: #e2d6bc; }
.panel.help b { color: #fff0c0; }
.panel.help .big-btn { align-self: center; margin-top: 6px; }

@media (max-height: 720px) { .screen { padding-top: 70px; } .logo-a { font-size: 22px; } .card .cname { font-size: 10.5px; } }

/* ---------- итерация 2 ---------- */
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-b); font-size: 28px; color: var(--brass-l); background: #120c08; z-index: 20; }
.roster.r2 { grid-template-columns: repeat(2, 1fr); }
.card .cstats { font-size: 10.5px; font-weight: 900; color: #e8dcc0; }
.card .ctrait { font-size: 10px; font-weight: 800; color: var(--blue-l); }
.ped .ptr { font-size: 10px; font-weight: 800; color: var(--muted); margin-top: 3px; line-height: 1.2; }
.syn .s-a { font-size: 10px; font-weight: 900; color: var(--brass); margin-top: 1px; }
.tank { display: grid; grid-template-columns: 0.8fr 1.6fr; gap: 8px; align-items: center; background: rgba(20,14,9,0.75); border: 1.5px solid var(--panel-b); border-radius: 10px; padding: 6px; margin-bottom: 6px; }
.tank canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; }
.tank .rname { font-family: var(--font-h); font-weight: 700; font-size: 12px; text-align: center; margin-top: -6px; }
.tier { font-size: 10px; color: var(--brass); border: 1px solid var(--brass-d); border-radius: 4px; padding: 0 5px; }
.els { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.elb { border: 2px solid #5b4a33; border-radius: 8px; background: linear-gradient(#2c2219, #17110b); color: var(--text); font-family: var(--font-b); font-size: 13px; padding: 6px 4px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.elb span { font-size: 17px; }
.elb.on { border-color: var(--c); box-shadow: 0 0 12px var(--c), 0 0 0 1px var(--c) inset; color: #fff; }
.el-d { font-size: 11px; font-weight: 800; color: #d0c3a6; margin-top: 6px; line-height: 1.25; }
.fcard .eli { font-size: 13px; }
.fcard .chg { font-size: 11px; background: rgba(255,230,140,0.15); border: 1px solid var(--brass); border-radius: 5px; padding: 0 3px; }

.zoomer { position: absolute; right: 6px; top: 40%; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.zoomer button { width: 38px; height: 38px; border-radius: 10px; border: 2px solid #4a3b28; background: rgba(24,18,13,0.85); color: #e8dcc0; font-size: 20px; font-weight: 900; }
.gripbar { position: absolute; left: 15%; right: 15%; top: 30%; text-align: center; font-family: var(--font-b); font-size: 18px; color: #ffcf70; text-shadow: 0 2px 0 #000; }
.gripbar b { display: block; height: 10px; border-radius: 5px; background: rgba(10,7,4,0.85); border: 1px solid #ffb040; overflow: hidden; margin-bottom: 4px; }
.gripbar i { display: block; height: 100%; background: linear-gradient(90deg, #ff7a30, #ffd070); }

.flabel { margin-left: -24px; margin-top: -22px; width: 48px; text-align: center; }
.flabel .fl-hp { height: 6px; border-radius: 3px; background: rgba(20,8,6,0.8); border: 1px solid #000; overflow: hidden; }
.flabel .fl-hp i { display: block; height: 100%; background: #e0453b; transition: width 0.25s; }
.flabel.mine .fl-hp i { background: #4aa3ff; }
.flabel .fl-st { font-size: 11px; line-height: 13px; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.flabel .fl-st .ch { background: rgba(30,20,10,0.85); border: 1px solid var(--brass); border-radius: 5px; padding: 0 2px; }
.plabel { margin-left: -9px; margin-top: -10px; font-size: 16px; text-shadow: 0 1px 3px #000; }
.nlabel { margin-left: -50px; margin-top: -16px; width: 100px; text-align: center; font-family: var(--font-b); font-size: 10px; line-height: 1.1; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.ftext { margin-left: -80px; width: 160px; text-align: center; font-family: var(--font-b); font-size: 22px; color: #fff; -webkit-text-stroke: 1px #1a0e06; text-shadow: 0 2px 0 #1a0e06; white-space: nowrap; }
.ftext small { font-size: 13px; display: block; }
.ftext.fire { color: #ff7a4a; } .ftext.ice { color: #9fe0ff; } .ftext.poison { color: #8dff5a; } .ftext.light { color: #ffe23a; }
.ftext.slam { color: #ffd080; font-size: 24px; } .ftext.ko { color: #ff4a3a; font-size: 34px; } .ftext.gold { color: var(--brass-l); font-size: 18px; }
.ftext.rx { color: #fff3c0; font-size: 28px; } .ftext.charge { color: #ffe9a0; font-size: 18px; } .ftext.node { color: #ffd0a0; font-size: 13px; }
.alabel { margin-left: -70px; margin-top: -12px; width: 140px; text-align: center; font-family: var(--font-b); font-size: 17px; color: #ffd0c0; -webkit-text-stroke: 1px #1a0e06; text-shadow: 0 2px 0 #1a0e06; }
.alabel.rx { color: #fff3c0; font-size: 19px; } .alabel.gold { color: var(--brass-l); font-size: 14px; } .alabel.self { color: #ff9a8a; font-size: 14px; }

/* ---------- главное меню на весь экран без прокрутки (D-064) ---------- */
.screen.meta { overflow: hidden; touch-action: none; height: 100%; padding-left: max(10px, calc((100% - 600px) / 2)); padding-right: max(10px, calc((100% - 600px) / 2)); padding-bottom: max(100px, calc(92px + env(safe-area-inset-bottom))); }
#team.screen { display: grid; grid-template-rows: auto minmax(0, 1.3fr) auto minmax(0, 1fr); gap: 6px; }
.roster.r2 { grid-template-rows: 1fr 1fr; min-height: 0; }
.roster.r2 .card { display: flex; flex-direction: column; min-height: 0; padding-bottom: 3px; }
.roster.r2 .card canvas { flex: 1 1 0; min-height: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }
.pair { min-height: 0; height: 100%; align-items: stretch; }
.ped { display: flex; flex-direction: column; min-height: 0; justify-content: flex-end; }
.ped canvas { flex: 1 1 0; min-height: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }
.ped .ptr { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.syn .s-d { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
#alchemy.screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; }
#tanks { display: grid; grid-template-rows: 1fr 1fr; gap: 6px; min-height: 0; }
.tank { margin: 0; min-height: 0; height: 100%; }
.tank > div:first-child { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.tank canvas { flex: 1 1 0; min-height: 0; height: 100%; aspect-ratio: auto; object-fit: contain; }
.tank .elb { padding: 4px; font-size: 12px; }
.tank .el-d { font-size: 10.5px; }
#alchemy .reactions { grid-template-columns: repeat(3, 1fr); gap: 4px; }
#alchemy .rx { padding: 3px 5px; }
#alchemy .rx .rn { font-size: 12.5px; line-height: 1.1; }
#alchemy .rx .rd { font-size: 9.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#alchemy .rx .rv { font-size: 9px; }
#alchemy .box-head span { font-size: 10px; }
#hud .top, #hud .bottom { max-width: 640px; margin: 0 auto; }
@media (max-height: 700px) { .card .ctrait, #alchemy .rx .rd { display: none; } .screen.meta { padding-top: 64px; } }
.tank .rname { margin-top: 0; font-size: 11px; white-space: nowrap; }

/* ---------- значки свойств и порядок хода (D-070) ---------- */
.tbadge { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border: 2px solid #3c5f95; border-radius: 999px; padding: 2px 10px 2px 4px; font-family: var(--font-h); font-size: 10.5px; color: #f3e6c6; white-space: nowrap; }
.tbadge .ti { font-size: 16px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(#2c5ea8, #173564); border: 1.5px solid #7fc4ff; }
.tbadge.enemy { position: absolute; top: calc(max(6px, env(safe-area-inset-top)) + 60px); right: 8px; border-color: #8f3a33; }
.tbadge.enemy .ti { background: linear-gradient(#a8352c, #5a1712); border-color: #ff9a8a; }
.tbadge.mine { margin: 0 0 5px 2px; }
.order { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.order .o-h { font-family: var(--font-b); font-size: 10px; color: var(--brass-l); text-shadow: 0 1px 2px #000; }
.oslot { position: relative; width: 42px; height: 42px; border-radius: 50%; background: rgba(20,14,9,0.9); border: 3px solid #4aa3ff; display: grid; place-items: center; overflow: visible; transition: transform 0.2s; }
.oslot.enemy { border-color: #ff5a4a; }
.oslot canvas { width: 36px; height: 36px; border-radius: 50%; }
.oslot .q { font-family: var(--font-b); font-size: 20px; color: #e8dcc0; }
.oslot i { position: absolute; bottom: -4px; right: -6px; font-style: normal; font-family: var(--font-b); font-size: 11px; background: #1a120b; border: 1.5px solid var(--brass-d); border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; color: var(--brass-l); }
.oslot.done { opacity: 0.4; filter: grayscale(0.7); }
.oslot.now { transform: scale(1.18); box-shadow: 0 0 0 3px #fff, 0 0 14px rgba(255,240,180,0.9); }

/* ---------- плашка заряда комбинации (D-072) ---------- */
.notice { position: absolute; left: 50%; top: calc(max(6px, env(safe-area-inset-top)) + 100px); transform: translateX(-50%); min-width: 230px; max-width: 86%; text-align: center; background: rgba(18,12,8,0.94); border: 3px solid var(--c); border-radius: 14px; padding: 6px 14px 8px; box-shadow: 0 0 18px var(--c); pointer-events: none; animation: npop 0.25s cubic-bezier(.2,1.6,.4,1); }
.notice .n-t { font-family: var(--font-b); font-size: 13px; color: var(--c); letter-spacing: 0.5px; }
.notice .n-m { font-family: var(--font-b); font-size: 21px; color: #fff; text-shadow: 0 2px 0 #000; }
.notice .n-m b { color: var(--c); font-weight: normal; }
.notice .n-s { font-size: 11px; font-weight: 800; color: #d8ccb2; }
@keyframes npop { from { transform: translateX(-50%) scale(0.7); opacity: 0; } }

/* главное меню: три кнопки — Алхимия, Битва, Команда (D-087) */
.nav { grid-template-columns: 1fr 1.35fr 1fr; gap: 8px; padding-left: max(10px, calc((100% - 520px) / 2)); padding-right: max(10px, calc((100% - 520px) / 2)); }
.nav .tab { font-size: 13px; padding: 6px 0 7px; }
.nav .tab .ti { font-size: 24px; }

/* совет перед матчем (D-088) */
.tipbox { position: absolute; inset: 0; z-index: 12; background: rgba(6,4,2,0.78); display: grid; place-items: center; padding: 20px; animation: tipin 0.3s ease-out; }
@keyframes tipin { from { opacity: 0; } }
.tip-card { max-width: 360px; text-align: center; background: linear-gradient(#2a2016, #17110b); border: 2px solid var(--brass); border-radius: 16px; padding: 18px 18px 14px; box-shadow: 0 0 40px rgba(255,200,100,0.25); }
.tip-h { font-family: var(--font-h); font-weight: 700; font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.tip-ic { font-size: 44px; margin: 6px auto 2px; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(#2c5ea8, #173564); border: 2px solid #7fc4ff; box-shadow: 0 0 18px rgba(80,160,255,0.6); }
.tip-n { font-family: var(--font-b); font-size: 24px; color: var(--brass-l); margin-top: 6px; }
.tip-t { font-size: 15px; font-weight: 800; line-height: 1.4; color: #efe3c8; margin-top: 8px; }
.tip-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,0.12); overflow: hidden; margin-top: 14px; }
.tip-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3a8cff, #8fd0ff); }
.tip-s { font-size: 11px; font-weight: 800; color: var(--muted); margin-top: 6px; }

/* таймер хода — кольцо под номером раунда, на виду, но вне поля (D-093) */
#timer { display: none !important; }
.round { position: relative; padding-bottom: 6px; }
.tring { position: relative; width: 50px; height: 50px; margin: 4px auto 0; transition: opacity 0.2s, transform 0.2s; }
.tring.off { opacity: 0; transform: scale(0.6); }
.tring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tring circle { fill: rgba(12,8,5,0.9); stroke-width: 4.5; }
.tring .bg { stroke: rgba(255,255,255,0.12); }
.tring .fg { fill: none; stroke: #5fb0ff; stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: 0; transition: stroke-dashoffset 0.15s linear; filter: drop-shadow(0 0 3px rgba(95,176,255,0.8)); }
.tring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-b); font-size: 19px; color: #fff; text-shadow: 0 2px 0 #000; }
.tring.low .fg { stroke: #ff5a3a; filter: drop-shadow(0 0 4px rgba(255,90,58,0.9)); }
.tring.low span { color: #ffb0a0; animation: tlow 0.5s ease-in-out infinite alternate; }
@keyframes tlow { to { transform: scale(1.18); } }
.ftext.big { font-size: 28px; color: #ffd0c0; }

/* дикая жаба-NPC (D-102) */
.notice { top: calc(max(6px, env(safe-area-inset-top)) + 160px); }
.boss { position: absolute; left: 50%; transform: translateX(-50%); top: calc(max(6px, env(safe-area-inset-top)) + 96px); width: min(330px, 74%); display: grid; grid-template-columns: 40px 1fr; gap: 6px; align-items: center; background: rgba(28,10,36,0.92); border: 2px solid #b050ff; border-radius: 12px; padding: 4px 8px 5px 4px; box-shadow: 0 0 16px rgba(176,80,255,0.45); pointer-events: none; }
.boss.dead { filter: grayscale(1); opacity: 0.6; }
.boss .b-pic canvas { width: 40px; height: 40px; display: block; }
.boss .b-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; font-weight: 800; color: #d8c8f0; }
.boss .b-top b { font-family: var(--font-b); font-size: 13px; font-weight: normal; color: #f0d8ff; letter-spacing: 0.5px; }
.boss .b-hp { position: relative; height: 10px; border-radius: 5px; background: #2a1030; border: 1px solid #000; overflow: hidden; margin: 2px 0; }
.boss .b-hp i { display: block; height: 100%; background: linear-gradient(90deg, #8a2be2, #e050ff); transition: width 0.3s; }
.boss .b-hp em { position: absolute; inset: 0; text-align: center; font-style: normal; font-size: 8.5px; font-weight: 900; line-height: 9px; text-shadow: 0 1px 2px #000; }
.boss .b-row { display: flex; justify-content: space-between; font-size: 10px; font-weight: 900; color: #eee; gap: 4px; }
.boss .b-weak { color: var(--c); border: 1px solid var(--c); border-radius: 5px; padding: 0 4px; }
.oslot.npc { border-color: #b050ff; }
.flabel.npc .fl-hp i { background: #c050ff; }
.tip-goal { font-size: 12.5px; font-weight: 800; color: #e8d0ff; background: rgba(120,40,170,0.3); border: 1px solid #8a40c0; border-radius: 8px; padding: 6px 8px; margin-top: 10px; line-height: 1.35; }
.tip-goal b { color: #ffd8ff; }
