/* TCG mode — board layout + card faces. Scoped under .tcg-board / .tcg-card so
   it never touches the legacy battler. The board is a vertical scroll column
   that fills the viewport with a sticky action bar at the bottom. */

/* The global site footer would otherwise flow under the board's log. */
body.tcg-mode #site-footer { display: none; }

.tcg-board {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 0 0;
  box-sizing: border-box;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% -5%, rgba(120, 70, 200, 0.28), transparent 42%),
    radial-gradient(circle at 50% 105%, rgba(50, 130, 180, 0.26), transparent 42%),
    linear-gradient(180deg, #0d0b18, #14111f 50%, #0d0b18);
  color: var(--ink, #f0eee2);
  font-family: "Inter", system-ui, sans-serif;
}

/* ---- playmat: a left rail (prizes/deck/discard) + the field column ---- */
.tcg-mat {
  flex: 1; width: 100%; max-width: 820px; margin: 0 auto; box-sizing: border-box;
  display: flex; flex-direction: row; align-items: stretch; gap: 8px;
  padding: 8px max(8px, env(safe-area-inset-left)) 10px;
}
.tcg-field {
  flex: 1; min-width: 0; position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
/* Glowing mid-line splitting the two players' halves. */
.tcg-field::before {
  content: ""; position: absolute; left: 2%; right: 2%; top: 50%; height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(247, 208, 44, 0.35), rgba(255, 255, 255, 0.25), rgba(247, 208, 44, 0.35), transparent);
  pointer-events: none; z-index: 0;
}
/* Faint felt weave over the whole board. */
.tcg-board::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 4px);
}
.tcg-board > * { position: relative; z-index: 1; }

/* ---- left rail: prizes + deck + discard for both players ---- */
.tcg-rail {
  flex: 0 0 66px; width: 66px; display: flex; flex-direction: column;
  justify-content: space-between; padding: 2px 0;
}
.tcg-rail-half { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; border-radius: 10px; background: rgba(0, 0, 0, 0.26); border: 1px solid rgba(255, 255, 255, 0.07); }
.tcg-rail-mid { flex: 1; min-height: 8px; }
.tcg-rail-label { font-size: 7px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted, #8a8eaa); font-weight: 700; }
.tcg-rail-prizes { display: grid; grid-template-columns: repeat(2, auto); gap: 3px; justify-content: center; }
.tcg-rail-piles { display: flex; gap: 5px; margin-top: 1px; }
.tcg-prize-card {
  width: 16px; height: 22px; border-radius: 3px; display: grid; place-items: center;
  background: linear-gradient(150deg, #2f61bd, #16357a); border: 1px solid rgba(233, 230, 216, 0.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.tcg-prize-card .tcg-ball { width: 78%; }
.tcg-prize-card.empty { background: rgba(255, 255, 255, 0.05); border: 1px dashed rgba(255, 255, 255, 0.16); box-shadow: none; }

/* ---- name bars (whose turn) ---- */
.tcg-namebar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 1px 0; }
.tcg-strip-name { font-weight: 800; font-size: 13px; color: #d7daff; }
.tcg-strip-name.active { color: #f7d02c; text-shadow: 0 0 10px rgba(247, 208, 44, 0.55); }
.tcg-strip-name.active::after { content: " ●"; font-size: 9px; vertical-align: middle; }
.tcg-hand-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #b9bdd6; }
.tcg-hand-count .tcg-pilesvg { width: 15px; height: 15px; color: #aeb2cc; }

.tcg-pile { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tcg-pile-n { font-size: 10px; font-weight: 700; color: #b9bdd6; line-height: 1; }
.tcg-pile-stack {
  width: 17px; height: 23px; border-radius: 3px; display: grid; place-items: center;
  background: linear-gradient(150deg, #2f61bd, #16357a); border: 1px solid rgba(233, 230, 216, 0.55);
  box-shadow: 1.5px 1.5px 0 -0.5px #16357a, 3px 3px 0 -1px rgba(233, 230, 216, 0.4);
}
.tcg-pile-stack .tcg-ball { width: 80%; }
.tcg-pile-discard, .tcg-pile-hand { width: 17px; height: 23px; border-radius: 3px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16); }
.tcg-pile-discard .tcg-pilesvg, .tcg-pile-hand .tcg-pilesvg { width: 13px; height: 13px; color: #aeb2cc; }
.tcg-pile.empty .tcg-pile-discard { border-style: dashed; opacity: 0.6; }

/* ---- opponent hand fan (face-down) ---- */
.tcg-hand-fan { display: flex; justify-content: center; align-items: flex-start; height: 26px; margin-bottom: 2px; }
.tcg-fan-card {
  width: 20px; height: 28px; margin: 0 -6px; border-radius: 3px; display: grid; place-items: center;
  background: linear-gradient(150deg, #2f61bd, #16357a); border: 1px solid rgba(233, 230, 216, 0.5);
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--rot, 0deg)); transform-origin: bottom center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.tcg-fan-card .tcg-ball { width: 74%; }

/* ---- rows ---- */
.tcg-bench-row, .tcg-active-row {
  display: flex; justify-content: center; align-items: flex-start; gap: 6px;
  min-height: 30px;
}
/* Active Pokémon sit in a glowing "spot" on the mat. */
.tcg-active-row { position: relative; padding: 4px 0; }
.tcg-active-row::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 176px; height: 176px;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: 0;
}
.tcg-active-player::before { background: radial-gradient(circle, rgba(108, 217, 124, 0.24), transparent 68%); }
.tcg-active-ai::before { background: radial-gradient(circle, rgba(255, 108, 108, 0.2), transparent 68%); }
.tcg-active-row .tcg-card { position: relative; z-index: 1; }
.tcg-slot-empty {
  width: 62px; height: 84px; border-radius: 8px; flex: 0 0 auto;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 6px, transparent 6px 12px);
}
.tcg-empty-active {
  min-width: 96px; min-height: 116px; display: grid; place-items: center;
  color: var(--muted, #8a8eaa); font-size: 11px; font-style: italic; text-align: center;
  border: 1.5px dashed rgba(255, 255, 255, 0.18); border-radius: 10px; padding: 8px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.tcg-center { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 3px 0; position: relative; z-index: 1; }
.tcg-turn {
  font-family: "Press Start 2P", monospace; font-size: 10px; letter-spacing: 1px; color: #f7d02c;
  background: rgba(18, 15, 30, 0.8); border: 1px solid rgba(247, 208, 44, 0.35); border-radius: 999px;
  padding: 5px 14px; box-shadow: 0 0 16px rgba(247, 208, 44, 0.18);
}
.tcg-stadium { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #9fd8ff; background: rgba(60, 155, 255, 0.12); border: 1px solid rgba(60, 155, 255, 0.3); border-radius: 999px; padding: 2px 10px; }
.tcg-stadium .tcg-tsvg { width: 14px; height: 14px; }

/* ---- card face (bright, real-TCG inspired) ---- */
.tcg-card {
  position: relative; box-sizing: border-box; flex: 0 0 auto;
  border-radius: 9px; overflow: hidden; cursor: default; user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, outline-color 0.12s ease;
}
/* Every card keeps the real Pokémon-card proportion (63×88mm ≈ 0.716). */
.tcg-full { width: 146px; aspect-ratio: 63 / 88; }
.tcg-mini { width: 74px; aspect-ratio: 63 / 88; }

/* Pokémon: cream interior inside a thick type-colored frame. Flex column so
   the art window grows to fill the fixed-ratio card. */
.tcg-pokemon {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fbf7ea, #ece5d1);
  border: 3px solid var(--type, #888);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  color: #211f18; padding: 3px;
}
.tcg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 1px 3px 3px; }
.tcg-head-left { min-width: 0; flex: 1; }
.tcg-head-right { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.tcg-stage { display: block; font-size: 6.5px; text-transform: uppercase; letter-spacing: 0.5px; color: #8a7f5c; font-weight: 700; }
.tcg-name { display: block; font-weight: 800; font-size: 11.5px; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcg-hp { font-weight: 800; font-size: 12px; color: #d3202f; white-space: nowrap; }
.tcg-hp i { font-style: normal; font-size: 7px; margin-right: 1px; opacity: 0.8; }
.tcg-type-badge { width: 15px; height: 15px; }

.tcg-art { position: relative; margin: 0 1px; border-radius: 4px; flex: 1 1 auto; min-height: 0; display: flex; }
.tcg-art-frame {
  flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; overflow: hidden;
  border: 1.5px solid color-mix(in srgb, var(--type) 65%, #6f6033); border-radius: 4px;
  background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--type) 34%, #fff), #cbc5b4 92%);
}
.tcg-art img { max-width: 96%; max-height: 96%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.tcg-attached { position: absolute; left: 3px; bottom: 3px; display: flex; gap: 2px; flex-wrap: wrap; max-width: 64%; }
.tcg-damage { position: absolute; right: 3px; top: 3px; background: #d3202f; color: #fff; font-weight: 800; font-size: 10px; padding: 1px 4px; border-radius: 5px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }
/* Special Condition badge (renamed from .tcg-status to avoid clashing with the
   action-bar status prompt, which shares no styling with this). */
.tcg-cond { position: absolute; left: 3px; top: 3px; z-index: 4; font-family: "Press Start 2P", monospace; font-size: 7px; color: #fff; padding: 2px 4px; border-radius: 4px; letter-spacing: 0.5px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); animation: tcgStatusPulse 1.4s ease-in-out infinite; }
@keyframes tcgStatusPulse { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }
.st-poison { background: #a040d0; }
.st-burn { background: #e0562e; }
.st-paralyze { background: #d6a10c; color: #1a1400; }
.st-sleep { background: #5a6ea8; }
.st-confuse { background: #d64f9e; }

/* Energy pips — colored disc + white glyph, like real Energy symbols. */
.tcg-pip {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--type, #888); border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.55), inset 0 -1px 2px rgba(0, 0, 0, 0.25);
}
.tcg-pip .tcg-esvg { width: 68%; height: 68%; fill: #fff; display: block; }
.tcg-pip.pip-cost { width: 13px; height: 13px; }
.tcg-pip.pip-mini { width: 13px; height: 13px; }
.tcg-cost { display: inline-flex; gap: 1.5px; align-items: center; }

.tcg-attacks { padding: 3px 2px 1px; display: flex; flex-direction: column; gap: 1px; }
.tcg-attack { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px; padding: 2px 3px; border-radius: 5px; font-size: 11px; border-top: 1px solid rgba(0, 0, 0, 0.09); }
.tcg-attack:first-child { border-top: none; }
.tcg-attack.affordable { background: rgba(76, 165, 90, 0.22); box-shadow: inset 0 0 0 1px rgba(52, 140, 66, 0.55); cursor: pointer; }
.tcg-atk-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcg-atk-dmg { font-weight: 800; font-size: 13px; }

.tcg-card-foot { display: flex; justify-content: space-between; gap: 4px; padding: 2px 4px 1px; margin-top: 1px; border-top: 1px solid rgba(0, 0, 0, 0.14); }
.tcg-foot-cell { display: flex; align-items: center; gap: 3px; font-size: 7px; text-transform: uppercase; letter-spacing: 0.3px; color: #8a7f5c; }
.tcg-foot-cell b { font-weight: 800; }
.tcg-x2 { font-weight: 800; color: #3f9a4e; font-size: 8px; }
.tcg-dash { color: #b3a988; }

.tcg-mini-foot { display: flex; align-items: center; gap: 3px; padding: 2px 3px 1px; font-size: 8px; font-weight: 700; }
.tcg-mini-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Compact overrides for Bench/opponent mini cards. */
.tcg-mini .tcg-stage { display: none; }
.tcg-mini .tcg-name { font-size: 9px; }
.tcg-mini .tcg-hp { font-size: 10px; }
.tcg-mini .tcg-type-badge { width: 13px; height: 13px; }
.tcg-mini .tcg-card-head { padding: 1px 2px; }

@keyframes tcgFoil { 0% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } }

/* Bespoke full-art Pokémon illustrations fill the whole art window (cover). */
.tcg-pokemon.gen-art .tcg-art-frame { background: #1a1712; }
.tcg-pokemon.gen-art .tcg-art img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; filter: none; }

/* Full-art (Illustration Rare): the illustration fills the whole card and the
   text is overlaid on scrims for readability. */
.tcg-pokemon.full-art { padding: 0; }
.tcg-pokemon.full-art .tcg-art { position: absolute; inset: 0; margin: 0; z-index: 0; }
.tcg-pokemon.full-art .tcg-art-frame { border: none; border-radius: 0; background: #16130f; }
.tcg-pokemon.full-art .tcg-card-head { position: relative; z-index: 2; padding: 4px 7px 10px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent); }
.tcg-pokemon.full-art .tcg-name { color: #fff; text-shadow: 0 1px 4px #000, 0 0 8px rgba(0, 0, 0, 0.7); }
.tcg-pokemon.full-art .tcg-stage { color: #f0ead2; text-shadow: 0 1px 3px #000; }
.tcg-pokemon.full-art .tcg-hp { color: #ff6b6b; text-shadow: 0 1px 4px #000; }
.tcg-pokemon.full-art .tcg-attacks { position: relative; z-index: 2; margin-top: auto; padding: 14px 5px 2px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72) 34%); }
.tcg-pokemon.full-art .tcg-attack { border-top-color: rgba(255, 255, 255, 0.15); }
.tcg-pokemon.full-art .tcg-atk-name, .tcg-pokemon.full-art .tcg-atk-dmg { color: #fff; text-shadow: 0 1px 3px #000; }
.tcg-pokemon.full-art .tcg-card-foot { position: relative; z-index: 2; margin-top: 0; border-top: none; background: rgba(0, 0, 0, 0.6); }
.tcg-pokemon.full-art .tcg-foot-cell { color: #d6cfb8; }
.tcg-pokemon.full-art .tcg-mini-foot { position: relative; z-index: 2; color: #fff; text-shadow: 0 1px 3px #000; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7)); }

/* Illustrator credit — a thin strip above the stats footer, like the fine
   print on a real card. Guest-Artist Ultras carry a small "Guest Artist" badge. */
.tcg-illus {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 5px;
  padding: 2px 7px; font-size: 7.5px; font-weight: 600; letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 2px #000;
}
.tcg-pokemon.full-art .tcg-illus { background: rgba(0, 0, 0, 0.55); }
.tcg-illus-badge {
  font-size: 6.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 1px 4px; border-radius: 6px; color: #1a1206; text-shadow: none;
  background: linear-gradient(90deg, #ffd76b, #ffb347); box-shadow: 0 0 6px rgba(255, 200, 90, 0.6);
}
.tcg-mini .tcg-illus { display: none; }

/* ---- Mega EX / Pokémon-ex premium treatment ---- */
.tcg-pokemon.mega-ex {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(255, 210, 100, 0.75), 0 0 22px rgba(255, 190, 70, 0.5);
}
.tcg-pokemon.mega-ex .tcg-card-head { background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent); }
.tcg-ex-ribbon {
  position: absolute; top: 8px; right: -2px; z-index: 5;
  font-size: 9px; font-weight: 900; letter-spacing: 0.6px; color: #2a1c02;
  padding: 2px 8px 2px 9px; border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, #ffe08a, #ffb43d);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 0 5px rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.tcg-pokemon.is-ex:not(.mega-ex) .tcg-ex-ribbon { text-transform: lowercase; font-style: italic; padding: 2px 9px; }
.tcg-ex-prizes {
  position: absolute; left: 6px; bottom: 22px; z-index: 4;
  font-size: 7.5px; font-weight: 800; color: #ffdf8a; text-shadow: 0 1px 2px #000; letter-spacing: 0.3px;
}
.tcg-mini .tcg-ex-ribbon { font-size: 7px; padding: 1px 5px; top: 4px; }

/* ---- rarity ---- */
.tcg-rarity-mark {
  position: absolute; right: 4px; bottom: 3px; z-index: 4;
  font-size: 9px; line-height: 1; color: #6b6244; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}
.tcg-rarity-mark.rm-rare { color: #caa53a; }
.tcg-rarity-mark.rm-ultra { color: transparent; background: linear-gradient(90deg, #ff5f6d, #ffc371, #47e0a0, #6a9bff, #c86bff); -webkit-background-clip: text; background-clip: text; }
/* Holo sheen sweeping over Rare/Ultra cards. */
.tcg-holo {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: inherit; overflow: hidden;
  background: linear-gradient(115deg, transparent 36%, rgba(255, 255, 255, 0.5) 48%, transparent 60%);
  background-size: 250% 250%; animation: tcgFoil 3.8s ease-in-out infinite; mix-blend-mode: screen;
}
.rarity-rare { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 12px color-mix(in srgb, var(--type) 45%, transparent); }
/* Ultra Rare: rainbow foil frame + prismatic shimmer. */
.rarity-ultra { border-image: linear-gradient(135deg, #ff5f6d, #ffc371, #47e0a0, #6a9bff, #c86bff) 1; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 18px rgba(200, 107, 255, 0.5); }
.rarity-ultra .tcg-holo {
  background:
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.55) 49%, transparent 60%),
    repeating-linear-gradient(115deg, rgba(255, 95, 109, 0.16) 0 8px, rgba(71, 224, 160, 0.16) 8px 16px, rgba(106, 155, 255, 0.16) 16px 24px, rgba(200, 107, 255, 0.16) 24px 32px);
  background-size: 250% 250%, 200% 200%; animation: tcgFoil 3s ease-in-out infinite;
}

/* Energy card — big glowing Energy symbol on a type field with a sunburst. */
.tcg-energy {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; border: 3px solid #f4efdd;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--type) 52%, #fff), color-mix(in srgb, var(--type) 90%, #000));
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.tcg-energy::before {
  content: ""; position: absolute; inset: -25%; pointer-events: none; opacity: 0.6;
  background: repeating-conic-gradient(from 0deg at 50% 42%, rgba(255, 255, 255, 0.12) 0 7deg, transparent 7deg 19deg);
}
.tcg-energy-symbol {
  position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 42% 38%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 0 16px rgba(255, 255, 255, 0.4);
}
.tcg-full .tcg-energy-symbol { width: 70px; height: 70px; }
.tcg-energy-symbol .tcg-esvg { width: 62%; height: 62%; fill: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.tcg-energy-name { position: relative; font-size: 10.5px; font-weight: 800; letter-spacing: 0.3px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

/* Trainer card — light with a colored category banner + faint tint. */
.tcg-trainer {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0 0 5px;
  background:
    radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--tk) 16%, transparent), transparent 62%),
    linear-gradient(180deg, #fbf7ea, #e9e2ce);
  color: #211f18;
  border: 3px solid var(--tk); box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45); --tk: #d6a13d;
}
.tcg-trainer.kind-supporter { --tk: #e06cc0; }
.tcg-trainer.kind-stadium { --tk: #4bb0d8; }
.tcg-trainer-banner { width: 100%; background: var(--tk); color: #fff; font-size: 7px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; text-align: center; padding: 2px 0; }
/* Framed illustration window, mirroring the Pokémon card art window. */
.tcg-trainer-art {
  width: calc(100% - 10px); margin: 4px 5px 0; flex: 1; min-height: 0; border-radius: 4px; overflow: hidden;
  display: grid; place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--tk) 55%, #6f6033);
  background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--tk) 24%, #fff), #cbc5b4 92%);
}
.tcg-trainer-art img { max-width: 92%; max-height: 92%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
/* Item sprites are small pixel art — upscale crisply and centre. */
.art-item .tcg-trainer-art img { image-rendering: pixelated; max-width: 60%; max-height: 60%; }
/* Trainer character sprites sit taller and bottom-aligned. */
.art-trainer .tcg-trainer-art { align-items: end; }
.art-trainer .tcg-trainer-art img { max-height: 100%; }
.tcg-trainer-art-icon { color: var(--tk); }
.tcg-trainer-art-icon .tcg-tsvg { width: 42%; height: 42%; }
/* Bespoke illustrations fill the whole window (cover). */
.art-art .tcg-trainer-art { border-color: color-mix(in srgb, var(--tk) 70%, #6f6033); background: #2a2620; }
.art-art .tcg-trainer-art img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; filter: none; image-rendering: auto; }
.tcg-trainer-name { font-weight: 800; font-size: 11px; text-align: center; padding: 2px 4px 0; }
.tcg-mini .tcg-trainer-name { font-size: 9px; }
.tcg-trainer-text { font-size: 8.5px; color: #5f5943; text-align: center; padding: 0 6px; line-height: 1.3; }

/* Card back — classic blue Pokéball. */
.tcg-back { background: linear-gradient(150deg, #2f61bd, #16357a); border: 3px solid #e9e6d8; display: grid; place-items: center; min-height: 56px; }
.tcg-back-face { width: 58%; display: grid; place-items: center; }
.tcg-back-face .tcg-ball { width: 100%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }

/* interaction states */
.tcg-card[data-zone="hand"], .tcg-card[data-uid] { cursor: pointer; }
.tcg-card.selected { outline: 3px solid #f7d02c; outline-offset: 2px; transform: translateY(-8px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55); z-index: 3; }
.tcg-card.targetable { outline: 3px solid #57d06a; outline-offset: 2px; box-shadow: 0 0 18px rgba(87, 208, 106, 0.6); cursor: pointer; }

/* ---- bottom dock: hand + controls pinned to the viewport bottom ---- */
.tcg-dock {
  position: sticky; bottom: 0; z-index: 6;
  background: linear-gradient(180deg, rgba(13, 11, 24, 0) 0%, rgba(13, 11, 24, 0.82) 22%, rgba(13, 11, 24, 0.97) 55%);
  backdrop-filter: blur(6px);
}

/* ---- hand (fans + overlaps as it grows) ---- */
.tcg-hand-wrap { margin-top: auto; }
.tcg-hand-label { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: #8a8eaa; padding: 3px 0 2px; }
.tcg-hand-toggle { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); color: #cdd0e6; border-radius: 7px; padding: 3px 10px; font-size: 10px; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; }
.tcg-hand-toggle:hover { background: rgba(255, 255, 255, 0.16); }
/* Hand cards keep the standard proportion; a slightly smaller width keeps the
   dock from getting too tall. */
.tcg-hand .tcg-full { width: 120px; }
.tcg-hand {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 6px; padding: 6px 8px 4px; overflow-x: auto; overflow-y: visible; scrollbar-width: thin;
}
.tcg-hand::-webkit-scrollbar { height: 6px; }
.tcg-hand .tcg-card {
  transform-origin: bottom center;
  transform: translateY(var(--fan-y, 0)) rotate(var(--fan-rot, 0deg));
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.25, 1.15), box-shadow 0.14s ease, margin 0.14s ease;
}
/* Overlap ramps up with hand size so many cards stay on one row. */
.tcg-hand[data-size="7"] .tcg-card, .tcg-hand[data-size="8"] .tcg-card { margin: 0 -14px; }
.tcg-hand[data-size="9"] .tcg-card, .tcg-hand[data-size="10"] .tcg-card { margin: 0 -26px; }
.tcg-hand[data-size="11"] .tcg-card, .tcg-hand[data-size="12"] .tcg-card,
.tcg-hand[data-size="13"] .tcg-card, .tcg-hand[data-size="14"] .tcg-card { margin: 0 -38px; }
/* Hovered/selected cards straighten, rise clear of the fan, and enlarge. */
.tcg-hand .tcg-card:hover { transform: translateY(-18px) rotate(0deg) scale(1.06); z-index: 20; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.62); }
.tcg-hand .tcg-card.selected { transform: translateY(-14px) rotate(0deg) scale(1.03); z-index: 21; }
.tcg-hand-empty { color: var(--muted, #8a8eaa); font-size: 12px; padding: 20px; }

/* ---- action bar (inside the dock) ---- */
.tcg-action-bar {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 4px 10px;
}
.tcg-status { font-size: 12px; color: var(--ink, #f0eee2); text-align: center; min-height: 16px; }
.tcg-note { font-size: 10px; color: #ffb27a; text-align: center; }
.tcg-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tcg-btn {
  background: rgba(255, 255, 255, 0.08); color: var(--ink, #f0eee2);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 9px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.tcg-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.15); }
.tcg-btn.primary { background: linear-gradient(90deg, #f7d02c, #ee8130); color: #1a0a00; border-color: transparent; }
.tcg-btn.ghost { background: transparent; }
.tcg-attack-choose { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tcg-atk-btn { display: flex; align-items: center; gap: 6px; background: rgba(108, 217, 124, 0.16); border: 1px solid rgba(108, 217, 124, 0.45); color: var(--ink, #f0eee2); border-radius: 9px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.tcg-atk-btn.disabled { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); color: var(--muted, #8a8eaa); cursor: not-allowed; }
.tcg-atk-btn-name { font-weight: 600; }
.tcg-atk-btn-dmg { font-family: "Press Start 2P", monospace; font-size: 11px; }

/* ---- log: a floating panel pinned to the right-middle of the screen ---- */
.tcg-log {
  position: fixed; right: 8px; top: 50%; transform: translateY(-50%); z-index: 4;
  width: 150px; max-height: 40vh; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
  font-size: 10.5px; color: var(--muted, #8a8eaa); text-align: right;
  background: rgba(10, 9, 20, 0.55); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; backdrop-filter: blur(4px); pointer-events: none;
}
.tcg-log-line { line-height: 1.35; }
.tcg-log-line:last-child { color: var(--ink, #f0eee2); }
/* On narrow screens tuck it to a thin strip so it never crowds the board. */
@media (max-width: 640px) {
  .tcg-log { width: 108px; right: 4px; font-size: 9px; padding: 6px 7px; opacity: 0.9; }
}

/* ---- game over ---- */
.tcg-gameover { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgba(6, 6, 14, 0.72); backdrop-filter: blur(4px); }
.tcg-gameover-card { background: linear-gradient(180deg, #24243a, #16162a); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px; padding: 26px 30px; text-align: center; max-width: 90%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.tcg-gameover-card.win { border-color: rgba(247, 208, 44, 0.5); box-shadow: 0 0 40px rgba(247, 208, 44, 0.3); }
.tcg-go-title { font-family: "Press Start 2P", monospace; font-size: 20px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.tcg-go-title .tcg-trophy { width: 30px; height: 30px; }
.tcg-gameover-card.win .tcg-go-title { color: #f7d02c; }
.tcg-go-sub { color: var(--muted, #8a8eaa); font-size: 13px; margin-bottom: 20px; }
.tcg-go-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- deck picker (pre-match) ---- */
.tcg-picker {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  overflow-y: auto; gap: 22px; padding: 40px 16px; box-sizing: border-box;
  background:
    radial-gradient(circle at 20% 12%, rgba(120, 70, 210, 0.22), transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(60, 150, 210, 0.2), transparent 45%),
    radial-gradient(ellipse at 50% 120%, rgba(247, 208, 44, 0.12), transparent 55%),
    linear-gradient(160deg, #0e0c1a, #171326);
}
.tcg-picker-head { text-align: center; }
.tcg-picker-title {
  font-family: "Press Start 2P", monospace; font-size: 22px; margin: 0 0 10px;
  background: linear-gradient(90deg, #f7d02c, #ee8130, #f95587, #6390F0, #f7d02c);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 200, 80, 0.3)); animation: tcgTitleShimmer 6s ease-in-out infinite;
  line-height: 1.3; padding: 0.1em;
}
@keyframes tcgTitleShimmer { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.tcg-picker-sub { color: #a9adca; font-size: 13px; text-align: center; max-width: 500px; line-height: 1.6; margin: 0 auto; }

.tcg-deck-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; width: 100%; max-width: 800px; }
.tcg-deck-card { flex: 0 1 232px; }

/* Deck box — type-themed, holo shine, floating hero art, staggered entrance. */
.tcg-deck-card {
  position: relative; overflow: hidden; cursor: pointer; text-align: center;
  border-radius: 16px; padding: 14px 14px 16px;
  border: 1px solid color-mix(in srgb, var(--type) 45%, rgba(255,255,255,0.12));
  background:
    radial-gradient(circle at 50% 8%, color-mix(in srgb, var(--type) 34%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(28, 26, 48, 0.92), rgba(16, 15, 30, 0.96));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  animation: tcgDeckIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) backwards;
  animation-delay: var(--pick-delay, 0ms);
}
@keyframes tcgDeckIn { 0% { opacity: 0; transform: translateY(24px) scale(0.94); } 100% { opacity: 1; transform: none; } }
.tcg-deck-card:hover {
  transform: translateY(-6px);
  border-color: var(--type);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5), 0 0 24px color-mix(in srgb, var(--type) 55%, transparent);
}
.tcg-deck-shine {
  position: absolute; inset: 0; pointer-events: none; border-radius: 16px;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.14) 48%, transparent 58%);
  background-size: 250% 250%; opacity: 0; transition: opacity 0.2s ease;
}
/* Decks that carry a Mega EX get a gold ribbon + warmer glow. */
.tcg-deck-card.has-mega { border-color: rgba(255, 200, 90, 0.6); }
.tcg-deck-card.has-mega:hover { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5), 0 0 26px rgba(255, 190, 70, 0.55); }
.tcg-deck-mega {
  position: absolute; top: 10px; right: -26px; z-index: 3; transform: rotate(38deg);
  background: linear-gradient(90deg, #ffe08a, #ffb43d); color: #2a1c02;
  font-size: 9px; font-weight: 900; letter-spacing: 0.5px; padding: 3px 28px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.tcg-deck-card:hover .tcg-deck-shine { opacity: 1; animation: tcgFoil 1.6s ease-in-out infinite; }

.tcg-deck-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.tcg-deck-type { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--type); }
.tcg-deck-total { font-family: "Press Start 2P", monospace; font-size: 11px; color: rgba(255,255,255,0.4); }
.tcg-deck-hero { height: 116px; display: grid; place-items: center; margin: 2px 0; }
.tcg-deck-hero img {
  max-width: 116px; max-height: 116px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 16px color-mix(in srgb, var(--type) 40%, transparent));
  animation: tcgHeroBob 3.4s ease-in-out infinite alternate;
}
@keyframes tcgHeroBob { from { transform: translateY(0); } to { transform: translateY(-8px); } }
.tcg-deck-name { font-family: "Press Start 2P", monospace; font-size: 13px; color: #fff; margin: 4px 0 6px; text-shadow: 0 0 10px color-mix(in srgb, var(--type) 60%, transparent); }
.tcg-deck-blurb { font-size: 11px; color: #b6b9d2; line-height: 1.45; min-height: 46px; }
.tcg-deck-preview { display: flex; justify-content: center; gap: 4px; margin: 8px 0; }
.tcg-deck-thumb {
  width: 34px; height: 34px; border-radius: 8px; background-size: 30px; background-repeat: no-repeat; background-position: center;
  image-rendering: pixelated;
  background-color: rgba(255, 255, 255, 0.05); border: 1px solid color-mix(in srgb, var(--type) 35%, rgba(255,255,255,0.08));
}
.tcg-deck-stats { display: flex; justify-content: center; gap: 12px; font-size: 11px; font-weight: 700; color: #cdd0e6; margin-bottom: 10px; }
.tcg-deck-stats span { display: inline-flex; align-items: center; gap: 4px; }
.tcg-deck-stats svg { width: 15px; height: 15px; }
.tcg-deck-stats .tcg-tsvg { color: #d6a13d; }
.tcg-deck-play {
  font-weight: 800; font-size: 13px; color: #12101c; border-radius: 9px; padding: 8px 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--type) 85%, #fff), var(--type));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--type) 45%, transparent);
  transition: filter 0.15s ease;
}
.tcg-deck-card:hover .tcg-deck-play { filter: brightness(1.1); }
.tcg-picker-exit { margin-top: 4px; }

@media (max-width: 560px) {
  .tcg-full { width: 128px; }
  .tcg-mini { width: 64px; }
  .tcg-deck-grid { grid-template-columns: 1fr; max-width: 340px; }
  .tcg-go-title { font-size: 16px; }
  /* Lighter hand overlap on touch screens so each card stays easy to tap;
     the hand scrolls horizontally for overflow instead of hiding tap targets. */
  .tcg-hand { justify-content: flex-start; }
  .tcg-hand[data-size="7"] .tcg-card, .tcg-hand[data-size="8"] .tcg-card { margin: 0 -4px; }
  .tcg-hand[data-size="9"] .tcg-card, .tcg-hand[data-size="10"] .tcg-card { margin: 0 -10px; }
  .tcg-hand[data-size="11"] .tcg-card, .tcg-hand[data-size="12"] .tcg-card,
  .tcg-hand[data-size="13"] .tcg-card, .tcg-hand[data-size="14"] .tcg-card { margin: 0 -16px; }
}

/* ============ juice: motion, shine & combat FX ============ */

/* Slow drifting aurora behind the playmat. */
.tcg-board::before {
  content: ""; position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: 0.55;
  background:
    radial-gradient(closest-side at 28% 26%, rgba(122, 70, 205, 0.28), transparent),
    radial-gradient(closest-side at 74% 72%, rgba(48, 140, 185, 0.24), transparent),
    radial-gradient(closest-side at 60% 40%, rgba(230, 90, 140, 0.14), transparent);
  animation: tcgAurora 26s ease-in-out infinite alternate;
}
@keyframes tcgAurora {
  from { transform: translate(-3%, -2%) scale(1.05); }
  to   { transform: translate(3%, 3%) scale(1.16); }
}

/* Active spot breathes. */
.tcg-active-row::before { animation: tcgSpot 2.8s ease-in-out infinite; }
@keyframes tcgSpot {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}

/* Turn banner subtle pulse. */
.tcg-turn { animation: tcgTurnPulse 2.4s ease-in-out infinite; }
@keyframes tcgTurnPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(247, 208, 44, 0.12); }
  50%      { box-shadow: 0 0 22px rgba(247, 208, 44, 0.3); }
}

/* Holo card-tilt on hover for hand cards. */
.tcg-hand .tcg-card:hover { transform: translateY(-18px) rotate(0deg) scale(1.06) perspective(600px) rotateX(7deg); }

/* Ultra Rare pulses a prismatic glow. */
.rarity-ultra { animation: tcgUltraGlow 2.6s ease-in-out infinite; }
@keyframes tcgUltraGlow {
  0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 14px rgba(200, 107, 255, 0.4); }
  50%      { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55), 0 0 26px rgba(110, 175, 255, 0.6); }
}

/* ---- attack animation ---- */
.tcg-lunge-up { animation: tcgLungeUp 0.5s ease; z-index: 6; }
.tcg-lunge-down { animation: tcgLungeDown 0.5s ease; z-index: 6; }
@keyframes tcgLungeUp {
  0% { transform: translateY(0); } 42% { transform: translateY(-26px) scale(1.06); } 100% { transform: translateY(0); }
}
@keyframes tcgLungeDown {
  0% { transform: translateY(0); } 42% { transform: translateY(26px) scale(1.06); } 100% { transform: translateY(0); }
}
.tcg-hit { animation: tcgHit 0.42s ease; }
.tcg-hit::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 90, 90, 0.55), rgba(255, 60, 60, 0.15) 70%);
  animation: tcgFlash 0.42s ease;
}
@keyframes tcgHit {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-1.5deg); } 40% { transform: translateX(6px) rotate(1.5deg); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}
@keyframes tcgFlash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.tcg-dmg-float {
  position: fixed; z-index: 3000; pointer-events: none; transform: translate(-50%, -50%);
  font-family: "Press Start 2P", monospace; font-size: 22px; font-weight: 800;
  color: #ff5c63; text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 2px 4px #000;
  animation: tcgDmgFloat 1s ease forwards;
}
.tcg-dmg-float.ko { color: #ffd23f; font-size: 18px; }
@keyframes tcgDmgFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  22% { opacity: 1; transform: translate(-50%, -70%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

/* ============ booster packs & binder ============ */
.tcg-btn.disabled { opacity: 0.45; cursor: not-allowed; }
.tcg-go-reward { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; color: #f7d02c; margin: 4px 0 8px; }
.tcg-go-reward svg { width: 22px; height: 22px; }
.tcg-go-season { text-align: center; font-size: 13px; color: #cdd0e6; margin: 2px 0 4px; }
.tcg-go-sp { font-weight: 800; color: #7fe0a0; }
.tcg-go-rankup {
  text-align: center; font-weight: 800; font-size: 13px; color: #1a1206; margin: 4px auto 12px;
  padding: 5px 12px; border-radius: 10px; width: max-content;
  background: linear-gradient(90deg, #ffd76b, #ffb347); box-shadow: 0 0 14px rgba(255, 200, 90, 0.55);
}

/* ---- season banner (deck picker hub) ---- */
.tcg-season {
  display: flex; align-items: stretch; gap: 12px; max-width: 640px; margin: 0 auto 14px;
  padding: 12px 14px; border-radius: 16px; text-align: left;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--type) 30%, #14121c), color-mix(in srgb, var(--type) 8%, #14121c));
  border: 1px solid color-mix(in srgb, var(--type) 45%, transparent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 30px color-mix(in srgb, var(--type) 12%, transparent);
}
.tcg-season-main { flex: 1; min-width: 0; }
.tcg-season-top { display: flex; align-items: center; gap: 6px; }
.tcg-season-emoji { font-size: 18px; }
.tcg-season-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #a7abc6; font-weight: 700; }
.tcg-season-name { font-weight: 800; font-size: 17px; color: #fff; }
.tcg-season-days { margin-left: auto; font-size: 11px; font-weight: 700; color: #ffd76b; background: rgba(0, 0, 0, 0.3); padding: 2px 8px; border-radius: 8px; }
.tcg-season-blurb { font-size: 11.5px; color: #c7cbe6; margin: 4px 0 8px; line-height: 1.35; }
.tcg-season-ladder { display: flex; align-items: center; gap: 8px; }
.tcg-season-tier { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; min-width: 58px; }
.tcg-season-bar { flex: 1; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.4); overflow: hidden; }
.tcg-season-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--type), #fff6); transition: width 0.5s ease; }
.tcg-season-next { font-size: 10.5px; color: #a7abc6; font-weight: 600; white-space: nowrap; }
.tcg-season-feat { display: flex; gap: 6px; align-items: center; }
.tcg-season-ultra {
  width: 46px; height: 64px; border-radius: 7px; background-size: cover; background-position: center top;
  border: 1.5px solid rgba(255, 255, 255, 0.35); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
@media (max-width: 560px) {
  .tcg-season { flex-direction: column; gap: 8px; }
  .tcg-season-feat { justify-content: center; }
}

/* ---- online lobby ---- */
.tcg-lobby { max-width: 560px; margin: 0 auto; }
.tcg-lobby-decks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.tcg-lobby-deck {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid rgba(255, 255, 255, 0.12); color: #cdd0e6; font-size: 13px;
}
.tcg-lobby-deck svg { width: 15px; height: 15px; }
.tcg-lobby-deck.sel { border-color: var(--type); background: color-mix(in srgb, var(--type) 22%, transparent); color: #fff; box-shadow: 0 0 12px color-mix(in srgb, var(--type) 40%, transparent); }
.tcg-lobby-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 6px auto 12px; max-width: 320px; }
.tcg-lobby-actions .tcg-btn { width: 100%; }
.tcg-lobby-join { display: flex; gap: 8px; width: 100%; }
.tcg-lobby-code {
  flex: 1; text-align: center; letter-spacing: 4px; font-weight: 800; font-size: 18px; text-transform: uppercase;
  padding: 8px; border-radius: 10px; border: 1.5px solid rgba(255, 255, 255, 0.16); background: rgba(0, 0, 0, 0.35); color: #fff;
}
.tcg-lobby-join .tcg-btn { width: auto; padding: 8px 18px; }
.tcg-lobby-status { text-align: center; min-height: 22px; color: #c7cbe6; font-size: 14px; margin: 6px 0; }
.tcg-roomcode { letter-spacing: 3px; color: #ffd76b; font-size: 18px; }
.tcg-spin {
  display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: tcgSpin 0.7s linear infinite;
}
@keyframes tcgSpin { to { transform: rotate(360deg); } }

.tcg-shelf { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.tcg-shelf .tcg-btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.tcg-pack-cta { animation: tcgUltraGlow 2s ease-in-out infinite; }

.tcg-pack-overlay {
  position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 20px; box-sizing: border-box; overflow: auto;
  background: radial-gradient(circle at 50% 28%, rgba(90, 60, 160, 0.5), rgba(6, 6, 14, 0.92)); backdrop-filter: blur(8px);
}
.tcg-pack-stage { text-align: center; max-width: 840px; }
.tcg-pack-title { font-family: "Press Start 2P", monospace; font-size: 18px; color: #f7d02c; margin-bottom: 6px; line-height: 1.4; }
.tcg-pack-title.hit-ultra { background: linear-gradient(90deg, #ff5f6d, #ffc371, #47e0a0, #6a9bff, #c86bff); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: tcgTitleShimmer 3s linear infinite; }
.tcg-pack-title.hit-rare { color: #ffd23f; }
.tcg-pack-sub { color: #b6b9d2; font-size: 12px; margin-bottom: 16px; }
.tcg-pack-cards { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.tcg-pack-slot { position: relative; width: 146px; min-height: 198px; display: grid; place-items: center; cursor: pointer; animation: packIn 0.4s backwards; animation-delay: calc(var(--i) * 0.07s); }
.tcg-pack-back { width: 146px; height: 198px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(150deg, #2f61bd, #16357a); border: 3px solid #e9e6d8; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); transition: transform 0.12s ease; }
.tcg-pack-slot:hover .tcg-pack-back { transform: translateY(-4px) scale(1.02); }
.tcg-pack-back .tcg-ball { width: 54%; }
.tcg-pack-reveal { animation: cardPop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
@keyframes cardPop { 0% { transform: scale(0.4) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes packIn { 0% { transform: translateY(18px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.tcg-pack-slot.rar-rare::before, .tcg-pack-slot.rar-ultra::before {
  content: ""; position: absolute; inset: -16px; border-radius: 18px; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(247, 208, 44, 0.55), transparent 70%); animation: tcgBurst 0.7s ease forwards;
}
.tcg-pack-slot.rar-ultra::before {
  background: conic-gradient(from 0deg, #ff5f6d, #ffc371, #47e0a0, #6a9bff, #c86bff, #ff5f6d); filter: blur(7px);
  animation: tcgBurst 0.7s ease forwards, spin 6s linear infinite;
}
@keyframes tcgBurst { 0% { transform: scale(0.4); opacity: 0; } 50% { opacity: 1; } 100% { transform: scale(1); opacity: 0.6; } }
@keyframes spin { to { transform: rotate(360deg); } }
.tcg-pack-rlabel { margin-top: 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #b6b9d2; }
.tcg-pack-slot.rar-rare .tcg-pack-rlabel { color: #ffd23f; }
.tcg-pack-slot.rar-ultra .tcg-pack-rlabel { color: #d59bff; }
.tcg-pack-actions { display: flex; gap: 10px; justify-content: center; }

.tcg-binder { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 14px; box-sizing: border-box; overflow-y: auto;
  background: radial-gradient(circle at 50% 0%, rgba(90, 60, 160, 0.2), transparent 55%), linear-gradient(160deg, #0e0c1a, #171326); }
.tcg-binder-head { text-align: center; }
.tcg-binder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; width: 100%; max-width: 860px; }
.tcg-binder-cell { position: relative; display: flex; flex-direction: column; align-items: center; }
.tcg-binder-cell.unowned { filter: grayscale(1) brightness(0.35); opacity: 0.55; }
.tcg-binder-count { font-size: 10px; font-weight: 800; color: #d7daff; margin-top: 3px; }
.tcg-binder-count.locked { color: #6a6e88; }

/* ===== First-load mode chooser (Battle vs TCG) ===== */
.mode-chooser {
  position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background:
    radial-gradient(50% 45% at 20% 12%, rgba(255, 95, 109, 0.22), transparent 60%),
    radial-gradient(48% 50% at 82% 18%, rgba(106, 155, 255, 0.22), transparent 60%),
    radial-gradient(60% 55% at 55% 92%, rgba(200, 107, 255, 0.2), transparent 60%),
    linear-gradient(180deg, #0b0913, #100d1c);
  animation: mcFade 0.35s ease;
}
@keyframes mcFade { from { opacity: 0; } to { opacity: 1; } }
.mc-inner { width: 100%; max-width: 860px; text-align: center; }
.mc-kicker { font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: #8f93bd; margin-bottom: 8px; }
.mc-title {
  font-size: clamp(26px, 5vw, 44px); font-weight: 900; line-height: 1.05; margin: 0 0 10px; color: #fff;
}
.mc-sub { color: #b9bce0; font-size: 15px; margin: 0 auto 26px; max-width: 520px; }
.mc-cards { display: flex; gap: 18px; justify-content: center; align-items: stretch; }
.mc-card {
  position: relative; flex: 1 1 0; max-width: 380px; text-align: left; cursor: pointer; color: #fff;
  border-radius: 20px; padding: 24px 22px 20px; border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(30, 27, 50, 0.9), rgba(16, 15, 30, 0.96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: mcRise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) backwards;
  display: flex; flex-direction: column;
}
.mc-card:nth-child(2) { animation-delay: 0.08s; }
@keyframes mcRise { from { opacity: 0; transform: translateY(26px) scale(0.95); } to { opacity: 1; transform: none; } }
.mc-battle:hover { transform: translateY(-6px); border-color: #ff7a4d; box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55), 0 0 30px rgba(255, 110, 70, 0.4); }
.mc-tcg:hover { transform: translateY(-6px); border-color: #b98bff; box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55), 0 0 30px rgba(150, 110, 255, 0.45); }
.mc-battle { background: linear-gradient(180deg, rgba(60, 30, 26, 0.92), rgba(24, 16, 22, 0.96)); }
.mc-tcg { background: linear-gradient(180deg, rgba(40, 28, 60, 0.92), rgba(18, 16, 32, 0.96)); }
.mc-emoji { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.mc-name { font-size: 26px; font-weight: 900; margin-bottom: 8px; }
.mc-tcg .mc-name {
  background: linear-gradient(90deg, #ff5f6d, #ffc371, #47e0a0, #6a9bff, #c86bff); -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: sheen 5s linear infinite;
}
@keyframes sheen { to { background-position: 200% center; } }
.mc-desc { font-size: 13.5px; line-height: 1.5; color: #c7cbe6; flex: 1; margin-bottom: 16px; }
.mc-cta {
  align-self: flex-start; font-weight: 800; font-size: 14px; padding: 9px 18px; border-radius: 11px; color: #fff;
}
.mc-battle .mc-cta { background: linear-gradient(90deg, #ff6b3d, #ff8f5a); }
.mc-tcg .mc-cta { background: linear-gradient(90deg, #7a6bff, #c86bff); }
.mc-badge {
  position: absolute; top: 14px; right: 14px; font-size: 10px; font-weight: 900; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; color: #1a1206; background: linear-gradient(90deg, #ffd76b, #ffb347); box-shadow: 0 0 12px rgba(255, 200, 90, 0.5);
}
.mc-close { margin-top: 24px; background: none; border: 0; color: #8a8daf; font-size: 13px; font-weight: 600; cursor: pointer; padding: 8px 16px; }
.mc-close:hover { color: #cdd0e6; }
@media (max-width: 620px) {
  .mc-cards { flex-direction: column; align-items: stretch; }
  .mc-card { max-width: none; }
}

/* "Switch game mode" pill on the Battle home screen */
.switch-mode-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 4px auto 0; cursor: pointer;
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #e7d6ff;
  border: 1px solid rgba(180, 130, 255, 0.4);
  background: linear-gradient(90deg, rgba(150, 110, 255, 0.18), rgba(200, 107, 255, 0.18));
  transition: 0.15s;
}
.switch-mode-btn b { color: #fff; }
.switch-mode-btn:hover { background: linear-gradient(90deg, rgba(150, 110, 255, 0.34), rgba(200, 107, 255, 0.34)); border-color: rgba(180, 130, 255, 0.7); transform: translateY(-1px); }
