/* Pet Champions v0.1 — dark fantasy + gold, the Bet Arena look (frames/buttons from assets/ui, 9-slice in %) */
:root {
  --bg: #000; --s1: #141414; --s2: #262626; --s3: #303030; --s4: #434343;
  --gold1: #ffd666; --gold2: #ffc53d; --gold: #faad14; --gold4: #d48806; --gold5: #874d00; --gold6: #613400; --gold7: #2b2111;
  --green: #52c41a; --red: #ff4d4f; --red2: #ff7875; --blue: #40a9ff; --ice: #91d5ff;
  --t1: rgba(255, 255, 255, .88); --t2: rgba(255, 255, 255, .65); --t3: rgba(255, 255, 255, .45);
  --display: "Cinzel", "Trajan Pro", Optima, Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.645, .045, .355, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--t1); overflow: hidden; user-select: none; -webkit-tap-highlight-color: transparent; font-size: 14px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i .solid { fill: currentColor; stroke: none; }
.muted { color: var(--t3); }
.small { font-size: 12px; }
#app { height: 100dvh; display: flex; flex-direction: column; max-width: 1180px; margin: 0 auto; }

/* ---------- art-pack frames (stretch by 9-slice; ornaments stay in the corners) ---------- */
.panel-frame { border: 12px solid transparent; border-image: url("../assets/ui/frame-panel.webp") 30% 15% fill / 24px 23px stretch; }
.plate { border: 8px solid transparent; border-image: url("../assets/ui/frame-plate.webp") 40% 7% fill / 18px 17px stretch; }
.chip { border: 4px solid transparent; border-width: 4px 9px; border-image: url("../assets/ui/frame-chip.webp") 45% 11% fill / 11px stretch; color: var(--gold1); font-size: 13px; white-space: nowrap; }
.ui-btn {
  width: 100%; height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 8px solid transparent; border-width: 8px 24px; font: 600 17px/1 var(--display); letter-spacing: .03em;
  position: relative; overflow: hidden; isolation: isolate; transition: filter .15s;
}
.ui-btn .i { font-size: 20px; }
.ui-btn.gold { color: #2a1700; border-image: url("../assets/ui/btn-gold.webp") 35% 11% fill / 20px 31px stretch; animation: btnGlow 2.4s ease-in-out infinite; }
.ui-btn.gold:active { border-image-source: url("../assets/ui/btn-gold-pressed.webp"); }
.ui-btn.dark { color: var(--gold1); border-image: url("../assets/ui/btn-dark.webp") 35% 11% fill / 20px 31px stretch; }
.ui-btn:hover { filter: brightness(1.1); }
.ui-btn:not(:disabled)::after {
  content: ''; position: absolute; top: -30%; bottom: -30%; left: -80%; width: 60%; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 236, 180, 0), rgba(255, 236, 180, .5) 50%, rgba(255, 236, 180, 0));
  transform: skewX(-18deg); mix-blend-mode: screen; animation: shineSweep 3.6s ease-in-out infinite;
}
.ui-btn.dark::after { animation-delay: 1.2s; opacity: .6; }
@keyframes shineSweep { 0%, 58% { left: -80%; } 88%, 100% { left: 130%; } }
@keyframes btnGlow { 50% { filter: brightness(1.1) drop-shadow(0 0 10px rgba(250, 173, 20, .55)); } }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--s1); border: 1px solid var(--s3); color: var(--t2); font-size: 16px; flex: none; }
.link { color: var(--gold1); text-decoration: underline; }

/* ---------- portraits in art rings ---------- */
.pt-wrap { position: relative; width: 120px; height: 120px; flex: none; }
.pt-wrap.small { width: 84px; height: 84px; }
.pt { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: #000; display: grid; place-items: center; transition: filter .6s; }
.pt .portrait { width: 100%; height: 100%; object-fit: cover; }
.portrait.mirror { transform: scaleX(-1); }   /* the raccoon art faces left; the player's pet faces the enemy */
.frog-ph { background: radial-gradient(circle at 45% 40%, #3f7d2a, #10260a 75%); font-size: 64px; }
.pt-wrap.small .frog-ph { font-size: 44px; }
/* ring art: clear centre ≈ 35% (player), 29% (bot), 26% (winner) of the ring image radius */
.pt-wrap .ring { position: absolute; inset: -21%; width: 142%; height: 142%; pointer-events: none; }
.pt-wrap.bot .ring { inset: -35%; width: 170%; height: 170%; }
.pt-wrap.winner .ring { inset: -48%; width: 196%; height: 196%; }
.pt-wrap.loser .pt { filter: grayscale(1) brightness(.55); }
.pt-wrap.hurt .pt { animation: hurt .35s; }
@keyframes hurt { 30% { filter: brightness(1.8) saturate(.6) sepia(.4) hue-rotate(-30deg); } }

/* tones (handoff accents): red/orange attack · blue energy/speed · purple dodge/special · green health/defense */
.ab-art.svg.attack { color: #ff7a45; } .ab-art.svg.speed { color: var(--ice); } .ab-art.svg.special { color: #d3adf7; } .ab-art.svg.defense { color: #95de64; }
.hero-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-art.mirror { transform: scaleX(-1); }
/* transparent cut-outs sit on a soft hero-coloured backdrop inside rings and cards */
.pt.raccoon, .hc-art, .sk-art { background: radial-gradient(circle at 50% 38%, #f6c35c 0%, #c4572a 48%, #3b140a 100%); }
.pt.frog, .hc-art.frog, .sk-art.frog { background: radial-gradient(circle at 50% 38%, #b7eb8f 0%, #3f7d2a 50%, #10260a 100%); }
.hero-art.full { width: auto; height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .65)); }
.hero-art.full.hero-xl { height: min(44dvh, 380px); position: relative; }
.hero-art.full.hero-lg { height: min(34dvh, 250px); }
.res-pose { height: min(30dvh, 240px); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .7)); margin-top: 14px; }
.result.defeat .res-pose { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .7)) saturate(.75); }
.hero-art.ph { display: grid; place-items: center; background: radial-gradient(circle at 45% 40%, #3f7d2a, #10260a 75%); font-size: 3.2em; line-height: 1; }
.pt .hero-art.ph { font-size: 64px; }
.pt-wrap.tiny { width: 38px; height: 38px; }
.pt-wrap.tiny .hero-art.ph { font-size: 20px; }
.pt-wrap.small .hero-art.ph { font-size: 40px; }

/* ================= mobile shell: header · scrolling content · CTA · bottom navigation ================= */
#app { position: relative; max-width: 520px; }
.shell { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; isolation: isolate; }
.shell-bg { position: absolute; inset: 0; z-index: -1; background: #120d07 center 30% / cover no-repeat; }
.shell { background: #0a0703; }
.shell-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 7, 3, .15), rgba(10, 7, 3, .45) 35%, rgba(10, 7, 3, .8) 60%, rgba(6, 4, 2, .94) 85%); }

.hdr { flex: none; display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
.avatar { position: relative; flex: none; }
.avatar .lvl, .hc-art .lvl { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: #0b2a4a; border: 1px solid var(--ice); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.who { flex: 1; min-width: 0; }
.who b { font: 600 15px var(--display); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp { height: 6px; border-radius: 3px; background: #1a1612; margin-top: 3px; overflow: hidden; } .xp i { display: block; height: 100%; background: var(--gold); }
.hdr-title { flex: 1; min-width: 0; font: 600 20px var(--display); color: var(--gold1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-res { display: flex; gap: 6px; margin-left: auto; }
.pill { display: flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 4px; border-radius: 16px; background: rgba(0, 0, 0, .7); border: 1px solid var(--gold5); }
.pill img { width: 24px; height: 24px; }
.pill b { font-size: 14px; min-width: 14px; color: var(--t2); }
.gem { display: grid; place-items: center; width: 24px; height: 24px; color: #69c0ff; font-size: 18px; filter: drop-shadow(0 0 4px rgba(64, 169, 255, .7)); }
.gem.big { width: 56px; height: 56px; font-size: 44px; }
.icon-btn.big { width: 44px; height: 44px; font-size: 20px; color: var(--gold1); border-color: var(--gold5); background: rgba(0, 0, 0, .7); }
.icon-btn:active, .bn:active, .hero-card:active, .abil-prev:active, .arena-card:active, .tab:active { transform: scale(.96); }

.content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.content > * { flex-shrink: 0; }
.cta { flex: none; padding: 6px 12px 8px; }
.cta .ui-btn { height: 58px; font-size: 22px; }
.battle-cta { text-transform: uppercase; letter-spacing: .08em; }

.bnav { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 4px 6px max(6px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, #17120b, #0a0805); border-top: 1px solid var(--gold6); }
.bn { position: relative; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; color: var(--t2); font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.bn .i { font-size: 22px; }
.bn.on { color: var(--gold1); background: radial-gradient(ellipse at 50% 100%, rgba(250, 173, 20, .28), rgba(43, 33, 17, .9) 70%); border-color: var(--gold4); }
.bn.soon-item { opacity: .45; cursor: default; }
.bn em { position: absolute; top: 3px; right: 4px; font-style: normal; font-size: 9px; padding: 1px 4px; border-radius: 6px; background: var(--s3); color: var(--t2); }

/* ================= Panel / SectionHeader / small pieces ================= */
.panel { background: linear-gradient(180deg, rgba(28, 22, 14, .94), rgba(12, 10, 7, .94)); border: 1px solid #6b4a12; border-radius: 14px; padding: 12px; box-shadow: inset 0 0 0 1px rgba(255, 214, 102, .07), 0 6px 18px rgba(0, 0, 0, .5); }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--gold1); }
.sec-head .i { font-size: 18px; }
.sec-head h2 { flex: 1; font: 600 16px var(--display); letter-spacing: .03em; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.page-title h1 { font: 700 26px var(--display); color: var(--gold1); text-shadow: 0 2px 0 #000; }
.count { color: var(--t2); font-size: 13px; }
.note { color: var(--t3); font-size: 12px; line-height: 1.4; display: flex; gap: 6px; align-items: flex-start; }
.note .i { flex: none; margin-top: 1px; }
.soon { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; background: #5c1414; color: #ffccc7; border: 1px solid #a8071a; white-space: nowrap; letter-spacing: 0; text-transform: none; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.rarity { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--s3); }
.rarity.rare { background: #0958d9; } .rarity.epic { background: #722ed1; } .rarity.legendary { background: var(--gold4); }
.role { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--t2); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .ui-btn { height: 50px; font-size: 15px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; color: var(--t3); text-align: center; }
.empty-state .i { font-size: 28px; }
.empty-state.big { padding: 36px 14px; font: 600 16px var(--display); color: var(--t2); }
.tabs { display: flex; gap: 6px; }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
.tabs.scroll::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 40px; padding: 0 16px; border-radius: 20px; background: rgba(0, 0, 0, .7); border: 1px solid var(--s4); font-weight: 600; color: var(--t2); }
.tab.on { background: linear-gradient(180deg, var(--gold1), var(--gold)); color: #2a1700; border-color: var(--gold1); }
.toggle { position: relative; width: 46px; height: 26px; border-radius: 13px; background: var(--s4); flex: none; transition: background .2s; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.toggle.on { background: var(--gold); } .toggle.on i { transform: translateX(20px); }

/* stats row (only stats that exist in config) */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: rgba(0, 0, 0, .45); text-align: center; }
.stat .i { font-size: 18px; }
.stat span { font-size: 10px; color: var(--t3); line-height: 1.1; }
.stat b { font: 600 15px var(--display); }
.stat.hp .i { color: var(--red); } .stat.attack .i { color: #ff7a45; } .stat.speed .i { color: var(--ice); } .stat.energy .i { color: var(--blue); }

/* ================= Home ================= */
.arena-chip { align-self: flex-end; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 12px; background: rgba(0, 0, 0, .72); border: 1px solid var(--gold4); text-align: left; min-height: 48px; }
.arena-chip .ac-thumb { width: 52px; height: 38px; border-radius: 8px; background: center / cover; }
.arena-chip b { display: block; font: 600 14px var(--display); color: var(--gold1); }
.arena-chip small { color: var(--t3); font-size: 11px; }
.arena-chip > .i { color: var(--gold1); }
.showcase { position: relative; display: grid; place-items: center; padding: 0 0 4px; margin-top: -30px; }
.showcase .glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, rgba(250, 173, 20, .35), transparent 60%); }
.pt-wrap.hero-xl { width: min(52vw, 210px); height: min(52vw, 210px); }
.pt-wrap.hero-lg { width: min(34vw, 140px); height: min(34vw, 140px); }
.id-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.id-head h2 { font: 700 20px var(--display); color: var(--gold1); }
.id-head .role { margin-left: auto; }
.abil-previews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.abil-prev { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 12px; background: rgba(0, 0, 0, .5); border: 1px solid var(--s3); min-height: 84px; }
.abil-prev .ab-art { width: 34px; height: 34px; } .abil-prev .ab-art.svg { font-size: 28px; }
.abil-prev b { font-size: 12px; } .abil-prev small, .cost { display: inline-flex; align-items: center; gap: 2px; color: var(--blue); font-size: 12px; font-weight: 700; }
.carousel { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 4px 12px; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .hero-card { width: 116px; flex: none; }

/* HeroCard */
.hero-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 6px 8px; border-radius: 14px; background: linear-gradient(180deg, #221a10, #0d0a06); border: 1px solid var(--s4); text-align: center; }
.hc-art { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; margin-bottom: 4px; font-size: 22px; }
.hero-card b { font: 600 13px var(--display); line-height: 1.2; }
.hero-card small { font-size: 11px; color: var(--t3); }
.hero-card.selected { border-color: var(--gold1); box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(250, 173, 20, .45); }
.hero-card.locked .hc-art > :first-child { filter: grayscale(.85) brightness(.5); }
.hc-art .lock, .arc-art .lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; color: #fff; text-shadow: 0 2px 4px #000; }
.hc-art .sel, .skin .sel { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; background: var(--green); display: grid; place-items: center; font-size: 15px; color: #fff; }
.hc-art .lvl { right: 4px; bottom: 4px; }

/* ================= Heroes ================= */
.hero-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hero-grid .hero-card b { font-size: 15px; }
@media (min-width: 440px) { .hero-grid { grid-template-columns: repeat(3, 1fr); } }

/* ================= Hero Details ================= */
.detail-top { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 4px 0; }
.dt-info h1 { font: 700 24px/1.1 var(--display); color: var(--gold1); text-shadow: 0 2px 0 #000; }
.dt-tags { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.dt-info p { font-size: 13px; color: var(--t2); line-height: 1.4; }
.state { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--t3); }
.state.on { color: #95de64; } .state.locked { color: var(--red2); }
.dt-art { display: grid; place-items: end center; }
.abil-list { display: flex; flex-direction: column; gap: 8px; }
.ability-card { display: grid; grid-template-columns: 52px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 10px 8px 8px; border-radius: 12px; background: rgba(0, 0, 0, .5); border: 1px solid var(--s3); border-left: 3px solid; }
.ability-card.attack { border-left-color: #ff7a45; } .ability-card.speed { border-left-color: var(--blue); } .ability-card.special { border-left-color: #b37feb; } .ability-card.defense { border-left-color: var(--green); }
.ac-art { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: 10px; background: radial-gradient(circle, #2b2111, #0a0805); display: grid; place-items: center; }
.ac-art .ab-art { width: 40px; height: 40px; } .ac-art .ab-art.svg { font-size: 32px; }
.ability-card b { font: 600 15px var(--display); }
.ability-card p { grid-column: 2 / 4; font-size: 12px; color: var(--t2); line-height: 1.35; }
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skin { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 12px; background: rgba(0, 0, 0, .5); border: 1px solid var(--s3); text-align: center; }
.skin.selected { border-color: var(--gold1); box-shadow: 0 0 10px rgba(250, 173, 20, .4); }
.sk-art { width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; font-size: 20px; }
.sk-art.empty { display: grid; place-items: center; background: #15110b; color: var(--t3); font-size: 26px; }
.skin b { font-size: 12px; }

/* ================= Shop ================= */
.featured { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; align-items: center; background: radial-gradient(ellipse at 20% 30%, rgba(250, 173, 20, .25), transparent 60%), linear-gradient(180deg, rgba(43, 33, 17, .96), rgba(12, 10, 7, .96)); border-color: var(--gold4); }
.ft-art { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.ft-art img { width: 84px; height: 84px; }
.ft-art .gem { position: absolute; right: -6px; bottom: -4px; width: 40px; height: 40px; font-size: 30px; }
.ribbon { display: inline-block; font-size: 11px; font-weight: 700; color: #2a1700; background: var(--gold1); padding: 2px 8px; border-radius: 6px; }
.ft-info h2 { font: 700 20px var(--display); color: var(--gold1); margin: 4px 0 2px; }
.ft-info p { font-size: 13px; color: var(--t2); } .ft-info small { color: var(--t3); font-size: 11px; }
.price { height: 40px; border-radius: 10px; font-weight: 700; font-size: 13px; color: #2a1700; background: linear-gradient(180deg, var(--gold1), var(--gold4)); width: 100%; }
.price:disabled { opacity: 1; color: var(--t3); background: #262019; border: 1px solid var(--s4); }
.price.wide { grid-column: 1 / -1; height: 48px; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.product { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 12px; background: rgba(0, 0, 0, .5); border: 1px solid var(--s3); text-align: center; }
.pr-art { height: 60px; display: grid; place-items: center; } .pr-art img { width: 56px; height: 56px; }
.product b { font-size: 12px; line-height: 1.2; min-height: 2.4em; display: grid; place-items: center; }
.product .amount { font: 600 15px var(--display); color: var(--t3); }
.product .price { height: 36px; font-size: 11px; }
@media (max-width: 359px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }

/* ================= Arena ================= */
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { height: 52px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 14px; font: 600 16px var(--display); background: rgba(0, 0, 0, .72); border: 1px solid var(--s4); color: var(--t2); flex-wrap: wrap; }
.mode .i { font-size: 20px; }
.mode.on { background: linear-gradient(180deg, var(--gold1), var(--gold)); color: #2a1700; border-color: var(--gold1); }
.mode[aria-disabled] { cursor: default; } .mode .soon { font-size: 10px; }
.arena-hero { position: relative; min-height: 210px; border-radius: 16px; overflow: hidden; background: center / cover no-repeat; border: 1px solid var(--gold4); display: flex; align-items: flex-end; }
.arena-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, .9)); }
.ah-info { position: relative; padding: 14px; }
.ah-info h1 { font: 700 28px/1 var(--display); color: var(--gold1); text-shadow: 0 2px 0 #000; }
.ah-info small { font: 600 14px var(--display); color: var(--t1); }
.ah-info p { font-size: 13px; color: var(--t1); margin: 6px 0; line-height: 1.4; }
.trophies { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gold1); flex-wrap: wrap; }
.trophies.muted { color: var(--t2); }
.arena-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.arena-card { flex: none; width: 150px; display: flex; flex-direction: column; gap: 4px; padding: 6px 6px 8px; border-radius: 14px; background: linear-gradient(180deg, #221a10, #0d0a06); border: 1px solid var(--s4); text-align: center; }
.arena-card.selected { border-color: var(--gold1); box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(250, 173, 20, .4); }
.arc-art { position: relative; height: 80px; border-radius: 10px; background: center / cover; }
.arena-card.locked .arc-art { filter: grayscale(.8) brightness(.5); }
.arena-card b { font: 600 14px var(--display); }
.arena-card small { font-size: 11px; color: var(--t2); display: inline-flex; gap: 4px; justify-content: center; align-items: center; }
.opponents { display: flex; gap: 10px; }
.opp { display: flex; align-items: center; gap: 14px; padding: 6px 4px 6px 18px; text-align: left; width: 100%; border-radius: 12px; min-height: 84px; }
.opp b { display: block; font: 600 15px var(--display); color: #d9f7be; }
.opp small { font-size: 12px; color: var(--t2); }
.opp > span { flex: 1; } .opp > .i { color: var(--gold1); }
.opp .pt-wrap.small { width: 56px; height: 56px; }

/* ================= Battle ================= */
.battle { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; isolation: isolate; }
.battle > .arena-bg, .result > .arena-bg { position: absolute; inset: 0; z-index: -2; background: url("../assets/fac/bg-battle.webp") center 60% / cover no-repeat, #1a140c; }
.battle > .arena-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 22%, transparent 60%, rgba(0, 0, 0, .85) 78%); }
.hud { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: start; padding: max(8px, env(safe-area-inset-top)) 8px 4px; }
.hud-card { display: flex; gap: 6px; align-items: flex-start; padding: 6px; border-radius: 12px; background: rgba(12, 9, 5, .82); border: 1px solid var(--gold6); min-width: 0; }
.hud-card.frog { flex-direction: row-reverse; }
.hud-card .pt-wrap.tiny { margin: 2px; }
.hud-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hud-card.frog .hud-body { align-items: stretch; text-align: right; }
.hud-name { font: 600 12px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-card.raccoon .hud-name { color: var(--gold1); } .hud-card.frog .hud-name { color: #d9f7be; }
.bar { position: relative; height: 14px; background: #1a1612; border-radius: 7px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8), 0 0 0 1px var(--gold6); display: flex; }
.bar.en { height: 11px; }
.hud-card.frog .bar { justify-content: flex-end; }
.bar > div { height: 100%; transition: width .2s linear; border-radius: inherit; }
.bar.hp > div { background: linear-gradient(180deg, #7ee05a, #3f9e1c); }
.hud-card.frog .bar.hp > div { background: linear-gradient(180deg, #ff6b6b, #c4212a); }
.bar.en > div { background: linear-gradient(180deg, #69c0ff, #1d6fd1); transition: none; }
.bar-txt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
.bar.en .bar-txt { font-size: 9px; }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.timer { display: block; min-width: 64px; padding: 6px 8px; border-radius: 10px; text-align: center; font: 700 18px/1 var(--display); color: var(--gold1); background: rgba(0, 0, 0, .8); border: 1px solid var(--gold4); }
.timer.low { color: var(--red2); border-color: var(--red); }
.hud .chip { font-size: 11px; }
.mini-skills { display: flex; gap: 4px; }
.hud-card.frog .mini-skills { justify-content: flex-end; }
.mini { position: relative; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; overflow: hidden; background: rgba(0, 0, 0, .75); border: 1px solid var(--s4); color: #95de64; font-size: 13px; }
.mini .i { position: relative; }
.mini .mfill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(82, 196, 26, .35); transition: height .15s linear; }
.mini.ready { border-color: #95de64; box-shadow: 0 0 6px rgba(149, 222, 100, .6); }
.mini.cooling { opacity: .45; }
.mini.active { border-color: var(--gold); box-shadow: 0 0 8px var(--gold); animation: blink .3s infinite alternate; }
.hud-card.raccoon .mini { color: var(--gold1); }
.hud-card.raccoon .mini .mfill { background: rgba(250, 173, 20, .35); }
.hud-card.raccoon .mini.ready { border-color: var(--gold1); box-shadow: 0 0 6px rgba(255, 214, 102, .6); }

.arena { position: relative; flex: 1; min-height: 220px; display: flex; align-items: flex-end; justify-content: space-between; padding: 64px 4px 6px; }
.fighter { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 48%; --c: #b37feb; }
/* full-body fighters stand still on the arena floor; all the motion and colour comes from the skill effects */
.pt-holder { position: relative; isolation: isolate; }
.body { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; transition: filter .2s; }
.body .hero-art.full { height: clamp(150px, 34dvh, 300px); max-width: 100%; transition: opacity .2s, filter .2s; }
.fighter.frog .body .hero-art.full { height: clamp(135px, 30dvh, 265px); }
.body::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -4px; height: 14px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); z-index: -1; }
.vs-mid { position: absolute; left: 50%; top: 46%; translate: -50% -50%; z-index: 2; font: 700 22px var(--display); color: var(--gold1); text-shadow: 0 2px 6px #000, 0 0 12px rgba(250, 173, 20, .5); }
.effects { position: absolute; bottom: calc(100% + 4px); display: flex; flex-direction: column; gap: 3px; min-height: 22px; width: 170px; }
.fighter.raccoon .effects { left: -4px; align-items: flex-start; }
.fighter.frog .effects { right: -4px; align-items: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, .75); border: 1px solid; white-space: nowrap; }
.badge .i { font-size: 12px; }
.badge.haste { color: #ffe58f; border-color: #d4b106; }
.badge.dodge { color: #efdbff; border-color: #b37feb; }
.badge.block { color: #b7eb8f; border-color: #52c41a; }
.badge.frozen { color: var(--ice); border-color: var(--ice); }
.badge.cast { position: relative; overflow: hidden; isolation: isolate; color: #fff; border-color: #d3adf7; background: rgba(20, 0, 40, .85); }
.badge.cast::before { content: ''; position: absolute; inset: 0; width: var(--p, 0%); background: rgba(146, 84, 222, .55); z-index: -1; }
.badge.cast .q { font: 700 13px var(--display); color: #ffd666; width: 12px; text-align: center; }
@keyframes blink { to { filter: brightness(1.5); } }
.atk-bar { width: 96px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .7); box-shadow: 0 0 0 1px var(--gold7); overflow: hidden; }
.atk-bar > div { height: 100%; background: var(--gold); }
.fighter.frozen .body .hero-art { filter: saturate(.3) brightness(1.15) hue-rotate(170deg); }
.fighter.frozen .atk-bar > div { background: var(--ice); }
.fighter.hasted .atk-bar > div { background: #fff1b8; box-shadow: 0 0 8px var(--gold1); }
.pt-holder.hurt .body .hero-art { animation: hurt .35s; }
.pt-holder.loser .body .hero-art { filter: grayscale(1) brightness(.55); opacity: .85; }

/* ================= skill VFX ================= */
/* colour of the cast: the player sees its own skill's colour, the bot's cast is a neutral violet */
.fighter[data-cast="attack"] { --c: #ff7a45; } .fighter[data-cast="speed"] { --c: #40a9ff; }
.fighter[data-cast="special"] { --c: #b37feb; } .fighter[data-cast="defense"] { --c: #73d13d; } .fighter[data-cast="unknown"] { --c: #9254de; }
/* preparing a skill: a spinning rune circle under the feet + a glow in the cast colour */
.fx-under { position: absolute; left: 50%; bottom: 0; width: 135%; aspect-ratio: 1; transform: translate(-50%, 50%) scaleY(.3); z-index: 0; pointer-events: none; }
.fx-circle { position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .15s;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 40%, transparent) 0 28%, transparent 48%, var(--c) 49% 52%, transparent 53% 66%, var(--c) 67% 71%, transparent 72%);
  filter: drop-shadow(0 0 8px var(--c)); }
.fx-circle::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(var(--c) 0 5deg, transparent 5deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55% 64%, transparent 65%); mask: radial-gradient(circle, transparent 54%, #000 55% 64%, transparent 65%); }
.fighter.casting .fx-circle { opacity: 1; animation: spin 1.1s linear infinite; }
.fighter.casting .body { filter: drop-shadow(0 0 6px var(--c)) drop-shadow(0 0 14px var(--c)); }

.fx-over { position: absolute; inset: 0; pointer-events: none; }
.fx-over > i { position: absolute; display: block; opacity: 0; pointer-events: none; }
/* Hurricane Rush: a cyclone of wind rings around the raccoon + white wind streaks rushing past */
.fx-haste { z-index: 2; inset: 4% -22% 4%; filter: drop-shadow(0 0 2px #0050b3) drop-shadow(0 0 8px #69c0ff); }
.fx-haste::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0, #e6f7ff 40px, transparent 80px, transparent 200px), linear-gradient(90deg, transparent 0, #e6f7ff 30px, transparent 60px, transparent 200px), linear-gradient(90deg, transparent 0, #e6f7ff 50px, transparent 100px, transparent 200px), linear-gradient(90deg, transparent 0, #e6f7ff 25px, transparent 50px, transparent 200px), linear-gradient(90deg, transparent 0, #e6f7ff 35px, transparent 70px, transparent 200px), linear-gradient(90deg, transparent 0, #e6f7ff 45px, transparent 90px, transparent 200px);
  background-size: 200px 5px, 200px 3px, 200px 6px, 200px 3px, 200px 5px, 200px 3px; background-repeat: repeat-x; background-position: 0 18%, 70px 32%, 140px 46%, 30px 60%, 110px 74%, 170px 88%;
  -webkit-mask: linear-gradient(90deg, #000 0 24%, transparent 36% 64%, #000 76%); mask: linear-gradient(90deg, #000 0 24%, transparent 36% 64%, #000 76%); animation: streaks .3s linear infinite; }
@keyframes streaks { to { background-position: -200px 18%, -130px 32%, -60px 46%, -170px 60%, -90px 74%, -30px 88%; } }
/* the cyclone: three tilted wind rings spinning around the body */
.fx-haste::after { content: ''; position: absolute; left: 14%; right: 14%; top: 10%; bottom: 0; border-radius: 50%;
  background: radial-gradient(ellipse 50% 9% at 50% 22%, transparent 70%, rgba(230, 247, 255, .9) 80%, transparent 92%),
    radial-gradient(ellipse 46% 9% at 50% 52%, transparent 70%, rgba(186, 231, 255, .9) 80%, transparent 92%),
    radial-gradient(ellipse 40% 9% at 50% 84%, transparent 70%, rgba(230, 247, 255, .9) 80%, transparent 92%);
  -webkit-mask: linear-gradient(90deg, #000 0 30%, transparent 45% 55%, #000 70%); mask: linear-gradient(90deg, #000 0 30%, transparent 45% 55%, #000 70%);
  animation: cyclone .45s linear infinite; }
@keyframes cyclone { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
.fighter.hasted .fx-haste { opacity: 1; animation: flicker .2s steps(2) infinite; }
@keyframes flicker { 50% { filter: drop-shadow(0 0 2px #0050b3) drop-shadow(0 0 12px #bae7ff) brightness(1.15); } }
/* Lightning Dodge: a crackling electric aura — the raccoon turns into a flickering bolt of light */
.fx-dodge { z-index: 2; left: 50%; top: 50%; width: 118%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #fff 0 2deg, #69c0ff 2deg 5deg, transparent 5deg 17deg, #bae7ff 17deg 19deg, transparent 19deg 31deg);
  -webkit-mask: radial-gradient(closest-side, transparent 78%, #000 82% 88%, transparent 94%); mask: radial-gradient(closest-side, transparent 78%, #000 82% 88%, transparent 94%);
  filter: drop-shadow(0 0 6px #40a9ff) drop-shadow(0 0 14px #1890ff); }
.fx-dodge::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(105, 192, 255, .28), transparent 75%); }
.fighter.dodging .fx-dodge { opacity: 1; animation: zapSpin .5s steps(5) infinite, zapFlicker .12s steps(2) infinite; }
@keyframes zapSpin { to { rotate: 360deg; } }
@keyframes zapFlicker { 50% { opacity: .55; } }
.fighter.dodging .body .hero-art { opacity: .78; filter: brightness(1.15) drop-shadow(0 0 6px #e6f7ff) drop-shadow(0 0 14px #40a9ff); animation: zapFlicker .16s steps(2) infinite; }
/* Royal Block: a golden-green royal dome with a crown on top; stays up until it swallows a skill */
.fx-shield { z-index: 2; inset: -10% -14% -3%; border-radius: 50% 50% 46% 46%;
  background: radial-gradient(ellipse at 50% 45%, rgba(183, 235, 143, .08) 50%, rgba(115, 209, 61, .38) 70%, rgba(255, 214, 102, .95) 77%, transparent 80%),
    repeating-linear-gradient(60deg, rgba(255, 229, 143, .22) 0 2px, transparent 2px 18px), repeating-linear-gradient(-60deg, rgba(183, 235, 143, .22) 0 2px, transparent 2px 18px);
  -webkit-mask: radial-gradient(ellipse at 50% 45%, #000 79%, transparent 80%); mask: radial-gradient(ellipse at 50% 45%, #000 79%, transparent 80%);
  filter: drop-shadow(0 0 10px #faad14) drop-shadow(0 0 6px #52c41a); }
.fx-shield::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .55) 45%, transparent 55%); background-size: 250% 100%; animation: sheen 2.4s linear infinite; }
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.fx-shield::before { content: ''; position: absolute; left: 50%; top: -2%; width: 46px; height: 46px; translate: -50% 0; background: url("../assets/fac/skill-block.webp") center / contain no-repeat; filter: drop-shadow(0 0 8px #ffd666); }
.fighter.shield-hit .fx-shield { animation: domeHit .6s ease-out forwards; }
.fighter.blocking .fx-shield { opacity: 1; animation: domeIn .3s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes domeIn { from { opacity: 0; scale: .5; } }
@keyframes domeHit { 0% { opacity: 1; filter: drop-shadow(0 0 26px #fff1b8) brightness(2.4); scale: 1.06; } 35% { opacity: 1; } 100% { opacity: 0; scale: 1.35; } }
/* Freeze: an ice crystal grows around the pet (after the snowflake arrives) */
.fx-ice { z-index: 2; inset: -4% -8% -2%;
  background: linear-gradient(155deg, rgba(240, 250, 255, .75), rgba(145, 213, 255, .28) 35%, rgba(186, 231, 255, .5) 60%, rgba(105, 192, 255, .6));
  clip-path: polygon(18% 100%, 4% 62%, 14% 22%, 34% 6%, 50% 0, 70% 8%, 88% 26%, 96% 64%, 82% 100%);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, .8); }
.fx-ice::before { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, .7) 24%, transparent 28%, transparent 55%, rgba(255, 255, 255, .5) 58%, transparent 61%); }
.fighter.frozen .fx-ice { animation: iceIn .35s .3s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes iceIn { from { opacity: 0; clip-path: polygon(18% 100%, 18% 100%, 20% 100%, 40% 100%, 50% 100%, 60% 100%, 80% 100%, 82% 100%, 82% 100%); } to { opacity: 1; } }

/* release: the skill icon blooms over the caster */
.impacts { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.bloom { position: absolute; left: 50%; top: 38%; width: 120px; height: 120px; translate: -50% -50%; animation: bloom .8s cubic-bezier(.2, .9, .3, 1) forwards; }
.bloom img { width: 100%; height: 100%; object-fit: contain; }
.bloom.attack img { filter: drop-shadow(0 0 16px #ff7a45); } .bloom.speed img { filter: drop-shadow(0 0 16px #40a9ff); }
.bloom.special img { filter: drop-shadow(0 0 16px #b37feb); } .bloom.defense img { filter: drop-shadow(0 0 16px #73d13d); }
@keyframes bloom { 0% { scale: .3; opacity: 0; } 25% { scale: 1.2; opacity: 1; } 60% { scale: 1; opacity: 1; } 100% { scale: 1.5; opacity: 0; translate: -50% -80%; } }
/* projectiles: the Super Strike fireball and the Freeze snowflake fly across the arena */
.arena-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.projectile { position: absolute; left: 0; top: 0; width: 96px; height: 96px; margin: -48px 0 0 -48px; }
.projectile img { width: 100%; height: 100%; object-fit: contain; }
.projectile.fire img { transform: scaleX(-1); filter: drop-shadow(0 0 12px #ff7a45) drop-shadow(0 0 26px #ffd666); }
.projectile.ice { width: 72px; height: 72px; margin: -36px 0 0 -36px; }
.projectile.ice img { filter: drop-shadow(0 0 12px #69c0ff) drop-shadow(0 0 24px #e6f7ff); animation: spin .5s linear infinite; }
/* impacts on the target */
.impact { position: absolute; top: 42%; left: 50%; width: 92px; height: 92px; translate: -50% -50%; }
.fighter.frog .impact { left: 30%; } .fighter.raccoon .impact { left: 70%; }
.impact.hit { background: radial-gradient(circle, #fff 0 12%, #ffe58f 22%, #ff7a45 42%, transparent 62%);
  clip-path: polygon(50% 0, 60% 34%, 96% 22%, 68% 50%, 100% 72%, 62% 66%, 54% 100%, 44% 66%, 6% 80%, 34% 52%, 0 26%, 40% 36%);
  animation: impactPop .34s ease-out forwards; }
.impact.hit.frog { background: radial-gradient(circle, #fff 0 12%, #d9f7be 22%, #73d13d 42%, transparent 62%); }
.impact.super { width: 200px; height: 200px; left: 50% !important; background: url("../assets/ui/fx-gold-burst.webp") center / contain no-repeat; mix-blend-mode: screen; animation: impactBig .65s ease-out forwards; }
.impact.super::after { content: ''; position: absolute; inset: 22%; background: radial-gradient(circle, #fff 0 15%, #ffd666 35%, #ff4d4f 55%, transparent 70%);
  clip-path: polygon(50% 0, 61% 33%, 98% 18%, 70% 48%, 100% 74%, 63% 66%, 52% 100%, 42% 67%, 3% 84%, 32% 52%, 0 22%, 39% 35%); }
.impact.ring { left: 50% !important; width: 70px; height: 70px; border-radius: 50%; border: 6px solid var(--rc); box-shadow: 0 0 20px var(--rc), inset 0 0 14px var(--rc); animation: ringOut .55s ease-out forwards; }
.impact.ring.big { width: 100px; height: 100px; }
.impact.ring.fire { --rc: #ff7a45; } .impact.ring.leaf { --rc: #73d13d; } .impact.ring.ice { --rc: #69c0ff; }
.impact.miss { width: 110px; height: 70px; border-radius: 50%; border-top: 5px solid #d3adf7; box-shadow: 0 -6px 14px -6px #b37feb; animation: whoosh .4s ease-out forwards; }
@keyframes impactPop { 0% { scale: .2; opacity: 1; } 60% { opacity: 1; } 100% { scale: 1.35; opacity: 0; rotate: 25deg; } }
@keyframes impactBig { 0% { scale: .15; opacity: 1; } 50% { opacity: 1; } 100% { scale: 1.5; opacity: 0; rotate: 40deg; } }
@keyframes ringOut { 0% { scale: .3; opacity: 1; } 100% { scale: 2.8; opacity: 0; border-width: 1px; } }
@keyframes whoosh { 0% { scale: .5 .8; opacity: 1; rotate: -30deg; } 100% { scale: 1.3 1; opacity: 0; rotate: 20deg; } }
/* sparks scattered from the centre (--x/--y set per spark) */
.spark { position: absolute; left: 50%; top: 42%; width: 13px; height: 13px; margin: -6px 0 0 -6px; border-radius: 50%; animation: sparkFly .8s cubic-bezier(.2, .8, .3, 1) forwards; }
.spark.fire { background: #ffd666; box-shadow: 0 0 0 2px #fa541c, 0 0 12px #ff7a45; }
.spark.bolt { background: #fffbe6; box-shadow: 0 0 8px #ffe58f, 0 0 16px #40a9ff; width: 6px; height: 14px; border-radius: 2px; }
.spark.wind { background: #efdbff; box-shadow: 0 0 10px #b37feb; }
.spark.leaf { background: #b7eb8f; box-shadow: 0 0 8px #52c41a; border-radius: 0 60%; }
.spark.ice { background: #e6f7ff; box-shadow: 0 0 8px #69c0ff; border-radius: 1px; rotate: 45deg; }
@keyframes sparkFly { 0% { translate: 0 0; scale: 1.2; opacity: 1; } 55% { opacity: 1; } 100% { translate: var(--x) var(--y); scale: .2; opacity: 0; } }

/* ---- Super Strike: crushing blow */
.crush-lines { position: absolute; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 3deg, rgba(255, 255, 255, .95) 0 1.4deg, transparent 1.4deg 6deg, rgba(255, 214, 102, .8) 6deg 7deg, transparent 7deg 11deg);
  -webkit-mask: radial-gradient(circle, transparent 14%, #000 26%, #000 40%, transparent 62%); mask: radial-gradient(circle, transparent 14%, #000 26%, #000 40%, transparent 62%);
  animation: crushLines .6s ease-out forwards; }
@keyframes crushLines { 0% { scale: .5; opacity: 1; } 40% { opacity: 1; } 100% { scale: 1.35; opacity: 0; rotate: 8deg; } }
.crater { position: absolute; left: 50%; bottom: 8%; width: 130%; height: 46px; translate: -50% 0; border-radius: 50%; z-index: -1;
  background: radial-gradient(ellipse at 50% 50%, rgba(40, 20, 5, .85) 0 18%, rgba(70, 40, 15, .6) 34%, transparent 62%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(30, 15, 5, .8) 0 2deg, transparent 2deg 26deg);
  -webkit-mask: radial-gradient(ellipse, #000 40%, transparent 70%); mask: radial-gradient(ellipse, #000 40%, transparent 70%);
  animation: crater 1.6s ease-out forwards; }
@keyframes crater { 0% { scale: .2; opacity: 0; } 10% { scale: 1; opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.impact.ring.big { width: 110px; height: 110px; border-width: 9px; }
.impact.ring.royal { --rc: #ffd666; }
.spark.rock { background: #8c5a2b; box-shadow: 0 0 0 1px #3b2410; border-radius: 2px; width: 11px; height: 9px; }
.spark.gold { background: #fff1b8; box-shadow: 0 0 8px #faad14; border-radius: 1px; rotate: 45deg; }
.flash.white { background: #fff; animation: flash .25s ease-out; }
.arena-bg.punch { animation: bgPunch .4s cubic-bezier(.2, .9, .3, 1); }
@keyframes bgPunch { 0% { scale: 1.05; filter: brightness(1.4); } 100% { scale: 1; } }
/* ---- Hurricane Rush: flurry streaks and small pops */
.rush-streak { position: absolute; height: 3px; transform-origin: 0 50%; border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(230, 247, 255, .9) 40%, #fff 85%, #69c0ff); box-shadow: 0 0 6px #91d5ff;
  animation: streakShot .26s ease-out forwards; }
@keyframes streakShot { 0% { scale: 0 1; opacity: 1; } 55% { scale: 1 1; opacity: 1; } 100% { scale: 1 .4; opacity: 0; } }
.impact.flurry { width: 54px; height: 54px; background: radial-gradient(circle, #fff 0 14%, #e6f7ff 26%, #69c0ff 46%, transparent 64%);
  clip-path: polygon(50% 0, 60% 34%, 96% 22%, 68% 50%, 100% 72%, 62% 66%, 54% 100%, 44% 66%, 6% 80%, 34% 52%, 0 26%, 40% 36%); animation: impactPop .3s ease-out forwards; }
.float.small { font-size: 16px; color: #ff9c6e; }
/* ---- Lightning Dodge: miss = electric burst */
.impact.zap { width: 90px; height: 90px; background: radial-gradient(circle, #fff 0 10%, #bae7ff 22%, #1890ff 40%, transparent 60%);
  clip-path: polygon(50% 0, 56% 40%, 100% 50%, 56% 60%, 50% 100%, 44% 60%, 0 50%, 44% 40%); animation: impactPop .32s ease-out forwards; }
/* ---- a skill swallowed by Royal Block / broken off by Royal Freeze fizzles out on the caster */
.fizzle { position: absolute; left: 50%; top: 40%; width: 120px; height: 120px; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 200, 200, .7), rgba(120, 120, 120, .35) 45%, transparent 70%); filter: blur(4px); animation: fizzle .9s ease-out forwards; }
.fizzle.ice { background: radial-gradient(circle, rgba(230, 247, 255, .85), rgba(105, 192, 255, .4) 45%, transparent 70%); }
@keyframes fizzle { 0% { scale: .3; opacity: 1; } 100% { scale: 1.6; opacity: 0; translate: -50% -90%; } }
/* ---- Royal Heal */
.float.heal.big { font-size: 34px; color: #b7eb8f; text-shadow: 0 2px 0 #135200, 0 0 14px #52c41a, 0 0 24px rgba(183, 235, 143, .8); }
.heal-ring { position: absolute; left: 50%; bottom: 4%; width: 90px; height: 28px; translate: -50% 0; border-radius: 50%; border: 4px solid #95de64;
  box-shadow: 0 0 16px #52c41a, inset 0 0 10px #b7eb8f; animation: healRing 1.2s ease-out forwards; }
@keyframes healRing { 0% { scale: .3; opacity: 1; } 100% { scale: 2.3; opacity: 0; } }
.heal-crown { position: absolute; left: 50%; top: -8%; width: 70px; height: 70px; translate: -50% 0; animation: healCrown 1.3s ease-out forwards; }
.heal-crown img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 12px #52c41a); }
@keyframes healCrown { 0% { scale: .3; opacity: 0; } 25% { scale: 1.15; opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; translate: -50% -40px; } }
.heal-plus.sparkle { color: #fff1b8; text-shadow: 0 0 8px #faad14; font-size: 22px; }
.hud-card.healed { animation: hudHeal .9s ease-out; }
@keyframes hudHeal { 30% { box-shadow: 0 0 0 2px #95de64, 0 0 22px #52c41a; } }
/* ---- Royal Freeze: everything is covered in ice while the raccoon is frozen */
.battle::after { content: ''; position: absolute; inset: 0; z-index: 14; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(186, 231, 255, .35) 70%, rgba(230, 247, 255, .85) 100%),
    repeating-linear-gradient(35deg, transparent 0 22px, rgba(255, 255, 255, .18) 22px 24px), repeating-linear-gradient(-35deg, transparent 0 30px, rgba(255, 255, 255, .14) 30px 32px);
  -webkit-mask: radial-gradient(ellipse at 50% 45%, transparent 40%, #000 75%); mask: radial-gradient(ellipse at 50% 45%, transparent 40%, #000 75%); }
.battle.iced::after { opacity: 1; transition-delay: .3s; }
.battle.iced .ability::after { content: ''; position: absolute; inset: 0; z-index: 3; animation: none; transform: none; mix-blend-mode: normal; top: 0; bottom: 0; left: 0; width: auto;
  background: linear-gradient(160deg, rgba(240, 250, 255, .8), rgba(145, 213, 255, .45) 45%, rgba(186, 231, 255, .7)), url("../assets/fac/skill-freeze.webp") center 30% / 46px no-repeat;
  box-shadow: inset 0 0 14px #fff; border-radius: 6px; }
.battle.iced .ability { pointer-events: none; }
/* Heal: a green light pillar and rising pluses */
.heal-pillar { position: absolute; left: 50%; bottom: 6%; width: 80%; height: 120%; -webkit-mask: linear-gradient(90deg, transparent, #000 30% 70%, transparent); mask: linear-gradient(90deg, transparent, #000 30% 70%, transparent); translate: -50% 0; transform-origin: 50% 100%;
  background: linear-gradient(0deg, rgba(82, 196, 26, .55), rgba(183, 235, 143, .3) 50%, rgba(217, 247, 190, 0)); border-radius: 50% 50% 0 0 / 25% 25% 0 0;
  box-shadow: 0 0 30px rgba(82, 196, 26, .6); filter: blur(2px); animation: pillar 1.2s ease-out forwards; }
@keyframes pillar { 0% { scale: 1 0; opacity: 0; } 25% { scale: 1 1; opacity: 1; } 100% { opacity: 0; } }
.heal-plus { position: absolute; left: 50%; bottom: 12%; font: 700 34px/1 var(--display); color: #d9f7be; text-shadow: 0 0 8px #52c41a, 0 2px 0 #135200; opacity: 0; animation: plusRise 1s ease-out forwards; }
@keyframes plusRise { 0% { transform: translate(calc(-50% + var(--x)), 0) scale(.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--x)), -160px) scale(1.15); opacity: 0; } }
.floats { position: absolute; left: 50%; top: 20%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.float { position: absolute; left: 0; top: 0; translate: -50% 0; white-space: nowrap; font: 700 24px/1 var(--display); text-shadow: 0 2px 0 #000, 0 0 10px rgba(0, 0, 0, .9); animation: floatUp 1.1s cubic-bezier(.215, .61, .355, 1) forwards; }
.float.dmg { color: var(--red); } .float.super { color: var(--gold1); font-size: 38px; } .float.heal { color: #95de64; }
.float.miss { color: #d3adf7; font-size: 18px; } .float.block { color: #b7eb8f; font-size: 18px; } .float.freeze { color: var(--ice); font-size: 18px; }
/* keep floats on screen: the raccoon's drift right of centre, the frog's left */
.fighter.raccoon .float.miss, .fighter.raccoon .float.block, .fighter.raccoon .float.freeze { translate: -30% 0; }
.fighter.frog .float.miss, .fighter.frog .float.block, .fighter.frog .float.freeze { translate: -70% 0; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { transform: translateY(-8px) scale(1.15); opacity: 1; } 100% { transform: translateY(-60px) scale(1); opacity: 0; } }
.callouts { position: absolute; bottom: calc(100% + 30px); left: 50%; translate: -50% 0; width: 0; height: 0; pointer-events: none; z-index: 4; }
.fighter.raccoon .callouts { left: 30%; } .fighter.frog .callouts { left: 70%; }
.callout { position: absolute; bottom: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 12px 4px 6px; border-radius: 16px; font: 700 15px var(--display); letter-spacing: .03em;
  background: rgba(0, 0, 0, .85); border: 1px solid var(--gold); color: var(--gold1); box-shadow: 0 0 14px rgba(250, 173, 20, .45);
  animation: calloutPop 1.4s cubic-bezier(.215, .61, .355, 1) forwards; }
.fighter.raccoon .callout { left: -40px; } .fighter.frog .callout { right: -40px; }
.callout.frog { border-color: #95de64; color: #d9f7be; box-shadow: 0 0 14px rgba(149, 222, 100, .45); }
.callout .ab-art { width: 22px; height: 22px; font-size: 18px; }
@keyframes calloutPop { 0% { transform: scale(.4); opacity: 0; } 12% { transform: scale(1.15); opacity: 1; } 22% { transform: scale(1); } 80% { opacity: 1; transform: translateY(-6px); } 100% { opacity: 0; transform: translateY(-16px); } }
.ko { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 6; }
.ko span { font: 700 56px var(--display); color: var(--gold1); text-shadow: 0 0 24px rgba(250, 173, 20, .8), 0 4px 0 #000; animation: finIn .45s cubic-bezier(.215, .61, .355, 1) both; }

.controls { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 6px 8px max(8px, env(safe-area-inset-bottom)); }
.abilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ability {
  position: relative; height: clamp(96px, 15dvh, 124px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 6px solid transparent; border-image: url("../assets/ui/spell-card.webp") 26% 24% fill / 25px 24px stretch;
  overflow: hidden; isolation: isolate; transition: opacity .15s, filter .15s, transform .1s;
}
.ability:active { transform: scale(.96); }
.ability .ab-art { width: 46px; height: 46px; } .ability .ab-art.svg { font-size: 38px; }
.ability.attack .ab-art { filter: drop-shadow(0 0 8px rgba(255, 110, 50, .7)); }
.ability.speed .ab-art { filter: drop-shadow(0 0 8px rgba(64, 169, 255, .7)); }
.ability.special .ab-art { filter: drop-shadow(0 0 8px rgba(179, 127, 235, .8)); }
.ability b { font: 600 14px var(--display); white-space: nowrap; }
.ability .cost { font-size: 12px; }
.ability .cost .have { color: #fff; }
.ability kbd { position: absolute; top: 2px; right: 6px; font-size: 10px; color: var(--t3); font-family: inherit; }
@media (hover: none) { .ability kbd { display: none; } }
.ability .cd { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.ability .cd i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .62); }
.ability .cd em { position: relative; font: 700 24px var(--display); font-style: normal; color: #fff; text-shadow: 0 2px 4px #000; }
.ability .charge { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.ability .charge i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, rgba(64, 169, 255, .38), rgba(64, 169, 255, .08)); box-shadow: inset 0 2px 0 rgba(145, 213, 255, .7); transition: height .15s linear; }
.ability.ready .charge i { background: linear-gradient(0deg, rgba(250, 173, 20, .32), rgba(250, 173, 20, .06)); box-shadow: inset 0 2px 0 rgba(255, 214, 102, .8); }
.ability.poor { filter: saturate(.5) brightness(.8); }
.ability.poor .ab-art { opacity: .55; }
.ability.poor .cost { color: var(--red2); }
.ability.off { opacity: .3; pointer-events: none; }
.ability.auto { pointer-events: none; }
.ability.active { border-image-source: url("../assets/ui/spell-card-active.webp"); }
.ability.ready { animation: cardGlow 2.4s ease-in-out infinite; }
.ability.ready::after {
  content: ''; position: absolute; top: -30%; bottom: -30%; left: -80%; width: 60%; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 236, 180, 0), rgba(255, 236, 180, .5) 50%, rgba(255, 236, 180, 0));
  transform: skewX(-18deg); mix-blend-mode: screen; animation: shineSweep 3s ease-in-out infinite;
}
.ability.deny { animation: deny .3s; }
@keyframes deny { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
@keyframes cardGlow { 50% { filter: brightness(1.15) drop-shadow(0 0 7px rgba(250, 173, 20, .5)); } }
.ctl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auto-toggle { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px 0 10px; border-radius: 24px; background: rgba(0, 0, 0, .78); border: 1px solid var(--gold6); font: 600 15px var(--display); color: var(--t2); }
.auto-toggle .i { font-size: 18px; }
.auto-toggle.on { color: var(--gold1); border-color: var(--gold); box-shadow: 0 0 10px rgba(250, 173, 20, .35); }
.icon-btn.pause { width: 48px; height: 48px; border-radius: 12px; font-size: 20px; color: var(--gold1); border-color: var(--gold4); background: rgba(0, 0, 0, .78); }

.finisher { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(43, 33, 17, .9), rgba(0, 0, 0, .95)); overflow: hidden; }
.finisher[hidden] { display: none; }
.fin-burst { position: absolute; width: 140%; max-width: 640px; opacity: .9; mix-blend-mode: screen; animation: spin 6s linear infinite; }
.fin-title { position: relative; font: 700 40px/1 var(--display); color: var(--gold1); text-shadow: 0 0 24px rgba(250, 173, 20, .8), 0 3px 0 #000; animation: finIn .5s cubic-bezier(.215, .61, .355, 1) both; text-align: center; }
.fin-sub { position: relative; margin-top: 10px; color: var(--t2); font-size: 13px; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes finIn { from { transform: scale(2.4); opacity: 0; } to { transform: none; opacity: 1; } }
.flash { position: absolute; inset: 0; z-index: 15; pointer-events: none; opacity: 0; }
.flash.gold { background: var(--gold1); animation: flash .4s ease-out; }
.flash.ice { background: var(--ice); animation: flash .5s ease-out; }
@keyframes flash { from { opacity: .45; } to { opacity: 0; } }

/* ================= Victory / Defeat ================= */
.result { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; }
.result-tint { position: absolute; inset: 0; z-index: -1; }
.result.victory .result-tint { background: radial-gradient(circle at 50% 30%, rgba(250, 173, 20, .35), rgba(20, 12, 2, .9) 70%); }
.result.defeat .result-tint { background: radial-gradient(circle at 50% 30%, rgba(40, 70, 120, .35), rgba(4, 8, 16, .94) 70%); }
.result.draw .result-tint { background: radial-gradient(circle at 50% 30%, rgba(160, 160, 160, .2), rgba(8, 8, 8, .92) 70%); }
.result.defeat > .arena-bg { filter: saturate(.35) brightness(.6) hue-rotate(10deg); }
.res-burst { position: absolute; top: -8%; left: 50%; width: 150%; max-width: 700px; translate: -50% 0; opacity: .45; mix-blend-mode: screen; animation: spin 14s linear infinite; z-index: -1; pointer-events: none; }
.res-scroll { position: relative; height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom)); }
.res-banner { position: relative; width: min(100%, 380px); aspect-ratio: 3 / 2; flex: none; margin-bottom: -18%; animation: obRise .6s cubic-bezier(.215, .61, .355, 1) both; }
.rb-banner { position: absolute; inset: 0; width: 100%; height: 100%; }
.rb-title { position: absolute; left: 18%; width: 64%; top: 30%; }
@keyframes obRise { from { opacity: 0; transform: translateY(18%) scale(.9); } to { opacity: 1; transform: none; } }
.res-hero { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.res-hero .pt-wrap { width: 120px; height: 120px; margin-top: 18px; }
.res-msg { font: 600 15px var(--display); color: var(--t1); text-align: center; text-shadow: 0 2px 4px #000; }
.res-panel { width: 100%; }
.res-sum { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.res-sum > div { display: flex; flex-direction: column; gap: 2px; }
.res-sum > div + div { border-left: 1px solid var(--gold6); }
.res-sum span { font-size: 11px; color: var(--t2); }
.res-sum b { font: 600 18px var(--display); }
.res-why { text-align: center; font-size: 12px; color: var(--t2); margin: 8px 0; }
.res-uses { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-uses > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.res-uses small { width: 100%; font-size: 11px; color: var(--t3); }
.use { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.use .ab-art { width: 22px; height: 22px; font-size: 18px; }
.res-btns { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 4px; }
.res-btns .ui-btn.gold { height: 58px; font-size: 20px; }
.auto-info { text-align: center; font-size: 12px; color: var(--t2); min-height: 16px; }

/* ================= Test stats ================= */
.stat-card h3 { font: 600 16px var(--display); color: var(--gold1); margin-bottom: 6px; }
.stat-card h3 small { font: 400 12px -apple-system, sans-serif; color: var(--t3); margin-left: 6px; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; border-bottom: 1px solid #1d1a14; }
.kv span { color: var(--t2); }
.ab-table { width: 100%; margin-top: 8px; font-size: 12px; border-collapse: collapse; }
.ab-table td { padding: 2px 4px; text-align: right; } .ab-table td:first-child { text-align: left; } .ab-table thead td { color: var(--t3); }
.checks { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: 12px; }
.checks .ok { color: #95de64; } .checks .bad { color: var(--red2); }

/* ================= Modal / ConfirmDialog / Settings / toast ================= */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .75); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
#modal[hidden] { display: none; }
.modal-box { width: min(420px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: linear-gradient(180deg, #221a10, #0d0a06); border: 1px solid var(--gold4); box-shadow: 0 10px 40px rgba(0, 0, 0, .8); animation: modalIn .15s; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } }
.modal-box h2 { display: flex; justify-content: space-between; align-items: center; font: 600 20px var(--display); color: var(--gold1); }
.set-body { display: flex; flex-direction: column; gap: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; font-size: 14px; }
.set-title { font: 600 13px var(--display); color: var(--gold1); letter-spacing: .06em; border-top: 1px solid var(--gold6); padding-top: 10px; }
.set-hint { color: var(--t3); font-size: 12px; margin-top: -6px; }
.segs { display: flex; gap: 4px; }
.seg { min-width: 44px; height: 36px; padding: 0 8px; border-radius: 18px; border: 1px solid var(--s4); background: #0c0b09; font-weight: 600; }
.seg.on { border-color: var(--gold); color: #2a1700; background: var(--gold); }
.toast { position: fixed; left: 50%; bottom: 40%; translate: -50% 0; z-index: 60; background: rgba(20, 20, 20, .95); border: 1px solid var(--gold5); color: var(--gold1); border-radius: 8px; padding: 8px 14px; font-weight: 600; animation: toastIn .15s; pointer-events: none; }
@keyframes toastIn { from { opacity: 0; translate: -50% 8px; } }

/* ================= short phones ================= */
@media (max-height: 700px) {
  .hud { padding-top: max(6px, env(safe-area-inset-top)); }
  .arena { padding-top: 56px; min-height: 180px; }
  .fighter { gap: 6px; }
  .body .hero-art.full { height: clamp(130px, 31dvh, 220px); }
  .fighter.frog .body .hero-art.full { height: clamp(118px, 28dvh, 196px); }
  .ability { height: 88px; }
  .ability .ab-art { width: 36px; height: 36px; } .ability .ab-art.svg { font-size: 30px; }
  .auto-toggle, .icon-btn.pause { height: 44px; }
  .hero-art.full.hero-xl { height: 36dvh; }
  .showcase { padding: 18px 0 12px; }
  .cta .ui-btn { height: 52px; font-size: 20px; }
  .res-hero .pt-wrap { width: 92px; height: 92px; }
  .res-banner { width: min(100%, 300px); }
}
@media (prefers-reduced-motion: reduce) {
  .ui-btn::after, .ability.ready::after { display: none; }
  .ui-btn.gold, .ability.ready, .fin-burst, .res-burst, .mini.active, .fx-circle, .fx-haste, .fx-haste::before, .fx-haste::after, .fx-dodge, .fx-shield::after, .fighter.dodging .body .hero-art, .crush-lines, .arena-bg.punch { animation: none !important; }
}
