:root {
  /* Безопасный верхний отступ: чёлка/статусбар (env или tg) + панель Telegram
     с кнопками «Закрыть»/«…» (--tg-content-safe-area-inset-top, Bot API 8.0+).
     Вне Telegram tg-переменных нет — остаётся системный env(). */
  --safe-top: calc(
    max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) +
    var(--tg-content-safe-area-inset-top, 0px)
  );
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ink: #fffaf0;
  --muted: #aaa6c4;
  --night: #17152c;
  --panel: #24213d;
  --panel-2: #312c50;
  --line: #080711;
  --yellow: #ffd84d;
  --cyan: #55e9ff;
  --green: #67f39d;
  --red: #ff5d6c;
  --purple: #a86eff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #0d0b19;
  color: var(--ink);
  font-family: "Russo One", system-ui, sans-serif;
  overflow-x: hidden;
}

body {
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 16px 16px;
}

button { font: inherit; }

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, var(--safe-top)) 16px calc(92px + var(--safe-bottom));
  background:
    radial-gradient(circle at 90% 4%, rgba(168,110,255,.22), transparent 28%),
    linear-gradient(180deg, #1e1a38 0%, var(--night) 70%);
  box-shadow: 0 0 0 2px #080711, 0 0 80px rgba(0,0,0,.75);
  overflow-x: hidden;
  overflow-y: auto;
}
.app-shell { padding-bottom: calc(124px + var(--safe-bottom)); }

.app-shell::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: .09;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #000 4px);
}

.pixel-title,
.kicker,
.stat-chip,
.rarity,
.card-stats,
.pixel-btn,
.nav-label,
.battle-log,
.tiny {
  font-family: "Press Start 2P", monospace;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  font-size: 25px;
  background: var(--yellow);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  transform: rotate(-3deg);
}
.pixel-title { font-size: 10px; line-height: 1.45; text-shadow: 2px 2px 0 #000; }
.player-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.wallet { display: flex; gap: 6px; }
.stat-chip {
  padding: 9px 8px;
  color: var(--ink);
  font-size: 8px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  white-space: nowrap;
}
.stat-chip.diamond { color: var(--cyan); }

.hero {
  position: relative;
  min-height: 200px;
  padding: 20px;
  margin-bottom: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #493a88, #2b2858 65%, #1d1a3b);
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--line);
}
.hero::after {
  content: "⚔️";
  position: absolute;
  right: -8px;
  bottom: -24px;
  font-size: 124px;
  filter: drop-shadow(7px 7px 0 rgba(0,0,0,.35));
  transform: rotate(-8deg);
}
.kicker { color: var(--cyan); font-size: 8px; line-height: 1.5; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 260px; margin: 10px 0 12px; font-size: 32px; line-height: .98; text-transform: uppercase; text-shadow: 4px 4px 0 #131027; }
h2 { margin-bottom: 10px; font-size: 21px; }
.hero p { position: relative; z-index: 1; max-width: 230px; margin-bottom: 18px; color: #d6d1f2; font-size: 13px; line-height: 1.45; }

.pixel-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  color: #161324;
  font-size: 9px;
  line-height: 1.4;
  text-transform: uppercase;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--line);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.pixel-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.pixel-btn.secondary { color: var(--ink); background: #443e68; }
.pixel-btn.cyan { background: var(--cyan); }
.pixel-btn.red { color: var(--ink); background: var(--red); }
.pixel-btn:disabled { filter: grayscale(.8); opacity: .45; cursor: default; }
.hero .pixel-btn { width: auto; min-width: 190px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.section-head h2 { margin: 0; }
.section-head span { color: var(--muted); font-size: 12px; }

.squad-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.squad-slot {
  position: relative;
  min-height: 114px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.035);
  border: 2px dashed #5a547b;
  color: #77718f;
  font-size: 24px;
}
.squad-slot.filled { border-style: solid; border-color: var(--line); background: var(--panel); box-shadow: 3px 3px 0 var(--line); }
.squad-slot .emoji { font-size: 42px; filter: drop-shadow(3px 4px 0 #000); }
.squad-slot .mini-stats { margin-top: 7px; color: var(--ink); font-size: 11px; }
.slot-index { position: absolute; top: 5px; left: 6px; font-family: "Press Start 2P"; font-size: 7px; color: var(--muted); }

.mode-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
}
.mode-icon { display: grid; place-items: center; width: 58px; height: 58px; font-size: 34px; background: #39345b; border: 2px solid var(--line); }
.mode-card h3 { margin: 0 0 5px; font-size: 16px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.mode-reward { text-align: right; color: var(--cyan); font-size: 12px; }

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  width: min(100%, 460px);
  min-height: calc(72px + var(--safe-bottom));
  padding: 8px 16px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  transform: translateX(-50%);
  background: #1c1932;
  border-top: 3px solid var(--line);
}
.nav-btn { color: #77718f; background: none; border: 0; cursor: pointer; }
.nav-btn.active { color: var(--yellow); }
.nav-icon { display: block; font-size: 24px; margin-bottom: 4px; filter: grayscale(1); }
.nav-btn.active .nav-icon { filter: none; }
.nav-label { font-size: 7px; }

.page-title { margin: 6px 0 4px; font-size: 30px; text-transform: uppercase; text-shadow: 4px 4px 0 #000; }
.page-subtitle { color: var(--muted); font-size: 13px; line-height: 1.45; }
.filter-row { display: flex; gap: 7px; margin: 17px 0; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn { flex: 0 0 auto; padding: 9px 10px; color: var(--muted); background: var(--panel); border: 2px solid var(--line); font-family: "Press Start 2P"; font-size: 7px; }
.filter-btn.active { color: #151225; background: var(--yellow); }

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.game-card {
  position: relative;
  min-height: 210px;
  padding: 9px;
  overflow: hidden;
  background: var(--card-color, #666);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--line);
  cursor: pointer;
}
.game-card::before { content: ""; position: absolute; inset: 5px; border: 2px solid rgba(255,255,255,.35); pointer-events: none; }
.game-card.selected::after { content: "✓"; position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 28px; height: 28px; color: #121020; background: var(--yellow); border: 2px solid var(--line); font-size: 17px; }
.game-card .rarity { position: relative; z-index: 1; font-size: 6px; line-height: 1.3; text-transform: uppercase; }
.card-emoji { display: grid; place-items: center; height: 96px; font-size: 66px; filter: drop-shadow(4px 5px 0 rgba(0,0,0,.4)); }
.card-name { position: relative; z-index: 1; margin: 2px 0 7px; font-size: 16px; text-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.card-stats { display: flex; gap: 6px; position: relative; z-index: 1; font-size: 8px; }
.card-stats span { flex: 1; padding: 7px 3px; text-align: center; background: rgba(15,12,30,.78); border: 2px solid var(--line); }
.ability { position: relative; z-index: 1; min-height: 31px; margin-top: 7px; padding: 5px; background: rgba(15,12,30,.68); font-size: 9px; line-height: 1.25; }

.rarity-common { --card-color: linear-gradient(145deg, #6c7180, #434754); }
.rarity-rare { --card-color: linear-gradient(145deg, #2a98dc, #2757a6); }
.rarity-unique { --card-color: linear-gradient(145deg, #37b982, #246c58); }
.rarity-epic { --card-color: linear-gradient(145deg, #a05be6, #5a2a98); }
.rarity-legendary { --card-color: linear-gradient(145deg, #ffb12b, #dd5f29); }

.shop-pack {
  position: relative;
  min-height: 235px;
  margin: 20px 0;
  padding: 20px;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(145deg, #5d46a2, #2c2757);
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--line);
}
.pack-art { font-size: 94px; line-height: 1.2; filter: drop-shadow(7px 8px 0 rgba(0,0,0,.4)); animation: hover 1.5s steps(2) infinite; }
@keyframes hover { 50% { transform: translateY(-5px) rotate(2deg); } }
.shop-pack h2 { margin: 4px 0; }
.odds { color: var(--muted); font-size: 11px; }

.starter-screen { min-height: calc(100dvh - 32px); display: flex; flex-direction: column; justify-content: space-between; }
.starter-logo { text-align: center; margin-top: 22px; }
.starter-logo .big { display: block; font-size: 78px; filter: drop-shadow(7px 8px 0 #080711); }
.starter-logo h1 { max-width: none; margin: 14px auto 8px; font-size: 38px; }
.starter-logo p { color: var(--muted); line-height: 1.45; }
.starter-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 15px 0 24px; }
.starter-pack { position: relative; aspect-ratio: .72; display: grid; place-items: center; font-size: 52px; background: linear-gradient(145deg, #6350ad, #332964); border: 3px solid var(--line); box-shadow: 5px 5px 0 var(--line); cursor: pointer; }
.starter-pack::after { content: "FREE"; position: absolute; bottom: 10px; font-family: "Press Start 2P"; font-size: 7px; color: var(--yellow); }
.starter-pack.opened { filter: grayscale(1); opacity: .35; pointer-events: none; }
.starter-pack.opened::after { content: "OPEN"; }

.reveal-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9,7,19,.92);
  animation: fade .2s both;
}
@keyframes fade { from { opacity: 0; } }
.reveal-content { width: min(300px, 90vw); text-align: center; }
.reveal-burst { font-size: 13px; color: var(--yellow); margin-bottom: 14px; font-family: "Press Start 2P"; animation: blink .5s steps(2) 3; }
@keyframes blink { 50% { opacity: .2; } }
.reveal-content .game-card { min-height: 340px; transform: scale(1.03); animation: card-in .45s cubic-bezier(.2,1.5,.5,1) both; }
.reveal-content .card-emoji { height: 172px; font-size: 112px; }
.reveal-content .card-name { font-size: 23px; }
@keyframes card-in { from { transform: scale(.15) rotateY(90deg); } }
.reveal-content .pixel-btn { margin-top: 22px; }

.battle-head { text-align: center; margin-bottom: 14px; }
.versus { color: var(--yellow); font-family: "Press Start 2P"; font-size: 10px; }
.rating-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.arena {
  position: relative;
  padding: 14px 8px;
  background:
    linear-gradient(rgba(255,255,255,.05) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255,255,255,.05) 2px, transparent 2px),
    #28234a;
  background-size: 24px 24px;
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--line);
}
.fighter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.fighter { position: relative; min-height: 110px; padding: 8px 5px; text-align: center; background: rgba(14,11,28,.75); border: 2px solid var(--line); transition: transform .16s, opacity .2s; }
.fighter.hit { transform: translateX(6px); filter: brightness(2); }
.fighter.dead { filter: grayscale(1); opacity: .25; transform: rotate(4deg); }
.fighter-emoji { font-size: 42px; filter: drop-shadow(3px 3px 0 #000); }
.fighter-name { overflow: hidden; margin: 2px 0 5px; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.hp-bar { height: 10px; background: #181526; border: 2px solid var(--line); }
.hp-fill { height: 100%; background: var(--green); transition: width .25s steps(5); }
.fighter-numbers { margin-top: 4px; color: var(--muted); font-size: 9px; }
.arena-divider { position: relative; height: 42px; display: grid; place-items: center; color: var(--yellow); font-family: "Press Start 2P"; font-size: 8px; }
.arena-divider::before, .arena-divider::after { content: ""; position: absolute; top: 50%; width: 34%; height: 2px; background: #5a547b; }
.arena-divider::before { left: 0; }
.arena-divider::after { right: 0; }
.battle-log { height: 86px; margin: 15px 0; padding: 10px; overflow-y: auto; color: #c8c3e5; background: #100e20; border: 2px solid var(--line); font-size: 7px; line-height: 1.7; }
.battle-log div:last-child { color: var(--yellow); }
.battle-result { padding: 18px; margin: 16px 0; text-align: center; background: var(--panel); border: 3px solid var(--line); box-shadow: 5px 5px 0 var(--line); }
.result-emoji { font-size: 64px; }
.reward-row { display: flex; justify-content: center; gap: 20px; margin: 12px 0 18px; }
.reward-row span { color: var(--cyan); }

.empty-state { padding: 34px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 2px dashed #5a547b; }
.empty-state .big { display: block; margin-bottom: 10px; font-size: 50px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 88px; padding: 12px 16px; color: #171323; background: var(--yellow); border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--line); font-family: "Press Start 2P"; font-size: 8px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Unified pixel UI icons (stats no longer depend on platform emoji rendering). */
.ui-icon { width: 1.15em; height: 1.15em; fill: currentColor; vertical-align: -.18em; image-rendering: pixelated; }
.stat-chip { display: flex; align-items: center; gap: 5px; }
.stat-chip .ui-icon { width: 14px; height: 14px; }
.stat-chip.diamond .ui-icon { color: var(--cyan); }
.mode-reward .ui-icon { width: 13px; }
.pixel-btn .ui-icon { width: 14px; }

.duel-hero::after { content: "🃏"; transform: rotate(8deg); }
.deck-strip { display: grid; grid-template-columns: repeat(5,1fr); gap: 7px; }
.deck-mini { position: relative; height: 58px; display: grid; place-items: center; font-size: 30px; background: var(--card-color); border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--line); }
.deck-mini > span { position: absolute; top: 3px; left: 4px; color: var(--cyan); font-family: "Press Start 2P"; font-size: 7px; }
.deck-mini.empty { color: #5b5675; background: rgba(255,255,255,.03); border-style: dashed; font-size: 18px; }
.rules-card { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 14px 0; }
.rules-card div { padding: 10px 4px; text-align: center; background: var(--panel); border: 2px solid var(--line); }
.rules-card b { display: block; color: var(--yellow); font-family: "Press Start 2P"; font-size: 12px; }
.rules-card span { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.mode-button { width: 100%; color: var(--ink); text-align: left; cursor: pointer; }
.deck-builder-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.deck-builder-head > div { display: flex; align-items: center; gap: 10px; font-family: "Press Start 2P"; font-size: 8px; }
.deck-builder-head b { padding: 8px; color: var(--yellow); background: var(--panel); border: 2px solid var(--line); }
.deck-builder-head b.ready { color: var(--green); }
.deck-builder-head button { padding: 8px 10px; color: var(--ink); background: #443e68; border: 2px solid var(--line); font-family: "Press Start 2P"; font-size: 7px; }

.cost-badge { position: absolute; z-index: 3; top: 5px; right: 5px; width: 34px; height: 34px; display: grid; place-items: center; color: #141125; background: var(--cyan); border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--line); }
.cost-badge .ui-icon { position: absolute; width: 25px; height: 25px; opacity: .22; }
.cost-badge b { position: relative; font-family: "Press Start 2P"; font-size: 11px; }
.card-stats { font-size: 10px; }
.card-stats .ui-icon { width: 16px; height: 16px; }
.card-stats span:first-child .ui-icon { color: #fff2b5; }
.card-stats span:last-child .ui-icon { color: var(--red); }
.deck-controls { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 34px 1fr; gap: 4px; align-items: center; margin-top: 7px; }
.deck-controls button { height: 30px; color: #171426; background: var(--yellow); border: 2px solid var(--line); font-size: 18px; line-height: 1; }
.deck-controls button:disabled { opacity: .3; }
.deck-controls strong { text-align: center; font-family: "Press Start 2P"; font-size: 9px; }
.card-grid .game-card:has(.deck-controls) { min-height: 245px; }

/* Card duel board */
.battle-top { height: 42px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; margin-bottom: 6px; font-family: "Press Start 2P"; font-size: 7px; }
.battle-top > div { display: flex; flex-direction: column; gap: 4px; }
.battle-top > div span { color: var(--yellow); }
.battle-top > span { color: var(--cyan); }
.battle-exit { width: 30px; height: 30px; color: var(--ink); background: #3b365d; border: 2px solid var(--line); font-size: 20px; }
.battle-top-simple { display: flex; justify-content: flex-end; align-items: center; height: 36px; margin-bottom: 0; }
/* Surrender modal */
.surrender-backdrop { position: fixed; inset: 0; z-index: 1500; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; }
.surrender-dialog { width: min(320px, 90vw); background: #1a1530; border: 3px solid #3b365d; border-radius: 16px; padding: 28px 24px 20px; text-align: center; box-shadow: 0 0 40px rgba(0,0,0,.8), inset 0 0 0 2px #2e2850; }
.surrender-dialog h2 { margin: 0 0 12px; font-family: "Russo One", sans-serif; font-size: clamp(26px, 7vw, 36px); color: #fff3c8; text-shadow: 3px 4px 0 #000; text-transform: uppercase; }
.surrender-dialog p { margin: 0 0 24px; font-family: "Press Start 2P", monospace; font-size: clamp(7px, 2vw, 9px); color: #c9c0e8; line-height: 1.6; }
.surrender-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.surrender-yes { background: linear-gradient(#e8413a, #c02020); color: #fff; border: 3px solid #7a1010; box-shadow: inset 0 0 0 2px rgba(255,150,150,.3), 3px 4px 0 #08050a; font-family: "Press Start 2P", monospace; font-size: 10px; padding: 12px 0; border-radius: 8px; cursor: pointer; }
.surrender-no { background: linear-gradient(#3ac84a, #1e8a2c); color: #fff; border: 3px solid #0d5018; box-shadow: inset 0 0 0 2px rgba(150,255,160,.3), 3px 4px 0 #08050a; font-family: "Press Start 2P", monospace; font-size: 10px; padding: 12px 0; border-radius: 8px; cursor: pointer; }
.hero-bar { display: grid; grid-template-columns: 36px 1fr auto auto auto; gap: 5px; align-items: center; padding: 6px; margin: 6px 0; background: #272342; border: 2px solid var(--line); }
.hero-avatar { display: grid; place-items: center; width: 34px; height: 34px; background: #423b69; border: 2px solid var(--line); font-size: 21px; }
.hero-data { min-width: 0; }
.hero-data b { display: block; overflow: hidden; margin-bottom: 5px; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.hero-hp { height: 7px; background: #100e20; border: 1px solid var(--line); }
.hero-hp span { display: block; height: 100%; background: var(--green); transition: width .25s steps(5); }
.hero-stat { display: flex; align-items: center; gap: 2px; font-family: "Press Start 2P"; font-size: 7px; }
.hero-stat .ui-icon { width: 12px; }
.hero-stat.health { color: var(--red); }
.hero-stat.mana { color: var(--cyan); }
.hero-stat.deck-count { color: #d7d2ed; }

.lane-board { position: relative; padding: 6px; background: linear-gradient(rgba(255,255,255,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.035) 1px,transparent 1px),#211d3d; background-size: 16px 16px; border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--line); }
.battle-row { position: relative; display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 4px 0; padding-left: 22px; }
.row-label { position: absolute; left: 1px; top: 50%; color: #77718f; font-family: "Press Start 2P"; font-size: 5px; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.battle-slot { min-width: 0; height: 80px; padding: 0; overflow: hidden; color: #655f81; background: rgba(255,255,255,.025); border: 2px dashed #4d4868; }
.battle-slot.available { color: var(--yellow); border-color: var(--yellow); background: rgba(255,216,77,.08); font-size: 25px; cursor: pointer; animation: slot-pulse .8s steps(2) infinite; }
@keyframes slot-pulse { 50% { background: rgba(255,216,77,.18); } }
.battle-slot.occupied { overflow: visible; border-style: solid; border-color: #0b0916; touch-action: none; cursor: grab; }
.battle-slot.dragging { z-index: 50; cursor: grabbing; }
.battle-slot.dragging .board-unit { opacity: .88; filter: drop-shadow(8px 12px 6px rgba(0,0,0,.5)); }
.battle-slot.move-drop { transition: background .15s,border-color .15s; }
.lane-board:has(.battle-slot.dragging) .battle-slot.move-drop,
.lane-board:has(.battle-slot.dragging) .battle-slot.occupied:not(.dragging) { border-color: var(--cyan); background: rgba(85,233,255,.08); }
.board-unit { position: relative; width: 100%; height: 100%; padding: 3px; text-align: center; transform-origin: center; }
.battle-card-neutral { color: #fffdf4; background: linear-gradient(180deg,#3a3850 0%,#28263b 58%,#1c1a2a 100%); border: 1px solid #76718f; box-shadow: inset 0 0 0 2px rgba(255,255,255,.05); }
.board-emoji { height: 37px; display: grid; place-items: center; font-size: 30px; filter: drop-shadow(2px 3px 0 rgba(0,0,0,.6)); }
.board-unit-name { overflow: hidden; font-size: 8px; line-height: 1; white-space: nowrap; text-overflow: ellipsis; }
.board-unit-stats { position: absolute; left: 3px; right: 3px; bottom: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-family: "Press Start 2P"; font-size: 9px; }
.board-unit-stats span { display: flex; align-items: center; justify-content: center; gap: 3px; min-height: 21px; background: #0e0c19; border: 1px solid #05040a; text-shadow: 1px 1px 0 #000; }
.board-unit-stats span:first-child { color: #fff1a6; }
.board-unit-stats span:last-child { color: #ff8597; }
.board-unit-stats .ui-icon { width: 13px; height: 13px; }
.board-cost { position: absolute; z-index: 2; top: 2px; left: 3px; color: var(--cyan); font-family: "Press Start 2P"; font-size: 6px; }
.board-unit > i { position: absolute; top: 2px; right: 3px; color: var(--yellow); font-family: "Press Start 2P"; font-size: 6px; font-style: normal; }
.sleep-mark { position: absolute; z-index: 3; top: 2px; right: 3px; color: var(--cyan); font-family: "Press Start 2P"; font-size: 7px; animation: blink 1s steps(2) infinite; }
.unit-tooltip { position: absolute; z-index: 80; left: 50%; bottom: calc(100% + 7px); width: 150px; padding: 9px; color: var(--ink); background: #100e20; border: 2px solid var(--yellow); box-shadow: 4px 4px 0 var(--line); text-align: left; opacity: 0; visibility: hidden; transform: translate(-50%,6px); transition: opacity .12s,transform .12s; pointer-events: none; }
.unit-tooltip::after { content:""; position:absolute; left:50%; bottom:-7px; width:10px; height:10px; background:#100e20; border-right:2px solid var(--yellow); border-bottom:2px solid var(--yellow); transform:translateX(-50%) rotate(45deg); }
.unit-tooltip b { display:block; margin-bottom:5px; color:var(--yellow); font-size:10px; }
.unit-tooltip span { display:block; font-size:9px; line-height:1.3; }
.battle-row.enemy .unit-tooltip { top:calc(100% + 7px); bottom:auto; }
.battle-row.enemy .unit-tooltip::after { top:-7px; bottom:auto; transform:translateX(-50%) rotate(225deg); }
.board-unit:hover .unit-tooltip,.board-unit:focus .unit-tooltip,.board-unit.show-info .unit-tooltip { opacity:1; visibility:visible; transform:translate(-50%,0); }

.board-unit.impact { animation: unit-hit .28s steps(2); }
.hero-bar.impact { animation: hero-hit .32s steps(2); }
.board-unit.dying { animation: unit-death .43s steps(5) forwards; }
.damage-pop { position:absolute; z-index:100; left:50%; top:38%; color:#fff; font-family:"Press Start 2P"; font-size:15px; text-shadow:2px 2px 0 #000,-1px -1px 0 var(--red); pointer-events:none; animation:damage-fly .5s ease-out forwards; }
.hero-bar > .damage-pop { top:6px; }
@keyframes unit-hit { 0%,100%{filter:none} 40%{filter:brightness(3) saturate(0);transform:translateX(5px)} 70%{transform:translateX(-4px)} }
@keyframes hero-hit { 40%{background:#a62f4f;transform:translateX(5px)} 70%{transform:translateX(-4px)} }
@keyframes unit-death { 0%{opacity:1;transform:scale(1)} 45%{filter:brightness(3);transform:scale(1.12) rotate(-4deg)} 100%{opacity:0;filter:grayscale(1);transform:scale(.2) rotate(18deg) translateY(25px)} }
@keyframes damage-fly { 0%{opacity:0;transform:translate(-50%,8px) scale(.6)} 25%{opacity:1;transform:translate(-50%,-5px) scale(1.25)} 100%{opacity:0;transform:translate(-50%,-28px) scale(.9)} }
.combat-line { height: 20px; display: grid; place-items: center; color: var(--yellow); font-family: "Press Start 2P"; font-size: 10px; }
.combat-line::before,.combat-line::after { content:""; position:absolute; left:9%; right:9%; height:2px; background:#554f76; }
.combat-line span { position: relative; z-index: 1; padding: 0 8px; background: #211d3d; }

.hand-head { display: flex; justify-content: space-between; margin: 10px 0 6px; color: var(--muted); font-family: "Press Start 2P"; font-size: 6px; }
.hand { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.hand-card { position: relative; min-width: 0; height: 122px; padding: 5px 3px; overflow: hidden; color: var(--ink); background: var(--card-color); border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--line); cursor: pointer; }
.hand-card.selected { outline: 3px solid var(--yellow); transform: translateY(-5px); }
.hand-card:disabled { filter: grayscale(.65); opacity: .5; }
.hand-cost { position: absolute; top: 3px; left: 3px; display: flex; align-items: center; color: var(--cyan); font-family: "Press Start 2P"; font-size: 7px; }
.hand-cost .ui-icon { width: 10px; }
.hand-emoji { height: 48px; display: grid; place-items: center; padding-top: 6px; font-size: 36px; }
.hand-name { display: block; overflow: hidden; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.hand-stats { display: flex; justify-content: center; gap: 7px; margin: 5px 0; padding: 4px 2px; color:#fff; background:rgba(9,7,18,.82); border:1px solid #080711; font-family: "Press Start 2P"; font-size: 9px; }
.hand-stats .ui-icon { width: 13px; height:13px; }
.hand-stats .ui-icon:first-child { color:#fff1a6; }
.hand-card small { display: block; height: 25px; overflow: hidden; font-size: 7px; line-height: 1.15; }
.end-turn { margin-top: 10px; }
.battle-log { height: 50px; margin: 8px 0; }
.reward-row .ui-icon { width: 16px; }

@media (max-width: 370px) {
  .battle-row { padding-left: 18px; gap: 3px; }
  .battle-slot { height: 73px; }
  .board-emoji { height: 36px; font-size: 27px; }
  .hand-card { height: 116px; }
  .hero-stat.deck-count { display: none; }
}

@media (max-width: 360px) {
  .app-shell { padding-inline: 11px; }
  h1 { font-size: 27px; }
  .wallet { gap: 3px; }
  .stat-chip { padding-inline: 5px; font-size: 7px; }
  .card-grid { gap: 9px; }
  .card-name { font-size: 14px; }
}

@media (min-width: 700px) {
  body { padding: 20px 0; }
  .app-shell { min-height: calc(100dvh - 40px); }
}

/* V3 — single-lane emoji arena */
.deck-eight { grid-template-columns: repeat(4,1fr); }
.reward-explain { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:18px; }
.reward-explain span { padding:12px 8px; color:var(--muted); background:var(--panel); border:2px solid var(--line); font-size:10px; text-align:center; }
.reward-explain b { display:block; margin-top:6px; color:var(--cyan); font-family:"Press Start 2P"; font-size:9px; }

.new-starter { justify-content:flex-start; gap:18px; }
.new-starter .starter-logo { margin-top:8px; }
.new-starter .starter-logo .big { font-size:58px; }
.new-starter .starter-logo h1 { margin-top:8px; font-size:32px; }
.new-starter .starter-logo p { font-size:13px; }
.new-starter .starter-logo p b { color:var(--yellow); }
.starter-team { display:grid; grid-template-columns:repeat(8,1fr); gap:3px; padding:9px 6px; background:#100e20; border:2px solid var(--line); box-shadow:4px 4px 0 var(--line); }
.starter-team span { display:grid; place-items:center; aspect-ratio:1; font-size:26px; background:#302b4d; border:1px solid #514b70; filter:drop-shadow(2px 2px 0 #000); }
.starter-note { text-align:center; color:var(--muted); font-size:7px; line-height:1.6; }
.new-starter .starter-packs { margin-top:4px; }

/* Booster ceremony. Every rarity has its own motion language. */
.booster-reveal { --reveal:#9ba0ad; overflow:hidden; background:radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--reveal) 30%,transparent),#090713 58%); }
.reveal-rarity-common { --reveal:#aeb3bf; }
.reveal-rarity-rare { --reveal:#42b9ff; }
.reveal-rarity-unique { --reveal:#52f5a0; }
.reveal-rarity-epic { --reveal:#b66bff; }
.reveal-rarity-legendary { --reveal:#ffd84d; }
.opening-pack { position:relative; z-index:4; font-size:112px; filter:drop-shadow(0 0 18px var(--reveal)) drop-shadow(8px 10px 0 #000); }
.opening-label { position:absolute; z-index:5; bottom:20%; color:var(--reveal); font-family:"Press Start 2P"; font-size:9px; animation:blink .7s steps(2) infinite; }
.reveal-rarity-common .opening-pack { animation:pack-crack .8s steps(6) both; }
.reveal-rarity-rare .opening-pack { animation:pack-bounce .8s cubic-bezier(.2,1.5,.5,1) both; }
.reveal-rarity-unique .opening-pack { animation:pack-spin .85s steps(8) both; }
.reveal-rarity-epic .opening-pack { animation:pack-warp .85s ease-in both; }
.reveal-rarity-legendary .opening-pack { animation:pack-legend .9s cubic-bezier(.2,1.6,.3,1) both; }
@keyframes pack-crack { 0%{transform:scale(.6)} 25%{transform:translateX(-8px) rotate(-4deg)} 50%{transform:translateX(8px) rotate(4deg)} 80%{transform:scale(1.12)} 100%{transform:scale(0);opacity:0} }
@keyframes pack-bounce { 0%{transform:translateY(120px) scale(.4)} 45%{transform:translateY(-25px) scale(1.1)} 75%{transform:translateY(0) scale(.92)} 100%{transform:scale(1.5);opacity:0} }
@keyframes pack-spin { 0%{transform:scale(.35) rotate(-180deg)} 65%{transform:scale(1.05) rotate(18deg)} 100%{transform:scale(1.8) rotate(90deg);opacity:0} }
@keyframes pack-warp { 0%{transform:scale(.3);filter:blur(10px) drop-shadow(0 0 30px var(--reveal))} 55%{transform:scale(1.1);filter:blur(0) drop-shadow(0 0 35px var(--reveal))} 100%{transform:scale(.05) rotate(25deg);opacity:0} }
@keyframes pack-legend { 0%{transform:scale(.2) rotate(-12deg)} 40%{transform:scale(1.25) rotate(7deg)} 70%{transform:scale(.95)} 100%{transform:scale(2.4);filter:brightness(4);opacity:0} }
.rarity-rays { position:absolute; z-index:1; width:120vmax; height:120vmax; background:repeating-conic-gradient(from 0deg,var(--reveal) 0 7deg,transparent 7deg 20deg); opacity:.14; animation:ray-spin 7s linear infinite; }
.reveal-rarity-epic .rarity-rays { animation-duration:3s; }
.reveal-rarity-legendary .rarity-rays { opacity:.3; animation-duration:2s; }
@keyframes ray-spin { to{transform:rotate(360deg)} }
.reveal-particles { position:absolute; z-index:2; left:50%; top:48%; width:1px; height:1px; }
.reveal-particles i { position:absolute; width:7px; height:7px; background:var(--reveal); box-shadow:0 0 9px var(--reveal); transform:rotate(calc(var(--i) * 22.5deg)) translateY(40px); animation:particle-burst 1.15s ease-out infinite; animation-delay:calc(var(--i) * -55ms); }
.reveal-rarity-legendary .reveal-particles i { width:11px; height:11px; clip-path:polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%); }
@keyframes particle-burst { 0%{opacity:0;transform:rotate(calc(var(--i) * 22.5deg)) translateY(25px) scale(.2)} 35%{opacity:1} 100%{opacity:0;transform:rotate(calc(var(--i) * 22.5deg)) translateY(210px) scale(1.1)} }
.booster-reveal .reveal-content { position:relative; z-index:5; }
.booster-reveal .reveal-burst { color:var(--reveal); text-shadow:0 0 12px var(--reveal); }
.booster-reveal .game-card { box-shadow:0 0 35px color-mix(in srgb,var(--reveal) 70%,transparent),7px 7px 0 #000; }

/* Battlefield scene */
.emoji-battlefield { position:relative; min-height:290px; padding:22px 10px 14px; overflow:visible; isolation:isolate; background:
  linear-gradient(180deg,rgba(7,9,28,.1) 0 30%,rgba(8,9,22,.55) 31% 34%,transparent 35%),
  repeating-linear-gradient(105deg,transparent 0 52px,rgba(255,255,255,.035) 53px 55px),
  linear-gradient(180deg,#303a62 0%,#4b5265 29%,#46543a 30%,#303b2c 100%);
  border:3px solid var(--line); box-shadow:5px 5px 0 var(--line),inset 0 0 50px rgba(0,0,0,.42); }
.emoji-battlefield::before { content:""; position:absolute; z-index:-1; left:0; right:0; top:31%; bottom:0; opacity:.7; background:
  radial-gradient(ellipse at 15% 22%,#778452 0 4px,transparent 5px),
  radial-gradient(ellipse at 76% 48%,#6f7a4b 0 5px,transparent 6px),
  repeating-linear-gradient(0deg,transparent 0 37px,rgba(13,16,14,.27) 38px 40px),
  repeating-linear-gradient(90deg,transparent 0 52px,rgba(13,16,14,.2) 53px 55px); }
.emoji-battlefield::after { content:"🏳️     🔥     🏳️"; position:absolute; z-index:-1; left:0; right:0; top:18%; color:#cbc7e7; font-size:18px; letter-spacing:22px; text-align:center; filter:drop-shadow(2px 3px 0 #111); opacity:.75; }
.arena-crowd { position:absolute; z-index:-1; left:0; right:0; top:7px; overflow:hidden; color:#141426; font-family:"Press Start 2P"; font-size:12px; letter-spacing:9px; white-space:nowrap; text-shadow:0 4px 0 #576078; }
.pixel-cloud { position:absolute; z-index:-1; top:35px; width:46px; height:9px; background:rgba(224,229,255,.17); box-shadow:10px -7px 0 rgba(224,229,255,.17),22px 0 0 rgba(224,229,255,.17); }
.cloud-a { left:26px; animation:cloud-drift 9s linear infinite alternate; }
.cloud-b { right:52px; top:57px; animation:cloud-drift 12s linear infinite alternate-reverse; }
@keyframes cloud-drift { to{transform:translateX(42px)} }
.arena-row { position:relative; z-index:3; display:grid; grid-template-columns:repeat(3,1fr); gap:12px; min-height:93px; align-items:end; }
.enemy-row { margin-bottom:4px; }
.player-row { margin-top:4px; }
.arena-mid { position:relative; z-index:1; height:48px; display:grid; place-items:center; color:var(--yellow); font-family:"Press Start 2P"; font-size:12px; }
.arena-mid::before,.arena-mid::after { content:""; position:absolute; left:4%; right:4%; height:3px; background:repeating-linear-gradient(90deg,#d4bb6e 0 12px,#3b3422 12px 18px); box-shadow:0 3px 0 rgba(0,0,0,.28); }
.arena-mid span { z-index:2; display:grid; place-items:center; width:31px; height:31px; background:#2a263f; border:2px solid #8e7950; transform:rotate(45deg); }
.arena-mid span::first-letter { transform:rotate(-45deg); }
.arena-cell { position:relative; min-width:0; height:92px; display:grid; place-items:end center; touch-action:none; }
.arena-cell.drop-cell { align-items:center; color:rgba(255,255,255,.22); border:2px dashed rgba(240,226,169,.23); border-radius:50%; font-family:"Press Start 2P"; font-size:8px; }
.arena-cell.active-drop { transition:.15s; }
body:has(.hand-card.dragging) .arena-cell.active-drop,.emoji-battlefield:has(.arena-cell.dragging) .arena-cell { border-color:var(--cyan); background:rgba(85,233,255,.1); }
.arena-cell.dragging { z-index:80; }
.arena-cell.dragging .arena-fighter,.hand-card.dragging { filter:drop-shadow(9px 13px 7px rgba(0,0,0,.55)); }
.field-grass { position:absolute; z-index:0; left:0; right:0; bottom:0; height:9px; background:repeating-linear-gradient(90deg,#768348 0 4px,#3c4829 4px 8px); opacity:.8; }

/* A unit on the battlefield is a character token, not a card. */
.arena-fighter { position:relative; width:100%; height:92px; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; cursor:grab; transform-origin:center bottom; }
.arena-fighter:active { cursor:grabbing; }
.fighter-aura { position:absolute; left:12%; right:12%; bottom:5px; height:24px; border-radius:50%; background:radial-gradient(ellipse,#151322 0 35%,rgba(6,5,12,.65) 36% 55%,transparent 57%); box-shadow:0 5px 0 rgba(0,0,0,.25); }
.fighter-portrait { position:relative; z-index:2; width:68px; height:61px; display:grid; place-items:center; padding-bottom:5px; border-radius:48% 48% 44% 44% / 52% 52% 38% 38%; background:radial-gradient(circle at 50% 35%,#595574 0 45%,#252238 47% 70%,#0c0b14 72%); border:3px solid #090812; box-shadow:inset 0 0 0 2px rgba(255,255,255,.12),0 6px 0 rgba(0,0,0,.28); font-size:42px; filter:drop-shadow(2px 3px 0 rgba(0,0,0,.5)); }
.enemy-row .fighter-portrait { background:radial-gradient(circle at 50% 35%,#675067 0 45%,#302334 47% 70%,#0c0b14 72%); }
.fighter-name { position:absolute; z-index:5; bottom:19px; max-width:82px; padding:3px 5px; overflow:hidden; color:#fff; background:#181522; border:1px solid #080711; font-size:8px; white-space:nowrap; text-overflow:ellipsis; }
.fighter-badges { position:absolute; z-index:6; left:3px; right:3px; bottom:0; display:flex; justify-content:space-between; pointer-events:none; }
.fighter-badges span { width:34px; height:25px; display:flex; align-items:center; justify-content:center; gap:2px; color:#fff; background:#0b0a12; border:2px solid #050409; border-radius:45%; font-family:"Press Start 2P"; font-size:9px; box-shadow:2px 2px 0 rgba(0,0,0,.4); }
.fighter-badges .attack-badge { color:#ffeaa0; }
.fighter-badges .health-badge { color:#ff8799; }
.fighter-badges .ui-icon { width:13px; height:13px; }
.arena-fighter .sleep-mark { top:3px; right:10px; padding:3px; color:var(--cyan); background:#151326; border:1px solid var(--line); }
.arena-fighter .unit-tooltip { bottom:calc(100% + 5px); }
.enemy-row .unit-tooltip { top:calc(100% + 6px); bottom:auto; }
.arena-fighter:hover .unit-tooltip,.arena-fighter:focus .unit-tooltip,.arena-fighter.show-info .unit-tooltip { opacity:1; visibility:visible; transform:translate(-50%,0); }
.arena-fighter.impact { animation:unit-hit .28s steps(2); }
.arena-fighter.dying { animation:unit-death .43s steps(5) forwards; }

.hand-three { grid-template-columns:repeat(3,1fr); gap:8px; }
.hand-three .hand-card { height:139px; touch-action:none; transition:transform .12s; }
.hand-three .hand-emoji { height:59px; font-size:43px; }
.hand-three .hand-name { font-size:10px; }
.hand-three .hand-stats { font-size:10px; }
.hand-three .hand-card small { height:27px; font-size:8px; }
.battle-result p { color:var(--muted); font-size:11px; line-height:1.4; }

@media(max-width:370px){
  .arena-row{gap:6px}.fighter-portrait{width:61px;height:57px;font-size:37px}.fighter-name{font-size:7px}.hand-three{gap:5px}.hand-three .hand-card{height:132px}.starter-team span{font-size:22px}
}

/* V4 — readable fantasy card-game interface */
.rarity-common { --rarityAccent:#aeb4c0; }
.rarity-rare { --rarityAccent:#42b9ff; }
.rarity-unique { --rarityAccent:#55e99d; }
.rarity-epic { --rarityAccent:#b66bff; }
.rarity-legendary { --rarityAccent:#ffd84d; }
.rarity-special { --rarityAccent:#ff7ad9; }

.fantasy-card { min-height:258px; padding:10px 10px 9px; overflow:hidden; background:linear-gradient(145deg,#716550,#3e382f 68%,#27231f); border:4px solid #17120d; border-radius:20px 20px 11px 11px; box-shadow:inset 0 0 0 2px #a79370,5px 6px 0 var(--line); }
.fantasy-card::before { inset:5px; border:2px solid color-mix(in srgb,var(--rarityAccent) 70%,#9a835a); border-radius:14px 14px 7px 7px; }
.fantasy-card::after { content:""; position:absolute; z-index:0; left:16px; right:16px; top:13px; height:112px; border-radius:48% 48% 12% 12%; background:radial-gradient(circle at 50% 40%,color-mix(in srgb,var(--rarityAccent) 34%,#536072),#1b1925 72%); border:3px solid #17121c; box-shadow:inset 0 0 0 2px rgba(255,255,255,.16),0 4px 0 rgba(0,0,0,.32); }
.fantasy-card .rarity { position:absolute; z-index:3; top:9px; left:12px; padding:4px 5px; color:#fff; background:rgba(12,10,18,.72); border:1px solid var(--rarityAccent); }
.fantasy-card .card-art-orb { position:relative; z-index:2; height:105px; display:grid; place-items:center; }
.fantasy-card .card-emoji { height:auto; font-size:70px; }
.fantasy-card .card-ribbon { position:relative; z-index:4; width:calc(100% - 10px); margin:-2px auto 7px; padding:7px 5px 6px; color:#fff; background:linear-gradient(#3c3150,#211b2e); border:2px solid #110e18; box-shadow:inset 0 0 0 1px #817298,0 3px 0 rgba(0,0,0,.35); text-align:center; text-shadow:2px 2px 0 #000; }
.fantasy-card .card-stats { position:relative; z-index:4; margin:0 4px; }
.fantasy-card .ability { position:relative; z-index:3; min-height:50px; margin:7px 4px 0; padding:7px 6px; color:#29231e; background:linear-gradient(#e9dec3,#cfc09e); border:2px solid #17120e; font-size:9px; line-height:1.28; text-align:left; }
.fantasy-card .active-effect strong { color:#5b238a; }
.fantasy-card .flavor-text { display:flex; align-items:center; justify-content:center; color:#716957; font-style:italic; text-align:center; }
.ornate-corner { position:absolute; z-index:5; width:16px; height:16px; border-color:var(--rarityAccent); }
.ornate-corner.tl { top:4px; left:4px; border-top:4px solid var(--rarityAccent); border-left:4px solid var(--rarityAccent); }
.ornate-corner.br { right:4px; bottom:4px; border-right:4px solid var(--rarityAccent); border-bottom:4px solid var(--rarityAccent); }
.fantasy-card .deck-controls { margin:7px 4px 0; }
.card-grid .fantasy-card:has(.deck-controls) { min-height:298px; }
.reveal-content .fantasy-card { min-height:370px; }
.reveal-content .fantasy-card::after { height:185px; }
.reveal-content .fantasy-card .card-art-orb { height:178px; }

.battle-screen { min-height:calc(100dvh - 34px); padding-bottom:8px; }
/* Prevent outer shell from scrolling during battle */
body:has(.hearth-battle) { overflow:hidden; }
body:has(.hearth-battle) .app-shell { overflow:hidden; height:100dvh; min-height:unset; padding:0; }
.battle-screen.hearth-battle { height:100dvh; min-height:unset; overflow:hidden; display:flex; flex-direction:column; padding:max(4px, var(--safe-top)) 0 var(--safe-bottom); box-sizing:border-box; }
.battle-screen.hearth-battle .hero-bar.enemy { flex-shrink:0; position:relative; z-index:20; margin:0 0 -8px; }
.battle-screen.hearth-battle .hero-bar.player { flex-shrink:0; position:relative; z-index:20; margin:-8px 0 0; }
/* Field lives in a size-container wrapper: it takes the leftover height and the
   field scales inside it with a fixed aspect ratio (see the adaptive section at
   the end of the file). */
.battle-screen.hearth-battle .hearth-field-wrap { position:relative; z-index:10; flex:1 1 0; min-width:0; min-height:0; container-type:size; display:grid; place-items:center; }
/* The hand takes exactly the height left after the field: this way the field
   wrapper always matches the field height and the hero bars stay glued to it.
   100px = two 58px hero bars minus their 8px overlaps; 1.3303 = 580/436 aspect.
   No upper cap: on tall screens the extra space stays below the cards.
   Card visibility wins over field size: the hand never drops below 200px
   (7px top pad + 172px card + 14px protruding stat badges + fan offsets),
   the field then shrinks proportionally inside its size-container wrapper. */
.battle-screen.hearth-battle .hand-three { flex-shrink:0; height:max(200px, calc(100dvh - max(4px, var(--safe-top)) - var(--safe-bottom) - 100px - min(100vw, 460px) * 1.3303)); padding:0 4px; }
.battle-screen.hearth-battle .battle-result-overlay { flex:1; min-height:0; overflow:hidden; }
.battle-screen .hero-bar { min-height:48px; padding:5px 7px; margin:4px 0; grid-template-columns:40px 1fr auto auto auto; background:linear-gradient(180deg,#6c472b,#382618); border:3px solid #160d08; border-radius:23px 8px 8px 23px; box-shadow:inset 0 0 0 2px #a97a4d,3px 3px 0 #08050a; }
.battle-screen .hero-bar:not(.enemy) { background:linear-gradient(180deg,#355c71,#1c3546); box-shadow:inset 0 0 0 2px #6aa2b5,3px 3px 0 #08050a; }
.battle-screen .hero-avatar { width:38px; height:38px; border-radius:50%; background:radial-gradient(circle,#7b664e,#2a2018 70%); border:3px solid #130c08; box-shadow:inset 0 0 0 2px #c2a16d; }
.battle-screen .hero-bar:not(.enemy) .hero-avatar { background:radial-gradient(circle,#4f7c91,#182d38 70%); box-shadow:inset 0 0 0 2px #78b2c3; }
.battle-screen .hero-data b { color:#fff8dc; font-size:11px; text-shadow:1px 1px 0 #000; }
.battle-screen .hero-hp { height:9px; border:2px solid #140d0a; border-radius:6px; overflow:hidden; }
.battle-screen .hero-hp span { background:linear-gradient(#8fff82,#35b650); }
.battle-screen .hero-stat { padding:4px 3px; background:rgba(10,7,8,.48); border-radius:7px; font-size:7px; }

.emoji-battlefield { min-height:310px; padding:16px 12px 12px; overflow:visible; background:
  radial-gradient(circle at 12% 17%,rgba(255,188,102,.23) 0 3px,transparent 4px),
  radial-gradient(circle at 86% 75%,rgba(215,255,121,.2) 0 4px,transparent 5px),
  linear-gradient(180deg,#873c32 0%,#652c2b 42%,#e6b348 42.5%,#fff099 44%,#a8db56 45.5%,#4c7c3d 100%);
  border:9px solid #3b2316; border-radius:17px; box-shadow:inset 0 0 0 3px #9a6439,inset 0 0 45px rgba(24,10,7,.45),5px 6px 0 #08050a; }
.emoji-battlefield::before { z-index:0; top:0; opacity:.65; background:
  linear-gradient(155deg,transparent 0 47%,rgba(46,18,19,.22) 48% 49%,transparent 50%) 0 0/70px 52px,
  linear-gradient(25deg,transparent 0 47%,rgba(29,55,23,.2) 48% 49%,transparent 50%) 0 100%/86px 58px; }
.emoji-battlefield::after { content:""; z-index:0; top:42%; height:15%; background:linear-gradient(90deg,#6e3e21 0 7%,transparent 8% 92%,#6e3e21 93%); opacity:.5; }
.arena-crowd { z-index:1; top:3px; color:#321b24; text-shadow:0 4px 0 #b0614e; opacity:.7; }
.pixel-cloud { display:none; }
.arena-row { z-index:3; min-height:104px; gap:14px; align-items:center; }
.enemy-row { margin-bottom:2px; }
.player-row { margin-top:2px; }
.arena-mid { z-index:4; height:52px; }
.arena-mid::before,.arena-mid::after { left:1%; right:1%; height:4px; background:repeating-linear-gradient(90deg,#fff4a8 0 15px,#ee9f3b 15px 22px); box-shadow:0 0 10px #ffffad,0 4px 0 rgba(83,36,18,.5); }
.arena-mid span { width:34px; height:34px; color:#fff5c4; background:linear-gradient(145deg,#573a2b,#211821); border-color:#e9bd62; box-shadow:0 0 10px rgba(255,229,120,.55); }
.arena-cell { height:102px; }
.arena-cell.drop-cell { border:3px solid rgba(70,30,24,.24); border-radius:46% 46% 18px 18px / 39% 39% 18px 18px; background:rgba(40,16,20,.08); box-shadow:inset 0 0 0 2px rgba(255,255,255,.06); }
.player-row .arena-cell.drop-cell { border-color:rgba(35,78,28,.34); background:rgba(35,90,25,.08); }
.arena-cell.drop-cell::before { content:"⚔"; position:absolute; top:35%; color:rgba(255,255,255,.16); font-size:22px; }
.arena-cell.drop-cell > span { position:absolute; bottom:8px; color:rgba(255,255,255,.2); }
.field-grass { display:none; }

.end-turn-float { position:absolute; z-index:9; right:-5px; width:76px; min-height:46px; padding:6px 6px 5px; color:#2d2109; background:linear-gradient(#fff477,#e4bb28); border:3px solid #2a1908; border-radius:22px 6px 6px 22px; box-shadow:inset 0 0 0 2px #fff7b5,3px 4px 0 rgba(35,16,8,.55); font-family:"Press Start 2P"; cursor:pointer; }
.end-turn-float b { display:block; font-size:10px; }
.end-turn-float small { display:block; margin-top:4px; font-family:"Russo One"; font-size:8px; text-transform:uppercase; }
.end-turn-float:disabled { color:#9b8d70; background:#5d584b; filter:grayscale(1); }
.end-turn-float:not(:disabled) { animation:end-ready 1s steps(2) infinite; }
@keyframes end-ready { 50%{filter:brightness(1.2);box-shadow:inset 0 0 0 2px #fff7b5,0 0 13px #fff05c,3px 4px 0 rgba(35,16,8,.55)} }

.arena-fighter { height:101px; }
.fighter-portrait { width:75px; height:70px; padding-bottom:9px; border-radius:48% 48% 14px 14px / 40% 40% 18px 18px; background:radial-gradient(circle at 50% 34%,#657a86 0 42%,#32424d 44% 68%,#17141b 70%); border:4px solid #20140d; box-shadow:inset 0 0 0 2px #9caab2,inset 0 -8px 0 rgba(17,13,18,.3),0 6px 0 rgba(0,0,0,.3); font-size:47px; }
.enemy-row .fighter-portrait { background:radial-gradient(circle at 50% 34%,#9b665a 0 42%,#5b3435 44% 68%,#17141b 70%); box-shadow:inset 0 0 0 2px #c89478,inset 0 -8px 0 rgba(17,13,18,.3),0 6px 0 rgba(0,0,0,.3); }
.fighter-name { bottom:19px; min-width:68px; padding:4px 5px; background:linear-gradient(#51432d,#241b16); border:2px solid #140c08; border-radius:8px; text-align:center; }
.fighter-badges span { width:37px; height:29px; border-radius:50%; background:radial-gradient(circle,#29323e,#0a0a10 72%); border:3px solid #17110d; box-shadow:inset 0 0 0 1px #6e7784,2px 2px 0 rgba(0,0,0,.5); }
.fighter-badges .attack-badge { background:radial-gradient(circle,#5f502b,#17130b 72%); }
.fighter-badges .health-badge { background:radial-gradient(circle,#692e3d,#180a0e 72%); }

.battle-screen .hand-head { margin:8px 2px 2px; }
.hand-three { position:relative; z-index:4; height:170px; display:flex; justify-content:center; gap:6px; align-items:flex-start; padding:5px 4px 0; perspective:700px; }
.hand-three .hearth-card { position:relative; height:158px; padding:0; overflow:visible; color:#fff; background:linear-gradient(145deg,#65533e,#2c251e 70%); border:4px solid #17110c; border-radius:18px 18px 10px 10px; box-shadow:inset 0 0 0 2px var(--rarityAccent),4px 5px 0 rgba(0,0,0,.52); transform-origin:center 125%; }
.hand-three .hearth-card { flex:0 0 calc((100% - 12px)/3); max-width:122px; }
.hand-three .hearth-card:nth-child(1) { transform:rotate(-3deg) translateY(7px); }
.hand-three .hearth-card:nth-child(2) { transform:translateY(0); }
.hand-three .hearth-card:nth-child(3) { transform:rotate(3deg) translateY(7px); }
.hand-three .hearth-card.selected { transform:translateY(-10px) scale(1.04); outline:none; box-shadow:0 0 0 3px var(--yellow),0 0 16px var(--yellow),4px 5px 0 rgba(0,0,0,.52); }
.hand-three .hearth-card.dragging { z-index:90; }
.hearth-card .hand-cost { z-index:8; top:-7px; left:-7px; width:34px; height:34px; display:grid; place-items:center; color:#fff; background:radial-gradient(circle at 35% 30%,#9af7ff,#168bb7 54%,#083e66 70%); border:3px solid #17110d; border-radius:50%; box-shadow:inset 0 0 0 2px #c9fbff,2px 3px 0 rgba(0,0,0,.5); text-shadow:1px 2px 0 #082337; }
.hearth-card .hand-cost .ui-icon { position:absolute; width:25px; height:25px; opacity:.2; }
.hearth-card .hand-cost b { position:relative; font-size:11px; }
.hearth-card .hand-art { position:absolute; z-index:1; left:7px; right:7px; top:8px; height:75px; display:grid; place-items:center; overflow:hidden; border-radius:44% 44% 9px 9px; background:radial-gradient(circle at 50% 38%,color-mix(in srgb,var(--rarityAccent) 30%,#65798a),#20202c 72%); border:3px solid #17110d; box-shadow:inset 0 0 0 2px rgba(255,255,255,.16); }
.hearth-card .hand-emoji { height:auto; padding:0; font-size:52px; filter:drop-shadow(3px 4px 0 rgba(0,0,0,.48)); }
.hearth-card .hand-name { position:absolute; z-index:4; top:75px; left:5px; right:5px; padding:5px 2px; color:#fff; background:linear-gradient(#5a4933,#281f18); border:2px solid #160f0a; border-radius:7px; text-align:center; text-shadow:1px 2px 0 #000; }
.hearth-card .hand-stats { position:absolute; z-index:7; left:-4px; right:-4px; bottom:-5px; display:flex; justify-content:space-between; padding:0; background:none; border:0; }
.hearth-card .hand-stats i { width:34px; height:31px; display:flex; align-items:center; justify-content:center; gap:2px; color:#fff; background:radial-gradient(circle,#51472a,#15120a 70%); border:3px solid #17110d; border-radius:50%; box-shadow:inset 0 0 0 1px #b39a55,2px 2px 0 rgba(0,0,0,.5); font-style:normal; }
.hearth-card .hand-stats i:last-child { background:radial-gradient(circle,#7a3041,#1b090e 70%); box-shadow:inset 0 0 0 1px #be6374,2px 2px 0 rgba(0,0,0,.5); }
.hearth-card .ability { position:absolute; z-index:3; left:8px; right:8px; top:101px; height:42px; margin:0; padding:5px 4px; overflow:hidden; color:#342d24; background:linear-gradient(#eee3c8,#cdbf9f); border:2px solid #17110d; font-size:7px; line-height:1.18; text-align:left; }
.hearth-card .active-effect strong { color:#5b238a; }
.hearth-card .active-effect span,
.mechanic-box { font-weight:400; }
.hearth-card .active-effect strong,
.mechanic-box b { font-weight:900; }
.hearth-card .flavor-text { display:flex; align-items:center; justify-content:center; color:#817662; font-style:italic; text-align:center; }
.hand-three .hearth-card:disabled { opacity:.64; filter:grayscale(.68) brightness(.78); }

.unit-tooltip .ability { min-height:0; margin:5px 0 0; padding:0; color:#d9d4eb; background:none; border:0; font-size:9px; line-height:1.35; }
.unit-tooltip .active-effect strong { color:var(--yellow); }
.unit-tooltip .flavor-text { color:#817b98; font-style:italic; }
.battle-screen .battle-log { display:none !important; }

@media(max-width:370px){
  .emoji-battlefield{min-height:294px;padding-inline:8px}.arena-row{gap:7px}.fighter-portrait{width:68px;height:65px;font-size:42px}.end-turn-float{right:-7px;width:66px}.hand-three{height:163px;padding-inline:1px}.hand-three .hearth-card{height:151px}.hearth-card .hand-art{height:69px}.hearth-card .hand-name{top:69px}.hearth-card .ability{top:95px;height:42px;font-size:6.5px}
}

/* V5 — simultaneous rounds, collection cards and mobile drag interactions */
.gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; align-items:start; }
.gallery-card { position:relative; height:254px; padding:0; overflow:visible; color:#fff; background:linear-gradient(145deg,#65533e,#2c251e 70%); border:5px solid #17110c; border-radius:22px 22px 12px 12px; box-shadow:inset 0 0 0 3px var(--rarityAccent),5px 6px 0 rgba(0,0,0,.55); cursor:pointer; }
.gallery-card.deck-selected { border-color:#3a2504; box-shadow:inset 0 0 0 4px #ffe451,0 0 0 4px #ffbb16,0 0 19px rgba(255,216,55,.85),5px 7px 0 rgba(0,0,0,.55); }
.gallery-card .hand-art { top:15px; height:122px; }
.gallery-card .hand-emoji { font-size:78px; }
.gallery-card .hand-name { top:127px; padding:8px 4px; font-size:12px; }
.gallery-card .ability { top:164px; height:66px; padding:8px 6px; font-size:8px; line-height:1.3; }
.gallery-card .hand-stats { bottom:-8px; }
.gallery-card .hand-stats i { width:42px; height:38px; font-size:11px; }
.gallery-card .gallery-rarity { position:absolute; z-index:9; top:5px; right:7px; padding:4px 5px; color:#fff; background:rgba(13,10,15,.76); border:1px solid var(--rarityAccent); border-radius:5px; font-family:"Press Start 2P"; font-size:6px; text-transform:uppercase; }
.gallery-card .card-level { position:absolute; z-index:10; top:7px; left:51px; padding:3px 4px; color:#fff4ae; background:#17131f; border:1px solid #756431; border-radius:4px; font-family:"Press Start 2P"; font-size:5px; }
.gallery-card .deck-check { position:absolute; z-index:12; top:-10px; right:-10px; width:34px; height:34px; display:grid; place-items:center; color:#241900; background:#ffe34f; border:4px solid #241700; box-shadow:2px 3px 0 rgba(0,0,0,.45); font-size:20px; }
.gallery-card .gallery-rarity + .deck-check { top:30px; }

.deck-strip.deck-eight { position:relative; z-index:20; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; overflow:visible; }
.deck-mini { appearance:none; width:100%; height:72px; padding:0; color:inherit; cursor:pointer; }
.deck-mini > b { font-size:37px; line-height:1; }
.deck-mini:hover { z-index:50; border-color:#ffe451; }
.deck-popover { position:absolute; z-index:200; left:50%; bottom:calc(100% + 8px); width:154px; opacity:0; visibility:hidden; transform:translate(-50%,8px) scale(.86); transform-origin:bottom center; transition:.14s; pointer-events:none; }
.deck-mini:nth-child(-n+3) .deck-popover { top:calc(100% + 8px); bottom:auto; transform-origin:top center; }
.deck-mini:hover .deck-popover,.deck-mini:focus .deck-popover { opacity:1; visibility:visible; transform:translate(-50%,0) scale(.86); }
.deck-popover .gallery-card { width:178px; height:254px; margin-left:-12px; }
.deck-popover .deck-check { display:none; }

.battle-screen .hero-bar { grid-template-columns:42px minmax(0,1fr) auto auto; overflow:visible; }
.battle-screen .hero-avatar { position:relative; font-size:22px; }
.hero-heart { position:absolute; right:-9px; bottom:-8px; min-width:29px; height:26px; display:flex; align-items:center; justify-content:center; gap:1px; color:#fff; background:radial-gradient(circle,#d64b63,#671829 72%); border:3px solid #24100e; border-radius:50%; box-shadow:inset 0 0 0 1px #ff98aa,2px 2px 0 rgba(0,0,0,.5); font-family:"Press Start 2P"; font-size:9px; }
.hero-heart .ui-icon { width:13px; height:13px; }
.battle-screen .hero-data small { display:block; margin-top:3px; color:#d7c5a7; font-size:7px; }
.battle-screen .hero-bar:not(.enemy) .hero-data small { color:#b8dbe8; }
.battle-screen .hero-hp,.battle-screen .hero-stat.health { display:none; }

.arena-row { z-index:10; }
.arena-mid { z-index:1; grid-template-columns:1fr 44px 1fr; }
.arena-mid::before,.arena-mid::after { z-index:0; }
.arena-mid > * { z-index:2; }
.arena-mid > span { display:none; }
.arena-cell.drop-cell::before,.arena-cell.drop-cell > span { display:none !important; content:none; }
.unit-tooltip { z-index:220; }
.arena-fighter .unit-tooltip { z-index:220; }
.fighter-badges { left:50%; right:auto; width:76px; transform:translateX(-50%); justify-content:center; gap:1px; }
.fighter-badges span { flex:0 0 37px; }
.end-turn-float { right:-5px; }
.end-turn-ghost { position:absolute; z-index:2; left:-5px; width:76px; min-height:46px; background:linear-gradient(#706d68,#45433f); border:3px solid #231d17; border-radius:6px 22px 22px 6px; box-shadow:inset 0 0 0 2px #96918a,3px 4px 0 rgba(35,16,8,.55); pointer-events:none; }
.end-turn-float:not(:disabled) { animation:none; }
.end-turn-float.ready-pulse { animation:end-ready 1s steps(2) infinite; }

.sell-portal { position:relative; width:40px; height:40px; display:grid; place-items:center; color:#8cf5ff; background:radial-gradient(circle,#512f78 0 23%,#1c1330 25% 58%,#090713 60%); border:3px solid #e6bc58; border-radius:50%; box-shadow:inset 0 0 8px #9b65ff,0 0 8px rgba(117,211,255,.6); font-family:"Press Start 2P"; }
.sell-portal span { font-size:17px; animation:portal-spin 2.4s linear infinite; }
.sell-portal b { position:absolute; right:-16px; top:-8px; padding:3px; color:#241b08; background:#ffe75b; border:2px solid #2b1b08; font-size:7px; }
body:has(.dragging) .sell-portal { transform:scale(1.12); box-shadow:inset 0 0 12px #b47cff,0 0 16px #7befff; }
.sell-portal.portal-pop { animation:portal-pop .42s steps(4); }
.energy-pop { position:absolute; z-index:40; left:50%; top:-8px; color:#ffe85e; font-family:"Press Start 2P"; font-size:12px; font-style:normal; animation:energy-rise .75s forwards; }
@keyframes portal-spin { to{transform:rotate(360deg)} }
@keyframes portal-pop { 50%{transform:scale(1.35);filter:brightness(1.7)} }
@keyframes energy-rise { to{transform:translate(-50%,-35px);opacity:0} }

.golden-unit .fighter-portrait,.golden-card { box-shadow:inset 0 0 0 3px #fff1a2,0 0 13px #ffd33d,4px 5px 0 rgba(0,0,0,.52) !important; border-color:#6c4205 !important; }
.merge-born { animation:merge-born .7s steps(6); }
@keyframes merge-born { 0%{transform:scale(.2) rotate(-18deg);filter:brightness(4)} 55%{transform:scale(1.25);filter:brightness(2)} 100%{transform:scale(1);filter:none} }
.hand-three { justify-content:flex-start; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
.hand-three::-webkit-scrollbar { display:none; }
.hand-three .hearth-card { flex:0 0 min(31%,118px); }
.hand-three .hearth-card.unaffordable { opacity:.64; filter:grayscale(.65) brightness(.8); }

@media(max-width:370px){
  .gallery-grid{gap:10px}.gallery-card{height:236px}.gallery-card .hand-art{height:110px}.gallery-card .hand-name{top:115px}.gallery-card .ability{top:151px;height:61px}.gallery-card .hand-emoji{font-size:67px}.deck-mini{height:65px}.fighter-badges{width:70px}.fighter-badges span{flex-basis:34px}.end-turn-ghost,.end-turn-float{width:65px}
}

/* V6 — compact three-column collection and hidden simultaneous planning */
.booster-reveal { background:radial-gradient(circle at 50% 43%,color-mix(in srgb,var(--reveal) 25%,#151025) 0 18%,#0b0817 58%,#07050e 100%); }
.booster-reveal .reveal-content { width:min(190px,62vw); }
.booster-reveal .gallery-card { width:100%; height:276px; }
.booster-reveal .gallery-card .hand-art { height:132px; }
.booster-reveal .gallery-card .hand-name { top:137px; }
.booster-reveal .gallery-card .ability { top:174px; height:74px; }
.booster-reveal .gallery-card .hand-emoji { font-size:82px; }
.booster-reveal .pixel-btn { width:calc(100% + 32px); margin-left:-16px; }

.screen-collection { overflow:visible; }
.deck-dock { position:sticky; z-index:180; top:0; margin:10px -10px 14px; padding:8px 10px 10px; background:linear-gradient(180deg,#211c3c 0%,#19162f 88%,rgba(25,22,47,.94)); border-block:2px solid #080711; box-shadow:0 7px 13px rgba(4,3,10,.48); }
.deck-dock .deck-builder-head { margin:0 0 7px; }
.deck-dock .deck-strip.deck-eight { display:grid; grid-template-columns:repeat(8,minmax(38px,1fr)); gap:4px; }
.deck-dock .deck-mini { height:52px; min-width:0; }
.deck-dock .deck-mini > b { font-size:27px; }
.deck-dock .deck-mini > span { font-size:6px; }
.deck-dock .deck-popover { bottom:auto; top:calc(100% + 7px); }

.gallery-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:11px 8px; padding:2px 2px 42px; }
.gallery-card { height:211px; border-width:4px; border-radius:16px 16px 9px 9px; box-shadow:inset 0 0 0 2px var(--rarityAccent),3px 4px 0 rgba(0,0,0,.55); }
.gallery-card.deck-selected { outline:4px solid #ffd83d; outline-offset:1px; border-color:#17110c; box-shadow:inset 0 0 0 2px var(--rarityAccent),3px 4px 0 rgba(0,0,0,.55); }
.gallery-card .hand-art { top:8px; left:5px; right:5px; height:93px; border-radius:36% 36% 4px 4px; }
.gallery-card .hand-emoji { font-size:57px; }
.gallery-card .hand-name { top:101px; left:4px; right:4px; min-height:32px; margin:0; padding:7px 2px 5px; display:flex; align-items:center; justify-content:center; font-size:clamp(8px,2.45vw,11px); line-height:1; }
.gallery-card .ability { top:133px; left:5px; right:5px; height:55px; margin:0; padding:6px 6px 15px; font-size:7px; line-height:1.18; }
.gallery-card .ability.text-short { font-size:8px; }
.gallery-card .ability.text-medium { font-size:7px; }
.gallery-card .ability.text-long { font-size:6.2px; line-height:1.12; }
.gallery-card .gallery-rarity { top:auto; right:50%; bottom:1px; padding:2px 4px; transform:translateX(50%); color:#bdb5a6; background:#27201a; border-color:#655b50; font-size:4.5px; opacity:.85; }
.gallery-card .deck-check,.gallery-card .gallery-rarity + .deck-check { top:-8px; right:-8px; width:29px; height:29px; font-size:17px; }
.gallery-card .hand-cost { top:-7px; left:-7px; transform:scale(.82); transform-origin:top left; }
.gallery-card .hand-stats { bottom:-7px; }
.gallery-card .hand-stats i { width:34px; height:31px; font-size:8px; }

.battle-screen { position:relative; overflow:visible; }
.battle-screen .hero-bar { min-height:58px; grid-template-columns:minmax(0,1fr) 56px 92px; gap:9px; padding:6px 10px; border-radius:12px; }
.battle-screen .hero-data { text-align:left; }
.battle-screen .hero-data b { margin:0; font-size:10px; }
.battle-screen .hero-avatar { width:52px; height:52px; margin:-6px auto; font-size:30px; border-width:3px; }
.hero-heart { right:-7px; bottom:-5px; min-width:26px; height:23px; border-width:2px; font-size:8px; }
.hero-heart .ui-icon { width:11px; height:11px; }
.battle-screen .hero-stat.mana { min-height:42px; padding:5px 6px; display:flex; flex-direction:column; justify-content:center; gap:4px; color:#8ff4ff; background:linear-gradient(#183e54,#0d2434); border:2px solid #06131d; box-shadow:inset 0 0 0 1px #5799b4; }
.battle-screen .hero-stat.mana span { color:#9dc1ce; font-size:5px; }
.battle-screen .hero-stat.mana b { display:flex; align-items:center; gap:3px; font-size:12px; }
.battle-screen .hero-stat.mana .ui-icon { width:17px; height:17px; }
.battle-screen .hero-stat.deck-count { display:none !important; }

.emoji-battlefield { z-index:10; }
.arena-row { z-index:20; }
.arena-mid { z-index:15; }
.unit-tooltip,.arena-fighter .unit-tooltip { z-index:320; }
.enemy-row .unit-tooltip { top:auto; bottom:calc(100% + 7px); }
.enemy-row .unit-tooltip::after { top:auto; bottom:-7px; transform:translateX(-50%) rotate(45deg); }
.unit-tooltip .ability { margin:0; }
.unit-tooltip .ability strong { font-size:9px; }

.end-turn-ghost { display:grid; place-items:center; color:#c5c0b8; }
.end-turn-ghost b { font-family:"Press Start 2P"; font-size:7px; }
.turn-sell { display:none; }
body:has(.dragging) .end-turn-float { color:#fff; background:linear-gradient(#ff705e,#b92d36); box-shadow:inset 0 0 0 2px #ffaca0,0 0 17px rgba(255,65,74,.75),3px 4px 0 rgba(35,16,8,.55); animation:none; }
body:has(.dragging) .end-turn-float .turn-normal { display:none; }
body:has(.dragging) .end-turn-float .turn-sell { display:block; }
.turn-sell small { display:flex; align-items:center; justify-content:center; gap:3px; }
.turn-sell .ui-icon { width:11px; height:11px; }
.end-turn-float.sale-pop { animation:sale-button-pop .45s steps(4); }
@keyframes sale-button-pop { 50%{transform:scale(1.2);filter:brightness(1.7)} }

.arena-cell.active-drop { transition:.12s; }
body:has(.hand-card.dragging) .arena-cell.active-drop { z-index:35; border-color:#8fffff !important; background:rgba(86,240,255,.24) !important; box-shadow:inset 0 0 0 2px #d5ffff,0 0 18px #58eaff; animation:slot-pulse .65s steps(2) infinite; }
.hand-three { position:relative; z-index:80; height:186px; display:block; padding:7px 0 0; overflow:visible; perspective:none; }
.hand-three .hearth-card { position:absolute; z-index:var(--fan-z); left:50%; width:112px; max-width:none; height:158px; flex:none; transform:translateX(calc(-50% + var(--fan-x))) translateY(var(--fan-y)) rotate(var(--fan-r)); transform-origin:center 92%; transition:transform .18s,filter .15s; }
.hand-three .hearth-card:nth-child(n) { transform:translateX(calc(-50% + var(--fan-x))) translateY(var(--fan-y)) rotate(var(--fan-r)); }
.hand-three .hearth-card.selected { box-shadow:0 0 0 3px var(--yellow),0 0 14px var(--yellow),4px 5px 0 rgba(0,0,0,.52); filter:brightness(1.08); }
.hand-three .hearth-card.held,.hand-three .hearth-card.dragging { z-index:600 !important; transform:translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 34px)) rotate(0deg) scale(1.2) !important; opacity:1; filter:none; }
.arena-cell.held,.arena-cell.dragging { z-index:600 !important; }
.hand-three .hearth-card .hand-name { font-size:10px; line-height:1; }
.hand-three .hearth-card .ability.text-short { font-size:8px; }
.hand-three .hearth-card .ability.text-medium { font-size:7px; }
.hand-three .hearth-card .ability.text-long { font-size:6.2px; line-height:1.08; }
.hand-three .hearth-card .ability { padding:5px 8px 14px; }

.enemy-curtain { position:absolute; z-index:120; left:0; right:0; top:0; height:43%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:13px; overflow:hidden; color:#d9d3c6; background:repeating-linear-gradient(0deg,#383842 0 10px,#4a4b55 10px 13px,#20212a 13px 17px); border-bottom:6px solid #161219; box-shadow:inset 0 0 0 4px #24232b,0 8px 13px rgba(0,0,0,.55); }
.enemy-curtain::before,.enemy-curtain::after { content:""; position:absolute; top:0; bottom:0; width:10px; background:repeating-linear-gradient(0deg,#ad8240 0 9px,#422c18 9px 13px); }
.enemy-curtain::before { left:9px; }.enemy-curtain::after { right:9px; }
.enemy-curtain span { font-family:"Press Start 2P"; font-size:7px; text-shadow:2px 2px 0 #111; }
.enemy-curtain i { color:#9e9ca4; font-style:normal; letter-spacing:9px; }
.enemy-curtain.opening { animation:curtain-open .7s cubic-bezier(.7,0,.35,1) forwards; }
@keyframes curtain-open { to{transform:translateY(-108%);filter:brightness(1.4)} }
.round-banner { position:absolute; z-index:180; inset:0; display:grid; place-items:center; color:#fff6b8; background:rgba(12,8,18,.36); font-family:"Press Start 2P"; font-size:22px; text-shadow:4px 4px 0 #17101a,0 0 18px #ffd452; pointer-events:none; animation:round-title 1s both; }
@keyframes round-title { 0%{opacity:0;transform:scale(.35)} 22%,72%{opacity:1;transform:scale(1)} 100%{opacity:0;transform:scale(1.35)} }

.arena-fighter.impact { animation:unit-hit .28s steps(3); }
.arena-fighter.target-flash .fighter-portrait { animation:target-flash .34s steps(2); }
.arena-fighter.dying { animation:unit-death-card .52s cubic-bezier(.2,.8,.25,1) forwards; }
.hero-bar.hero-smash { animation:hero-smash .7s steps(6); }
.hero-damage-pop { position:absolute; z-index:400; left:50%; top:50%; color:#ff314e; font-family:"Press Start 2P"; font-size:44px; text-shadow:4px 4px 0 #2b0710,0 0 16px #ff8a2f; pointer-events:none; animation:hero-damage .7s ease-out forwards; }
@keyframes hero-smash { 0%,100%{transform:none} 15%{transform:translateX(10px) scale(1.04);filter:brightness(2)} 28%{transform:translateX(-9px) rotate(-2deg)} 42%{transform:translateX(7px) rotate(2deg)} 58%{transform:translateX(-5px)} }
@keyframes hero-damage { 0%{opacity:0;transform:translate(-50%,-20%) scale(.3)} 25%{opacity:1;transform:translate(-50%,-70%) scale(1.45)} 100%{opacity:0;transform:translate(-50%,-150%) scale(.9)} }

/* V9 — polish pass: closer to the older compact pixel lobby */
.app-shell {
  padding: max(18px, var(--safe-top)) 14px calc(104px + var(--safe-bottom));
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg,#332753 0%,#2b234b 45%,#19172f 100%);
  background-size: 3px 3px, 3px 3px, auto;
}
.topbar {
  min-height: 54px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.topbar .wallet { gap: 18px; }
.topbar .stat-chip {
  min-width: 118px;
  min-height: 46px;
  padding: 9px 12px;
  justify-content: center;
  color: #fff6cf;
  background: #3a315f;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  font-size: 17px;
  line-height: 1;
}
.settings-btn {
  width: 40px;
  height: 40px;
  font-size: 34px;
  filter: drop-shadow(2px 2px 0 #080711);
}

.ui-panel,
.league-panel {
  margin: 14px 5px 18px;
  padding: 15px 16px;
  background: linear-gradient(145deg,#403374 0%,#282347 72%);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--line);
}
.profile-main { grid-template-columns: minmax(0,1fr) 128px; }
.profile-copy h2,
.panel-heading h2,
.league-row h2 {
  color: #fff5c7;
  text-shadow: 4px 4px 0 #080711;
  letter-spacing: 0;
}
.profile-copy h2 { font-size: clamp(34px,8vw,46px); }
.panel-heading h2 { font-size: clamp(28px,7vw,39px); }
.league-row h2 { font-size: clamp(19px,4.8vw,27px); }
.profile-status,
.panel-heading span {
  margin: 6px 0 13px;
  color: #23eaff;
  font-size: 9px;
}
.profile-avatar {
  width: 128px;
  height: 128px;
  font-size: 98px;
  filter: drop-shadow(6px 7px 0 rgba(0,0,0,.45));
}
.pixel-btn.compact {
  width: min(100%, 210px);
  min-height: 44px;
  padding-block: 10px;
  color: #c4b4d7;
  background: #2a2340;
}

.deck-choice-row,
.deck-tabs {
  gap: 9px;
  margin: 12px 0;
}
.deck-tile {
  flex-basis: 96px;
  min-height: 102px;
  padding: 7px 5px;
  border-width: 3px;
  box-shadow: 4px 4px 0 var(--line);
}
.deck-tile.active,
.deck-tile.editing {
  outline: 3px solid #fff143;
  outline-offset: 0;
}
.deck-tile span { font-size: 39px; }
.deck-tile b {
  margin-top: 4px;
  font-size: 13px;
}
.deck-tile small {
  margin-top: 6px;
  font-size: 10px;
}
.battle-deck-panel .deck-strip.deck-eight {
  gap: 7px;
  margin-top: 10px;
}
.battle-deck-panel .deck-mini {
  height: 60px;
  border-width: 2px;
  box-shadow: 3px 3px 0 var(--line);
}
.battle-deck-panel .deck-mini > b { font-size: 32px; }

.league-panel {
  background: #292340;
  box-shadow: 5px 5px 0 rgba(8,7,17,.72);
}
.league-icon { font-size: 39px; }
.league-progress {
  height: 34px;
  margin: 14px 0 18px;
  border-width: 3px;
  background: #38343e;
}
.league-progress span { background: linear-gradient(90deg,#45c900,#62e51f); }
.league-progress b { font-size: 12px; }
.league-progress i {
  right: -9px;
  top: -11px;
  font-size: 38px;
}
.fight-btn {
  min-height: 82px;
  border: 4px solid #8d6232;
  box-shadow: inset 0 0 0 2px rgba(255,245,178,.55),4px 4px 0 var(--line);
  font-size: 23px;
  text-shadow: 2px 2px 0 rgba(255,255,255,.55);
}

.bottom-nav {
  min-height: calc(88px + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left);
  background: #211936;
  border-top: 3px solid var(--line);
}
.nav-btn {
  min-height: 88px;
  color: #fff;
  background: transparent;
  border: 3px solid transparent;
}
.nav-btn.active {
  margin-top: -18px;
  min-height: 106px;
  background: #5a3e86;
  border-color: var(--line);
  box-shadow: 0 -1px 0 #6f55a0, inset 0 0 0 1px rgba(255,255,255,.07);
}
.nav-icon {
  margin-bottom: 6px;
  font-size: 33px;
}
.nav-label {
  font-size: 9px;
  line-height: 1.15;
}

.shop-spacer { height: min(34vh,360px); }
.shop-grid {
  gap: 13px;
  margin: 0 5px 112px;
}
.shop-offer {
  min-height: 292px;
  border-width: 3px;
  box-shadow: 5px 5px 0 var(--line);
  background: linear-gradient(145deg,#493a80,#262246 70%);
}
.shop-offer .pack-art { font-size: 82px; }
.shop-price {
  border-top-width: 3px;
  font-size: 20px;
}

.collection-sticky {
  top: 0;
  margin: -4px -8px 13px;
  padding: 8px;
  background: linear-gradient(180deg,#2a2349 0%,#1c1834 92%,rgba(28,24,52,.96));
  border-bottom: 3px solid var(--line);
}
.collection-sticky .deck-tile {
  flex-basis: 86px;
  min-height: 78px;
}
.collection-sticky .deck-tile span { font-size: 28px; }
.collection-sticky .deck-tile b { font-size: 10px; }
.collection-sticky .deck-tile small { font-size: 8px; }
.collection-counter,
.deck-editor {
  border-width: 3px;
  background: #241f3c;
}
.collection-counter {
  padding: 8px 10px;
  box-shadow: 3px 3px 0 rgba(8,7,17,.65);
}
.filter-row {
  gap: 8px;
  margin: 13px 0 8px;
}
.filter-btn {
  padding: 9px 11px;
  background: #2a2543;
  border-width: 2px;
  box-shadow: 2px 2px 0 rgba(8,7,17,.65);
}
.filter-btn.active {
  color: #1d1830;
  background: #ffd84d;
}
.deck-editor { padding: 8px; }
.deck-editor input,
.profile-panel input {
  height: 36px;
  border-width: 3px;
}
.done-btn {
  height: 42px;
  border-width: 3px;
}
.delete-deck {
  border-width: 3px;
  font-size: 11px;
}

.card-view-panel {
  border-width: 3px;
  box-shadow: 6px 6px 0 var(--line);
}

@media(max-width:370px){
  .app-shell { padding-inline: 11px; }
  .topbar .wallet { gap: 8px; }
  .topbar .stat-chip {
    min-width: 98px;
    min-height: 42px;
    font-size: 14px;
  }
  .profile-main { grid-template-columns: minmax(0,1fr) 104px; }
  .profile-avatar {
    width: 104px;
    height: 104px;
    font-size: 80px;
  }
  .profile-copy h2 { font-size: 28px; }
  .ui-panel,
  .league-panel {
    margin-inline: 1px;
    padding: 12px;
  }
  .deck-tile { flex-basis: 86px; }
  .shop-offer { min-height: 268px; }
  .nav-icon { font-size: 38px; }
  .nav-label { font-size: 9px; }
}

@media(max-width:370px){
  .gallery-grid{gap:9px 6px}.gallery-card{height:198px}.gallery-card .hand-art{height:86px}.gallery-card .hand-emoji{font-size:51px}.gallery-card .hand-name{top:94px;min-height:30px;font-size:8px}.gallery-card .ability{top:124px;height:51px;padding:5px 4px}.deck-dock{margin-inline:-7px;padding-inline:7px}.deck-dock .deck-strip.deck-eight{gap:3px}.deck-dock .deck-mini{height:48px}.deck-dock .deck-mini> b{font-size:24px}.battle-screen .hero-bar{grid-template-columns:minmax(0,1fr) 52px 82px}.battle-screen .hero-stat.mana b{font-size:10px}.hand-three .hearth-card{width:106px}.end-turn-ghost,.end-turn-float{width:68px}
}

/* V8 — three-tab lobby, deck editor and shop layout */
.topbar { min-height: 76px; align-items: flex-start; margin-bottom: 14px; }
.topbar .wallet { gap: 22px; }
.topbar .stat-chip {
  min-width: 118px;
  min-height: 52px;
  justify-content: center;
  padding: 11px 13px;
  color: #fff8d7;
  background: #332d55;
  border: 4px solid #080711;
  box-shadow: 5px 5px 0 #080711;
  font-size: 17px;
  text-shadow: 2px 2px 0 #000;
}
.settings-btn {
  width: 43px;
  height: 43px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 0;
  font-size: 36px;
  filter: drop-shadow(2px 3px 0 #080711);
}

.bottom-nav {
  min-height: calc(100px + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left);
  background: #211936;
  border-top: 3px solid #080711;
}
.nav-btn {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100px;
  color: #fff;
  border: 3px solid transparent;
}
.nav-btn.active {
  color: #fff;
  background: #5a3c86;
  border-color: #080711;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.nav-icon { font-size: 39px; filter: none; }
.nav-label { font-size: 11px; text-shadow: 2px 2px 0 #000; }

.ui-panel,
.league-panel {
  margin: 16px 6px 22px;
  padding: 18px;
  background: linear-gradient(145deg,#3f3273,#211d43);
  border: 4px solid #080711;
  box-shadow: 6px 6px 0 #080711;
}
.profile-main {
  display: grid;
  grid-template-columns: minmax(0,1fr) 142px;
  gap: 10px;
  align-items: center;
}
.profile-copy h2,
.panel-heading h2,
.league-row h2 {
  margin: 0;
  color: #fff7c7;
  font-size: clamp(28px,7vw,43px);
  line-height: .95;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #000;
}
.profile-status,
.panel-heading span {
  display: block;
  margin: 7px 0 14px;
  color: #21efff;
  font-family: "Press Start 2P";
  font-size: 10px;
  line-height: 1.35;
  text-transform: uppercase;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 112px;
  filter: drop-shadow(7px 8px 0 rgba(0,0,0,.45));
}
.pixel-btn.compact {
  width: min(100%, 236px);
  min-height: 48px;
  color: #bba7cf;
  background: #28213c;
}
.profile-panel label,
.deck-editor label {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  color: #21efff;
  font-family: "Press Start 2P";
  font-size: 7px;
}
.profile-panel input,
.deck-editor input {
  min-width: 0;
  height: 38px;
  padding: 8px;
  color: #fff7d0;
  background: #17152c;
  border: 3px solid #080711;
  font-family: "Russo One";
  font-size: 17px;
}
.avatar-picker {
  display: flex;
  gap: 7px;
}
.avatar-picker button,
.avatar-strip button {
  width: 42px;
  height: 42px;
  background: #27213f;
  border: 3px solid #080711;
  font-size: 25px;
}
.avatar-picker button.active,
.avatar-strip button.active { outline: 3px solid #ffd84d; }

.panel-heading,
.league-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-heading b {
  color: #fff7c7;
  font-family: "Press Start 2P";
  font-size: 12px;
}
.deck-choice-row,
.deck-tabs {
  display: flex;
  gap: 10px;
  margin: 13px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.deck-choice-row::-webkit-scrollbar,
.deck-tabs::-webkit-scrollbar { display: none; }
.deck-tile {
  flex: 0 0 104px;
  min-height: 112px;
  padding: 8px 6px;
  color: #232016;
  background: var(--deckColor,#666);
  border: 4px solid #080711;
  box-shadow: 4px 4px 0 #080711;
  text-transform: uppercase;
}
.deck-tile.active,
.deck-tile.editing {
  outline: 4px solid #fff143;
  outline-offset: -1px;
}
.deck-tile span {
  display: block;
  font-size: 43px;
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,.28));
}
.deck-tile b {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  line-height: .9;
}
.deck-tile small {
  display: block;
  margin-top: 7px;
  color: rgba(0,0,0,.68);
  font-size: 11px;
}
.deck-tile.new {
  color: #211f26;
  background: #8a8987;
}
.battle-deck-panel .deck-strip.deck-eight {
  grid-template-columns: repeat(4,minmax(0,1fr));
  margin-top: 12px;
}

.league-panel {
  background: #282140;
  box-shadow: none;
}
.league-icon { font-size: 43px; }
.league-row h2 {
  flex: 1;
  font-size: clamp(19px,4.9vw,28px);
}
.league-progress {
  position: relative;
  height: 38px;
  margin: 16px 0 22px;
  overflow: visible;
  background: #35323a;
  border: 4px solid #080711;
  border-radius: 5px;
}
.league-progress span {
  display: block;
  height: 100%;
  background: #48c300;
}
.league-progress b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8d5;
  font-family: "Press Start 2P";
  font-size: 13px;
  text-shadow: 2px 2px 0 #000;
}
.league-progress i {
  position: absolute;
  right: -12px;
  top: -12px;
  font-size: 42px;
  font-style: normal;
}
.fight-btn {
  min-height: 92px;
  color: #9d4d1d;
  background: linear-gradient(#ffc83e,#d99c12);
  border-color: #86523a;
  font-size: 25px;
  -webkit-text-stroke: 1px #fff4c2;
}

.shop-spacer { height: min(36vh,460px); }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 16px;
  margin: 0 6px 130px;
}
.shop-offer {
  min-height: 316px;
  display: grid;
  grid-template-rows: 1fr 76px;
  background: linear-gradient(145deg,#4c3c86,#222049);
  border: 4px solid #080711;
  box-shadow: 5px 5px 0 #080711;
}
.shop-offer .pack-art {
  display: grid;
  place-items: center;
  font-size: 86px;
}
.shop-offer .pack-art.muted { color: #68607d; }
.shop-price {
  color: #fff7cd;
  background: #3fc6cc;
  border: 0;
  border-top: 4px solid #080711;
  font-family: "Press Start 2P";
  font-size: 22px;
  text-shadow: 3px 3px 0 #000;
}
.shop-price:disabled {
  opacity: .75;
  filter: grayscale(.45);
}

.collection-sticky {
  position: sticky;
  z-index: 180;
  top: 0;
  margin: -2px -10px 13px;
  padding: 8px 10px 10px;
  background: linear-gradient(180deg,#211c3c 0%,#19162f 90%,rgba(25,22,47,.96));
  border-bottom: 3px solid #080711;
  box-shadow: 0 8px 14px rgba(4,3,10,.5);
}
.collection-sticky .deck-tabs { margin-top: 0; }
.collection-sticky .deck-tile {
  flex-basis: 92px;
  min-height: 86px;
}
.collection-sticky .deck-tile span { font-size: 31px; }
.collection-sticky .deck-tile b { font-size: 11px; }
.collection-sticky .deck-tile small { font-size: 9px; }
.collection-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  color: #fff7cf;
  background: #282342;
  border: 3px solid #080711;
  font-family: "Press Start 2P";
}
.collection-counter b { color: #55e9ff; }
.collection-counter span { font-size: 8px; }
.deck-editor {
  padding: 9px;
  background: #241f3c;
  border: 3px solid #080711;
}
.deck-editor-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 44px;
  gap: 8px;
  align-items: end;
}
.done-btn {
  height: 44px;
  color: #171323;
  background: #67f39d;
  border: 3px solid #080711;
  font-size: 24px;
}
.deck-editor-row.colors {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.deck-editor-row.colors button:not(.delete-deck) {
  width: 31px;
  height: 31px;
  background: var(--deckColor);
  border: 3px solid #080711;
}
.deck-editor-row.colors button.active { outline: 3px solid #ffd84d; }
.delete-deck {
  margin-left: auto;
  min-height: 31px;
  color: #fff;
  background: #ff5d6c;
  border: 3px solid #080711;
  font-size: 12px;
}
.avatar-strip {
  display: flex;
  gap: 6px;
  min-height: 42px;
  margin-bottom: 8px;
  overflow-x: auto;
}
.avatar-strip span {
  color: #aaa6c4;
  font-size: 12px;
}
.collection-sticky .deck-strip.deck-eight {
  grid-template-columns: repeat(8,minmax(0,1fr));
  gap: 4px;
}

.card-view-backdrop {
  position: fixed;
  z-index: 260;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9,7,19,.9);
}
.card-view-panel {
  position: relative;
  width: min(320px,92vw);
  padding: 12px;
  background: #17152c;
  border: 4px solid #080711;
  box-shadow: 7px 7px 0 #080711;
}
.card-view-panel .gallery-card {
  width: 100%;
  height: 330px;
}
.card-view-panel .gallery-card .hand-art { height: 144px; }
.card-view-panel .gallery-card .hand-emoji { font-size: 92px; }
.card-view-panel .gallery-card .hand-name { top: 149px; font-size: 17px; }
.card-view-panel .gallery-card .ability { top: 194px; height: 92px; font-size: 10px; }
.card-view-panel .mechanic-boxes {
  margin-top: 14px;
}

@media(max-width:370px){
  .topbar .wallet{gap:10px}.topbar .stat-chip{min-width:98px;font-size:14px}.profile-main{grid-template-columns:minmax(0,1fr) 112px}.profile-avatar{width:112px;height:112px;font-size:86px}.profile-copy h2{font-size:25px}.profile-status{font-size:8px}.ui-panel,.league-panel{margin-inline:2px;padding:13px}.deck-tile{flex-basis:92px}.shop-grid{gap:10px}.shop-offer{min-height:282px}.shop-price{font-size:18px}.nav-label{font-size:10px}.nav-icon{font-size:40px}
}

/* V7 — readable hand, mystery slots and punchier combat */
.hand-three { height:205px; }
.hand-three .hearth-card { height:172px; opacity:1; background:linear-gradient(145deg,#715e47,#30271f 70%); }
.hand-three .hearth-card.unaffordable { opacity:1; filter:grayscale(.72) brightness(.64); }
.hand-three .hearth-card .ability { top:101px; height:52px; padding:6px 8px 17px; overflow:hidden; color:#211a14; background:linear-gradient(#fff3d5,#d9c7a3); border-color:#0d0906; text-shadow:none; }
.hand-three .hearth-card .ability.text-short { font-size:8.5px; line-height:1.22; }
.hand-three .hearth-card .ability.text-medium { font-size:7.4px; line-height:1.16; }
.hand-three .hearth-card .ability.text-long { font-size:6.5px; line-height:1.1; }
.hand-three .hearth-card .active-effect strong { color:#6928a0; }
.hand-three .hearth-card .flavor-text { color:#776b59; }
.hand-three .hearth-card .hand-stats { bottom:-14px; }
.hand-three .hearth-card.held,.hand-three .hearth-card.dragging { transform:translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 41px)) rotate(0deg) scale(1.32) !important; }

.arena-mid .end-turn-float > span { width:auto; height:auto; transform:none; color:inherit; background:none; border:0; box-shadow:none; }
.arena-mid .end-turn-float .turn-normal { display:block !important; }
.arena-mid .end-turn-float .turn-sell { display:none !important; }
body:has(.dragging) .arena-mid .end-turn-float .turn-normal { display:none !important; }
body:has(.dragging) .arena-mid .end-turn-float .turn-sell { display:block !important; }

.mystery-row { z-index:28; }
.arena-cell.mystery-cell { align-items:center; overflow:hidden; border:3px solid rgba(255,220,155,.26); border-radius:46% 46% 18px 18px / 39% 39% 18px 18px; background:linear-gradient(180deg,rgba(65,29,35,.54),rgba(41,17,25,.7)); box-shadow:inset 0 0 0 2px rgba(255,255,255,.045); }
.arena-cell.mystery-cell span { display:grid; place-items:center; width:54px; height:67px; color:#d9b987; background:rgba(19,10,17,.28); border:2px dashed rgba(242,207,149,.3); border-radius:45% 45% 13px 13px; font-family:"Press Start 2P"; font-size:30px; text-shadow:3px 4px 0 rgba(0,0,0,.6); animation:mystery-breathe 1.25s steps(3) infinite; }
@keyframes mystery-breathe { 50%{color:#fff1bd;transform:scale(1.05);filter:brightness(1.25)} }

.round-banner { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:11px; color:#fff2a8; background:radial-gradient(circle,rgba(77,47,21,.68),rgba(12,8,18,.44)); }
.round-banner b { font-size:20px; }
.round-banner small { color:#ffad45; font-size:13px; }
.round-banner.combat-banner { color:#ffd7d0; background:radial-gradient(circle,rgba(128,23,32,.72),rgba(24,8,16,.5)); text-shadow:4px 4px 0 #26070d,0 0 18px #ff4e5e; }
.round-banner.combat-banner small { color:#ffdf59; text-shadow:2px 2px 0 #4d1609; }

.battle-screen .hero-bar { min-height:70px; grid-template-columns:76px minmax(0,1fr) 88px; gap:5px; padding:5px 9px 5px 0; border-radius:36px 10px 10px 36px; }
.hearth-battle > .hero-bar.enemy { margin-bottom: -4px; position: relative; z-index: 5; }
.hearth-battle > .hero-bar.player { margin-top: -4px; position: relative; z-index: 5; }
.hearth-battle > .hero-bar.active-hero-turn { z-index: 15; }
.battle-screen.hearth-battle .hero-bar { min-height:clamp(44px,6.5dvh,66px); }
.battle-screen .hero-avatar { width:72px; height:72px; margin:-7px 0 -7px -5px; font-size:43px; border:4px solid #153544; box-shadow:inset 0 0 0 3px #72c4da,3px 4px 0 rgba(0,0,0,.55); }
.battle-screen .hero-bar.enemy .hero-avatar { border-color:#3e1e15; box-shadow:inset 0 0 0 3px #d3946d,3px 4px 0 rgba(0,0,0,.55); }
.battle-screen .hero-bar.active-hero-turn {
  border-color:#ffd84d;
  box-shadow:inset 0 0 0 2px rgba(255,248,174,.82),0 0 0 3px rgba(255,216,77,.65),0 0 22px rgba(255,216,77,.82),3px 4px 0 rgba(0,0,0,.55);
  animation:hero-turn-glow .9s ease-in-out infinite;
}
.battle-screen .hero-bar.active-hero-turn .hero-avatar {
  filter:drop-shadow(0 0 8px rgba(255,216,77,.9));
}
@keyframes hero-turn-glow {
  50% { filter:brightness(1.15); box-shadow:inset 0 0 0 2px #fff3a6,0 0 0 4px rgba(255,216,77,.78),0 0 28px rgba(255,216,77,.94),3px 4px 0 rgba(0,0,0,.55); }
}
.battle-screen .hero-data { text-align:center; }
.battle-screen .hero-data b { margin:0; font-size:clamp(12px,3.5vw,17px); white-space:normal; line-height:1.05; }
.battle-screen .hero-stat.mana { min-height:48px; padding:5px; }
.battle-screen .hero-stat.mana b { justify-content:center; font-size:12px; }
.battle-screen .hero-stat.mana span { display:none; }
/* Actions column fits the 44px inner height of the 58px hero bar:
   18px mana chip + 2px gap + 24px button */
.battle-screen .hero-actions {
  width:88px;
  display:grid;
  grid-template-rows:18px 24px;
  gap:2px;
  align-self:center;
}
/* Same thin mana chip for both players */
.battle-screen .hero-actions .hero-stat.mana {
  min-height:0;
  height:18px;
  padding:0 4px;
  border-width:2px;
  box-shadow:inset 0 0 0 1px #0fb5d6,2px 2px 0 rgba(0,0,0,.45);
}
.battle-screen .hero-actions .hero-stat.mana b {
  font-size:9px;
}
.battle-screen .hero-actions .hero-stat.mana .ui-icon {
  width:12px;
  height:12px;
}
.hero-end-turn,
.hero-surrender {
  min-height:24px;
  padding:2px 3px;
  border:2px solid #080711;
  font-family:"Press Start 2P";
  font-size:6px;
  line-height:1.15;
  text-align:center;
  cursor:pointer;
}
.hero-end-turn {
  color:#171006;
  background:linear-gradient(#fff145 0 45%,#ffd708 46% 100%);
  box-shadow:inset 0 0 0 1px #fff58e,2px 3px 0 rgba(0,0,0,.55);
}
.hero-surrender {
  color:#eceaf3;
  background:linear-gradient(#8d8a9c 0 45%,#585465 46% 100%);
  box-shadow:inset 0 0 0 1px #bab7c7,2px 3px 0 rgba(0,0,0,.55);
  text-shadow:1px 1px 0 rgba(0,0,0,.55);
}
.hero-end-turn:disabled {
  color:#8d887f;
  background:#494846;
  filter:grayscale(1) brightness(.72);
  cursor:default;
}
.hero-end-turn.mana-blocked {
  animation:end-ready 1s steps(2) infinite;
}
.hero-heart { right:-7px; bottom:-5px; min-width:27px; height:25px; }

.fighter-badges .health-badge.damaged-health { color:#ff7188; background:radial-gradient(circle,#4c1221,#13060a 72%); box-shadow:inset 0 0 0 1px #8f263c,2px 2px 0 rgba(0,0,0,.5); }
.fighter-badges .health-badge.damaged-health .ui-icon { color:#b62b49; }
.fighter-statuses { position:absolute; z-index:14; top:2px; left:2px; max-width:64px; padding:2px 3px; color:#fff; background:rgba(10,8,18,.82); border:1px solid #5f5874; border-radius:5px; font-size:8px; line-height:1; white-space:nowrap; }
.arena-fighter.attack-rebound { animation:attack-rebound .34s cubic-bezier(.18,1.6,.35,1); }
.arena-fighter.stat-buffed .fighter-badges span { animation:stat-badge-bloom .55s steps(4); }
.arena-fighter.stat-debuffed .fighter-badges span { animation:stat-badge-shrink .55s steps(4); }
.stat-gain-pop {
  position:absolute;
  z-index:430;
  left:50%;
  bottom:72%;
  min-width:30px;
  height:25px;
  display:grid;
  place-items:center;
  padding:0 4px;
  color:#fff;
  background:linear-gradient(#8bff72,#27b23a 62%,#126d20);
  border:3px solid #11340d;
  border-radius:8px 8px 5px 5px;
  box-shadow:inset 0 0 0 1px rgba(229,255,217,.86),0 0 14px rgba(100,255,74,.78),2px 3px 0 rgba(0,0,0,.5);
  font-family:"Press Start 2P";
  font-size:10px;
  font-style:normal;
  line-height:1;
  text-align:center;
  text-shadow:1px 2px 0 #0b3f11;
  pointer-events:none;
  animation:stat-gain-land .9s cubic-bezier(.16,1.25,.28,1) forwards;
}
.health-badge .stat-gain-pop { background:linear-gradient(#a6ff8c,#35be43 62%,#17772a); }
.stat-gain-pop.negative,
.health-badge .stat-gain-pop.negative {
  background:linear-gradient(#ff8a94,#c7273e 62%,#741020);
  border-color:#3a0710;
  box-shadow:inset 0 0 0 1px rgba(255,219,224,.8),0 0 14px rgba(255,64,85,.72),2px 3px 0 rgba(0,0,0,.5);
  text-shadow:1px 2px 0 #3a0610;
}
.breakthrough-flow {
  position:fixed;
  z-index:2400;
  left:0;
  top:0;
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  pointer-events:none;
  filter:drop-shadow(0 0 12px rgba(255,217,70,.95));
}
.breakthrough-flow i {
  position:absolute;
  inset:5px;
  border:4px solid #2a1007;
  border-left-color:#fff1a2;
  border-top-color:#ffb33d;
  background:linear-gradient(135deg,#fff0a7,#ff9c24 58%,#a72c16);
  clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.4),3px 3px 0 rgba(0,0,0,.42);
}
.breakthrough-flow::before,
.breakthrough-flow::after {
  content:"";
  position:absolute;
  right:28px;
  width:46px;
  height:7px;
  border-radius:999px;
  background:linear-gradient(90deg,transparent,#ffdc59,#ff6a2a);
  box-shadow:0 0 12px rgba(255,181,40,.8);
}
.breakthrough-flow::before { top:13px; transform:rotate(-10deg); }
.breakthrough-flow::after { bottom:13px; transform:rotate(10deg); }
.breakthrough-flow b {
  position:relative;
  z-index:2;
  color:#fff;
  font-family:"Press Start 2P";
  font-size:9px;
  text-shadow:2px 2px 0 #3a1003,0 0 8px #fff06b;
}
.unit-damage-pop { position:absolute; z-index:410; left:50%; top:31%; color:#ff314e; font-family:"Press Start 2P"; font-size:21px; text-shadow:3px 3px 0 #25050b,0 0 12px #ff8a2f; pointer-events:none; animation:unit-damage-rise .68s cubic-bezier(.2,1.2,.25,1) forwards; }
.unit-damage-pop.damage { color:#ff314e !important; text-shadow:2px 2px 0 #25050b,0 0 10px #ff8a2f !important; }
.unit-damage-pop.blocked { color:#bdf8ff; text-shadow:2px 2px 0 #09171b,0 0 9px #6defff; }
.unit-damage-pop.missed { color:#d5d5df; text-shadow:2px 2px 0 #17171c,0 0 8px #fff; }
.timer-pop {
  position:absolute;
  z-index:410;
  left:50%;
  top:8%;
  transform:translateX(-50%);
  color:#fff5a9;
  font-family:"Press Start 2P";
  font-size:17px;
  text-shadow:2px 2px 0 #3a2304,0 0 14px #ffd44d,0 0 28px rgba(255,180,0,.6);
  pointer-events:none;
  animation:unit-damage-rise .7s cubic-bezier(.2,1.2,.25,1) forwards;
  white-space:nowrap;
}
.impact-smoke { position:absolute; z-index:405; left:50%; top:38%; width:15px; height:15px; border-radius:50%; background:#ebe3d5; box-shadow:-16px 3px 0 #aaa59e,15px -4px 0 #fff4df,-9px -12px 0 #c7c2b8,9px 11px 0 #9d9992,0 0 11px rgba(255,239,202,.8); opacity:.92; pointer-events:none; animation:smoke-puff .5s ease-out forwards; }
@keyframes attack-rebound { 0%{transform:scale(1.1)} 38%{transform:translateY(6px) scale(.88)} 72%{transform:translateY(-3px) scale(1.04)} 100%{transform:none} }
@keyframes target-flash { 0%,100%{filter:none} 45%{filter:brightness(2.2) saturate(1.5); transform:scale(1.08)} }
@keyframes unit-damage-rise { 0%{opacity:0;transform:translate(-50%,2px) scale(.5)} 20%{opacity:1;transform:translate(-50%,-12px) scale(1.35)} 58%{opacity:1;transform:translate(-50%,-20px) scale(1)} 100%{opacity:0;transform:translate(-50%,-40px) scale(.84)} }
@keyframes stat-buff-rise { 0%{opacity:0;transform:translate(-50%,10px) scale(.45)} 18%{opacity:1;transform:translate(-50%,-8px) scale(1.22)} 62%{opacity:1;transform:translate(-50%,-18px) scale(1)} 100%{opacity:0;transform:translate(-50%,-34px) scale(.86)} }
@keyframes stat-gain-land { 0%{opacity:0;transform:translate(-50%,15px) scale(.35)} 28%{opacity:1;transform:translate(-50%,-11px) scale(1.24)} 54%{opacity:1;transform:translate(-50%,-3px) scale(.96)} 82%{opacity:1;transform:translate(-50%,-8px) scale(1)} 100%{opacity:0;transform:translate(-50%,-25px) scale(.88)} }
@keyframes stat-badge-bloom { 0%,100%{filter:none;transform:none} 45%{filter:brightness(1.8) drop-shadow(0 0 7px #9dff58);transform:scale(1.16)} }
@keyframes stat-badge-shrink { 0%,100%{filter:none;transform:none} 45%{filter:brightness(1.25) drop-shadow(0 0 7px #ff4055);transform:scale(.86)} }
@keyframes smoke-puff { 0%{opacity:.95;transform:translate(-50%,-50%) scale(.22)} 62%{opacity:.8;transform:translate(-50%,-50%) scale(1.35)} 100%{opacity:0;transform:translate(-50%,-70%) scale(1.85)} }
@keyframes unit-death-card { 0%{opacity:1;transform:scale(1);filter:brightness(1)} 28%{opacity:1;transform:scale(1.05) rotate(-2deg);filter:brightness(.75) grayscale(.25)} 72%{opacity:.55;transform:scale(.72) rotate(7deg);filter:grayscale(1) brightness(.8)} 100%{opacity:0;transform:translateY(20px) scale(.18) rotate(18deg);filter:grayscale(1) brightness(.4)} }

@media(max-width:370px){
  .battle-screen .hero-bar{grid-template-columns:68px minmax(0,1fr) 69px}.battle-screen .hero-avatar{width:66px;height:66px;font-size:38px}.battle-screen .hero-data b{font-size:12px}.battle-screen .hero-stat.mana b{font-size:10px}.hand-three .hearth-card{height:168px}.hand-three .hearth-card.held,.hand-three .hearth-card.dragging{transform:translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 37px)) rotate(0) scale(1.25)!important}
}

/* V8 — Hearthstone ruleset */
.mode-select-screen { min-height:calc(100dvh - 48px); display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.mode-logo { font-size:74px; filter:drop-shadow(7px 8px 0 #080711); }
.mode-select-screen h1 { max-width:none; margin:12px 0 25px; }
.mode-choice-grid { width:100%; display:grid; gap:14px; }
.mode-choice { position:relative; min-height:132px; padding:17px 18px 16px 86px; color:#fff; border:4px solid #080711; box-shadow:6px 7px 0 #080711; text-align:left; cursor:pointer; }
.mode-choice.arcane { background:linear-gradient(135deg,#49388a,#29224f); box-shadow:inset 0 0 0 2px #896bd9,6px 7px 0 #080711; }
.mode-choice.hearthstone { background:linear-gradient(135deg,#96502a,#4c281e); box-shadow:inset 0 0 0 2px #e49a52,6px 7px 0 #080711; }
.mode-choice > span { position:absolute; left:17px; top:50%; font-size:50px; transform:translateY(-50%); filter:drop-shadow(4px 5px 0 rgba(0,0,0,.45)); }
.mode-choice b { display:block; margin-bottom:9px; font-family:"Press Start 2P"; font-size:11px; }
.mode-choice small { color:#ddd5ed; font-size:11px; line-height:1.35; }
.mode-pill { width:100%; margin:-6px 0 12px; padding:8px; color:#d8d2eb; background:#26213f; border:2px solid #080711; font-family:"Press Start 2P"; font-size:6px; cursor:pointer; }

.hearth-battle { padding-bottom:4px; }
/* Enemy face-down hand strip */
.enemy-hand { display: flex; justify-content: center; align-items: center; gap: 4px; height: 26px; flex-shrink: 0; padding: 2px 0; margin: 0 6px; }
.enemy-hand-empty { height: 26px; }
.enemy-hand-card {
  width: 17px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(135deg, #2a1e4a 0%, #1a1030 50%, #2e1f50 100%);
  border: 1px solid #4a3870;
  box-shadow: inset 0 0 0 1px rgba(180,140,255,.18), 1px 1px 0 rgba(0,0,0,.5);
  position: relative;
  overflow: hidden;
}
.enemy-hand-card::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(160,120,255,.22);
  border-radius: 1px;
}
/* Flying face-down card animation */
.enemy-card-fly {
  position: fixed;
  z-index: 2000;
  width: 32px;
  height: 42px;
  border-radius: 5px;
  background: linear-gradient(135deg, #2a1e4a, #1a1030, #2e1f50);
  border: 2px solid #4a3870;
  box-shadow: 0 0 12px rgba(140,100,255,.5), 2px 2px 0 rgba(0,0,0,.6);
  transform: translate(-50%, -50%);
  transition: transform 240ms cubic-bezier(.2,1,.4,1), opacity 240ms ease;
  pointer-events: none;
}
.hearth-field { position:relative; z-index:10; min-height:382px; padding:10px 9px; overflow:visible; isolation:isolate; background:linear-gradient(180deg,#78352f 0 45%,#e5b64e 48%,#a9d85a 52%,#47753b 100%); border:8px solid #392217; border-radius:17px; box-shadow:inset 0 0 0 3px #a56a3b,inset 0 0 45px rgba(24,10,7,.42),5px 6px 0 #08050a; }
.hearth-half { display:grid; gap:5px; }
.hearth-row { position:relative; z-index:20; height:78px; display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.hearth-row .arena-cell { height:78px; }
.hearth-row .arena-cell.drop-cell { border:2px solid rgba(33,18,18,.28); border-radius:42% 42% 13px 13px; background:rgba(20,10,16,.1); }
.hearth-row.player-front .arena-cell.drop-cell,.hearth-row.player-back .arena-cell.drop-cell { border-color:rgba(25,65,28,.42); }
.hearth-divider { position:relative; z-index:12; height:37px; display:grid; place-items:center; }
.hearth-divider::before { content:""; position:absolute; left:-12px; right:-12px; height:4px; background:repeating-linear-gradient(90deg,#fff0a0 0 14px,#dc9436 14px 21px); box-shadow:0 0 8px #ffe58d,0 3px 0 rgba(63,27,14,.45); }
.hearth-divider span { display:none; }
.hearth-row .arena-fighter { height:78px; }
.hearth-row .fighter-portrait { width:61px; height:55px; padding-bottom:7px; border-width:3px; font-size:38px; }
.hearth-row .fighter-name { bottom:15px; min-width:56px; max-width:72px; padding:3px; font-size:6.5px; }
.hearth-row .fighter-aura { bottom:1px; height:18px; }
.hearth-row .fighter-badges { bottom:-4px; width:65px; }
.hearth-row .fighter-badges span { flex-basis:32px; width:32px; height:24px; border-width:2px; font-size:7px; }
.hearth-row .fighter-badges .ui-icon { width:11px; height:11px; }
.hearth-row .sleep-mark { z-index:12; top:-5px; right:4px; padding:4px 3px; color:#8ef5ff; background:#171528; border:2px solid #080711; font-size:6px; text-shadow:0 0 6px #58eaff; animation:sleep-float 1s steps(3) infinite; }
@keyframes sleep-float { 50%{transform:translateY(-5px) scale(1.08);opacity:.65} }
.hearth-row .unit-tooltip { width:145px; z-index:450; }
.hearth-row.enemy-back .unit-tooltip,.hearth-row.enemy-front .unit-tooltip { top:auto; bottom:calc(100% + 7px); }
body:has(.hearth-card.dragging) .hearth-row .arena-cell.active-drop { z-index:50; border-color:#9cffff; background:rgba(72,235,255,.24); box-shadow:inset 0 0 0 2px #d9ffff,0 0 13px #62eaff; }
.turn-order-banner { position:absolute; z-index:500; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:9px; color:#fff; background:radial-gradient(circle,rgba(56,31,20,.86),rgba(10,7,15,.86)); font-family:"Press Start 2P"; text-align:center; animation:turn-order-in .35s cubic-bezier(.2,1.5,.4,1); }
.turn-order-banner small { color:#ffd55b; font-size:7px; }
.turn-order-banner b { font-size:16px; text-shadow:3px 3px 0 #1b0e0b; }
.turn-order-banner span { color:#83efff; font-size:7px; }
@keyframes turn-order-in { from{opacity:0;transform:scale(.65)} }
.hearth-end-turn { display:none; width:100%; min-height:42px; margin:7px 0 2px; color:#302007; background:linear-gradient(#fff277,#dcae22); border:3px solid #211408; box-shadow:inset 0 0 0 2px #fff9bb,3px 4px 0 #08050a; font-family:"Press Start 2P"; font-size:8px; cursor:pointer; }
.hearth-end-turn:disabled { color:#9e998e; background:#57544e; filter:grayscale(1); }
.hearth-end-turn.ready { animation:end-ready 1s steps(2) infinite; }
.hearth-projectile { position:fixed; z-index:1000; display:block; font-size:25px; filter:drop-shadow(0 0 7px #fff) drop-shadow(3px 4px 0 rgba(0,0,0,.5)); pointer-events:none; }
.hearth-row .arena-fighter.blocked-unit { animation:blocked-bump .3s steps(3); filter:grayscale(.65); }
@keyframes blocked-bump { 50%{transform:translateY(-3px);filter:grayscale(1) brightness(.65)} }
.hearth-battle .hand-three { height:193px; }
.hearth-battle .hero-heart { min-width:31px; }

@media(max-width:370px){
  .mode-choice{min-height:120px;padding-left:78px}.mode-choice>span{font-size:44px}.hearth-field{min-height:358px;padding-inline:6px}.hearth-row{height:72px;gap:5px}.hearth-row .arena-cell,.hearth-row .arena-fighter{height:72px}.hearth-row .fighter-portrait{width:56px;height:51px;font-size:34px}.hearth-row .fighter-name{font-size:6px}.hearth-divider{height:34px}.hearth-battle .hand-three{height:187px}
}

/* V7 — field tokens first: stable 2×3 board for future animation work */
.hearth-field {
  min-height: 430px;
  padding: 16px 12px;
  background:
    linear-gradient(180deg,#7f3b32 0 46.8%,#e9c45e 48.7%,#fff38a 50%,#9bd75b 51.3%,#437941 53.2% 100%);
}
.hearth-half { gap: 8px; }
.hearth-row {
  height: 112px;
  gap: 13px;
  align-items: center;
}
.hearth-row .arena-cell {
  height: 112px;
  align-items: center;
}
.hearth-row .arena-cell.board-slot {
  border: 3px solid rgba(32,20,14,.22);
  border-radius: 46% 46% 18px 18px / 42% 42% 20px 20px;
  background: rgba(30,20,18,.07);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.055);
}
.hearth-row .arena-cell.drop-cell {
  border: 3px solid rgba(32,20,14,.22);
  border-radius: 46% 46% 18px 18px / 42% 42% 20px 20px;
  background: rgba(30,20,18,.07);
  transform: scale(.96);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.055);
}
.hearth-row .arena-cell.occupied {
  transform: scale(.96);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.hearth-row .arena-cell.occupied .field-token {
  z-index: 2;
}
.hearth-row .arena-cell.occupied .cell-frame {
  position: absolute;
  z-index: 0;
  inset: 8px 5px 5px;
  border: 2px solid rgba(255,246,179,.22);
  border-radius: inherit;
  box-shadow: inset 0 0 15px rgba(18,10,8,.16), 0 2px 0 rgba(0,0,0,.12);
  opacity: 0;
  pointer-events: none;
}
.hearth-row .arena-cell.occupied.freeing {
  border-color: rgba(255,246,179,.28);
  background: rgba(30,20,18,.07);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.055);
  animation: slot-death-pop .36s cubic-bezier(.18,1.35,.28,1) both;
}
.hearth-row .arena-cell.occupied.freeing .cell-frame {
  opacity: 1;
}
.hearth-row .arena-cell.drop-cell::before {
  content: "";
  display: none !important;
}
.hearth-row.player-front .arena-cell.drop-cell,
.hearth-row.player-back .arena-cell.drop-cell,
.hearth-row.player-front .arena-cell.occupied,
.hearth-row.player-back .arena-cell.occupied {
  border-color: rgba(26,80,28,.28);
  background: rgba(38,105,32,.08);
}
.hearth-row .arena-cell.occupied:not(.freeing) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.hearth-row .arena-cell.occupied:not(.freeing) .cell-frame {
  opacity: 0;
}
body:has(.hearth-card.dragging) .hearth-row .arena-cell.active-drop {
  border-color: #cfffff;
  background: rgba(75,236,255,.23);
  box-shadow: inset 0 0 0 3px #ebffff, 0 0 22px #6defff;
}

.field-token.arena-fighter {
  width: 100%;
  height: 112px;
  display: grid;
  grid-template: 1fr / 1fr;
  place-items: center;
  place-content: center;
  cursor: pointer;
}
.field-token.arena-fighter::before,
.field-token.arena-fighter::after {
  content:"";
  position:absolute;
  z-index:1;
  pointer-events:none;
}
.field-token.has-taunt::before {
  width:124px;
  height:126px;
  z-index:3;
  top:50%;
  left:50%;
  transform:translate(-50%,-52%);
  border:0;
  border-radius:50%;
  background:
    radial-gradient(circle at 50% 6%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 73% 14%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 90% 37%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 90% 64%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 73% 86%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 50% 94%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 27% 86%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 10% 64%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 10% 37%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(circle at 27% 14%,#0e1012 0 3px,#c4ccd2 4px 6px,transparent 7px),
    radial-gradient(ellipse at 50% 50%,transparent 0 55%,rgba(176,187,196,.96) 57% 64%,rgba(52,58,63,.98) 66% 76%,rgba(16,18,20,.96) 78% 100%),
    conic-gradient(from -18deg,#202428,#89929a 9%,#3c4248 18%,#c4ccd2 28%,#42484e 39%,#1d2024 50%,#9099a1 63%,#383e44 75%,#b6bfc6 86%,#202428 100%);
  box-shadow:
    inset 0 0 0 4px rgba(230,238,244,.5),
    inset 0 0 0 11px rgba(24,27,30,.76),
    0 0 11px rgba(230,238,244,.28),
    3px 5px 0 rgba(0,0,0,.35);
  -webkit-mask:radial-gradient(ellipse at 50% 50%,transparent 0 57%,#000 59%);
  mask:radial-gradient(ellipse at 50% 50%,transparent 0 57%,#000 59%);
}
.field-token.has-thorns::after {
  width:110px;
  height:97px;
  background:
    radial-gradient(circle at 16% 61%, #c67a2a 0 5px, transparent 6px),
    radial-gradient(circle at 84% 61%, #c67a2a 0 5px, transparent 6px),
    radial-gradient(circle at 50% 6%, #c67a2a 0 5px, transparent 6px);
  filter:drop-shadow(0 0 5px rgba(255,166,65,.65));
}
.field-token .fighter-aura {
  left: 5%;
  right: 5%;
  bottom: 5px;
  height: 28px;
  background: radial-gradient(ellipse, rgba(7,6,12,.85) 0 34%, rgba(7,6,12,.52) 48%, transparent 70%);
}
.field-token.is-moving-card {
  animation: card-table-slide var(--move-ms,.5s) cubic-bezier(.18,.82,.24,1) both;
  filter: drop-shadow(8px 12px 8px rgba(0,0,0,.34));
}
.field-token.active-turn .fighter-aura::after {
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:74px;
  height:74px;
  border-radius:50%;
  transform:translate(-50%,-50%);
  background:radial-gradient(circle,rgba(255,246,138,.9) 0 14%,rgba(255,216,77,.48) 30%,rgba(255,216,77,.14) 54%,transparent 72%);
  filter:blur(.2px);
  animation:active-turn-pulse .74s ease-in-out infinite;
}
.field-token.active-turn .fighter-portrait {
  outline:4px solid #ffd84d;
  outline-offset:4px;
  filter:drop-shadow(0 0 8px rgba(255,216,77,.98)) drop-shadow(0 0 18px rgba(255,216,77,.75));
  animation:active-frame-pulse .78s ease-in-out infinite;
}
.field-token.no-attack-activation .fighter-portrait {
  animation:no-attack-activation 1s cubic-bezier(.2,.8,.24,1) both;
}
.field-token.no-attack-activation .sleep-mark {
  animation:sleep-dismiss 1s ease-out forwards;
}
.active-turn-orb {
  position:fixed;
  z-index:1350;
  width:38px;
  height:38px;
  border-radius:50%;
  background:radial-gradient(circle,#fff 0 18%,#ffe76d 34%,rgba(255,216,77,.44) 58%,transparent 74%);
  box-shadow:0 0 18px #ffd84d,0 0 34px rgba(255,216,77,.7);
  pointer-events:none;
  transform:translate(-50%,-50%);
}
@keyframes card-table-slide {
  from { transform:translate(var(--move-x,0),var(--move-y,0)) rotate(-2deg); }
  58% { transform:translate(0,0) rotate(1deg); }
  to { transform:translate(0,0) rotate(0deg); }
}
@keyframes active-turn-pulse {
  50% { transform:translate(-50%,-50%) scale(1.16); opacity:.72; }
}
@keyframes active-frame-pulse {
  50% { outline-color:#fff39b; outline-offset:6px; filter:drop-shadow(0 0 12px #ffd84d) drop-shadow(0 0 24px rgba(255,216,77,.85)); }
}
@keyframes no-attack-activation {
  0% { transform:scale(1); }
  24%,72% { transform:scale(1.1); }
  100% { transform:scale(1); }
}
@keyframes sleep-dismiss {
  0% { opacity:1; transform:translateY(0) scale(1); }
  45% { opacity:.95; transform:translateY(-3px) scale(1.08); }
  100% { opacity:0; transform:translateY(-9px) scale(.72); }
}
@keyframes slot-death-pop {
  from { opacity:0; transform:scale(.68); filter:brightness(1.4); }
  62% { opacity:1; transform:scale(1.04); }
  to { opacity:1; transform:scale(.96); }
}
.field-token .fighter-portrait {
  position:relative;
  z-index:2;
  justify-self:center;
  align-self:center;
  width: 104px;
  height: 110px;
  padding: 6px 6px 20px;
  border-radius: 50% 50% 17px 17px / 45% 45% 17px 17px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,255,255,.22), transparent 32%),
    radial-gradient(circle at 50% 36%, #667681 0 48%, #28323d 50% 70%, #101018 72%);
  border: 4px solid #21150e;
  box-shadow:
    inset 0 0 0 2px #aeb8c1,
    inset 0 -11px 0 rgba(8,6,12,.26),
    0 0 0 2px rgba(88,220,255,.34),
    0 7px 0 rgba(0,0,0,.28);
  font-size: 0;
}
.field-token.has-shield .fighter-portrait::after {
  content:"";
  position:absolute;
  z-index:1;
  inset:-11px -12px -8px;
  border:4px solid #697b93;
  border-radius:52% 52% 17px 17px / 43% 43% 18px 18px;
  background:
    linear-gradient(135deg,transparent 0 11%,rgba(226,241,255,.95) 12% 17%,transparent 18%),
    linear-gradient(225deg,transparent 0 11%,rgba(180,199,222,.95) 12% 17%,transparent 18%);
  box-shadow:inset 0 0 0 2px #dbe9f8,0 0 17px rgba(116,213,255,.72),3px 5px 0 rgba(0,0,0,.35);
  pointer-events:none;
}
.field-token.is-stunned .fighter-portrait::before {
  content:"✦ ✧ ✦";
  position:absolute;
  z-index:5;
  left:50%;
  top:-13px;
  transform:translateX(-50%);
  color:#9cf3ff;
  font-family:"Press Start 2P";
  font-size:8px;
  text-shadow:0 0 7px #74eaff;
  animation:stun-stars .75s steps(3) infinite;
}
@keyframes stun-stars { 50% { transform:translateX(-50%) translateY(-3px); opacity:.65; } }
.enemy-half .field-token .fighter-portrait {
  background:
    radial-gradient(circle at 50% 32%, rgba(255,255,255,.18), transparent 32%),
    radial-gradient(circle at 50% 36%, #9d675c 0 48%, #593136 50% 70%, #101018 72%);
  box-shadow:
    inset 0 0 0 2px #d09a80,
    inset 0 -11px 0 rgba(8,6,12,.26),
    0 0 0 2px rgba(255,170,110,.24),
    0 7px 0 rgba(0,0,0,.28);
}
.field-token .fighter-emoji {
  position:relative;
  z-index:2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(4px 5px 0 rgba(0,0,0,.42));
}
.field-token .fighter-badges {
  left: 50%;
  right: auto;
  bottom: -2px;
  width: 96px;
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  z-index:5;
}
.field-token .fighter-badges span {
  position:relative;
  overflow:visible;
  flex: 0 0 41px;
  width: 41px;
  height: 40px;
  border-radius: 11px 11px 5px 5px;
  border: 3px solid #15100c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 2px 3px 0 rgba(0,0,0,.48);
  font-family: "Press Start 2P";
  font-size: 18px;
  text-shadow: 2px 2px 0 #041222;
}
.field-token .fighter-badges .attack-badge {
  background: linear-gradient(#5ecbff,#1563b7 64%,#0d3d77);
}
.field-token .fighter-badges .health-badge {
  background: linear-gradient(#ff7691,#b52546 64%,#6b1429);
  text-shadow: 2px 2px 0 #26060e;
}
.field-token.is-poisoned .fighter-badges .health-badge {
  background:linear-gradient(#8ee66a,#32813e 64%,#194827);
  box-shadow:inset 0 0 0 1px rgba(209,255,187,.42),2px 3px 0 rgba(0,0,0,.48),0 0 11px rgba(82,255,104,.55);
}
.field-token .fighter-badges .health-badge i {
  position:absolute;
  right:-8px;
  top:-8px;
  min-width:17px;
  height:17px;
  display:grid;
  place-items:center;
  color:#f3f7ff;
  background:linear-gradient(#c7ced8,#6d7683);
  border:2px solid #15100c;
  border-radius:50%;
  font-style:normal;
  font-size:8px;
  text-shadow:1px 1px 0 #111820;
}
.field-token .fighter-badges .ui-icon { display: none; }
.stat-base { color: #fff; }
.stat-up { color: #43f25f; text-shadow: 2px 2px 0 #063411, 0 0 8px rgba(74,255,100,.8); }
.stat-down { color: #ff9aa8; text-shadow: 2px 2px 0 #3a0610, 0 0 8px rgba(255,64,85,.75); }
/* Container copies the portrait box so chips can ride its border arc via percentages */
.mechanic-chips {
  position:absolute;
  z-index:14;
  left:50%;
  top:50%;
  width:104px;
  height:110px;
  transform:translate(-50%,-50%);
  pointer-events:none;
}
.mechanic-chip {
  position:absolute;
  transform:translate(-50%,-50%);
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  color:#fff;
  background:
    radial-gradient(circle at 38% 28%,rgba(255,255,255,.48),transparent 28%),
    linear-gradient(color-mix(in srgb,var(--mech) 72%,#ffffff),var(--mech) 62%,color-mix(in srgb,var(--mech) 68%,#17070d));
  border:4px solid #050409;
  border-radius:50%;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.24),3px 4px 0 rgba(0,0,0,.5);
}
.mechanic-chip b {
  position:relative;
  display:block;
  width:22px;
  height:22px;
  font-family:"Press Start 2P";
  font-size:22px;
  line-height:22px;
  text-align:center;
  text-shadow:2px 2px 0 rgba(0,0,0,.55);
}
.mechanic-chip .icon-arrow::before {
  content:"";
  position:absolute;
  left:3px;
  top:8px;
  width:14px;
  height:6px;
  background:#fff;
  border-radius:5px;
  box-shadow:2px 2px 0 rgba(0,0,0,.38);
}
.mechanic-chip .icon-arrow::after {
  content:"";
  position:absolute;
  right:0;
  top:4px;
  border-left:9px solid #fff;
  border-top:7px solid transparent;
  border-bottom:7px solid transparent;
  filter:drop-shadow(2px 2px 0 rgba(0,0,0,.38));
}
.mechanic-chip .icon-shield::before {
  content:"";
  position:absolute;
  left:4px;
  top:1px;
  width:14px;
  height:19px;
  background:#fff;
  clip-path:polygon(50% 0,100% 18%,86% 72%,50% 100%,14% 72%,0 18%);
  filter:drop-shadow(2px 2px 0 rgba(0,0,0,.38));
}
.mechanic-chip .icon-spark::before,
.mechanic-chip .icon-splash::before {
  content:"+";
  position:absolute;
  inset:-1px 0 0;
  color:#fff;
  font-family:"Press Start 2P";
  font-size:23px;
  line-height:22px;
  text-align:center;
  text-shadow:2px 2px 0 rgba(0,0,0,.45);
}
.mechanic-chip .icon-splash::after {
  content:"";
  position:absolute;
  left:5px;
  top:5px;
  width:12px;
  height:12px;
  border:3px solid #fff;
  border-radius:50%;
  opacity:.55;
}
.mechanic-chip .icon-double::before,
.mechanic-chip .icon-double::after {
  content:"";
  position:absolute;
  top:4px;
  width:6px;
  height:15px;
  background:#fff;
  border-radius:6px;
  box-shadow:2px 2px 0 rgba(0,0,0,.4);
}
.mechanic-chip .icon-double::before { left:5px; transform:rotate(28deg); }
.mechanic-chip .icon-double::after { right:5px; transform:rotate(-28deg); }
.mechanic-chip .icon-drop::before {
  content:"";
  position:absolute;
  left:5px;
  top:2px;
  width:13px;
  height:18px;
  background:#fff;
  border-radius:70% 70% 70% 18%;
  transform:rotate(45deg);
  filter:drop-shadow(2px 2px 0 rgba(0,0,0,.38));
}
.mechanic-chip .icon-spike::before {
  content:"";
  position:absolute;
  left:3px;
  top:3px;
  width:16px;
  height:16px;
  background:#fff;
  clip-path:polygon(50% 0,61% 35%,98% 22%,70% 50%,98% 78%,61% 65%,50% 100%,39% 65%,2% 78%,30% 50%,2% 22%,39% 35%);
  filter:drop-shadow(2px 2px 0 rgba(0,0,0,.38));
}
/* Chip centers sit on the portrait frame arc: x=50%+50%*sin(a), y=45%-45%*cos(a) */
.mechanic-count-1 .mechanic-slot-1 { left:82%; top:10.5%; }
.mechanic-count-2 .mechanic-slot-1 { left:58.7%; top:0.7%; }
.mechanic-count-2 .mechanic-slot-2 { left:87.2%; top:14.9%; }
.mechanic-count-3 .mechanic-slot-1 { left:58.7%; top:0.7%; }
.mechanic-count-3 .mechanic-slot-2 { left:87.2%; top:14.9%; }
.mechanic-count-3 .mechanic-slot-3 { left:99.2%; top:37.2%; }
.mechanic-count-4 .mechanic-slot-1 { left:9.5%; top:18.5%; }
.mechanic-count-4 .mechanic-slot-2 { left:34.5%; top:2.2%; }
.mechanic-count-4 .mechanic-slot-3 { left:65.5%; top:2.2%; }
.mechanic-count-4 .mechanic-slot-4 { left:90.5%; top:18.5%; }
.mechanic-count-5 .mechanic-slot-1 { left:2.4%; top:31.1%; }
.mechanic-count-5 .mechanic-slot-2 { left:20.6%; top:8.6%; }
.mechanic-count-5 .mechanic-slot-3 { left:50%; top:0; }
.mechanic-count-5 .mechanic-slot-4 { left:79.4%; top:8.6%; }
.mechanic-count-5 .mechanic-slot-5 { left:97.6%; top:31.1%; }
.mechanic-count-6 .mechanic-slot-1 { left:0.2%; top:41.1%; }
.mechanic-count-6 .mechanic-slot-2 { left:11.1%; top:16.7%; }
.mechanic-count-6 .mechanic-slot-3 { left:35.4%; top:2%; }
.mechanic-count-6 .mechanic-slot-4 { left:64.6%; top:2%; }
.mechanic-count-6 .mechanic-slot-5 { left:88.9%; top:16.7%; }
.mechanic-count-6 .mechanic-slot-6 { left:99.8%; top:41.1%; }
.fighter-statuses {
  position: absolute;
  z-index: 13;
  left: 4px;
  top: 2px;
  max-width: 46px;
  overflow: hidden;
  color: #fff6b8;
  font-family: "Press Start 2P";
  font-size: 6px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
}
.field-token .sleep-mark {
  top: 1px;
  right: 33px;
  padding: 4px;
  border-radius: 7px;
}

.unit-hover-preview { display: none; }
@media (hover:hover) and (pointer:fine) {
  .hearth-half:has(.field-token:hover),
  .hearth-half:has(.field-token:focus),
  .hearth-half:has(.field-token:focus-within) {
    position: relative;
    z-index: 1900;
  }
  .hearth-row:has(.field-token:hover),
  .hearth-row:has(.field-token:focus),
  .hearth-row:has(.field-token:focus-within) {
    z-index: 1950;
  }
  .hearth-row .arena-cell.occupied:hover,
  .hearth-row .arena-cell.occupied:focus-within,
  .arena-cell.occupied:hover,
  .arena-cell.occupied:focus-within {
    z-index: 1600;
  }
  .field-token:hover,
  .field-token:focus,
  .field-token:focus-within {
    z-index: 1601;
  }
  .field-token:hover .unit-hover-preview,
  .field-token:focus .unit-hover-preview {
    position: absolute;
    z-index: 2200;
    left: 50%;
    bottom: calc(100% + 10px);
    display: block;
    width: 178px;
    transform: translateX(-50%) scale(.78);
    transform-origin: bottom center;
    pointer-events: none;
  }
  .enemy-half .field-token:hover .unit-hover-preview,
  .enemy-half .field-token:focus .unit-hover-preview {
    top: calc(100% + 10px);
    bottom: auto;
    transform-origin: top center;
  }
}
.field-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.field-info-card.overlay {
  width: min(236px, 74vw);
  margin-inline: auto;
  padding-top: 16px;
}
.field-info-card .gallery-card { width: 100%; }
.field-info-card .gallery-card.deck-selected {
  outline: 0;
  border-color: #17110c;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 3px 4px 0 rgba(0,0,0,.55);
}
.field-info-card .deck-check { display: none; }
.field-info-card .mechanic-boxes { width: 100%; margin-top: 14px; }
.field-info-card.overlay .hearth-card.unified-card {
  border-width:5px;
  box-shadow:inset 0 0 0 3px var(--rarityAccent),5px 6px 0 rgba(0,0,0,.52);
}
.field-info-card.overlay .hearth-card.unified-card .hand-cost {
  border-width:4px;
  box-shadow:inset 0 0 0 3px #c9fbff,3px 4px 0 rgba(0,0,0,.5);
}
.field-info-card.overlay .hearth-card.unified-card .hand-cost b { font-size:clamp(13px,9.8cqw,18px); }
.field-info-card.overlay .hearth-card.unified-card .hand-art {
  border-width:4px;
  box-shadow:inset 0 0 0 3px rgba(255,255,255,.16);
}
.field-info-card.overlay .hearth-card.unified-card .hand-name {
  border-width:4px;
  text-shadow:2px 3px 0 #000;
}
.field-info-card.overlay .hearth-card.unified-card.name-short .hand-name { font-size:clamp(16px,10.6cqw,25px); }
.field-info-card.overlay .hearth-card.unified-card.name-long .hand-name { font-size:clamp(13px,8.4cqw,21px); }
.field-info-card.overlay .hearth-card.unified-card.name-tiny .hand-name { font-size:clamp(11px,7.2cqw,18px); }
.field-info-card.overlay .hearth-card.unified-card .ability { border-width:4px; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-short { font-size:clamp(12px,7.6cqw,18px); line-height:1.2; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-medium { font-size:clamp(10px,6.5cqw,15px); line-height:1.14; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-long { font-size:clamp(8px,5.45cqw,13px); line-height:1.08; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-tiny { font-size:clamp(7px,4.85cqw,11px); line-height:1.03; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-micro { font-size:clamp(6px,4.35cqw,10px); line-height:1; }
.field-info-card.overlay .hearth-card.unified-card .ability.text-nano { font-size:clamp(5px,3.95cqw,9px); line-height:.96; }
.field-info-card.overlay .hearth-card.unified-card .hand-stats i {
  border-width:4px;
  width:clamp(43px,30.3cqw,59px);
  height:clamp(39px,27.6cqw,54px);
  font-size:clamp(10px,7.2cqw,15px);
}
.field-info-card.overlay .hearth-card.unified-card .gallery-rarity {
  border-width:2px;
  font-size:clamp(6px,4.2cqw,9px);
}
.field-info-card.overlay .hearth-card.unified-card .card-level {
  border-width:2px;
  font-size:clamp(6px,4.2cqw,9px);
}
.mechanic-box {
  padding: 8px 9px;
  margin-top: 7px;
  color: #f7f0ff;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mech) 28%, #151226), #100e20);
  border: 2px solid var(--mech);
  box-shadow: 3px 3px 0 #05040b;
  font-size: 11px;
  line-height: 1.28;
  font-weight: 400;
}
.mechanic-box b { color: #fff; font-weight: 900; }

.card-view-tips .mechanic-box b,
.card-view-panel .mechanic-box b,
.field-info-card .mechanic-box b { font-size: 12.5px; }
.hand-preview-backdrop {
  position: fixed;
  z-index: 1300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8,6,16,.78);
  animation: fade .14s both;
}
.hand-preview-panel {
  position: relative;
  width: min(230px, 70vw);
}
.unit-info-backdrop {
  position: fixed;
  z-index: 1400;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8,6,16,.72);
  animation: fade .14s both;
}
.unit-info-panel {
  position: relative;
  width: min(286px, 86vw);
  max-height: 92dvh;
  overflow: visible auto;
  display: flex;
  justify-content: center;
  padding-bottom: 58px;
}
.unit-info-close {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 56px;
  height: 44px;
  transform: translateX(-50%);
  color: #fff;
  background: linear-gradient(#ff655a,#b92034);
  border: 4px solid #1d0d0d;
  box-shadow: inset 0 0 0 2px #ff9f98, 3px 4px 0 rgba(0,0,0,.5);
  border-radius: 12px;
  font-family: "Press Start 2P";
  font-size: 20px;
}

.hearth-projectile {
  width: 78px;
  height: 30px;
  background: transparent;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.55));
  font-size: 0;
}
.hearth-projectile .projectile-body {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78px;
  height: 30px;
  transform: translate(-50%,-50%) rotate(var(--shot-angle,0rad));
  transform-origin: center;
}
.hearth-projectile i,
.hearth-projectile b {
  position:absolute;
  top:50%;
  display:block;
  pointer-events:none;
  transform:translateY(-50%);
  transform-origin:center;
}
.hearth-projectile i {
  width:64px;
  height:14px;
  left:0;
  border-radius:999px;
  background:linear-gradient(90deg,transparent,rgba(255,247,191,.18) 22%,rgba(255,236,126,.76) 58%,rgba(255,255,255,.94));
  box-shadow:0 0 10px rgba(255,232,91,.9),0 0 18px rgba(255,177,53,.62);
}
.hearth-projectile b {
  width:22px;
  height:20px;
  right:0;
  border-radius:48% 52% 45% 55%;
  background:
    radial-gradient(circle at 35% 28%,#c9c3b8 0 18%,transparent 20%),
    radial-gradient(circle at 72% 72%,#3d3c3a 0 18%,transparent 20%),
    linear-gradient(145deg,#8b8780,#4e4d4a 56%,#252625);
  border:2px solid #191b1c;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.2),0 0 9px rgba(255,245,188,.75);
}
.projectile-burst {
  position: fixed;
  z-index: 1001;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 8px rgba(255,255,255,.38), 0 0 22px #9ff4ff;
  pointer-events: none;
  transform: translate(-50%,-50%);
  animation: projectile-burst .36s ease-out forwards;
}
@keyframes projectile-burst {
  to { opacity: 0; transform: translate(-50%,-50%) scale(2.8); }
}
.claw-slash {
  position: absolute;
  z-index: 408;
  left: 50%;
  top: 43%;
  width: 168px;
  height: 128px;
  pointer-events: none;
  transform: translate(-50%,-50%) rotate(-18deg);
}
.claw-slash i {
  position: absolute;
  left: 14px;
  width: 144px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #7c0711 15%, #ff263a 38%, #ff8b32 66%, transparent);
  box-shadow: 0 0 10px #ff263a, 0 0 18px rgba(255,203,54,.75);
  animation: claw-cut .32s ease-out forwards;
}
.claw-slash::before,
.claw-slash::after {
  content:"";
  position:absolute;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#ffd84d;
  box-shadow:-36px 24px 0 #ffef78, 30px -20px 0 #ffbc32, 56px 32px 0 #fff1a6, 6px 54px 0 #ffcf3b;
  animation: claw-sparks .34s ease-out forwards;
}
.claw-slash::before { left:36px; top:20px; }
.claw-slash::after { right:36px; bottom:20px; animation-delay:.04s; }
.claw-slash i:nth-child(1) { top: 22px; }
.claw-slash i:nth-child(2) { top: 56px; animation-delay: .035s; }
.claw-slash i:nth-child(3) { top: 90px; animation-delay: .07s; }
.hero-claw-slash {
  left: 62%;
  top: 50%;
  transform: translate(-50%,-50%) rotate(-16deg) scale(.9);
}
@keyframes claw-cut {
  from { opacity: 0; transform: translateX(-20px) scaleX(.25); }
  35% { opacity: 1; }
  to { opacity: 0; transform: translateX(18px) scaleX(1.15); }
}
@keyframes claw-sparks {
  from { opacity:0; transform:scale(.35); }
  38% { opacity:1; transform:scale(1.18); }
  to { opacity:0; transform:translate(8px,-8px) scale(.65); }
}

.hand-three .hearth-card.drawn-card {
  animation: draw-card-from-left .58s cubic-bezier(.17,1.08,.28,1) both;
}
@keyframes draw-card-from-left {
  from { opacity: 0; transform: translateX(calc(-50% + var(--fan-x) - 240px)) translateY(calc(var(--fan-y) - 20px)) rotate(-12deg) scale(.65); }
}
.hand-three .hearth-card.held:not(.dragging) {
  z-index: 700 !important;
  transform: translateX(-50%) translateY(calc(var(--fan-y) - min(15vh, 92px))) rotate(0deg) scale(1.74) !important;
}
.hand-three .hearth-card.dragging {
  z-index: 700 !important;
  transform: translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 10px)) rotate(0deg) scale(.76) !important;
  transform-origin: 50% 18%;
}
.hand-three .hearth-card .ability.text-short { font-size: clamp(7px, 2.15vw, 8.6px); line-height: 1.18; }
.hand-three .hearth-card .ability.text-medium { font-size: clamp(6.2px, 1.9vw, 7.4px); line-height: 1.12; }
.hand-three .hearth-card .ability.text-long { font-size: clamp(5.45px, 1.62vw, 6.4px); line-height: 1.05; }

@media(max-width:370px){
  .battle-screen .hero-bar { grid-template-columns:70px minmax(0,1fr) 80px; }
  .battle-screen .hero-actions { width:80px; grid-template-rows:24px 32px; gap:2px; }
  .battle-screen .hero-actions .hero-stat.mana { height:24px; }
  .battle-screen .hero-actions .hero-stat.mana b { font-size:10px; }
  .hero-end-turn { min-height:32px; font-size:7px; border-width:3px; }
  .hearth-field { min-height: 400px; padding-inline: 8px; }
  .hearth-divider::before { left:-8px; right:-8px; }
  .hearth-row { height: 101px; gap: 7px; }
  .hearth-row .arena-cell { height: 101px; }
  .field-token.arena-fighter { height: 110px; }
  .field-token.has-taunt::before { width: 108px; height: 111px; }
  .field-token .fighter-portrait { width: 90px; height: 99px; }
  .field-token .fighter-emoji { font-size: 55px; }
  .field-token .fighter-badges { width: 96px; gap: 20px; }
  .field-token .fighter-badges span { flex-basis: 37px; width: 37px; height: 36px; font-size: 15px; }
  .mechanic-chips { width: 90px; height: 99px; }
  .mechanic-chip { width: 30px; height: 30px; border-width: 4px; }
  .mechanic-chip b { width: 19px; height: 19px; font-size: 19px; line-height: 19px; }
  .hand-three .hearth-card.held:not(.dragging),
  .hand-three .hearth-card.unified-card.held:not(.dragging) {
    transform: translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 72px)) rotate(0deg) scale(1.82) !important;
  }
}

/* V12 — one card format everywhere: hand, gallery, deck popovers and unit preview */
.hearth-card.unified-card {
  position: relative;
  padding: 0;
  overflow: visible;
  color: #fff;
  background: linear-gradient(145deg,#715e47,#30271f 70%);
  border: 4px solid #17110c;
  border-radius: 18px 18px 10px 10px;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 4px 5px 0 rgba(0,0,0,.52);
  container-type: inline-size;
}
.hand-three .hearth-card.unified-card {
  position: absolute;
  z-index: var(--fan-z);
  left: 50%;
  width: 112px;
  height: 172px;
  aspect-ratio: auto;
  transform: translateX(calc(-50% + var(--fan-x))) translateY(var(--fan-y)) rotate(var(--fan-r));
  transform-origin: center 92%;
  transition: transform .18s, filter .15s;
}
.hand-three .hearth-card.unified-card:nth-child(n) {
  transform: translateX(calc(-50% + var(--fan-x))) translateY(var(--fan-y)) rotate(var(--fan-r));
}
.hand-three .hearth-card.unified-card.held:not(.dragging) {
  z-index: 700 !important;
  transform: translateX(-50%) translateY(calc(var(--fan-y) - min(15vh, 92px))) rotate(0deg) scale(1.74) !important;
}
.hand-three .hearth-card.unified-card.dragging {
  z-index: 700 !important;
  transform: translateX(calc(-50% + var(--fan-x))) translateY(calc(var(--fan-y) - 10px)) rotate(0deg) scale(.76) !important;
  transform-origin: 50% 18%;
}
.gallery-card.hearth-card.unified-card {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 112 / 172;
}
.deck-popover .hearth-card.unified-card,
.unit-hover-preview .hearth-card.unified-card {
  width: 178px;
}
.unit-info-panel .hearth-card.unified-card {
  width: 100%;
}
.booster-reveal .hearth-card.unified-card {
  width: 100%;
  height: auto;
}
.hearth-card.unified-card .hand-cost {
  top: -4.1%;
  left: -5.8%;
  width: clamp(30px, 30cqw, 42px);
  height: clamp(30px, 30cqw, 42px);
  transform: none;
}
.hearth-card.unified-card .hand-cost .ui-icon {
  width: 74%;
  height: 74%;
}
.hearth-card.unified-card .hand-cost b {
  font-size: clamp(9px, 9.8cqw, 13px);
}
.hearth-card.unified-card .hand-art {
  top: 4.65%;
  left: 6.25%;
  right: 6.25%;
  height: 43.6%;
  border-radius: 44% 44% 9px 9px;
}
.hearth-card.unified-card .hand-emoji {
  font-size: clamp(43px, 46cqw, 82px);
}
.hearth-card.unified-card .hand-name {
  top: 47.4%;
  left: 6.25%;
  right: 6.25%;
  min-height: 14.4%;
  padding: 3.4% 2%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hearth-card.unified-card.name-short .hand-name { font-size: clamp(10px, 10.6cqw, 18px); }
.hearth-card.unified-card.name-long .hand-name { font-size: clamp(8px, 8.4cqw, 15px); }
.hearth-card.unified-card.name-tiny .hand-name { font-size: clamp(7px, 7.2cqw, 13px); }
.hearth-card.unified-card .ability {
  top: 60.6%;
  left: 7.1%;
  right: 7.1%;
  height: 31.2%;
  padding: 3% 5.3%;
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 0 .28em;
  overflow: hidden;
  color: #211a14;
  background: linear-gradient(#fff3d5,#d9c7a3);
  border-color: #0d0906;
  text-shadow: none;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
  word-break: normal;
}
.hearth-card.unified-card .ability strong,
.hearth-card.unified-card .ability span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}
.hearth-card.unified-card .ability.text-short { font-size: clamp(7px, 7.6cqw, 12px); line-height: 1.2; }
.hearth-card.unified-card .ability.text-medium { font-size: clamp(6px, 6.5cqw, 10px); line-height: 1.14; }
.hearth-card.unified-card .ability.text-long { font-size: clamp(5.2px, 5.45cqw, 8.6px); line-height: 1.08; }
.hearth-card.unified-card .ability.text-tiny { font-size: clamp(4.7px, 4.85cqw, 7.7px); line-height: 1.03; }
.hearth-card.unified-card .ability.text-micro { font-size: clamp(4.2px, 4.35cqw, 6.9px); line-height: 1; }
.hearth-card.unified-card .ability.text-nano { font-size: clamp(3.8px, 3.95cqw, 6.2px); line-height: .96; }
.hearth-card.unified-card .ability .effect-keyword {
  color: #5b238a;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255,255,255,.32);
}
.hearth-card.unified-card .ability .effect-trigger {
  text-decoration: none;
}
.hearth-card.unified-card .active-effect strong {
  color: #6928a0;
  font-weight: 900;
}
.hearth-card.unified-card .active-effect span {
  font-weight: 400;
}
.hearth-card.unified-card .flavor-text {
  color: #776b59;
  font-style: italic;
  font-weight: 400;
}
.hearth-card.unified-card .hand-stats {
  left: -3.6%;
  right: -3.6%;
  bottom: -8.1%;
}
.hearth-card.unified-card .hand-stats i {
  width: clamp(32px, 30.3cqw, 44px);
  height: clamp(29px, 27.6cqw, 39px);
  font-size: clamp(7px, 7.2cqw, 11px);
}
.hearth-card.unified-card .gallery-rarity {
  top: 95.9%;
  right: 50%;
  padding: 2px 4px;
  transform: translate(50%,-50%);
  color: #bdb5a6;
  background: #27201a;
  border-color: #655b50;
  font-size: clamp(4px, 4.2cqw, 6px);
  opacity: .85;
}
.hearth-card.unified-card .card-level {
  top: 3.7%;
  left: 50%;
  padding: 2px 4px;
  transform: translateX(-50%);
  font-size: clamp(4px, 4.2cqw, 6px);
}
.hearth-card.unified-card .deck-check,
.hearth-card.unified-card .gallery-rarity + .deck-check {
  top: -5.2%;
  right: -5.2%;
  width: clamp(27px, 25cqw, 35px);
  height: clamp(27px, 25cqw, 35px);
  font-size: clamp(15px, 15cqw, 21px);
}
.field-info-card .hearth-card.unified-card.deck-selected {
  outline: 0;
  border-color: #17110c;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 4px 5px 0 rgba(0,0,0,.52);
}
.field-info-card .hearth-card.unified-card .deck-check {
  display: none;
}

/* V13 — juicy mobile-game lobby inspired by chunky arena UI */
.app-shell {
  --juice-blue: #1cb8ff;
  --juice-sky: #67efff;
  --juice-yellow: #ffe24d;
  --juice-orange: #ff9a2b;
  --juice-pink: #ff4aa2;
  --juice-violet: #7a4df2;
  --juice-deep: #161135;
  padding: max(18px, var(--safe-top)) 14px calc(112px + var(--safe-bottom));
  background:
    radial-gradient(circle at 18% 11%, rgba(255,226,77,.26) 0 44px, transparent 45px),
    radial-gradient(circle at 89% 16%, rgba(28,184,255,.28) 0 62px, transparent 63px),
    radial-gradient(circle at 74% 78%, rgba(255,74,162,.2) 0 76px, transparent 77px),
    repeating-linear-gradient(135deg, rgba(255,255,255,.045) 0 8px, transparent 8px 24px),
    linear-gradient(180deg,#513091 0%,#25206a 43%,#161235 100%);
  box-shadow: 0 0 0 3px #080711, 0 0 90px rgba(0,0,0,.8);
}
.app-shell::after {
  content: "";
  pointer-events: none;
  position: fixed;
  left: 50%;
  top: 0;
  width: min(100%,460px);
  height: 100dvh;
  transform: translateX(-50%);
  background:
    linear-gradient(115deg, transparent 0 11%, rgba(255,255,255,.08) 11.5% 13.5%, transparent 14% 100%),
    linear-gradient(115deg, transparent 0 67%, rgba(255,255,255,.055) 67.5% 70%, transparent 70.5% 100%);
  z-index: 1;
}
.app-shell > * {
  position: relative;
  z-index: 2;
}
.app-shell > .bottom-nav {
  position: fixed;
  z-index: 10;
}
.app-shell > .collection-sticky {
  position: sticky;
}
.app-shell > .reveal-overlay,
.app-shell > .card-view-backdrop,
.app-shell > .unit-info-backdrop {
  position: fixed;
}
.topbar {
  min-height: 58px;
  margin-bottom: 16px;
}
.topbar .wallet { gap: 12px; }
.topbar .stat-chip {
  min-width: 112px;
  min-height: 48px;
  padding: 8px 13px;
  border: 4px solid #070611;
  border-radius: 14px;
  color: #fff8d6;
  background: linear-gradient(180deg,#6450a7 0%,#32255f 62%,#21194a 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.18), inset 0 -5px 0 rgba(0,0,0,.22), 4px 5px 0 #070611;
  font-size: 16px;
}
.topbar .stat-chip.coin { color: #fff4bd; }
.topbar .stat-chip.diamond { color: #bff8ff; }
.settings-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: linear-gradient(#e8f4ff,#7788a3);
  border: 4px solid #080711;
  border-radius: 13px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.55), 3px 4px 0 #080711;
  font-size: 30px;
  filter: none;
}

.ui-panel,
.league-panel {
  position: relative;
  overflow: hidden;
  margin: 14px 2px 18px;
  padding: 16px;
  border: 4px solid #080711;
  border-radius: 17px;
  background:
    radial-gradient(circle at 95% 8%, rgba(255,255,255,.18) 0 28px, transparent 29px),
    linear-gradient(145deg,#275bd8 0%,#5533b0 58%,#231952 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.18), inset 0 -7px 0 rgba(0,0,0,.2), 6px 7px 0 #080711;
}
.ui-panel::before,
.league-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.07) 0 6px, transparent 6px 20px);
  opacity: .6;
  pointer-events: none;
}
.ui-panel > *,
.league-panel > * {
  position: relative;
  z-index: 1;
}
.profile-panel {
  background:
    radial-gradient(circle at 77% 44%, rgba(255,226,77,.28) 0 64px, transparent 65px),
    linear-gradient(145deg,#1c8fe8 0%,#3a40c7 48%,#2b1a6c 100%);
}
.profile-copy h2,
.panel-heading h2,
.league-row h2 {
  color: #fff7c8;
  text-shadow: 3px 3px 0 #080711, 0 4px 0 rgba(132,60,9,.75);
}
.profile-copy h2 { font-size: clamp(34px,8vw,48px); }
.panel-heading h2 { font-size: clamp(29px,7.2vw,42px); }
.profile-status,
.panel-heading span {
  color: #72f6ff;
  text-shadow: 2px 2px 0 #080711;
}
.profile-avatar {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%,#fff78c 0 25%,#ffbd1d 54%,#e37200 100%);
  border: 5px solid #080711;
  box-shadow: inset 0 5px 0 rgba(255,255,255,.36), inset 0 -8px 0 rgba(137,54,0,.22), 5px 6px 0 rgba(8,7,17,.85);
  font-size: 86px;
  filter: none;
}
.pixel-btn.compact,
.pixel-btn.secondary {
  border-radius: 12px;
  background: linear-gradient(#7e63d8,#37256f);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), inset 0 -5px 0 rgba(0,0,0,.22), 4px 5px 0 #080711;
}

.deck-tile {
  border: 4px solid #080711;
  border-radius: 15px;
  color: #fff8ca;
  background:
    radial-gradient(circle at 50% 22%, rgba(255,255,255,.22) 0 24px, transparent 25px),
    linear-gradient(180deg, color-mix(in srgb,var(--deckColor) 72%,#fff 28%) 0%, var(--deckColor) 54%, color-mix(in srgb,var(--deckColor) 68%,#080711 32%) 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.24), inset 0 -6px 0 rgba(0,0,0,.24), 4px 5px 0 #080711;
  text-shadow: 2px 2px 0 #080711;
}
.deck-tile.active,
.deck-tile.editing {
  outline: 0;
  border-color: #fff04d;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.24), inset 0 -6px 0 rgba(0,0,0,.24), 0 0 0 4px #080711, 0 0 0 7px #fff04d, 4px 5px 0 #080711;
}
.deck-tile.new {
  color: #342545;
  background: linear-gradient(#f4f0f5,#8b8aa0);
  text-shadow: none;
}
.deck-tile small { color: rgba(255,255,255,.85); }
.deck-tile.new small { color: #3c3143; }
.battle-deck-panel .deck-mini,
.collection-sticky .deck-mini {
  border-radius: 10px;
  border-width: 3px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 3px 4px 0 #080711;
}

.league-panel {
  background:
    radial-gradient(circle at 14% 12%, rgba(255,226,77,.3) 0 34px, transparent 35px),
    linear-gradient(145deg,#6537d7 0%,#2d2f9c 54%,#19184a 100%);
}
.league-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(#eaf7ff,#738cac);
  border: 4px solid #080711;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.5), 3px 4px 0 #080711;
  font-size: 32px;
}
.league-progress {
  height: 36px;
  border: 4px solid #080711;
  border-radius: 18px;
  overflow: visible;
  background: linear-gradient(#302846,#1a1629);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.08);
}
.league-progress span {
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg,#b7ff2b 0%,#44cf00 55%,#1f8900 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.38), inset 0 -4px 0 rgba(0,0,0,.18);
}
.league-progress b {
  color: #fff8cd;
  font-size: 12px;
  text-shadow: 2px 2px 0 #080711;
}
.league-progress i {
  right: -13px;
  top: -14px;
  filter: drop-shadow(3px 4px 0 #080711);
}
.fight-btn {
  min-height: 82px;
  border: 5px solid #080711;
  border-radius: 15px;
  color: #fff6b7;
  background: linear-gradient(180deg,#ffec47 0%,#ffb22b 48%,#ef681a 100%);
  box-shadow: inset 0 5px 0 rgba(255,255,255,.38), inset 0 -8px 0 rgba(121,37,0,.24), 5px 6px 0 #080711;
  font-size: 23px;
  text-shadow: 3px 3px 0 #8e2f00;
  -webkit-text-stroke: 0;
}

.shop-spacer { height: min(31vh,340px); }
.shop-offer {
  min-height: 286px;
  border: 5px solid #080711;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,236,71,.28) 0 52px, transparent 53px),
    linear-gradient(145deg,#285be5 0%,#7033cc 62%,#29184d 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.18), inset 0 -7px 0 rgba(0,0,0,.22), 5px 6px 0 #080711;
}
.shop-offer:nth-child(2) {
  background:
    radial-gradient(circle at 50% 32%, rgba(103,239,255,.2) 0 52px, transparent 53px),
    linear-gradient(145deg,#454d78 0%,#2c295c 62%,#1b1739 100%);
}
.shop-offer .pack-art {
  font-size: 88px;
  filter: drop-shadow(6px 8px 0 rgba(8,7,17,.55));
}
.shop-offer .pack-art.muted {
  color: #c1bfd5;
  opacity: .55;
}
.shop-price {
  color: #fffdf0;
  background: linear-gradient(180deg,#79f6ff 0%,#20bdde 53%,#1683b6 100%);
  border-top: 5px solid #080711;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.32);
  font-size: 19px;
}

.collection-sticky {
  border: 4px solid #080711;
  border-radius: 0 0 18px 18px;
  background:
    radial-gradient(circle at 96% 0%, rgba(255,74,162,.2) 0 54px, transparent 55px),
    linear-gradient(180deg,#3c2d82 0%,#211a4d 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.13), 0 8px 0 rgba(8,7,17,.72);
}
.collection-counter,
.deck-editor {
  border: 4px solid #080711;
  border-radius: 14px;
  background: linear-gradient(145deg,#273a98,#21194e);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.15), 4px 5px 0 rgba(8,7,17,.75);
}
.filter-btn {
  border: 3px solid #080711;
  border-radius: 10px;
  color: #d4cbf4;
  background: linear-gradient(#493e7d,#28214e);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12), 2px 3px 0 #080711;
}
.filter-btn.active {
  color: #3a2600;
  background: linear-gradient(#fff26a,#ffca28);
}
.done-btn,
.delete-deck,
.avatar-picker button,
.avatar-strip button,
.deck-editor-row.colors button:not(.delete-deck) {
  border-radius: 10px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 2px 3px 0 #080711;
}
.done-btn { background: linear-gradient(#9cff9a,#43e46c); }
.delete-deck { background: linear-gradient(#ff6aa4,#e33458); }

.bottom-nav {
  min-height: calc(106px + var(--safe-bottom));
  background: linear-gradient(180deg,#302058,#171229);
  border-top: 5px solid #080711;
  box-shadow: 0 -6px 0 rgba(255,255,255,.05);
}
.nav-btn {
  position: relative;
  min-height: 106px;
  border: 0;
  color: #fff2d0;
  text-shadow: 2px 2px 0 #080711;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  gap: 0;
}
.nav-btn.active {
  margin: -22px 3px 0;
  min-height: 128px;
  border: 5px solid #080711;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg,#ff5aa9 0%,#7e4af3 48%,#493198 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.25), 0 -2px 0 #ffcf4d, 0 0 0 3px rgba(255,226,77,.45);
}
.nav-btn:nth-child(1).active { background: linear-gradient(180deg,#ffb440 0%,#ff5aa9 52%,#7e3ac5 100%); }
.nav-btn:nth-child(2).active { background: linear-gradient(180deg,#67efff 0%,#2867ee 54%,#5635c7 100%); }
.nav-btn:nth-child(3).active { background: linear-gradient(180deg,#ffe24d 0%,#ff8f29 52%,#b72c83 100%); }
.nav-icon {
  font-size: 52px;
  filter: drop-shadow(2px 3px 0 #080711);
  line-height: 1;
  margin-bottom: -8px;
  position: relative;
  z-index: 2;
}
.nav-btn.active .nav-icon {
  font-size: 58px;
}
.nav-label {
  font-size: 13px;
  font-family: 'Russo One', sans-serif;
  color: #fff8da;
  letter-spacing: 1.5px;
  position: relative;
  z-index: 1;
  text-shadow: 1px 2px 0 #080711;
}

@media(max-width:370px){
  .topbar .stat-chip {
    min-width: 98px;
    font-size: 14px;
  }
  .profile-main { grid-template-columns: minmax(0,1fr) 106px; }
  .profile-avatar {
    width: 106px;
    height: 106px;
    font-size: 72px;
  }
  .profile-copy h2 { font-size: 29px; }
  .panel-heading h2 { font-size: 27px; }
  .ui-panel,
  .league-panel { padding: 13px; }
  .shop-offer { min-height: 260px; }
  .nav-icon { font-size: 36px; }
  .nav-label { font-size: 10px; }
}

/* V13.1 — keep the battle CTA visible on common mobile heights */
.ui-panel,
.league-panel {
  margin: 10px 2px 14px;
  padding: 13px 14px;
}
.profile-main { grid-template-columns: minmax(0,1fr) 110px; }
.profile-avatar {
  width: 110px;
  height: 110px;
  font-size: 76px;
}
.profile-copy h2 { font-size: clamp(31px,7.2vw,43px); }
.panel-heading h2 { font-size: clamp(27px,6.4vw,38px); }
.profile-status,
.panel-heading span { margin-bottom: 10px; }
.pixel-btn.compact {
  min-height: 40px;
  padding-block: 9px;
}
.deck-choice-row,
.deck-tabs { margin: 9px 0; }
.deck-tile {
  flex-basis: 88px;
  min-height: 88px;
}
.deck-tile span { font-size: 33px; }
.deck-tile b { font-size: 11px; }
.deck-tile small { font-size: 9px; }
.battle-deck-panel .deck-strip.deck-eight {
  gap: 6px;
  margin-top: 8px;
}
.battle-deck-panel .deck-mini {
  height: 50px;
}
.battle-deck-panel .deck-mini > b { font-size: 27px; }
.league-icon {
  width: 48px;
  height: 48px;
  font-size: 29px;
}
.league-progress {
  height: 31px;
  margin: 10px 0 12px;
}
.fight-btn {
  min-height: 72px;
  font-size: 21px;
}

@media(max-width:370px){
  .profile-main { grid-template-columns: minmax(0,1fr) 96px; }
  .profile-avatar {
    width: 96px;
    height: 96px;
    font-size: 66px;
  }
  .deck-tile {
    flex-basis: 80px;
    min-height: 82px;
  }
  .battle-deck-panel .deck-mini { height: 46px; }
}

/* V14 — final reference style: dark pixel card-game UI */
:root {
  --ref-bg: #111024;
  --ref-bg-2: #191632;
  --ref-panel: #292550;
  --ref-panel-2: #332d63;
  --ref-line: #05040d;
  --ref-text: #fff6d4;
  --ref-muted: #a8a0c6;
  --ref-cyan: #22e8ff;
  --ref-yellow: #ffd91f;
}

html,
body {
  background: #0a0914;
}

.app-shell {
  width: min(100%, 460px);
  padding: max(15px, var(--safe-top)) 16px calc(104px + var(--safe-bottom));
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, #211b3e 0%, #121126 58%, #0f0e20 100%);
  background-size: 4px 4px, 4px 4px, auto;
  box-shadow: 0 0 0 2px var(--ref-line), 0 0 70px rgba(0,0,0,.78);
}
.app-shell::after { display: none; }
.app-shell > * {
  position: relative;
  z-index: 2;
}
.app-shell > .bottom-nav { position: fixed; z-index: 10; }
.app-shell > .collection-sticky { position: sticky; }
.app-shell > .reveal-overlay,
.app-shell > .card-view-backdrop,
.app-shell > .unit-info-backdrop { position: fixed; }

.topbar {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: start;
  gap: 10px;
  margin: 0 0 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 28px;
  background: var(--ref-yellow);
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ref-line);
  transform: rotate(-2deg);
}
.pixel-title {
  color: #fff7d2;
  font-size: 10px;
  line-height: 1.35;
  text-shadow: 2px 2px 0 #000;
}
.player-meta {
  margin-top: 5px;
  color: var(--ref-muted);
  font-family: "Russo One";
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
}
.topbar .wallet {
  display: flex;
  gap: 8px;
}
.topbar .stat-chip {
  min-width: 74px;
  min-height: 39px;
  padding: 8px 10px;
  justify-content: center;
  color: #fff7d2;
  background: #2d2852;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ref-line);
  font-size: 9px;
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}
.topbar .stat-chip .ui-icon {
  width: 14px;
  height: 14px;
}
.topbar .stat-chip.diamond {
  color: var(--ref-cyan);
}
.settings-btn { display: none; }

.ui-panel,
.league-panel,
.collection-sticky {
  position: relative;
  overflow: hidden;
  margin: 0 0 18px;
  padding: 18px 20px;
  color: var(--ref-text);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, #332e66 0%, #252145 100%);
  background-size: 4px 4px, auto;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 7px 7px 0 var(--ref-line);
}
.ui-panel::before,
.league-panel::before {
  display: none;
}
.profile-panel {
  min-height: 214px;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg,#383170 0%,#26224c 100%);
  background-size: 4px 4px, auto;
}
.profile-main {
  grid-template-columns: minmax(0,1fr) 118px;
  gap: 12px;
}
.profile-copy h2,
.panel-heading h2,
.league-row h2 {
  margin: 0;
  color: #fff7d2;
  font-family: "Russo One";
  font-size: 39px;
  line-height: .95;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #000;
}
.profile-status,
.panel-heading span {
  margin: 9px 0 19px;
  color: var(--ref-cyan);
  font-family: "Press Start 2P";
  font-size: 8px;
  line-height: 1.55;
  text-shadow: none;
  text-transform: uppercase;
}
.profile-avatar {
  width: 118px;
  height: 138px;
  align-self: end;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 96px;
  filter: drop-shadow(7px 8px 0 rgba(0,0,0,.48));
}
.pixel-btn.compact,
.pixel-btn.secondary {
  width: min(100%, 205px);
  min-height: 48px;
  color: #c8bddf;
  background: #211c37;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--ref-line);
  font-size: 8px;
}

.battle-deck-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.battle-deck-panel .panel-heading {
  margin: 0 0 12px;
}
.battle-deck-panel .panel-heading h2 {
  color: #fff7d2;
  font-size: 25px;
  text-transform: none;
  text-shadow: 3px 3px 0 #000;
}
.battle-deck-panel .panel-heading span {
  display: none;
}
.panel-heading b {
  color: var(--ref-muted);
  font-family: "Press Start 2P";
  font-size: 9px;
}
.deck-choice-row {
  margin: 0 0 14px;
  gap: 10px;
}
.deck-tile {
  flex: 0 0 69px;
  min-height: 66px;
  padding: 6px 4px;
  color: #29243b;
  background: var(--deckColor,#6b6b73);
  border: 2px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ref-line);
  text-shadow: none;
}
.deck-tile.active,
.deck-tile.editing {
  border-color: var(--ref-yellow);
  outline: 0;
  box-shadow: 3px 3px 0 var(--ref-line);
}
.deck-tile.new {
  color: #33313a;
  background: #8d8d8d;
}
.deck-tile span {
  font-size: 24px;
  filter: drop-shadow(1px 2px 0 rgba(0,0,0,.22));
}
.deck-tile b {
  margin-top: 3px;
  color: inherit;
  font-size: 8.5px;
  line-height: .95;
  text-shadow: none;
}
.deck-tile small {
  margin-top: 4px;
  color: rgba(0,0,0,.7);
  font-size: 6.5px;
}
.battle-deck-panel .deck-strip.deck-eight {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 9px;
  margin: 0 0 18px;
}
.battle-deck-panel .deck-mini {
  height: 72px;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ref-line);
}
.battle-deck-panel .deck-mini > b {
  font-size: 32px;
}
.battle-deck-panel .deck-mini > span {
  top: 5px;
  left: 6px;
  color: var(--ref-cyan);
  font-size: 7px;
}

.league-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.league-row {
  margin: 0 0 12px;
}
.league-icon {
  display: none;
}
.league-row h2 {
  color: #fff7d2;
  font-size: 25px;
  text-transform: none;
  text-shadow: 3px 3px 0 #000;
}
.league-progress {
  height: 36px;
  margin: 0 0 18px;
  overflow: visible;
  background: #2f2b37;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: none;
}
.league-progress span {
  display: block;
  height: 100%;
  background: #48c300;
  border-radius: 0;
  box-shadow: none;
}
.league-progress b {
  color: #fff7d2;
  font-size: 11px;
  text-shadow: 2px 2px 0 #000;
}
.league-progress i {
  right: -11px;
  top: -10px;
  font-size: 38px;
  filter: drop-shadow(3px 3px 0 #000);
}
.fight-btn {
  min-height: 62px;
  color: #20150a;
  background: var(--ref-yellow);
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--ref-line);
  font-size: 11px;
  text-shadow: none;
  -webkit-text-stroke: 0;
}

.bottom-nav {
  min-height: calc(82px + var(--safe-bottom));
  padding: 0 env(safe-area-inset-right) var(--safe-bottom) env(safe-area-inset-left);
  background: #171229;
  border-top: 3px solid var(--ref-line);
  box-shadow: none;
}
.nav-btn {
  min-height: 82px;
  color: #fff7d2;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-shadow: 2px 2px 0 #000;
}
.nav-btn.active {
  min-height: 94px;
  margin: -14px 0 0;
  color: #fff7d2;
  background: #563b83;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: none;
}
.nav-btn:nth-child(1).active,
.nav-btn:nth-child(2).active,
.nav-btn:nth-child(3).active {
  background: #563b83;
}
.nav-icon {
  margin-bottom: 5px;
  font-size: 30px;
  filter: none;
}
.nav-label {
  color: #fff7d2;
  font-size: 8px;
}

.shop-spacer {
  height: min(46vh,420px);
}
.shop-grid {
  gap: 13px;
  margin: 0 0 110px;
}
.shop-offer {
  min-height: 292px;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  background: linear-gradient(180deg,#383170 0%,#26224c 100%);
  box-shadow: 5px 5px 0 var(--ref-line);
}
.shop-offer:nth-child(2) {
  background: linear-gradient(180deg,#343052 0%,#25233c 100%);
}
.shop-offer .pack-art {
  font-size: 82px;
  filter: drop-shadow(6px 7px 0 rgba(0,0,0,.38));
}
.shop-price {
  color: #fff7d2;
  background: #45c3c9;
  border-top: 3px solid var(--ref-line);
  box-shadow: none;
  font-size: 18px;
  text-shadow: 2px 2px 0 #000;
}

.collection-sticky {
  top: 0;
  margin: -4px -8px 14px;
  padding: 8px;
  background: #18152f;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 0 6px 0 rgba(0,0,0,.45);
}
.collection-sticky .deck-tabs {
  margin: 0 0 9px;
  gap: 8px;
}
.collection-sticky .deck-tile {
  flex-basis: 86px;
  min-height: 80px;
}
.collection-sticky .deck-tile span {
  font-size: 28px;
}
.deck-editor,
.collection-counter {
  padding: 8px;
  background: #242042;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(0,0,0,.55);
}
.deck-editor input,
.profile-panel input {
  height: 36px;
  color: #fff7d2;
  background: #100e20;
  border: 3px solid var(--ref-line);
  border-radius: 0;
}
.done-btn,
.delete-deck,
.avatar-picker button,
.avatar-strip button,
.deck-editor-row.colors button:not(.delete-deck) {
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ref-line);
}
.done-btn {
  background: #67f39d;
}
.delete-deck {
  background: #ff5d6c;
}
.filter-row {
  gap: 8px;
  margin: 12px 0 7px;
}
.filter-btn {
  padding: 9px 11px;
  color: var(--ref-muted);
  background: #292550;
  border: 2px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ref-line);
}
.filter-btn.active {
  color: #161324;
  background: var(--ref-yellow);
}

@media(max-width:370px) {
  .app-shell {
    padding-inline: 11px;
  }
  .topbar {
    gap: 7px;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .pixel-title {
    font-size: 8px;
  }
  .player-meta {
    font-size: 12px;
  }
  .topbar .stat-chip {
    min-width: 62px;
    padding-inline: 7px;
    font-size: 8px;
  }
  .profile-main {
    grid-template-columns: minmax(0,1fr) 92px;
  }
  .profile-avatar {
    width: 92px;
    height: 112px;
    font-size: 76px;
  }
  .profile-copy h2 {
    font-size: 31px;
  }
  .panel-heading h2,
  .league-row h2 {
    font-size: 22px;
  }
  .battle-deck-panel .deck-mini {
    height: 62px;
  }
  .shop-offer {
    min-height: 260px;
  }
}

/* V14.1 — reference-like battle hero */
.battle-hero-panel {
  min-height: 238px;
  padding: 20px 22px;
}
.battle-hero-panel .profile-main {
  grid-template-columns: minmax(0,1fr) 112px;
  align-items: center;
}
.battle-hero-panel .kicker {
  margin-bottom: 14px;
  color: var(--ref-cyan);
  font-family: "Press Start 2P";
  font-size: 8px;
  line-height: 1.35;
}
.battle-hero-panel .profile-copy h2 {
  max-width: 310px;
  margin-bottom: 14px;
  font-size: clamp(34px,8vw,48px);
}
.hero-copy {
  max-width: 275px;
  margin: 0 0 19px;
  color: #d7d0ec;
  font-size: 16px;
  line-height: 1.35;
  text-shadow: 2px 2px 0 rgba(0,0,0,.65);
}
.hero-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-find {
  width: min(100%, 240px);
  min-height: 54px;
  color: #23160a;
  background: var(--ref-yellow);
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--ref-line);
  font-size: 9px;
  text-shadow: none;
}
.hero-edit {
  width: 112px;
  min-height: 42px;
  font-size: 7px;
}
.battle-hero-panel .profile-avatar {
  width: 112px;
  height: 150px;
  align-self: end;
  font-size: 92px;
  transform: rotate(6deg);
}
.screen-home .league-panel .fight-btn {
  display: none;
}
.screen-home .league-panel {
  margin-top: 4px;
}

@media(max-width:370px) {
  .battle-hero-panel {
    min-height: 224px;
    padding: 17px 15px;
  }
  .battle-hero-panel .profile-main {
    grid-template-columns: minmax(0,1fr) 82px;
  }
  .battle-hero-panel .kicker {
    font-size: 6.5px;
  }
  .battle-hero-panel .profile-copy h2 {
    font-size: 31px;
  }
  .hero-copy {
    font-size: 13px;
  }
  .hero-actions-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .hero-find {
    width: 205px;
    min-height: 48px;
    font-size: 8px;
  }
  .hero-edit {
    width: 140px;
  }
  .battle-hero-panel .profile-avatar {
    width: 82px;
    height: 120px;
    font-size: 68px;
  }
}

/* V15 — deck screen behavior and resource bar corrections */
.topbar {
  min-height: 54px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}
.topbar .brand,
.brand,
.brand-mark,
.pixel-title,
.player-meta {
  display: none !important;
}
.topbar .wallet {
  display: flex;
  gap: 22px;
}
.topbar .stat-chip {
  min-width: 120px;
  min-height: 48px;
  padding: 10px 13px;
  color: #fff7d2;
  background: #332d55;
  border: 4px solid var(--ref-line);
  box-shadow: 5px 5px 0 var(--ref-line);
  font-family: "Press Start 2P";
  font-size: 17px;
}
.topbar .stat-chip.diamond {
  color: var(--ref-cyan);
}

.screen-collection .topbar {
  position: sticky;
  top: 0;
  z-index: 230;
  margin: -15px -16px 0;
  padding: 15px 16px 10px;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, #211b3e 0%, #18152f 100%);
  background-size: 4px 4px, auto;
}
.screen-collection .collection-sticky {
  position: sticky;
  top: 58px;
  z-index: 220;
  margin: 0 -8px 14px;
  background: #18152f;
  box-shadow: 0 8px 0 #0b0918, 0 14px 18px rgba(0,0,0,.55);
}
.screen-collection .gallery-grid {
  position: relative;
  z-index: 1;
}

.deck-tabs {
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.deck-tabs::-webkit-scrollbar {
  display: none;
}
.collection-sticky .deck-tile,
.deck-tabs .deck-tile {
  position: relative;
  flex: 0 0 86px;
  width: 86px;
  min-height: 86px;
  aspect-ratio: 1;
  padding: 6px;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  overflow: visible;
}
.deck-tile .deck-avatar {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  font-size: 29px;
}
.deck-tile b {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 9px;
  line-height: 1;
  text-align: center;
}
.deck-tile small {
  display: none !important;
}
.deck-tile.all-cards {
  background: #6f6498;
}
.deck-tile.editing {
  border-color: var(--ref-yellow);
  box-shadow: 0 0 0 3px var(--ref-yellow), 4px 4px 0 var(--ref-line);
}
.deck-tile.invalid .deck-warning {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #d83449;
  border: 3px solid var(--ref-line);
  box-shadow: 2px 2px 0 var(--ref-line);
}
.deck-warning i {
  font-size: 16px;
  font-style: normal;
  filter: grayscale(.8) brightness(1.8);
}
.deck-warning b {
  position: absolute;
  right: 2px;
  top: -4px;
  color: #fff;
  font-family: "Press Start 2P";
  font-size: 13px;
  text-shadow: 2px 2px 0 #000;
}
.deck-gear {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #d9d7e2;
  border: 3px solid var(--ref-line);
  box-shadow: 2px 2px 0 var(--ref-line);
  font-size: 18px;
}
.collection-counter {
  color: #fff7d2;
  font-family: "Press Start 2P";
  font-size: 9px;
}
.collection-sticky .deck-strip.deck-eight {
  grid-template-columns: repeat(8,minmax(38px,1fr));
  gap: 5px;
  margin: 0;
}
.collection-sticky .deck-mini {
  aspect-ratio: 1;
  height: auto;
  min-height: 42px;
  border: 2px solid var(--ref-line);
  box-shadow: 2px 2px 0 var(--ref-line);
}
.collection-sticky .deck-mini > b {
  font-size: 25px;
}

.cover-editor-backdrop,
.delete-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5,4,13,.74);
}
.cover-editor-modal,
.delete-confirm-modal {
  width: min(360px, 94vw);
  padding: 18px;
  color: #fff7d2;
  background: #292550;
  border: 4px solid var(--ref-line);
  box-shadow: 7px 7px 0 var(--ref-line);
}
.cover-editor-modal h2,
.delete-confirm-modal h2 {
  margin: 0 0 14px;
  font-size: 24px;
  text-shadow: 3px 3px 0 #000;
}
.cover-editor-modal label,
.cover-editor-label {
  display: block;
  margin: 12px 0 7px;
  color: var(--ref-cyan);
  font-family: "Press Start 2P";
  font-size: 8px;
}
.cover-editor-modal input {
  width: 100%;
  height: 42px;
  padding: 8px 10px;
  color: #fff7d2;
  background: #100e20;
  border: 3px solid var(--ref-line);
  font-family: "Russo One";
  font-size: 18px;
}
.cover-color-grid,
.cover-icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cover-color-grid button,
.cover-icon-grid button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--deckColor,#333);
  border: 3px solid var(--ref-line);
  box-shadow: 2px 2px 0 var(--ref-line);
  font-size: 25px;
}
.cover-color-grid button.active,
.cover-icon-grid button.active {
  border-color: var(--ref-yellow);
  box-shadow: 0 0 0 3px var(--ref-yellow), 2px 2px 0 var(--ref-line);
}
.cover-icon-grid span {
  color: var(--ref-muted);
  font-size: 13px;
}
.cover-actions {
  display: grid;
  grid-template-columns: 1fr 54px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.cover-save {
  grid-column: 2;
  width: 54px;
  height: 48px;
  color: #111;
  background: #67f39d;
  border: 3px solid var(--ref-line);
  box-shadow: 3px 3px 0 var(--ref-line);
  font-size: 24px;
}
.cover-delete {
  grid-column: 3;
  justify-self: start;
  width: 42px;
  height: 38px;
  background: #ff5d6c;
  border: 3px solid var(--ref-line);
  box-shadow: 3px 3px 0 var(--ref-line);
  font-size: 18px;
}
.delete-confirm-modal {
  text-align: center;
}
.delete-confirm-modal h2 {
  font-size: 20px;
  line-height: 1.15;
}
.delete-confirm-modal div {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.delete-confirm-modal button {
  min-width: 94px;
  min-height: 42px;
  background: var(--ref-yellow);
  border: 3px solid var(--ref-line);
  box-shadow: 3px 3px 0 var(--ref-line);
  font-family: "Press Start 2P";
  font-size: 8px;
}

@media(max-width:370px) {
  .topbar .wallet {
    gap: 10px;
  }
  .topbar .stat-chip {
    min-width: 96px;
    font-size: 13px;
  }
  .collection-sticky .deck-tile,
  .deck-tabs .deck-tile {
    flex-basis: 76px;
    width: 76px;
    min-height: 76px;
  }
  .deck-tile .deck-avatar {
    width: 35px;
    height: 35px;
    font-size: 24px;
  }
  .deck-tile b {
    font-size: 8px;
  }
}

/* V16 — deck screen polish: fixed chrome, sorted deck previews and true card zoom */
.app-shell.screen-collection {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(94px + var(--safe-bottom));
}
.app-shell.screen-collection .topbar {
  position: relative;
  top: auto;
  z-index: 270;
  flex: 0 0 auto;
}
.app-shell.screen-collection .collection-sticky {
  position: relative;
  top: auto;
  z-index: 290;
  flex: 0 0 auto;
  margin-bottom: 0;
  overflow: visible;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, #211b3e 0%, #18152f 100%);
  background-size: 4px 4px, auto;
}
.app-shell.screen-collection .collection-sticky::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -18px;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(180deg, #0b0918 0 7px, rgba(11,9,24,0));
}
.app-shell.screen-collection .gallery-grid {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
  padding: 18px 2px calc(28px + var(--safe-bottom));
  scrollbar-width: none;
}
.app-shell.screen-collection .gallery-grid::-webkit-scrollbar {
  display: none;
}

.deck-strip.deck-eight,
.collection-sticky .deck-strip.deck-eight {
  position: relative;
  z-index: 300;
  overflow: visible;
}
.deck-mini {
  overflow: visible;
}
.deck-mini:hover,
.deck-mini:focus {
  z-index: 5000;
}
.deck-popover {
  z-index: 5100;
}
.deck-mini:hover .deck-popover,
.deck-mini:focus .deck-popover {
  z-index: 5100;
}

.collection-sticky .deck-tile,
.deck-tabs .deck-tile {
  flex-basis: 92px;
  width: 92px;
  min-height: 92px;
  padding: 6px 5px 8px;
}
.deck-tile .deck-avatar {
  width: 56px;
  height: 56px;
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.38));
}
.deck-tile b {
  font-size: 9px;
  line-height: 1.02;
}
.deck-tile.invalid .deck-warning {
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ref-line);
}
.deck-warning i {
  font-size: 14px;
}
.deck-warning b {
  top: -3px;
  right: 2px;
  font-size: 11px;
}
.deck-gear {
  right: 5px;
  bottom: 5px;
  width: 27px;
  height: 27px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ref-line);
  font-size: 15px;
  line-height: 1;
}

.cover-preview {
  display: grid;
  place-items: center;
  margin: 0 0 14px;
}
.cover-preview .deck-tile {
  width: 118px;
  min-height: 118px;
  aspect-ratio: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 8px;
  pointer-events: none;
}
.cover-preview .deck-avatar {
  width: 72px;
  height: 72px;
  font-size: 52px;
}
.cover-preview .deck-tile b {
  font-size: 10px;
}

.card-view-backdrop {
  z-index: 6200;
}
.card-view-panel {
  width: min(350px, 94vw);
  max-height: calc(100dvh - 34px);
  overflow-y: auto;
  padding: 16px;
}
.card-view-panel .hearth-card.unified-card,
.card-view-panel .gallery-card.hearth-card.unified-card {
  width: min(292px, 76vw);
  height: auto;
  min-height: 0;
  aspect-ratio: 112 / 172;
  margin: 0 auto;
}
.card-view-panel .hearth-card.unified-card .hand-cost {
  top: -4.1%;
  left: -5.8%;
  width: clamp(30px, 30cqw, 42px);
  height: clamp(30px, 30cqw, 42px);
}
.card-view-panel .hearth-card.unified-card .hand-cost b {
  font-size: clamp(9px, 9.8cqw, 13px);
}
.card-view-panel .hearth-card.unified-card .hand-art {
  top: 4.65%;
  left: 6.25%;
  right: 6.25%;
  height: 43.6%;
}
.card-view-panel .hearth-card.unified-card .hand-emoji {
  font-size: clamp(43px, 46cqw, 82px);
}
.card-view-panel .hearth-card.unified-card .hand-name {
  top: 47.4%;
  left: 6.25%;
  right: 6.25%;
  min-height: 14.4%;
  padding: 3.4% 2%;
}
.card-view-panel .hearth-card.unified-card.name-short .hand-name { font-size: clamp(10px, 10.6cqw, 18px); }
.card-view-panel .hearth-card.unified-card.name-long .hand-name { font-size: clamp(8px, 8.4cqw, 15px); }
.card-view-panel .hearth-card.unified-card.name-tiny .hand-name { font-size: clamp(7px, 7.2cqw, 13px); }
.card-view-panel .hearth-card.unified-card .ability {
  top: 60.6%;
  left: 7.1%;
  right: 7.1%;
  height: 31.2%;
  padding: 3% 5.3%;
}
.card-view-panel .hearth-card.unified-card .ability.text-short { font-size: clamp(7px, 7.6cqw, 12px); }
.card-view-panel .hearth-card.unified-card .ability.text-medium { font-size: clamp(6px, 6.5cqw, 10px); }
.card-view-panel .hearth-card.unified-card .ability.text-long { font-size: clamp(5.2px, 5.45cqw, 8.6px); }
.card-view-panel .hearth-card.unified-card .ability.text-tiny { font-size: clamp(4.7px, 4.85cqw, 7.7px); }
.card-view-panel .hearth-card.unified-card .ability.text-micro { font-size: clamp(4.2px, 4.35cqw, 6.9px); }
.card-view-panel .hearth-card.unified-card .ability.text-nano { font-size: clamp(3.8px, 3.95cqw, 6.2px); }
.card-view-panel .hearth-card.unified-card .hand-stats {
  left: -3.6%;
  right: -3.6%;
  bottom: -8.1%;
}
.card-view-panel .hearth-card.unified-card .hand-stats i {
  width: clamp(32px, 30.3cqw, 44px);
  height: clamp(29px, 27.6cqw, 39px);
  font-size: clamp(7px, 7.2cqw, 11px);
}

@media(max-width:370px) {
  .collection-sticky .deck-tile,
  .deck-tabs .deck-tile {
    flex-basis: 84px;
    width: 84px;
    min-height: 84px;
  }
  .deck-tile .deck-avatar {
    width: 50px;
    height: 50px;
    font-size: 36px;
  }
  .card-view-panel .hearth-card.unified-card,
  .card-view-panel .gallery-card.hearth-card.unified-card {
    width: min(274px, 74vw);
  }
}

/* V17 — cover tuning, all-cards modal layout and calmer collection spacing */
.app-shell.screen-collection .gallery-grid {
  gap: 30px 10px;
  padding-top: 24px;
}
.app-shell.screen-collection .gallery-card {
  margin-bottom: 4px;
}

.collection-sticky .deck-tile,
.deck-tabs .deck-tile {
  flex-basis: 100px;
  width: 100px;
  min-height: 100px;
  padding: 7px 6px 9px;
}
.deck-tile .deck-avatar {
  width: 68px;
  height: 62px;
  font-size: 50px;
}
.deck-gear {
  top: 5px;
  left: 5px;
  right: auto;
  bottom: auto;
}
.deck-tile.invalid .deck-warning {
  top: 5px;
  right: 5px;
}
.deck-warning i {
  font-size: 16px;
}
.deck-warning b {
  display: none;
}

.cover-editor-modal {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px 24px 24px;
}
.cover-editor-modal h2 {
  margin-bottom: 18px;
  font-size: clamp(22px, 5.3vw, 31px);
  line-height: 1.12;
}
.cover-preview {
  margin-bottom: 18px;
}
.cover-preview .deck-tile {
  width: 150px;
  min-height: 150px;
  padding: 12px 10px 11px;
}
.cover-preview .deck-avatar {
  width: 104px;
  height: 96px;
  font-size: 78px;
}
.cover-preview .deck-tile b {
  font-size: 11px;
  line-height: 1.08;
}
.cover-editor-modal label {
  display: grid;
  gap: 8px;
  margin: 14px 0 12px;
}
.cover-editor-label {
  margin: 16px 0 9px;
}
.cover-color-grid,
.cover-icon-grid {
  gap: 10px;
}
.cover-color-grid button,
.cover-icon-grid button {
  width: 50px;
  height: 50px;
}
.cover-icon-grid button {
  font-size: 32px;
}
.cover-actions {
  grid-template-columns: 1fr 135px 52px 1fr;
  gap: 14px;
  margin-top: 22px;
}
.cover-save {
  grid-column: 2;
  width: 135px;
}
.cover-delete {
  grid-column: 3;
  width: 46px;
}

.card-view-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.card-view-tips {
  order: 1;
  width: 100%;
}
.card-view-tips:empty {
  display: none;
}
.card-view-tips .mechanic-boxes,
.card-view-panel .mechanic-boxes {
  width: 100%;
  margin-top: 0;
}
.card-view-tips .mechanic-box:first-child {
  margin-top: 0;
}
.card-view-card {
  order: 2;
}
.card-view-panel .unit-info-close {
  position: relative;
  order: 3;
  left: auto;
  bottom: auto;
  width: 64px;
  height: 46px;
  margin: 2px auto 0;
  transform: none;
}
.card-view-panel .hearth-card.unified-card,
.card-view-panel .gallery-card.hearth-card.unified-card {
  width: min(326px, 82vw);
}

@media(max-width:370px) {
  .collection-sticky .deck-tile,
  .deck-tabs .deck-tile {
    flex-basis: 90px;
    width: 90px;
    min-height: 90px;
  }
  .deck-tile .deck-avatar {
    width: 58px;
    height: 54px;
    font-size: 43px;
  }
  .cover-preview .deck-tile {
    width: 132px;
    min-height: 132px;
  }
  .cover-preview .deck-avatar {
    width: 90px;
    height: 84px;
    font-size: 66px;
  }
  .cover-actions {
    grid-template-columns: 1fr 128px 48px 1fr;
  }
  .cover-save {
    width: 128px;
  }
  .card-view-panel .hearth-card.unified-card,
  .card-view-panel .gallery-card.hearth-card.unified-card {
    width: min(302px, 80vw);
  }
}

/* V18 — stronger deck covers and safer collection spacing */
.app-shell.screen-collection .gallery-grid {
  gap: 52px 10px;
  padding-top: 28px;
}
.app-shell.screen-collection .gallery-card.deck-selected {
  border-color: #17110c;
  outline: 3px solid #ffd83d;
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 0 0 0 3px #ffbb16, 3px 4px 0 rgba(0,0,0,.55);
}
.card-view-panel .gallery-card.deck-selected,
.card-view-panel .hearth-card.unified-card.deck-selected {
  outline: 3px solid #ffd83d;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 0 0 0 3px #ffbb16, 4px 5px 0 rgba(0,0,0,.52);
}

.collection-sticky .deck-tile,
.deck-tabs .deck-tile {
  flex-basis: 108px;
  width: 108px;
  min-height: 108px;
  padding: 7px 6px 9px;
}
.deck-tile .deck-avatar {
  width: 82px;
  height: 72px;
  font-size: 64px;
}
.deck-tile b {
  font-size: 11px;
  line-height: 1.05;
}
.deck-gear {
  width: 24px;
  height: 24px;
  font-size: 12px;
  overflow: hidden;
}
.cover-preview .deck-tile {
  width: 115px;
  min-height: 115px;
}
.cover-preview .deck-avatar {
  width: 85px;
  height: 77px;
  font-size: 67px;
}
.cover-preview .deck-tile b {
  font-size: 10px;
  line-height: 1.05;
}

@media(max-width:370px) {
  .app-shell.screen-collection .gallery-grid {
    gap: 48px 10px;
  }
  .collection-sticky .deck-tile,
  .deck-tabs .deck-tile {
    flex-basis: 98px;
    width: 98px;
    min-height: 98px;
  }
  .deck-tile .deck-avatar {
    width: 72px;
    height: 64px;
    font-size: 56px;
  }
  .deck-tile b {
    font-size: 10px;
  }
  .cover-preview .deck-tile {
    width: 102px;
    min-height: 102px;
  }
  .cover-preview .deck-avatar {
    width: 74px;
    height: 67px;
    font-size: 57px;
  }
  .cover-preview .deck-tile b {
    font-size: 8.5px;
  }
}

/* V19 — readable deck covers and battle-matched selected cards */
.app-shell.screen-collection .gallery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
  gap: 14px 12px;
  grid-auto-rows: calc((min(100vw, 460px) - 48px) * 172 / 336);
  align-items: start;
  margin: 0 -10px;
  padding: 18px 6px calc(30px + var(--safe-bottom));
}
.app-shell.screen-collection .gallery-card {
  margin-bottom: 24px;
}
.app-shell.screen-collection .gallery-card.deck-selected,
.card-view-panel .gallery-card.deck-selected,
.card-view-panel .hearth-card.unified-card.deck-selected {
  border-color: #17110c;
  outline: 3px solid #ffd83d;
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--rarityAccent), 0 0 0 3px #ffbb16, 4px 5px 0 rgba(0,0,0,.52);
}
.app-shell.screen-collection .gallery-grid > .gallery-card.deck-selected .deck-check {
  display: grid;
}

.collection-sticky .deck-tile,
.deck-tabs .deck-tile {
  flex-basis: 85px;
  width: 85px;
  min-height: 94px;
  padding: 4px 5px 7px;
}
.collection-sticky .deck-tile .deck-avatar,
.deck-tabs .deck-tile .deck-avatar {
  width: 67px;
  height: 59px;
  font-size: 43px;
}
.collection-sticky .deck-tile b,
.deck-tabs .deck-tile b {
  font-size: 11px;
  line-height: 1.04;
}
.collection-sticky .deck-tile .deck-gear,
.deck-tabs .deck-tile .deck-gear {
  top: 4px;
  left: 4px;
  width: 15px;
  height: 15px;
  border-width: 2px;
  font-size: 7px;
  line-height: 1;
  overflow: visible;
}
.collection-sticky .deck-tile.invalid .deck-warning,
.deck-tabs .deck-tile.invalid .deck-warning {
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-width: 2px;
}
.collection-sticky .deck-warning i,
.deck-tabs .deck-warning i {
  font-size: 11px;
}
.cover-editor-modal h2 {
  text-align: center;
}

@media(max-width:370px) {
  .app-shell.screen-collection .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 10px;
    grid-auto-rows: calc((100vw - 44px) * 172 / 336);
    margin: 0 -9px;
    padding: 16px 5px calc(28px + var(--safe-bottom));
  }
  .collection-sticky .deck-tile,
  .deck-tabs .deck-tile {
    flex-basis: 77px;
    width: 77px;
    min-height: 85px;
    padding: 4px 4px 6px;
  }
  .collection-sticky .deck-tile .deck-avatar,
  .deck-tabs .deck-tile .deck-avatar {
    width: 60px;
    height: 53px;
    font-size: 38px;
  }
  .collection-sticky .deck-tile b,
  .deck-tabs .deck-tile b {
    font-size: 10px;
  }
}

@media(max-width:360px) {
  .app-shell.screen-collection .gallery-grid {
    grid-auto-rows: calc((100vw - 34px) * 172 / 336);
  }
}

/* V20 — battle lobby: scroll enabled for short screens */
body:has(.app-shell.screen-home) {
  overflow-x: hidden;
}

@media (min-width: 700px) {
  body:has(.app-shell.screen-home) {
    padding: 0;
  }
}

.app-shell.screen-home {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(8px, var(--safe-top)) 12px calc(82px + var(--safe-bottom));
}

.screen-home .topbar {
  flex: 0 0 auto;
  min-height: 38px;
  align-items: center;
  margin: 0;
}

.screen-home .topbar .wallet {
  gap: 10px;
}

.screen-home .topbar .stat-chip {
  min-width: 96px;
  min-height: 34px;
  padding: 7px 10px;
  border-width: 3px;
  box-shadow: 3px 3px 0 var(--ref-line);
  font-size: 12px;
}

.screen-home .ui-panel,
.screen-home .league-panel {
  margin: 0;
  border: 4px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 5px 5px 0 var(--ref-line);
}

.battle-profile-panel {
  flex: 0 0 auto;
  min-height: clamp(88px, 15dvh, 116px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) clamp(52px, 12vw, 66px);
  align-items: center;
  gap: clamp(9px, 2.5vw, 18px);
  padding: 10px 12px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.045) 0 1px, transparent 1px),
    linear-gradient(180deg, #41367f 0%, #25214d 100%);
  background-size: 5px 5px, auto;
}

.battle-profile-avatar {
  width: clamp(68px, 18vw, 94px);
  height: clamp(68px, 18vw, 94px);
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: clamp(58px, 16vw, 84px);
  line-height: 1;
  filter: drop-shadow(5px 6px 0 rgba(0,0,0,.5));
  cursor: pointer;
}

.battle-profile-copy {
  min-width: 0;
}

.battle-profile-copy h2 {
  margin: 0 0 8px;
  overflow: hidden;
  color: #fff3c8;
  font-family: "Russo One";
  font-size: clamp(31px, 9vw, 54px);
  line-height: .9;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 4px 5px 0 #000;
}

.battle-profile-copy p {
  margin: 0;
  overflow: hidden;
  color: #16eaff;
  font-family: "Press Start 2P";
  font-size: clamp(8px, 2.5vw, 14px);
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
}

.battle-profile-gear {
  width: clamp(52px, 12vw, 66px);
  height: clamp(52px, 12vw, 66px);
  display: grid;
  place-items: center;
  padding: 0;
  color: #eef0ff;
  background: #36315c;
  border: 4px solid #05040d;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 4px 4px 0 #05040d;
  font-size: clamp(31px, 8vw, 43px);
  line-height: 1;
  cursor: pointer;
}

.profile-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5,4,13,.78);
}

.profile-editor-modal {
  width: min(360px, 94vw);
  max-height: calc(100dvh - 36px);
  display: grid;
  gap: 10px;
  padding: 18px;
  color: #fff7d2;
  background: #292550;
  border: 4px solid var(--ref-line);
  box-shadow: 7px 7px 0 var(--ref-line);
}

.profile-editor-modal h2 {
  margin: 0 0 3px;
  color: #fff3c8;
  font-size: clamp(25px, 7vw, 34px);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000;
}

.profile-editor-modal label,
.profile-editor-label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--ref-cyan);
  font-family: "Press Start 2P";
  font-size: 8px;
  line-height: 1.2;
  text-transform: uppercase;
}

.profile-editor-modal input {
  width: 100%;
  height: 42px;
  min-width: 0;
  padding: 8px 10px;
  color: #fff7d2;
  background: #100e20;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  font-family: "Russo One";
  font-size: 18px;
}

.profile-avatar-list,
.profile-status-list {
  display: flex;
  gap: 8px;
  max-height: 62px;
  overflow: auto hidden;
  padding: 0 3px 5px 0;
  scrollbar-width: thin;
}

.profile-status-list {
  max-height: 78px;
  flex-direction: column;
  overflow: hidden auto;
}

.profile-avatar-list button,
.profile-status-list button {
  flex: 0 0 auto;
  min-height: 46px;
  color: #fff7d2;
  background: #17142f;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ref-line);
  cursor: pointer;
}

.profile-avatar-list button {
  width: 50px;
  font-size: 29px;
}

.profile-status-list button {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  text-align: left;
}

.profile-avatar-list button.active,
.profile-status-list button.active {
  border-color: var(--ref-yellow);
  box-shadow: 0 0 0 3px var(--ref-yellow), 3px 3px 0 var(--ref-line);
}

.profile-ok-btn {
  justify-self: center;
  width: min(180px, 100%);
  min-height: 48px;
  margin-top: 4px;
  color: #102015;
  background: #67f39d;
  border: 3px solid var(--ref-line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ref-line);
  font-family: "Press Start 2P";
  font-size: 10px;
  cursor: pointer;
}

.screen-home .battle-deck-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: visible;
  background: linear-gradient(180deg, #332e66 0%, #211d43 100%);
}

.screen-home .battle-deck-panel .panel-heading {
  flex: 0 0 auto;
  margin: 0 0 6px;
}

.screen-home .battle-deck-panel .panel-heading h2 {
  font-size: clamp(20px, 5.8vw, 29px);
  line-height: 1;
}

.screen-home .battle-deck-panel .panel-heading span,
.screen-home .battle-deck-panel .panel-heading b {
  display: none;
}

.screen-home .deck-choice-row {
  flex: 0 0 auto;
  gap: 8px;
  min-height: 82px;
  margin: 0 0 8px;
  padding: 0 3px 5px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.screen-home .deck-choice-row .deck-tile {
  flex: 0 0 85px;
  width: 85px;
  min-height: 94px;
  padding: 4px 5px 7px;
}

.screen-home .deck-choice-row .deck-tile .deck-avatar {
  width: 67px;
  height: 59px;
  font-size: 43px;
}

.screen-home .deck-choice-row .deck-tile b {
  font-size: 11px;
  line-height: 1.04;
}

.screen-home .deck-choice-row .deck-tile .deck-gear {
  display: none;
}

.screen-home .battle-deck-panel .deck-strip.deck-eight {
  flex: 1 1 auto;
  min-height: 94px;
  max-height: 126px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  overflow: visible;
}

.screen-home .battle-deck-panel .deck-mini {
  --popover-x: -50%;
  --popover-y: 8px;
  --popover-scale: .76;
  --popover-origin: bottom center;
  min-height: 0;
  height: auto;
  border-width: 2px;
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ref-line);
}

.screen-home .battle-deck-panel .deck-mini:nth-child(-n+4) {
  --popover-origin: top center;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(4n+1) {
  --popover-x: 0;
  --popover-origin: bottom left;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(4n) {
  --popover-x: 0;
  --popover-origin: bottom right;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(-n+4):nth-child(4n+1) {
  --popover-origin: top left;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(-n+4):nth-child(4n) {
  --popover-origin: top right;
}

.screen-home .battle-deck-panel .deck-mini > b {
  font-size: clamp(25px, 7.4vw, 34px);
}

.screen-home .battle-deck-panel .deck-mini > span {
  top: 4px;
  left: 5px;
  font-size: 6px;
}

.screen-home .battle-deck-panel .deck-popover {
  width: 174px;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 6900;
  transform: translate(var(--popover-x), var(--popover-y)) scale(var(--popover-scale));
  transform-origin: var(--popover-origin);
}

.screen-home .battle-deck-panel .deck-mini:nth-child(-n+4) .deck-popover {
  top: auto;
  bottom: calc(100% + 6px);
  transform-origin: bottom center;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(4n+1) .deck-popover {
  left: 0;
}

.screen-home .battle-deck-panel .deck-mini:nth-child(4n) .deck-popover {
  right: 0;
  left: auto;
}

.screen-home .battle-deck-panel .deck-mini:hover .deck-popover,
.screen-home .battle-deck-panel .deck-mini:focus .deck-popover {
  --popover-y: 0;
  transform: translate(var(--popover-x), var(--popover-y)) scale(var(--popover-scale));
}

.screen-home .battle-deck-panel .deck-popover .gallery-card {
  width: 174px;
  height: 252px;
  margin: 0;
}

.screen-home .battle-build-btn {
  flex: 0 0 auto;
  min-height: 38px;
  margin-top: 8px;
  font-size: 8px;
}

.screen-home .league-panel {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(136px, 42%);
  grid-template-rows: auto auto;
  gap: 8px 10px;
  padding: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #2f294f 0%, #211d37 100%);
}

.screen-home .league-row {
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
}

.screen-home .league-icon {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  border-width: 3px;
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ref-line);
  font-size: 21px;
}

.screen-home .league-row h2 {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(15px, 4.2vw, 22px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-home .league-progress {
  height: 26px;
  margin: 0;
  border-width: 3px;
  border-radius: 0;
}

.screen-home .league-progress b {
  font-size: 9px;
}

.screen-home .league-progress i {
  right: -8px;
  top: -9px;
  font-size: 28px;
}

.screen-home .league-panel .fight-btn {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  display: block;
  min-height: 74px;
  color: #1b1004;
  background: linear-gradient(180deg, #fff15b 0%, #ffb320 44%, #ff5f1f 100%);
  border: 4px solid #080711;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.38), 4px 4px 0 var(--ref-line);
  font-size: clamp(12px, 3.8vw, 19px);
  text-shadow: 1px 1px 0 rgba(255,255,255,.6);
}

.screen-home .bottom-nav {
  min-height: calc(76px + var(--safe-bottom));
}

.screen-home .nav-btn {
  min-height: 76px;
  padding-top: 8px;
}

.screen-home .nav-btn.active {
  min-height: 88px;
  margin-top: -12px;
}


@media(max-height: 640px) {
  .app-shell.screen-home {
    gap: 6px;
    padding-top: max(6px, var(--safe-top));
    padding-bottom: calc(76px + var(--safe-bottom));
  }

  .screen-home .topbar {
    min-height: 34px;
  }

  .screen-home .topbar .stat-chip {
    min-width: 86px;
    min-height: 30px;
    font-size: 10px;
  }

  .battle-profile-panel {
    min-height: 80px;
    padding: 8px 10px;
  }

  .battle-profile-avatar {
    width: 62px;
    height: 62px;
    font-size: 53px;
  }

  .battle-profile-copy h2 {
    margin-bottom: 5px;
    font-size: clamp(27px, 8vw, 38px);
  }

  .battle-profile-copy p {
    font-size: 7px;
  }

  .battle-profile-gear {
    width: 48px;
    height: 48px;
    font-size: 29px;
  }

  .screen-home .battle-deck-panel {
    padding: 8px;
  }

  .screen-home .deck-choice-row {
    min-height: 70px;
    margin-bottom: 6px;
  }

  .screen-home .deck-choice-row .deck-tile {
    flex-basis: 74px;
    width: 74px;
    min-height: 80px;
  }

  .screen-home .deck-choice-row .deck-tile .deck-avatar {
    width: 58px;
    height: 49px;
    font-size: 36px;
  }

  .screen-home .battle-deck-panel .deck-strip.deck-eight {
    min-height: 82px;
    max-height: 100px;
    gap: 5px;
  }

  .screen-home .league-panel {
    padding: 8px;
  }

  .screen-home .league-panel .fight-btn {
    min-height: 62px;
  }

  .screen-home .bottom-nav {
    min-height: calc(70px + var(--safe-bottom));
  }

  .screen-home .nav-btn {
    min-height: 70px;
  }

  .screen-home .nav-btn.active {
    min-height: 80px;
  }
}

@media(max-width: 370px) {
  .app-shell.screen-home {
    padding-inline: 9px;
  }

  .screen-home .topbar .wallet {
    gap: 7px;
  }

  .screen-home .topbar .stat-chip {
    min-width: 82px;
    font-size: 10px;
  }

  .battle-profile-panel {
    grid-template-columns: auto minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .battle-profile-copy h2 {
    font-size: 27px;
  }

  .battle-profile-gear {
    width: 48px;
    height: 48px;
    font-size: 29px;
  }

  .screen-home .deck-choice-row .deck-tile {
    flex-basis: 77px;
    width: 77px;
    min-height: 85px;
    padding: 4px 4px 6px;
  }

  .screen-home .deck-choice-row .deck-tile .deck-avatar {
    width: 60px;
    height: 53px;
    font-size: 38px;
  }

  .screen-home .deck-choice-row .deck-tile b {
    font-size: 10px;
  }

  .screen-home .league-panel {
    grid-template-columns: minmax(0, 1fr) 126px;
    gap: 7px;
  }
}

/* V21 — lobby reference sizing and persistent deck selection */
.topbar,
.screen-home .topbar,
.app-shell.screen-collection .topbar,
.app-shell.screen-shop .topbar {
  position: relative;
  top: auto;
  z-index: 270;
  flex: 0 0 38px;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
}

.topbar .wallet,
.screen-home .topbar .wallet,
.app-shell.screen-collection .topbar .wallet,
.app-shell.screen-shop .topbar .wallet {
  gap: 10px;
}

.topbar .stat-chip,
.screen-home .topbar .stat-chip,
.app-shell.screen-collection .topbar .stat-chip,
.app-shell.screen-shop .topbar .stat-chip {
  min-width: 96px;
  min-height: 34px;
  height: 34px;
  padding: 7px 10px;
  border-width: 3px;
  box-shadow: 3px 3px 0 var(--ref-line);
  font-size: 12px;
}

.battle-profile-panel {
  grid-template-columns: auto minmax(0, 1fr) 46px;
  gap: 12px;
  min-height: 96px;
  padding: 10px 12px;
}

.battle-profile-avatar {
  width: 76px;
  height: 76px;
  font-size: 66px;
}

.battle-profile-copy {
  min-width: 0;
  overflow: visible;
}

.battle-profile-copy h2 {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.battle-profile-copy h2.profile-name-short { font-size: 43px; }
.battle-profile-copy h2.profile-name-medium { font-size: 35px; }
.battle-profile-copy h2.profile-name-long { font-size: 28px; }
.battle-profile-copy h2.profile-name-tiny { font-size: 23px; }

.battle-profile-copy p {
  overflow: visible;
  font-size: 10px;
  text-overflow: clip;
  white-space: nowrap;
}

.battle-profile-gear {
  justify-self: end;
  width: 46px;
  height: 46px;
  border-width: 3px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 3px 3px 0 #05040d;
  font-size: 28px;
}

.screen-home .battle-deck-panel {
  flex: 0 0 auto;
  min-height: 0;
  padding: 9px 10px 10px;
}

.screen-home .battle-deck-panel .panel-heading {
  margin-bottom: 6px;
}

.screen-home .deck-choice-row {
  min-height: 92px;
  margin-bottom: 8px;
}

.screen-home .deck-choice-row .deck-tile.active,
.app-shell.screen-collection .deck-tabs .deck-tile.active {
  border-color: #ffe451;
  box-shadow: 0 0 0 3px #ffe451, 4px 4px 0 var(--ref-line);
}

.screen-home .deck-choice-row .deck-tile.active {
  transform: translateY(-1px);
}

.screen-home .battle-deck-panel .deck-strip.deck-eight {
  flex: 0 0 auto;
  grid-template-rows: repeat(2, 54px);
  min-height: 0;
  max-height: none;
}

.screen-home .battle-deck-panel .deck-mini {
  height: 54px;
}

.screen-home .league-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.screen-home .league-panel::before {
  content: none;
  display: none;
}

.screen-home .league-panel::after {
  content: none;
  display: none;
}

.screen-home .league-panel > * {
  position: relative;
}

.screen-home .league-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  overflow: visible;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, #2b2348 0%, #211a3b 100%);
  background-size: 4px 4px, auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.screen-home .league-intro {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 4px 4px 2px;
}

.screen-home .league-intro h2 {
  margin: 0 0 7px;
  color: #fffaf0;
  font-family: "Russo One";
  font-size: clamp(19px, 5.6vw, 34px);
  line-height: .9;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 4px 5px 0 #000;
}

.screen-home .league-intro p {
  max-width: 390px;
  margin: 0;
  color: #d8d2f0;
  font-family: "Russo One";
  font-size: clamp(10.5px, 2.8vw, 16.8px);
  line-height: 1.3;
  text-shadow: 2px 2px 0 rgba(0,0,0,.72);
}

.screen-home .league-row {
  flex: 0 0 auto;
  justify-content: flex-start;
  gap: 12px;
  min-height: 44px;
}

.screen-home .league-icon {
  width: 54px;
  height: 44px;
  background: #21152f;
  border: 0;
  box-shadow: none;
  font-size: 31px;
}

.screen-home .league-row h2 {
  flex: 1 1 auto;
  overflow: visible;
  font-size: 21px;
  line-height: 1.05;
  text-overflow: clip;
  white-space: nowrap;
}

.screen-home .league-progress {
  flex: 0 0 auto;
  height: 38px;
  margin: 0;
  overflow: visible;
  background: linear-gradient(180deg, #4c4a4b 0%, #272626 100%);
  border: 3px solid #05040b;
  border-radius: 7px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 2px 0 rgba(0,0,0,.5);
}

.screen-home .league-progress span {
  border-radius: 3px 0 0 3px;
  background: linear-gradient(180deg, #59dd00 0%, #39ad00 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.16);
}

.screen-home .league-progress i {
  right: -9px;
  top: -15px;
  font-size: 44px;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.5));
}

.screen-home .fight-frame {
  flex: 0 0 103px;
  display: flex;
  padding: 6px;
  background: #6e6878;
  border: 4px solid #d6d0dc;
  box-shadow: inset 0 0 0 2px rgba(30,22,50,.45), 4px 4px 0 var(--ref-line);
}

.screen-home .league-panel .fight-btn {
  grid-column: auto;
  grid-row: auto;
  position: relative;
  flex: 1 1 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: #fff4c6;
  background: linear-gradient(180deg, #ffc42d 0%, #f4a917 47%, #b16e05 100%);
  border: 4px solid #904810;
  border-radius: 0;
  box-shadow: inset 0 0 0 3px rgba(255,238,143,.24), inset 0 -12px 0 rgba(109,48,0,.17);
  font-size: 27px;
  line-height: 1;
  text-align: center;
  text-shadow: 2px 2px 0 #8b4510, -1px -1px 0 #8b4510, 1px -1px 0 #8b4510, -1px 1px 0 #8b4510;
  -webkit-text-stroke: 1px #8b4510;
}

.screen-home .league-panel .fight-btn::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255,236,140,.62);
  pointer-events: none;
}
.screen-home .league-panel .fight-btn.has-streak {
  flex-direction: column;
  gap: 3px;
  padding-top: 10%;
  justify-content: center;
}
.fight-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: 'Russo One', sans-serif;
  color: #3a1500;
  text-shadow: none;
  -webkit-text-stroke: 0;
  letter-spacing: 0.02em;
  line-height: 1;
}
.fight-streak-coin {
  width: 13px;
  height: 13px;
  display: inline-block;
  vertical-align: middle;
}

@media(max-height: 640px) {
  .battle-profile-panel {
    min-height: 84px;
    padding: 8px 10px;
  }

  .battle-profile-avatar {
    width: 62px;
    height: 62px;
    font-size: 53px;
  }

  .battle-profile-copy h2.profile-name-short { font-size: 34px; }
  .battle-profile-copy h2.profile-name-medium { font-size: 29px; }
  .battle-profile-copy h2.profile-name-long { font-size: 24px; }
  .battle-profile-copy h2.profile-name-tiny { font-size: 20px; }

  .battle-profile-copy p { font-size: 8px; }

  .battle-profile-gear {
    width: 42px;
    height: 42px;
    font-size: 25px;
  }

  .screen-home .battle-deck-panel {
    padding: 8px;
  }

  .screen-home .deck-choice-row {
    min-height: 78px;
    margin-bottom: 6px;
  }

  .screen-home .battle-deck-panel .deck-strip.deck-eight {
    grid-template-rows: repeat(2, 46px);
  }

  .screen-home .battle-deck-panel .deck-mini {
    height: 46px;
  }

  .screen-home .league-panel {
    gap: 9px;
    padding: 0;
  }

  .screen-home .league-card {
    gap: 7px;
    padding: 9px;
  }

  .screen-home .league-intro {
    padding: 0;
  }

  .screen-home .league-intro h2 {
    margin-bottom: 4px;
    font-size: clamp(15px, 4.2vw, 22px);
  }

  .screen-home .league-intro p {
    font-size: clamp(8.4px, 2.3vw, 11.2px);
    line-height: 1.25;
  }

  .screen-home .league-row {
    min-height: 36px;
  }

  .screen-home .league-icon {
    width: 45px;
    height: 36px;
    font-size: 25px;
  }

  .screen-home .league-row h2 {
    font-size: 17px;
  }

  .screen-home .league-progress {
    height: 30px;
  }

  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 5px;
    border-width: 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 21px;
  }
}

@media(max-width: 370px) {
  .topbar .wallet,
  .screen-home .topbar .wallet,
  .app-shell.screen-collection .topbar .wallet,
  .app-shell.screen-shop .topbar .wallet {
    gap: 7px;
  }

  .topbar .stat-chip,
  .screen-home .topbar .stat-chip,
  .app-shell.screen-collection .topbar .stat-chip,
  .app-shell.screen-shop .topbar .stat-chip {
    min-width: 82px;
    font-size: 10px;
  }

  .battle-profile-panel {
    grid-template-columns: auto minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .battle-profile-copy h2.profile-name-short { font-size: 33px; }
  .battle-profile-copy h2.profile-name-medium { font-size: 28px; }
  .battle-profile-copy h2.profile-name-long { font-size: 23px; }
  .battle-profile-copy h2.profile-name-tiny { font-size: 19px; }

  .battle-profile-copy p {
    font-size: 7px;
  }

  .battle-profile-gear {
    width: 42px;
    height: 42px;
    font-size: 25px;
  }

  .screen-home .league-row {
    gap: 8px;
  }

  .screen-home .league-panel {
    gap: 9px;
    padding: 0;
  }

  .screen-home .league-card {
    gap: 7px;
    padding: 9px;
  }

  .screen-home .league-intro {
    padding: 0;
  }

  .screen-home .league-intro h2 {
    margin-bottom: 4px;
    font-size: 16px;
  }

  .screen-home .league-intro p {
    font-size: 8.4px;
    line-height: 1.18;
  }

  .screen-home .league-icon {
    width: 46px;
  }

  .screen-home .league-row h2 {
    font-size: 17px;
  }

  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 5px;
    border-width: 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 21px;
  }
}

/* V22 — arena panel styled after the duel reference */
.screen-home .league-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.screen-home .league-card {
  position: relative;
  isolation: isolate;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 14px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(180deg, #3a3171 0%, #2b275c 46%, #25204a 100%);
  background-size: 4px 4px, auto;
  border: 4px solid #05040d;
  box-shadow: 7px 7px 0 #05040d, inset 0 0 0 2px rgba(255,255,255,.05);
}

.screen-home .league-card::after {
  content: "🃏";
  position: absolute;
  right: -12px;
  bottom: 80px;
  z-index: 0;
  width: 84px;
  height: 112px;
  display: grid;
  place-items: center;
  color: #1e1b28;
  background:
    repeating-linear-gradient(0deg, rgba(80,64,40,.12) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #fff5df 0%, #e8dcc8 100%);
  border: 3px solid #17121a;
  border-radius: 10px;
  box-shadow: 4px 5px 0 rgba(0,0,0,.5);
  font-size: 46px;
  transform: rotate(8deg);
  opacity: .82;
  pointer-events: none;
}

.screen-home .league-card > * {
  position: relative;
  z-index: 1;
}

.screen-home .league-intro {
  flex: 0 0 auto;
  padding: 0;
}

.screen-home .league-intro h2 {
  margin: 0 0 7px;
  color: #fffaf0;
  font-size: clamp(19px, 5.6vw, 34px);
  line-height: .92;
  text-shadow: 4px 5px 0 #070612;
}

.screen-home .league-intro p {
  max-width: calc(100% - 58px);
  color: #d9d3ef;
  font-size: clamp(10.5px, 2.8vw, 16.8px);
  line-height: 1.3;
  text-shadow: 2px 2px 0 rgba(0,0,0,.72);
}

.screen-home .league-row {
  min-height: 42px;
  gap: 10px;
}

.screen-home .league-icon {
  width: 48px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #21142b;
  border: 0;
  box-shadow: none;
  font-size: 29px;
}

.screen-home .league-row h2 {
  color: #fff4c6;
  font-size: clamp(17px, 4.8vw, 26px);
  text-shadow: 3px 3px 0 #05040d;
}

.screen-home .league-progress {
  height: 36px;
  margin: 0;
  padding-right: 34px;
  overflow: visible;
  background: linear-gradient(180deg, #3f3d3f 0%, #252323 100%);
  border: 3px solid #05040d;
  border-radius: 7px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 2px 0 rgba(0,0,0,.5);
}
.screen-home .league-progress b.league-xp-label {
  right: 34px;
  font-size: 14px;
  line-height: 36px;
}

.screen-home .league-progress span {
  background: linear-gradient(180deg, #59dd00 0%, #38ad00 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.24), inset 0 -3px 0 rgba(0,0,0,.18);
}

.screen-home .league-progress i {
  right: -10px;
  top: -16px;
  font-size: 43px;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.5));
}

.screen-home .fight-frame {
  flex: 0 0 103px;
  display: flex;
  width: 100%;
  padding: 8px 5px 5px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.screen-home .league-panel .fight-btn {
  height: 100%;
  color: #1b1506;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.16) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #ffe85b 0%, #ffd321 52%, #f2b900 100%);
  border: 4px solid #05040d;
  box-shadow: 6px 6px 0 #05040d, inset 0 0 0 2px rgba(255,244,165,.32);
  font-family: "Press Start 2P";
  font-size: 15px;
  line-height: 1.1;
  text-shadow: none;
  -webkit-text-stroke: 0;
}

.screen-home .league-panel .fight-btn::after {
  content: none;
  display: none;
}

@media(max-height: 640px) {
  .screen-home .league-card {
    gap: 8px;
    padding: 11px 10px 10px;
  }

  .screen-home .league-card::after {
    right: -16px;
    bottom: 67px;
    width: 70px;
    height: 94px;
    font-size: 38px;
  }

  .screen-home .league-intro h2 {
    margin-bottom: 4px;
    font-size: clamp(15px, 4.2vw, 22px);
  }

  .screen-home .league-intro p {
    max-width: calc(100% - 42px);
    font-size: clamp(8.4px, 2.3vw, 11.2px);
    line-height: 1.22;
  }

  .screen-home .league-row {
    min-height: 36px;
  }

  .screen-home .league-icon {
    width: 43px;
    height: 36px;
    font-size: 24px;
  }

  .screen-home .league-row h2 {
    font-size: 17px;
  }

  .screen-home .league-progress {
    height: 30px;
  }

  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 6px 4px 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 12px;
  }
}

@media(max-width: 370px) {
  .screen-home .league-card {
    gap: 8px;
    padding: 11px 10px 10px;
  }

  .screen-home .league-card::after {
    display: none;
  }

  .screen-home .league-intro h2 {
    margin-bottom: 4px;
    font-size: 16px;
  }

  .screen-home .league-intro p {
    max-width: 100%;
    font-size: 8.4px;
    line-height: 1.18;
  }

  .screen-home .league-icon {
    width: 43px;
  }

  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 6px 4px 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 12px;
  }
}

/* V23 — fixed resources and tighter arena card */
.topbar,
.screen-home .topbar,
.app-shell.screen-collection .topbar,
.app-shell.screen-shop .topbar {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 7400;
  width: min(100%, 460px);
  height: calc(50px + var(--safe-top));
  min-height: calc(50px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: max(8px, var(--safe-top)) 12px 8px;
  transform: translateX(-50%);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(29,25,53,.98) 0%, rgba(23,21,44,.94) 100%);
  background-size: 4px 4px, auto;
  border-bottom: 3px solid var(--ref-line);
  box-shadow: 0 5px 0 rgba(5,4,13,.72);
}

.app-shell.screen-home,
.app-shell.screen-collection,
.app-shell.screen-shop {
  padding-top: calc(58px + var(--safe-top));
}

.topbar .wallet,
.screen-home .topbar .wallet,
.app-shell.screen-collection .topbar .wallet,
.app-shell.screen-shop .topbar .wallet {
  gap: 10px;
}

.topbar .stat-chip,
.screen-home .topbar .stat-chip,
.app-shell.screen-collection .topbar .stat-chip,
.app-shell.screen-shop .topbar .stat-chip {
  min-width: 98px;
  min-height: 36px;
  height: 36px;
  padding: 5px 10px 5px 6px;
  gap: 7px;
  font-size: 12px;
}

.topbar .stat-chip img {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.52));
}

.screen-home .league-panel {
  display: block;
  padding: 0;
  overflow: visible;
}

.screen-home .league-card {
  height: auto;
  min-height: 0;
  gap: 10px;
  padding-bottom: 12px;
}

.screen-home .league-card::after {
  content: none;
  display: none;
}

.screen-home .fight-frame {
  flex: 0 0 103px;
  padding: 8px 5px 5px;
  margin-top: 2px;
}

.screen-home .league-panel .fight-btn {
  font-size: 23px;
}

@media(max-height: 640px) {
  .app-shell.screen-home {
    padding-top: calc(56px + var(--safe-top));
  }

  .screen-home .league-card {
    gap: 8px;
    padding-bottom: 10px;
  }

  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 6px 4px 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 18px;
  }
}

@media(max-width: 370px) {
  .screen-home .fight-frame {
    flex-basis: 78px;
    padding: 6px 4px 3px;
  }

  .screen-home .league-panel .fight-btn {
    font-size: 18px;
  }
}

/* V24 — single deck selection and standardized resource chips */
.topbar,
.screen-home .topbar,
.app-shell.screen-collection .topbar,
.app-shell.screen-shop .topbar {
  width: min(100%, 460px);
  height: calc(60px + var(--safe-top));
  min-height: calc(60px + var(--safe-top));
  align-items: center;
  justify-content: flex-start;
  padding: max(7px, var(--safe-top)) 12px 7px;
}

.app-shell.screen-home,
.app-shell.screen-collection,
.app-shell.screen-shop {
  padding-top: calc(60px + var(--safe-top));
}

.app-shell.screen-collection .collection-sticky {
  position: sticky;
  top: calc(60px + var(--safe-top));
  z-index: 7300;
  margin: 0 -16px;
}

.topbar .wallet,
.screen-home .topbar .wallet,
.app-shell.screen-collection .topbar .wallet,
.app-shell.screen-shop .topbar .wallet {
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  width: auto;
}

.topbar .stat-chip,
.screen-home .topbar .stat-chip,
.app-shell.screen-collection .topbar .stat-chip,
.app-shell.screen-shop .topbar .stat-chip {
  min-width: 124px;
  width: auto;
  min-height: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  line-height: 1;
  white-space: nowrap;
}

.topbar .stat-icon {
  width: 36px;
  height: 30px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 4px;
  box-sizing: border-box;
}

.topbar .stat-icon img,
.topbar .stat-chip img {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.52));
}

.topbar .stat-chip.coin .stat-icon {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  padding-left: 0;
}

.topbar .stat-chip.coin .stat-icon img {
  width: 26px;
  height: 26px;
}

.topbar .stat-value {
  display: block;
  color: currentColor;
  font-family: "Press Start 2P";
  font-size: 18px;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(0,0,0,.56);
}

.app-shell.screen-collection .deck-tabs .deck-tile.active {
  border-color: var(--ref-line);
  box-shadow: 4px 4px 0 var(--ref-line);
}

@media(max-width: 370px) {
  .topbar .wallet,
  .screen-home .topbar .wallet,
  .app-shell.screen-collection .topbar .wallet,
  .app-shell.screen-shop .topbar .wallet {
    gap: 8px;
  }

  .topbar .stat-chip,
  .screen-home .topbar .stat-chip,
  .app-shell.screen-collection .topbar .stat-chip,
  .app-shell.screen-shop .topbar .stat-chip {
    min-width: 106px;
    height: 38px;
    min-height: 38px;
    padding: 4px 9px 4px 5px;
    gap: 6px;
  }

  .topbar .stat-icon {
    width: 32px;
    height: 29px;
    flex-basis: 32px;
    padding-left: 3px;
  }

  .topbar .stat-icon img,
  .topbar .stat-chip img {
    width: 26px;
    height: 26px;
  }

  .topbar .stat-chip.coin .stat-icon,
  .topbar .stat-chip.coin .stat-icon img {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .topbar .stat-value {
    font-size: 15px;
  }
}

/* V25 — collection chrome touches the fixed resource bar */
body:has(.app-shell.screen-collection) {
  padding-top: 0;
}

.app-shell.screen-collection {
  padding-top: 0;
}

/* V26 — collection grid alignment and modal layer order */
.app-shell.screen-collection .collection-sticky::after {
  content: none;
}

.app-shell.screen-collection .gallery-grid {
  margin-top: calc(60px + var(--safe-top) + 20px);
  padding-top: 0;
}

.unit-info-backdrop,
.card-view-backdrop {
  z-index: 10000;
}

/* V27 — one-slot booster shop */
.app-shell.screen-shop {
  padding-left: 14px;
  padding-right: 14px;
  background:
    linear-gradient(rgba(255,255,255,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px),
    linear-gradient(180deg, #211a45 0%, #151229 100%);
  background-size: 16px 16px, 16px 16px, auto;
}

.app-shell.screen-shop .shop-spacer {
  height: clamp(270px, 43dvh, 430px);
}

.app-shell.screen-shop .shop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: clamp(210px, 48vw, 224px);
  gap: 0;
  margin: 0 0 calc(116px + var(--safe-bottom));
}

.app-shell.screen-shop .shop-offer.booster-slot {
  width: 100%;
  min-height: 0;
  aspect-ratio: 220 / 338;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 50px;
  padding: 0;
  overflow: hidden;
  color: inherit;
  text-align: center;
  appearance: none;
  cursor: pointer;
  border: 3px solid #05040b;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 43%, rgba(108,88,183,.44) 0 72px, transparent 74px),
    linear-gradient(180deg, #45378b 0%, #292053 100%);
  box-shadow: 4px 5px 0 #05040b;
}

.app-shell.screen-shop .booster-slot h2 {
  margin: 12px 8px 0;
  color: #fff2c1;
  font-family: "Press Start 2P", monospace;
  font-size: 17px;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 rgba(0,0,0,.62);
}

.app-shell.screen-shop .booster-slot .pack-art {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 24px 14px;
  filter: none;
  animation: none;
}

.booster-pack-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.28));
  transform-origin: center bottom;
  animation: booster-shop-float 2.4s ease-in-out infinite;
}

.app-shell.screen-shop .booster-slot .shop-price {
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
  color: #f5e7b1;
  background: linear-gradient(180deg, #ffc52e 0%, #ffb51d 58%, #f0a30e 100%);
  border: 0;
  border-top: 3px solid #05040b;
  box-shadow: inset 0 5px 0 rgba(255,255,255,.22);
  font-family: "Press Start 2P", monospace;
  font-size: 29px;
  line-height: 1;
  text-shadow:
    2px 0 0 #05040b,
    -2px 0 0 #05040b,
    0 2px 0 #05040b,
    0 -2px 0 #05040b,
    3px 3px 0 rgba(0,0,0,.42);
}

.app-shell.screen-shop .booster-slot:disabled {
  opacity: 1;
  filter: saturate(.86) brightness(.9);
  cursor: default;
}

.app-shell.screen-shop .shop-price-icon {
  width: 35px;
  height: 35px;
  object-fit: contain;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.45));
}

@keyframes booster-shop-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  45% { transform: translateY(-7px) rotate(1.5deg); }
  70% { transform: translateY(-3px) rotate(-.8deg); }
}

@media(max-height: 640px) {
  .app-shell.screen-shop .shop-spacer {
    height: clamp(210px, 36dvh, 260px);
  }

  .app-shell.screen-shop .shop-offer.booster-slot {
    width: clamp(190px, 46vw, 210px);
    grid-template-rows: 44px minmax(0, 1fr) 46px;
  }

  .app-shell.screen-shop .booster-slot h2 {
    margin-top: 10px;
    font-size: 15px;
  }

  .app-shell.screen-shop .booster-slot .shop-price {
    font-size: 25px;
  }

  .app-shell.screen-shop .shop-price-icon {
    width: 31px;
    height: 31px;
  }
}

/* ── Card Upgrade System ─────────────────────────────────── */

/* Level-up arrow on gallery cards (viewer mode) */
.gallery-card .levelup-arrow {
  position: absolute;
  z-index: 16;
  top: -8px;
  right: -6px;
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px #39d640);
  animation: levelup-arrow-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes levelup-arrow-pulse {
  0%,100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 4px #39d640); }
  50%      { transform: translateY(-4px) scale(1.12); filter: drop-shadow(0 0 10px #6fff72); }
}

/* Upgrade UI panel (below card in modal) */
.upgrade-ui {
  width: 100%;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Progress bar */
.upgrade-bar {
  position: relative;
  height: 28px;
  background: #0e0c1c;
  border: 3px solid #332d50;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upgrade-bar-fill {
  position: absolute;
  inset: 0;
  height: 100%;
  background: linear-gradient(90deg, #1d5c22, #2e8a35);
  transition: width .4s ease;
}
.upgrade-bar.ready .upgrade-bar-fill {
  background: linear-gradient(90deg, #22a12a, #4dff5a);
  box-shadow: inset 0 0 12px rgba(110,255,120,.45);
}
.upgrade-bar-label {
  position: relative;
  z-index: 2;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #e6ffe7;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: .04em;
}

/* Upgrade button */
.upgrade-btn {
  width: 100%;
  padding: 14px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  letter-spacing: .06em;
  color: #6b5f3a;
  background: linear-gradient(180deg, #3a3328, #26211a);
  border: 3px solid #4a3f28;
  border-radius: 6px;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 2px 3px 0 #0a090e;
  opacity: .72;
  transition: filter .15s, transform .1s;
}
.upgrade-btn.ready {
  color: #241900;
  background: linear-gradient(180deg, #ffe97a, #e8a812);
  border-color: #8a5a00;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.22), 0 0 14px rgba(255,208,40,.55), 2px 3px 0 #3a2400;
  cursor: pointer;
  opacity: 1;
}
.upgrade-btn.ready:active { transform: translateY(2px); filter: brightness(.9); }
.upgrade-coin-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
}
.upgrade-coin-img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* Green highlight for upgraded stats */
.hand-stats i.stat-upgraded {
  color: #4eff4e;
  text-shadow: 0 0 8px #00dd00, 0 0 3px #00cc00;
  font-weight: 900;
}
.ability.effect-upgraded {
  /* fallback if whole-text upgrade ever used */
  color: #1a6b1a !important;
}
.ability.effect-upgraded .effect-keyword { color: inherit !important; }
/* Only the changed token gets highlighted */
.effect-upgraded-part {
  color: #1a6b1a;
  font-weight: 700;
}

/* Level-up star particles */
.levelup-star {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
  z-index: 200;
  animation: levelup-star-fly 1s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes levelup-star-fly {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  20%  { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 0; }
}

/* Upgrade smoke puff */
.upgrade-smoke {
  position: absolute;
  bottom: 18px;
  left: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210,210,220,.85) 0%, rgba(170,170,185,.5) 55%, transparent 100%);
  pointer-events: none;
  z-index: 300;
  transform: translate(-50%, 0);
}

/* Level-up arrow in card modal */
.field-info-card.overlay .gallery-card .levelup-arrow {
  top: -10px;
  right: -6px;
  width: 32px;
  height: 32px;
}

/* mechanic boxes sit ABOVE the card in collection view */
.field-info-card.overlay .mechanic-boxes {
  order: -1;
  margin-top: 0;
  margin-bottom: 12px;
}

/* ── Pack Opening Screen ──────────────────────────────────── */

.pack-opening-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 20px;
  background: radial-gradient(ellipse at 50% 44%, #1a0a44 0%, #08061a 65%);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 0;
}
/* cards phase: pad bottom so fixed button doesn't overlap cards */
.pack-cards-phase {
  gap: 0;
  padding-bottom: 80px;
}

.pack-bg-rays {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: repeating-conic-gradient(from 0deg, #2a1a60 0 8deg, transparent 8deg 22deg);
  opacity: .15;
  animation: ray-spin 9s linear infinite;
  pointer-events: none;
}

/* ── BOOSTER PHASE: split image joined seamlessly ── */
.pack-booster-splitwrap {
  position: relative;
  z-index: 1;
  /* 400×575 image, rendered at clamp(180px,52vw,240px) */
  width: clamp(180px, 52vw, 240px);
  aspect-ratio: 400 / 575;
  animation: pack-booster-shine 2s ease-in-out infinite;
}
@keyframes pack-booster-shine {
  0%,100% { filter: drop-shadow(0 0 20px rgba(255,255,255,.5)) drop-shadow(0 0 6px rgba(220,200,255,.3)); }
  50%      { filter: drop-shadow(0 0 42px rgba(255,255,255,.95)) drop-shadow(0 0 18px rgba(200,180,255,.6)); }
}
/* sparkle decorations */
.pack-booster-splitwrap::before,
.pack-booster-splitwrap::after {
  content: '✦';
  position: absolute;
  color: #fff;
  pointer-events: none;
  animation: booster-sparkle-a 1.6s ease-in-out infinite;
}
.pack-booster-splitwrap::before { top: 2%; left: -12%; font-size: 18px; animation-delay: 0s; }
.pack-booster-splitwrap::after  { bottom: 16%; right: -10%; font-size: 12px; animation-delay: .8s; }
@keyframes booster-sparkle-a {
  0%,100% { opacity: .2; transform: scale(.7) rotate(0deg); }
  50%      { opacity: 1;  transform: scale(1.2) rotate(30deg); }
}
.pack-booster-top,
.pack-booster-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.pack-booster-top img,
.pack-booster-body img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
}
/* top 27% of image */
.pack-booster-top  { clip-path: inset(0 0 73% 0); }
/* bottom 73% of image */
.pack-booster-body { clip-path: inset(27% 0 0 0); }

.pack-tap-hint {
  position: relative;
  z-index: 1;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: rgba(220,210,255,.6);
  letter-spacing: .06em;
  animation: fade-blink 1.8s ease-in-out infinite;
}
@keyframes fade-blink {
  0%,100% { opacity: .35; }
  50%      { opacity: .85; }
}

/* ── CARDS PHASE ── */
.pack-cards-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 31px;
  padding: 0 12px;
  width: 100%;
  max-width: 380px;
  align-items: start;
}

.pack-card-slot {
  position: relative;
  cursor: pointer;
  perspective: 700px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  width: 100%;
  /* reserve 24px top for new-label */
  padding-top: 24px;
  animation: pack-card-float 3.2s ease-in-out infinite;
}
.pack-card-slot:nth-child(2) { animation-delay: .5s; }
.pack-card-slot:nth-child(3) { animation-delay: 1s; }
.pack-card-slot:nth-child(4) { animation-delay: 1.5s; }
@keyframes pack-card-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ── RARITY GLOWS ── */
/* Hint glows on unrevealed cards */
.pack-glow-hint-rare   { filter: drop-shadow(0 0 7px #4a9fff); }
.pack-glow-hint-epic   { filter: drop-shadow(0 0 9px #cc66ff); }
.pack-glow-hint-legendary {
  animation: legendary-hint 1.8s ease-in-out infinite, pack-card-float 3.2s ease-in-out infinite;
}
@keyframes legendary-hint {
  0%,100% { filter: drop-shadow(0 0 10px #ffcc00); }
  50%      { filter: drop-shadow(0 0 22px #ffe030); }
}
/* Full glows on revealed cards */
.pack-glow-rare  { filter: drop-shadow(0 0 10px #4a9fff) drop-shadow(0 0 22px #2277dd); }
.pack-glow-epic  { filter: drop-shadow(0 0 12px #cc66ff) drop-shadow(0 0 28px #8833cc); }
.pack-glow-legendary {
  animation: legendary-sparkle 1.1s ease-in-out infinite, pack-card-float 3.2s ease-in-out infinite;
}
@keyframes legendary-sparkle {
  0%,100% { filter: drop-shadow(0 0 22px #ffcc00) drop-shadow(0 0 10px #fff0a0) drop-shadow(0 0 38px #ff9900); }
  50%      { filter: drop-shadow(0 0 40px #ffe030) drop-shadow(0 0 22px #fff) drop-shadow(0 0 58px #ffaa00); }
}

/* ── CARD BACK ── */
.pack-card-back {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 16px 16px 10px 10px;
  box-shadow: 3px 4px 0 rgba(0,0,0,.55);
}
.pack-card-back-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ── REVEALED CARD ── */
.pack-revealed-card {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.pack-double-shadow {
  position: absolute;
  inset: 0;
  transform: translate(6px, 7px) rotate(4deg);
  background: linear-gradient(145deg, #65533e, #2c251e 70%);
  border: 5px solid #17110c;
  border-radius: 22px 22px 12px 12px;
  box-shadow: inset 0 0 0 3px var(--rarityAccent);
  z-index: -1;
  opacity: .85;
}
.pack-double-shadow.rarity-common    { --rarityAccent: #9e9a94; }
.pack-double-shadow.rarity-rare      { --rarityAccent: #4a9bff; }
.pack-double-shadow.rarity-epic      { --rarityAccent: #9b39c9; }
.pack-double-shadow.rarity-legendary { --rarityAccent: #e8a812; }

/* ── COPY BAR WITH ANIMATED DELTA ── */
.pack-copy-bar {
  position: relative;
  height: 20px;
  background: #0e0c1c;
  border: 2px solid #2e2850;
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pack-copy-bar.max { }
.pack-copy-fill-old {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #1a5020, #2e8a38);
}
.pack-copy-fill-delta {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3aaa42, #6dff7a);
  transition: width .65s cubic-bezier(.22,1,.36,1);
}
.pack-copy-bar.max .pack-copy-fill-old { background: linear-gradient(90deg, #22a12a, #4dff5a); }
.pack-copy-label {
  position: relative;
  z-index: 1;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: #e6ffe7;
  text-shadow: 1px 1px 0 #000;
}

/* ── NEW CARD LABEL ── */
.pack-new-label {
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 8px #00e5ff, 0 0 20px #00aaff, 0 0 38px rgba(0,200,255,.7), 2px 2px 0 #000;
  letter-spacing: .05em;
  text-align: center;
  line-height: 1;
  animation: new-label-pulse 1.2s ease-in-out infinite;
  z-index: 10;
}
@keyframes new-label-pulse {
  0%,100% { opacity: .92; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}
/* ── COPY BADGE (label for duplicate cards) ── */
.pack-copy-badge {
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  font-weight: 700;
  color: rgba(210,200,255,.55);
  text-align: center;
  letter-spacing: .05em;
  z-index: 10;
  pointer-events: none;
}

/* ── SPARKLES for new cards ── */
.pack-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
}
.pack-sparkles i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sc, #fff);
  box-shadow: 0 0 4px 1px var(--sc, #fff);
  animation: pack-sparkle-fly 1.6s ease-out infinite;
  animation-delay: calc(var(--i) * 0.16s);
  --angle: calc(var(--i) * 36deg);
}
.pack-sparkles i:nth-child(odd)  { --sc: #ffffff; width: 5px; height: 5px; }
.pack-sparkles i:nth-child(even) { --sc: #e8f4ff; width: 4px; height: 4px; }
.pack-sparkles i:nth-child(3n)   { --sc: #fffde0; width: 6px; height: 6px; }
@keyframes pack-sparkle-fly {
  /* start from card perimeter (~75px from center), fly outward */
  0%   { transform: translate(-50%,-50%) rotate(var(--angle)) translateX(75px)  scale(1.1); opacity: 1; }
  60%  { opacity: .85; }
  100% { transform: translate(-50%,-50%) rotate(var(--angle)) translateX(145px) scale(0);   opacity: 0; }
}

/* Coins card */
.pack-coins-card {
  width: 100%;
  aspect-ratio: 61 / 85;
  background: linear-gradient(150deg, #3a2808, #1a1000);
  border: 4px solid #a07020;
  border-radius: 16px 16px 10px 10px;
  box-shadow: inset 0 0 0 2px rgba(255,200,60,.18), 3px 4px 0 rgba(0,0,0,.6), 0 0 20px rgba(255,180,30,.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pack-coins-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255,180,30,.55));
}
.pack-coins-amount { font-family: "Press Start 2P", monospace; font-size: 16px; color: #ffd060; text-shadow: 0 0 8px #ff9900, 2px 2px 0 #000; }
.pack-coins-sublabel { font-family: "Press Start 2P", monospace; font-size: 7px; color: #c8a040; }

/* ── BUTTONS ── */
.pack-actions {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 10px 24px max(env(safe-area-inset-bottom, 0px), 10px);
  display: flex;
  justify-content: center;
  background: linear-gradient(to top, rgba(8,6,26,.95) 60%, transparent);
}
.pack-reveal-all-btn {
  padding: 10px 24px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  letter-spacing: .06em;
  color: rgba(200,185,255,.5);
  background: rgba(30,20,65,.55);
  border: 2px solid rgba(100,80,180,.28);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .2s;
}
.pack-reveal-all-btn:active { opacity: .7; }
.pack-collect-btn {
  width: 100%;
  padding: 16px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  letter-spacing: .08em;
  color: #241900;
  background: linear-gradient(180deg, #ffe97a, #e8a812);
  border: 3px solid #8a5a00;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.22), 0 0 18px rgba(255,200,40,.6), 2px 3px 0 #3a2400;
  animation: collect-pulse .9s ease-in-out infinite alternate;
}
@keyframes collect-pulse {
  from { box-shadow: inset 0 2px 0 rgba(255,255,255,.22), 0 0 14px rgba(255,200,40,.5), 2px 3px 0 #3a2400; }
  to   { box-shadow: inset 0 2px 0 rgba(255,255,255,.22), 0 0 28px rgba(255,220,60,.85), 2px 3px 0 #3a2400; }
}
.pack-collect-btn:active { transform: translateY(2px); filter: brightness(.9); }

/* card view inside pack */
.pack-opening-screen .card-view-backdrop { z-index: 100; }

/* ── CARD SIZES IN PACK GRID ── */
.pack-cards-grid .pack-card-back,
.pack-cards-grid .pack-revealed-card,
.pack-cards-grid .pack-coins-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.pack-cards-grid .gallery-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
/* Revealed card and card back: same height as gallery card */
.pack-cards-grid .pack-revealed-card .gallery-card,
.pack-cards-grid .pack-card-back {
  height: 254px;
}
/* invisible placeholder keeps slot width/height stable before reveal */
.pack-copy-bar-placeholder {
  visibility: hidden;
  pointer-events: none;
  flex-shrink: 0;
}
/* Readable effect text by length class */
.pack-cards-grid .pack-revealed-card .gallery-card .ability.text-short  { font-size: 9px; }
.pack-cards-grid .pack-revealed-card .gallery-card .ability.text-medium { font-size: 8px; }
.pack-cards-grid .pack-revealed-card .gallery-card .ability.text-long   { font-size: 7.5px; line-height: 1.12; }
.pack-cards-grid .pack-revealed-card .gallery-card .ability.text-tiny   { font-size: 7px; line-height: 1.08; }
.pack-cards-grid .pack-revealed-card .gallery-card .ability.text-micro  { font-size: 6.5px; line-height: 1.04; }

/* ===== LEAGUE GIFT TOOLTIP ===== */
.league-gift-btn {
  position: absolute;
  right: -8px;
  top: 50%;
  z-index: 12;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 56px;
  line-height: 1;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.5));
  transition: transform .12s;
}
.league-gift-btn:hover, .league-gift-btn:focus { transform: translateY(-50%) scale(1.1); }
.screen-home .league-gift-btn {
  right: -6px;
  font-size: 52px;
}
.league-gift-tip {
  position: absolute;
  right: -6px;
  bottom: calc(100% + 14px);
  z-index: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: max-content;
  padding: 18px 24px 20px;
  background: linear-gradient(180deg, #30265a 0%, #1a1438 100%);
  border: 4px solid #05040d;
  border-radius: 0;
  box-shadow: 6px 6px 0 #05040d;
  font-family: "Russo One", sans-serif;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s ease, visibility .2s;
}
.league-gift-tip::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #1a1438;
  border-right: 4px solid #05040d;
  border-bottom: 4px solid #05040d;
  transform: rotate(45deg);
  z-index: 10;
}
.league-gift-tip.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.league-tip-title {
  margin: 0;
  color: #f5e8c4;
  font-family: "Russo One", sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: .01em;
  white-space: nowrap;
  -webkit-text-stroke: 2px #05040d;
  paint-order: stroke fill;
  text-shadow: 2px 3px 0 #05040d;
}
.league-gift-rewards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
}
.lgr-item {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
}
.lgr-amt {
  color: #f5e8c4;
  font-family: "Russo One", sans-serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  -webkit-text-stroke: 2px #05040d;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #05040d;
}
.lgr-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 #05040d);
  flex-shrink: 0;
}
.lgr-booster-img {
  width: 44px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(2px 3px 0 #05040d);
  flex-shrink: 0;
}

/* ===== LEAGUE PROGRESS: LARGER XP NUMBERS ===== */
.league-progress {
  position: relative;
  overflow: visible;
  padding-right: 32px;
}
.league-progress > span,
.league-progress > .league-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.league-progress b.league-xp-label,
.screen-home .league-progress b.league-xp-label {
  position: absolute;
  inset: 0;
  right: 32px;
  display: block;
  color: #fff8d5;
  font-family: "Press Start 2P", monospace;
  font-size: 15px;
  line-height: 36px;
  text-align: center;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  z-index: 2;
}

/* League progress — final overrides */
.screen-home .league-progress {
  padding-right: 36px;
  overflow: visible;
}
.screen-home .league-progress b.league-xp-label {
  right: 36px;
  font-size: 14px;
  line-height: 36px;
  white-space: nowrap;
}
.screen-home .league-gift-btn {
  right: -4px;
  font-size: 54px;
  z-index: 15;
}
.screen-home .league-card,
.screen-home .league-progress {
  overflow: visible;
}

/* ===== BATTLE RESULT OVERLAY ===== */
.battle-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 64px 18px 28px;
  overflow-y: auto;
  background: linear-gradient(180deg, #1a1330 0%, #0f0c1e 100%);
}
.battle-result-overlay.result-won {
  background: linear-gradient(160deg, #1a2e14 0%, #0f1d0a 40%, #0c0c1e 100%);
}
.battle-result-overlay.result-lost {
  background: linear-gradient(160deg, #2a1020 0%, #180a14 40%, #0c0c1e 100%);
}

/* Header */
.result-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.result-big-emoji {
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.6));
  animation: result-emoji-drop .55s cubic-bezier(.18,1.28,.28,1) both;
}
@keyframes result-emoji-drop {
  from { opacity: 0; transform: translateY(-30px) scale(.5); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.result-title {
  margin: 0;
  color: #fff7d2;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 5vw, 26px);
  text-shadow: 3px 3px 0 #000, 0 0 22px rgba(255,220,80,.35);
  animation: result-title-in .4s .18s both;
}
.result-won .result-title { color: #b8ff82; text-shadow: 3px 3px 0 #1a3a00, 0 0 22px rgba(100,255,50,.3); }
.result-lost .result-title { color: #ff8888; text-shadow: 3px 3px 0 #3a0000, 0 0 22px rgba(255,80,80,.3); }
@keyframes result-title-in {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* League XP section */
.result-league-section {
  width: 100%;
  max-width: 360px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #252142 0%, #1a1830 100%);
  border: 3px solid #05040d;
  box-shadow: 5px 5px 0 #05040d;
  animation: result-section-in .35s .28s both;
}
@keyframes result-section-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-league-label {
  margin-bottom: 10px;
  color: #c8c0e8;
  font-family: "Russo One", sans-serif;
  font-size: 16px;
}
.result-xp-track {
  position: relative;
  margin-bottom: 8px;
}
.result-xp-bar-wrap {
  height: 28px;
  background: linear-gradient(180deg, #312f3a 0%, #1e1d28 100%);
  border: 3px solid #05040d;
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06);
}
.result-xp-fill {
  height: 100%;
  background: linear-gradient(180deg, #6df52b 0%, #3dba00 55%, #1f7000 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.28), inset 0 -3px 0 rgba(0,0,0,.2);
  transition: none;
}
.result-xp-numbers {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: #fff8d5;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
}
.result-xp-sep { color: rgba(255,248,213,.5); font-size: 9px; }
.result-xp-delta {
  display: inline-block;
  padding: 4px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  text-align: center;
  border: 2px solid transparent;
  animation: result-delta-pop .4s .8s cubic-bezier(.18,1.28,.28,1) both;
}
@keyframes result-delta-pop {
  from { opacity: 0; transform: scale(.5) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.result-xp-delta.xp-gain {
  color: #9dff55;
  border-color: #3a8000;
  background: rgba(61,186,0,.18);
  text-shadow: 1px 1px 0 #1a4000;
}
.result-xp-delta.xp-loss {
  color: #ff7070;
  border-color: #7a0000;
  background: rgba(186,0,0,.18);
  text-shadow: 1px 1px 0 #400000;
}

/* New-card red dot on gallery cards */
.new-card-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff2244;
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(255,20,60,.7);
  z-index: 12;
  pointer-events: none;
  animation: new-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes new-dot-pulse {
  0%,100%{transform:scale(1);box-shadow:0 0 6px rgba(255,20,60,.7);}
  50%{transform:scale(1.25);box-shadow:0 0 12px rgba(255,20,60,.9);}
}
/* Badge counter on nav КАРТЫ button */
.nav-new-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ff2244;
  color: #fff;
  font-family: 'Russo One', sans-serif;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  box-shadow: 0 0 8px rgba(255,20,60,.7);
  border: 2px solid #17152c;
  z-index: 20;
  pointer-events: none;
}

/* Topbar inside result overlay — transparent, wallet only */
.battle-result-overlay .topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 10px 14px 0;
  z-index: 1;
}

/* Battle rewards row (diamonds + coins on one line) */
.result-rewards-row-battle {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px auto 4px;
}

/* Battle diamond reward */
.result-battle-diamonds {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-family: 'Russo One', sans-serif;
  font-size: 1rem;
  color: #7adcff;
  background: rgba(0,160,255,.12);
  border: 1px solid rgba(0,200,255,.28);
  border-radius: 10px;
  padding: 5px 14px;
  width: fit-content;
}
.result-battle-diamonds .rrc-img {
  width: 18px;
  height: 18px;
}

/* Battle coin reward */
.result-battle-coins {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-family: 'Russo One', sans-serif;
  font-size: 1rem;
  color: #ffd84d;
  background: rgba(255,200,40,.14);
  border: 1px solid rgba(255,200,40,.35);
  border-radius: 10px;
  padding: 5px 14px;
  width: fit-content;
}
.result-battle-coins .rrc-img {
  width: 18px;
  height: 18px;
}
.result-streak-label {
  font-family: 'Russo One', sans-serif;
  font-size: 0.72rem;
  color: rgba(255,216,77,.6);
  letter-spacing: 0.04em;
  margin: 2px auto 0;
  text-transform: uppercase;
}

/* League-up block */
.result-league-up {
  width: 100%;
  max-width: 360px;
  margin-bottom: 14px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(145deg, #3a2e66 0%, #1e1540 100%);
  border: 3px solid #05040d;
  box-shadow: 5px 5px 0 #05040d, inset 0 0 0 1px rgba(255,220,80,.12);
  opacity: 0;
  transform: translateY(12px) scale(.96);
  transition: opacity .4s, transform .4s cubic-bezier(.18,1.2,.28,1);
}
.result-league-up.visible {
  opacity: 1;
  transform: none;
}
.result-gift-wrap {
  margin-bottom: 6px;
}
.result-gift-emoji {
  display: inline-block;
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
}
.result-gift-emoji.gift-burst {
  animation: gift-pop .7s cubic-bezier(.18,1.25,.28,1) forwards;
}
@keyframes gift-pop {
  0%   { transform: scale(1); filter: drop-shadow(0 4px 12px rgba(0,0,0,.5)); }
  28%  { transform: scale(1.7); filter: drop-shadow(0 0 28px rgba(255,220,60,.9)) brightness(1.6); }
  55%  { transform: scale(0.85); filter: drop-shadow(0 0 14px rgba(255,180,40,.5)); }
  72%  { transform: scale(1.15); }
  100% { transform: scale(1); filter: drop-shadow(0 4px 12px rgba(0,0,0,.5)); }
}
.result-league-up-label {
  margin-bottom: 4px;
  color: #ffd84d;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  text-shadow: 2px 2px 0 #000, 0 0 18px rgba(255,200,40,.6);
  letter-spacing: 1px;
}
.result-league-up-name {
  margin-bottom: 14px;
  color: #fff4c6;
  font-family: "Russo One", sans-serif;
  font-size: 16px;
}
.result-rewards-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.result-reward-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 2px solid rgba(255,255,255,.15);
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
}
.result-reward-chip b { font-size: 13px; }
.result-reward-chip .ui-icon { width: 16px; height: 16px; }
.rrc-img { width: 16px; height: 16px; object-fit: contain; image-rendering: pixelated; }
.rrc-diamond { color: #7cd4ff; background: rgba(80,180,255,.12); border-color: rgba(80,180,255,.3); }
.rrc-coin { color: #ffd84d; background: rgba(255,200,40,.12); border-color: rgba(255,200,40,.3); }
.rrc-booster { color: #d4a8ff; background: rgba(180,100,255,.12); border-color: rgba(180,100,255,.3); }

/* Result action buttons */
.result-actions {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: result-section-in .35s .45s both;
}
.result-booster-btn {
  background: linear-gradient(180deg, #c97bff 0%, #8b30e8 55%, #5a0fa8 100%);
  border-color: #3a0070;
  box-shadow: 5px 5px 0 #3a0070, inset 0 0 0 2px rgba(255,255,255,.2);
  color: #fff;
  font-size: 14px;
}
.result-play-btn {
  font-size: 14px;
}
.result-play-btn.has-streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 10%;
}
.result-play-btn .fight-streak {
  color: #3a1500;
}
.result-home-btn {
  font-size: 14px;
}

/* Battle hero bar — profile from menu */
.battle-screen .hero-bar .hero-avatar-wrap {
  position: relative;
  width: clamp(56px, 14vw, 72px);
  height: clamp(56px, 14vw, 72px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.battle-screen .hero-bar .avatar-circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.58);
  z-index: 0;
}
.battle-screen .hero-bar .hero-avatar.battle-profile-avatar {
  position: relative;
  z-index: 1;
  width: clamp(56px, 14vw, 72px);
  height: clamp(56px, 14vw, 72px);
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: clamp(46px, 12vw, 62px);
  line-height: 1;
  filter: drop-shadow(4px 5px 0 rgba(0,0,0,.5));
}
.battle-screen .hero-bar.enemy .hero-avatar.battle-profile-avatar {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(4px 5px 0 rgba(0,0,0,.55));
}
.battle-screen .hero-bar.active-hero-turn .hero-avatar.battle-profile-avatar {
  filter: drop-shadow(0 0 10px rgba(255,216,77,.85)) drop-shadow(4px 5px 0 rgba(0,0,0,.5));
}
.battle-screen .hero-data.battle-profile-copy {
  min-width: 0;
  text-align: left;
  overflow: visible;
}
.battle-screen .hero-data.battle-profile-copy h2 {
  margin: 0 0 4px;
  overflow: hidden;
  color: #fff3c8;
  font-family: "Russo One", sans-serif;
  font-size: clamp(18px, 5vw, 28px);
  line-height: .95;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 3px 4px 0 #000;
}
.battle-screen .hero-data.battle-profile-copy h2.profile-name-short { font-size: clamp(22px, 6vw, 32px); }
.battle-screen .hero-data.battle-profile-copy h2.profile-name-medium { font-size: clamp(19px, 5.2vw, 26px); }
.battle-screen .hero-data.battle-profile-copy h2.profile-name-long { font-size: clamp(16px, 4.4vw, 22px); }
.battle-screen .hero-data.battle-profile-copy h2.profile-name-tiny { font-size: clamp(13px, 3.6vw, 18px); }
.battle-screen .hero-data.battle-profile-copy p {
  margin: 0;
  overflow: hidden;
  color: #16eaff;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(8px, 2.2vw, 11px);
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000;
}
.battle-screen .hero-bar.enemy .hero-data.battle-profile-copy p {
  color: #16eaff;
}

/* Deck popover — always above all layers */
.ui-panel.battle-deck-panel,
.collection-sticky {
  overflow: visible !important;
}
.deck-strip.deck-eight {
  position: relative;
  z-index: 50;
  overflow: visible;
}
.deck-mini {
  position: relative;
  overflow: visible;
}
.deck-mini:hover,
.deck-mini:focus-within {
  z-index: 9500 !important;
}
.deck-popover {
  z-index: 9600 !important;
}
.deck-mini:hover .deck-popover,
.deck-mini:focus-within .deck-popover {
  z-index: 9600 !important;
}
.screen-home .battle-deck-panel {
  position: relative;
  z-index: 40;
}
.screen-home .battle-deck-panel:has(.deck-mini:hover),
.screen-home .battle-deck-panel:has(.deck-mini:focus-within),
.collection-sticky:has(.deck-mini:hover),
.collection-sticky:has(.deck-mini:focus-within) {
  z-index: 9400 !important;
}
.screen-home .league-panel {
  position: relative;
  z-index: 10;
}
.screen-home .battle-deck-panel .deck-popover {
  z-index: 9600 !important;
}
.collection-sticky .deck-popover {
  z-index: 9600 !important;
}

/* Nav button sizes — global, all screens, all states */
.bottom-nav .nav-icon,
.bottom-nav .nav-btn.active .nav-icon { font-size: 40px; }
.bottom-nav .nav-label,
.bottom-nav .nav-btn.active .nav-label { font-size: 18px; }

/* ─── V28 — modal layer fixes + global proportional scaling ─────────────── */

/* All modal/overlay backdrops above fixed topbar (7400) and collection-sticky (7300) */
.reveal-overlay { z-index: 10000; }
.cover-editor-backdrop, .delete-confirm-backdrop { z-index: 10000; }
.profile-editor-backdrop { z-index: 10000; }
.toast { z-index: 10100; bottom: 68px; }

/* Topbar: globally 50px (down from 60px) */
.topbar,
.screen-home .topbar,
.app-shell.screen-collection .topbar,
.app-shell.screen-shop .topbar {
  height: calc(50px + var(--safe-top));
  min-height: calc(50px + var(--safe-top));
}

/* Shift content padding to match new topbar */
.app-shell.screen-home,
.app-shell.screen-collection,
.app-shell.screen-shop {
  padding-top: calc(50px + var(--safe-top));
}

/* Sticky filter panel anchors below new topbar */
.app-shell.screen-collection .collection-sticky {
  top: calc(50px + var(--safe-top));
}

/* Stat chips: globally smaller */
.topbar .stat-chip,
.screen-home .topbar .stat-chip,
.app-shell.screen-collection .topbar .stat-chip,
.app-shell.screen-shop .topbar .stat-chip {
  min-width: 104px;
  height: 34px;
  min-height: 34px;
  padding: 3px 10px 3px 5px;
  gap: 5px;
}
.topbar .stat-value { font-size: 15px; }
.topbar .stat-icon { width: 24px; height: 24px; flex-basis: 24px; }
.topbar .stat-chip.coin .stat-icon { width: 22px; height: 22px; flex-basis: 22px; }
.topbar .stat-icon img, .topbar .stat-chip img { width: 24px; height: 24px; }
.topbar .stat-chip.coin .stat-icon img { width: 22px; height: 22px; }

/* Bottom nav: globally 64px (down from 82px) */
.bottom-nav { min-height: calc(64px + var(--safe-bottom)); }
.nav-btn { min-height: 64px; }
.nav-btn.active { min-height: 74px; margin-top: -10px; }
.bottom-nav .nav-icon,
.bottom-nav .nav-btn.active .nav-icon { font-size: 28px; margin-bottom: 3px; }
.bottom-nav .nav-label,
.bottom-nav .nav-btn.active .nav-label { font-size: 13px; }
.screen-home .bottom-nav { min-height: calc(64px + var(--safe-bottom)); }
.screen-home .nav-btn { min-height: 64px; }
.screen-home .nav-btn.active { min-height: 74px; margin-top: -10px; }

/* Collection sticky: globally tighter */
.collection-sticky .deck-tile,
.collection-sticky .deck-tile.active { flex-basis: 72px; min-height: 66px; }
.collection-sticky .deck-tile span { font-size: 22px; }
.collection-sticky .deck-tile b { font-size: 9px; }
.collection-sticky .deck-tile small { font-size: 7px; }
.collection-sticky .deck-tabs { margin-bottom: 6px; }
.filter-btn { padding: 6px 9px; }
.filter-row { margin: 8px 0 5px; }

/* ─── end V28 ──────────────────────────────────────────────────────────────── */

/* ─── V29 — layout corrections ───────────────────────────────────────────── */

/* Disable text/element selection to prevent accidental highlights on swipe */
html, body, .app-shell { -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

/* Telegram WKWebView: убираем серую подсветку тапа и меню долгого нажатия */
* { -webkit-tap-highlight-color: transparent; }
html, body, .app-shell { -webkit-touch-callout: none; }

/* Collection screen: remove V26 margin-top that created dead space between sticky and grid */
.app-shell.screen-collection .gallery-grid {
  margin-top: 0;
}

/* Screen-home: profile panel removed → content fits, re-lock to one viewport */
.app-shell.screen-home {
  height: 100dvh;
  overflow: hidden;
  padding-bottom: calc(64px + var(--safe-bottom));
}

/* Shop: place booster grid at top-right; topbar and nav are fixed so only grid is in flow */
.app-shell.screen-shop {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
}
.app-shell.screen-shop .shop-grid {
  margin: 0;
}

/* Gear button in topbar (screen-home only) — square matching stat-chip height (34px) */
.screen-home .topbar .battle-profile-gear {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin-left: auto;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  color: #eef0ff;
  background: #36315c;
  border: 4px solid #05040d;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 4px 4px 0 #05040d;
  cursor: pointer;
}

/* Profile editor modal: subtitle below title */
.profile-editor-subtitle {
  margin: -4px 0 8px;
  color: #7774a5;
  font-family: "Press Start 2P";
  font-size: 6px;
  line-height: 1.5;
  text-align: center;
}

/* ─── end V29 ──────────────────────────────────────────────────────────────── */

/* ─── V30 — collection dead-space fix (red highlighted areas) ───────────── */

/*
 * Top gap: shell padding-top + in-flow topbar offset stacked → remove shell
 * padding-top; offset collection-sticky with margin-top instead.
 * Bottom gap: shell padding-bottom below flex gallery → move nav clearance
 * into gallery-grid padding-bottom inside the scroll area.
 */
.app-shell.screen-collection {
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
}

.app-shell.screen-collection > .topbar {
  position: fixed !important;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  flex: none !important;
  margin: 0;
}

.app-shell.screen-collection > .collection-sticky {
  margin: calc(50px + var(--safe-top)) -16px 0;
  padding: 8px 10px;
  flex: 0 0 auto;
  position: sticky;
  top: calc(50px + var(--safe-top));
}

.app-shell.screen-collection > .gallery-grid {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -2px;
  margin-top: 0;
  padding: 6px 2px calc(64px + var(--safe-bottom) + 6px);
  overflow-y: auto;
}

/* ─── end V30 ──────────────────────────────────────────────────────────────── */

/* ─── V31 — battle panels centered; shop booster top-left ─────────────────── */

/* Center deck + league block vertically in remaining viewport */
.screen-home .battle-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 2.5dvh, 16px);
  padding: clamp(10px, 2.5dvh, 20px) clamp(4px, 1.5vw, 8px);
  margin: 0;
}

.screen-home .battle-main .battle-deck-panel {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}

.screen-home .battle-main .league-panel {
  flex: 0 0 auto;
  margin: 0;
}

/* Booster tile — top-left corner */
.app-shell.screen-shop {
  justify-content: flex-start;
  align-items: flex-start;
}

.app-shell.screen-shop .shop-grid {
  margin: 0;
  align-self: flex-start;
}

/* Keep booster clickable when diamonds are low — toast handles feedback */
.app-shell.screen-shop .booster-slot:disabled {
  opacity: 1;
  filter: none;
  cursor: pointer;
}

/* ─── end V31 ──────────────────────────────────────────────────────────────── */

/* V32 — reference battle-field geometry (base design 436×580, u = 1px at scale 1).
   Uniform 12u spacing: field padding, gaps between cells, gap between rows
   and the divider between the two halves are all equal.
   The field keeps this aspect ratio at any screen size: --u shrinks/grows every
   internal dimension uniformly, so slots, tokens and gaps never distort.
   Board slot and field token share the exact same box: 124×126. */
.hearth-battle .hearth-field {
  --u: min(100cqw / 436, 100cqh / 580);
  flex: none;
  width: calc(var(--u) * 436);
  height: calc(var(--u) * 580);
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--u) * 12);
  border-width: calc(var(--u) * 8);
  border-radius: calc(var(--u) * 18);
}
.hearth-battle .hearth-half { flex: none; display: grid; gap: calc(var(--u) * 12); }
.hearth-battle .hearth-divider { flex: none; height: calc(var(--u) * 12); }
.hearth-battle .hearth-divider::before { left: calc(var(--u) * -12); right: calc(var(--u) * -12); height: calc(var(--u) * 4); }
.hearth-battle .hearth-row {
  height: calc(var(--u) * 126);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--u) * 12);
  align-items: center;
}
/* Slot box: 124×126 — identical to the fighter token below */
.hearth-battle .hearth-row .arena-cell {
  width: auto;
  height: calc(var(--u) * 126);
  min-height: 0;
}
.hearth-battle .hearth-row .arena-cell.board-slot {
  border-width: calc(var(--u) * 3);
  border-radius: 46% 46% calc(var(--u) * 18) calc(var(--u) * 18) / 42% 42% calc(var(--u) * 20) calc(var(--u) * 20);
}
.hearth-battle .hearth-row .arena-cell .cell-frame {
  inset: calc(var(--u) * 8) calc(var(--u) * 5) calc(var(--u) * 5);
  border-width: calc(var(--u) * 2);
}
/* Token box matches the slot box 1:1 (size and aspect): the occupied cell
   drops its (invisible) border so the token fills the exact same 124×126 box */
.hearth-battle .hearth-row .arena-cell.occupied:not(.freeing) { border-width: 0; }
.hearth-battle .field-token.arena-fighter {
  width: 100%;
  height: 100%;
}
.hearth-battle .field-token .fighter-portrait {
  width: calc(var(--u) * 114);
  height: calc(var(--u) * 116);
  padding: calc(var(--u) * 6) calc(var(--u) * 6) calc(var(--u) * 20);
  border-width: calc(var(--u) * 4);
  border-radius: 50% 50% calc(var(--u) * 17) calc(var(--u) * 17) / 45% 45% calc(var(--u) * 17) calc(var(--u) * 17);
}
.hearth-battle .field-token.has-shield .fighter-portrait::after {
  inset: calc(var(--u) * -11) calc(var(--u) * -12) calc(var(--u) * -8);
  border-width: calc(var(--u) * 4);
}
.hearth-battle .field-token .fighter-emoji { font-size: calc(var(--u) * 66); }
.hearth-battle .field-token .fighter-aura { height: calc(var(--u) * 30); bottom: calc(var(--u) * 4); }
.hearth-battle .field-token.active-turn .fighter-aura::after { width: calc(var(--u) * 80); height: calc(var(--u) * 80); }
.hearth-battle .field-token.has-taunt::before { width: calc(var(--u) * 136); height: calc(var(--u) * 138); }
.hearth-battle .field-token.has-thorns::after { width: calc(var(--u) * 120); height: calc(var(--u) * 106); }
.hearth-battle .field-token .fighter-badges {
  width: calc(var(--u) * 110);
  gap: calc(var(--u) * 18);
  bottom: calc(var(--u) * -2);
}
.hearth-battle .field-token .fighter-badges span {
  flex-basis: calc(var(--u) * 45);
  width: calc(var(--u) * 45);
  height: calc(var(--u) * 43);
  border-width: calc(var(--u) * 3);
  border-radius: calc(var(--u) * 12) calc(var(--u) * 12) calc(var(--u) * 5) calc(var(--u) * 5);
  font-size: calc(var(--u) * 19);
}
.hearth-battle .field-token .fighter-badges .health-badge i {
  min-width: calc(var(--u) * 18);
  height: calc(var(--u) * 18);
  right: calc(var(--u) * -8);
  top: calc(var(--u) * -8);
  border-width: calc(var(--u) * 2);
  font-size: calc(var(--u) * 8);
}
.hearth-battle .field-token .sleep-mark { top: calc(var(--u) * 2); right: calc(var(--u) * 28); }
.hearth-battle .mechanic-chips { width: calc(var(--u) * 114); height: calc(var(--u) * 116); }
.hearth-battle .mechanic-chip { width: calc(var(--u) * 36); height: calc(var(--u) * 36); border-width: calc(var(--u) * 4); }
.hearth-battle .mechanic-chip b { width: calc(var(--u) * 23); height: calc(var(--u) * 23); font-size: calc(var(--u) * 23); line-height: calc(var(--u) * 23); }

/* Hero bars and hand match the rendered field width.
   --bw/--bs are set from JS (syncHearthWidth) after every render and on resize. */
.battle-screen.hearth-battle .hero-bar.enemy { width: var(--bw, 100%); margin: 0 auto -8px; }
.battle-screen.hearth-battle .hero-bar.player { width: var(--bw, 100%); margin: -8px auto 0; }
.battle-screen.hearth-battle .hand-three { width: var(--bw, 100%); margin-inline: auto; }
/* Fan cards scale down together with the field on narrow layouts.
   The scale property multiplies the fan translateX(-50% + fan-x) inside
   `transform`, so margin-left re-centers the fan (56px = half card width). */
.battle-screen.hearth-battle .hand-three .hearth-card.unified-card {
  scale: var(--bs, 1);
  margin-left: calc(56px * (var(--bs, 1) - 1));
}

/* Both hero bars share one fixed compact height: same content structure
   (avatar + name + mana/button column) on both sides */
.battle-screen.hearth-battle .hero-bar {
  height: 58px;
  min-height: 0;
  padding: 4px 8px 4px 0;
  grid-template-columns: 60px minmax(0,1fr) 88px;
}
.battle-screen.hearth-battle .hero-bar .hero-avatar-wrap,
.battle-screen.hearth-battle .hero-bar .hero-avatar.battle-profile-avatar { width: 48px; height: 48px; font-size: 40px; }
.battle-screen.hearth-battle .hero-data.battle-profile-copy h2 { margin-bottom: 2px; font-size: clamp(14px, 4vw, 20px); }
.battle-screen.hearth-battle .hero-data.battle-profile-copy h2.profile-name-long,
.battle-screen.hearth-battle .hero-data.battle-profile-copy h2.profile-name-tiny { font-size: clamp(12px, 3.4vw, 16px); }
.battle-screen.hearth-battle .hero-data.battle-profile-copy p { font-size: 8px; }
/* Keep remaining HP clearly readable on the smaller avatar */
.battle-screen.hearth-battle .hero-heart { right: -6px; bottom: -4px; min-width: 28px; height: 24px; border-width: 2px; font-size: 9px; }
.battle-screen.hearth-battle .hero-actions { width: 88px; grid-template-rows: 18px 24px; gap: 2px; }
.battle-screen.hearth-battle .hero-end-turn,
.battle-screen.hearth-battle .hero-surrender { min-height: 24px; border-width: 2px; font-size: 6px; }

/* League rank PNG icons */
.screen-home .league-icon {
  width: 58px;
  height: 50px;
  flex: 0 0 58px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
  padding: 0;
  line-height: 0;
  font-size: 0;
}
.league-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}
.result-league-label,
.result-league-up-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.result-league-icon {
  display: block;
  width: 48px;
  height: 41px;
  object-fit: contain;
  flex: 0 0 auto;
  image-rendering: auto;
}
.result-league-up-icon {
  display: block;
  width: 48px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
  image-rendering: auto;
}
