:root {
  --bg: #e8e5df;
  --ink: #141414;
  --muted: #6f6f6b;
  --pack: #2b3ff0;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --spring: linear(0,0.055,0.193,0.378,0.577,0.767,0.93,1.056,1.142,1.19,1.205,1.195,1.167,1.13,1.089,1.05,1.016,0.99,0.972,0.961,0.958,0.96,0.965,0.973,0.981,0.989,0.996,1.002,1.006,1.008,1);
  /* Exact holo.yashb.xyz pouch (0.69:1) & card (5:7) proportions */
  --ph: min(420px, 58vh, 58svh, 120vw);
  --pw: calc(var(--ph) * .69);
  --cw: calc(var(--pw) * .84);
  --ch: calc(var(--cw) * 1.4);
  --crimp: calc(var(--ph) * .068);
  --d: 16px;
  --rainbow: repeating-linear-gradient(110deg, #ff7aa8 0%, #ffcf6b 5%, #a8ff8a 10%, #6be2ff 15%, #9b8cff 20%, #ff7aa8 25%);
  --glitter: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.8' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 14 0 0 0 -8.6'/></filter><rect width='160' height='160' filter='url(%23g)'/></svg>");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
html { overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 38%, #f3f1ec, var(--bg) 58%, #d8d4cb);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Text", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
i { font-style: normal; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Top Economy & Collection HUD ---------- */
.hud {
  position: fixed; top: 12px; left: 14px; right: 14px; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  pointer-events: none; gap: 8px;
}
.hud > * { pointer-events: auto; }
.pack-tabs {
  display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.76); backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.08); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.pack-tab {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 999px;
  cursor: pointer; transition: all .18s var(--ease-out);
}
.pack-tab.active { background: var(--ink); color: #fff; }

.hud-right { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.res-chip {
  background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.09); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.pill-btn {
  border: 1px solid rgba(0, 0, 0, 0.1); background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(10px); color: var(--ink); font-size: 12px; font-weight: 800;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06); transition: scale .15s var(--ease-out), background .15s;
}
.pill-btn:hover { background: #fff; }
.pill-btn:active { scale: .96; }
.pill-btn.accent-btn { background: #18181b; color: #fff; border-color: #18181b; }
.pill-btn.accent-btn:hover { background: #27272a; }
.badge-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ef4444;
  display: inline-block; box-shadow: 0 0 0 2px #fff;
}

.toast {
  position: fixed; top: 64px; left: 50%; translate: -50% 0; z-index: 120;
  background: #18181b; color: #fff; font-size: 13px; font-weight: 700;
  padding: 9px 18px; border-radius: 999px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none; transition: opacity .25s, transform .25s var(--ease-out);
}

/* ---------- 3D Stage & Foil Pouch (Exact holo.yashb.xyz Architecture) ---------- */
.stage {
  position: fixed; inset: 0; overflow: hidden;
  perspective: 1400px; perspective-origin: 50% 40%;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.scene { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.scene.flat { transform-style: flat; perspective: 1400px; perspective-origin: 50% 40%; }
.hit, .card { pointer-events: auto; }
.pack, .card { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; will-change: transform; }
.pack { width: var(--pw); height: var(--ph); margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) / -2); }
.ground {
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--pw) * .95); height: calc(var(--pw) * .16);
  margin: calc(var(--pw) * -.08) 0 0 calc(var(--pw) * -.475);
  border-radius: 50%; background: radial-gradient(closest-side, rgb(30 25 15 / .3), transparent);
  filter: blur(6px); pointer-events: none;
}

.skin {
  position: absolute; inset: 0; backface-visibility: hidden;
  transform: translateZ(calc(var(--d) / 2));
  --tooth: calc(var(--pw) / 26);
  background:
    var(--shade, none) 0 0 / 100% 100%,
    linear-gradient(90deg, transparent 91%, rgb(0 0 0 / .14) 97.6%) 0 50% / 100% calc(100% - 2 * var(--crimp)) no-repeat,
    repeating-linear-gradient(90deg, rgb(0 0 0 / .18) 0 1px, rgb(255 255 255 / .08) 1px 2px, transparent 2px 5px) 0 0 / 100% var(--crimp) no-repeat,
    repeating-linear-gradient(90deg, rgb(0 0 0 / .18) 0 1px, rgb(255 255 255 / .08) 1px 2px, transparent 2px 5px) 0 100% / 100% var(--crimp) no-repeat,
    var(--pack);
  mask:
    conic-gradient(from 135deg at 50% 0, #0000, #000 1deg 89deg, #0000 90deg) 0 0 / var(--tooth) calc(var(--tooth) / 2) repeat-x,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='M0 0H100V5.6C100 8 97.6 7.6 97.6 10V90C97.6 92.4 100 92 100 94.4V100H0V94.4C0 92 2.4 92.4 2.4 90V10C2.4 7.6 0 8 0 5.6Z'/></svg>") 0 50% / 100% calc(100% - var(--tooth)) no-repeat,
    conic-gradient(from -45deg at 50% 100%, #0000, #000 1deg 89deg, #0000 90deg) 0 100% / var(--tooth) calc(var(--tooth) / 2) repeat-x;
}
.skin.back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); }
.skin::before, .skin::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.skin::before {
  background: linear-gradient(90deg, transparent 2.4%, rgb(255 255 255 / .7) 3%, rgb(255 255 255 / .28) 5%, transparent 9%);
  mask: linear-gradient(transparent 7%, #000 13% 48%, transparent 84%);
  translate: calc(var(--gx, 0) * 1%) 0; opacity: var(--gl, .8);
}
.skin::after {
  background: var(--shine, none) 0 0 / 100% 100%; opacity: var(--gt, .85);
  mask: linear-gradient(90deg, rgb(0 0 0 / .45), #000 40% 60%, rgb(0 0 0 / .45)) calc(var(--gm, 50) * 1%) 0 / 250% 100%;
}
.rim { position: absolute; pointer-events: none; }

.flow {
  position: absolute; left: 50%; top: 50%; width: var(--pw); height: var(--ph);
  margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) / -2);
  transform-style: preserve-3d; pointer-events: none;
}
.rays {
  position: absolute; left: 0; width: 100%;
  top: calc(10.5% - var(--pw) * .6); height: calc(var(--pw) * .76);
  overflow: visible; opacity: 0; transform: translateZ(-6px);
}

/* Pack Print & Path-Traced Blender 3D Chrome Sparkle Mascot */
.tag { position: absolute; left: 9%; top: calc(var(--crimp) + .9%); font: 700 calc(var(--pw) * .029)/1 system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase; color: rgb(255 255 255 / .74); }
.mark { position: absolute; left: 9%; top: 15%; font: 800 calc(var(--pw) * .17)/1 ui-rounded, "SF Pro Rounded", system-ui, sans-serif; letter-spacing: -.045em; color: #fff; }
.series { position: absolute; right: 9%; top: 17.5%; font: 600 calc(var(--pw) * .036)/1 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: rgb(255 255 255 / .7); }
.foot { position: absolute; bottom: calc(var(--crimp) + 3.4%); font: 500 calc(var(--pw) * .04)/1 system-ui, sans-serif; color: rgb(255 255 255 / .82); }
.foot.l { left: 9%; }
.foot.r { right: 9%; }

.orb { position: absolute; left: 8%; width: 84%; top: 26.5%; aspect-ratio: 1; transition: scale .35s var(--spring); }
.body, .shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb .body { filter: hue-rotate(calc((var(--mh, 0) + var(--sh, 0)) * 1deg)); }
.shade { translate: 0 3.5%; filter: brightness(0) blur(calc(var(--pw) * .024)); opacity: .34; }
.eye { position: absolute; transition: opacity .09s, scale .14s var(--ease-out); }
.pupil { display: block; width: 100%; height: auto; transition: scale .2s var(--ease-out); }
.smile { position: absolute; height: auto; transition: opacity .08s, scale .2s var(--ease-out); }
.joy { position: absolute; height: auto; opacity: 0; scale: .7; transition: opacity .09s, scale .34s var(--spring); }
.glad .joy { opacity: 1; scale: 1; }
.glad .eye, .glad .smile { opacity: 0; scale: .7; }

.ouch { position: absolute; height: auto; opacity: 0; scale: .6; transition: opacity .08s, scale .24s var(--spring); }
.drip { position: absolute; height: auto; opacity: 0; scale: .7; translate: 0 -45%; transition: opacity .18s, scale .3s var(--spring), translate .5s var(--ease-out); }
.held .orb { scale: 1.06 .92; animation: tremble 90ms steps(2) infinite; }
.held .eye { scale: 1 0; }
.held .smile { opacity: 0; scale: .3; }
.held .ouch { opacity: 1; scale: 1; }
.hurt .drip { opacity: 1; scale: 1; translate: 0 0; }
.tug .orb { scale: .95 1.07; }
@keyframes tremble { 50% { translate: 1.2px -.8px; } }
@media (hover: hover) and (pointer: fine) {
  .pack:has(.hit:hover) .pupil { scale: 1.06; }
  .pack:has(.hit:hover) .smile { scale: 1.1; }
}

.fin {
  position: absolute; left: 45%; width: 10%; top: 0; bottom: 0;
  background: repeating-linear-gradient(rgb(0 0 0 / .14) 0 1px, transparent 1px 4px), linear-gradient(90deg, rgb(0 0 0 / .3), rgb(255 255 255 / .18) 45%, rgb(0 0 0 / .22));
}
.mark.sm { left: 0; right: 0; top: 20%; text-align: center; font-size: calc(var(--pw) * .1); }
.blurb { position: absolute; left: 10%; right: 10%; top: 40%; margin: 0; text-align: center; font: 500 calc(var(--pw) * .042)/1.5 system-ui, sans-serif; color: rgb(255 255 255 / .85); }
.code {
  position: absolute; left: 31%; right: 31%; bottom: calc(var(--crimp) + 6%); height: 10%; padding: 6px 8px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, #111 0 2px, #0000 2px 3px, #111 3px 4px, #0000 4px 7px, #111 7px 10px, #0000 10px 12px) content-box, #fff;
}

/* 12 Chained Spiral Foil Tear Slices */
.flap { position: absolute; inset: 0; transform-style: preserve-3d; visibility: hidden; pointer-events: none; }
.flap.on { visibility: visible; }
.ply { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: 0 0; }
.ply .front { transform: translateZ(.4px); }
.skin.foil {
  transform: rotateY(180deg) translateZ(.4px);
  background: linear-gradient(97deg, #e3e8f2, #fff 12%, #cfd7e6 26%, #fff 44%, #dbe1ee 58%, #fff 76%, #d3dbe9);
}
.skin.foil::before, .skin.foil::after { display: none; }
.tone { position: absolute; inset: 0; z-index: 3; background: #0b0d1c; opacity: 0; }
.lips { position: absolute; inset: 0; z-index: 2; filter: drop-shadow(0 1.5px 1.2px rgb(0 0 0 / .42)); pointer-events: none; }
.lip {
  position: absolute; inset: 0; z-index: 2; clip-path: polygon(0 0);
  background: linear-gradient(100deg, #f4f6fb, #fff 14%, #bfc8da 27%, #fff 42%, #c9d1e1 58%, #fbfcff 72%, #b9c2d4 86%, #eef1f7);
}
.hit {
  position: absolute; inset: -24px -16px -8px; margin: 0; padding: 0; border: 0; border-radius: 14px;
  background: none; appearance: none; cursor: grab; touch-action: none;
  transform: translateZ(calc(var(--d) / 2 + 1px));
}
.hit:focus-visible { outline: 2px solid #0a84ff; outline-offset: 8px; }
.held .hit, .tug .hit { cursor: grabbing; }

/* ---------- Collectible TCG Cards (3D Slab + Cost + Rarity + Attack + Health) ---------- */
.card {
  width: var(--cw); height: var(--ch);
  margin: calc(var(--ch) / -2) 0 0 calc(var(--cw) / -2);
  touch-action: none; cursor: pointer;
  --px: 50; --py: 50; --hyp: 0;
}
.card:focus { outline: none; }
.card:focus-visible .face { outline: 2px solid #0a84ff; outline-offset: 3px; }
.face, .slab { position: absolute; inset: 0; border-radius: calc(var(--cw) * .05); }
.slab { background: var(--edge, #cfcac0); pointer-events: none; }
.slab:nth-of-type(1) { transform: translateZ(-1.5px); }
.slab:nth-of-type(2) { transform: translateZ(-3px); }
.slab:nth-of-type(3) { transform: translateZ(-4.5px); box-shadow: 0 26px 40px -16px rgb(20 16 40 / .5); }

.face { overflow: hidden; isolation: isolate; container-type: inline-size; background: var(--frame); color: var(--text); }

/* Top-Left Summon Cost Mana Crystal */
.cost-gem {
  position: absolute; left: 4.5%; top: 3%; z-index: 6;
  width: 15cqw; height: 15cqw; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #93c5fd, #2563eb 58%, #1e3a8a 100%);
  border: 1.3cqw solid #eff6ff;
  box-shadow: 0 3px 8px rgb(0 0 0 / .36), inset 0 1px 2px rgb(255 255 255 / .82);
  color: #fff; font: 900 8.2cqw/1 ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}

/* Top-Right Rarity Badge */
.rar-badge {
  position: absolute; right: 5.5%; top: 4.3%; z-index: 6;
  padding: 1.4cqw 3cqw; border-radius: 99cqw;
  font: 800 3.6cqw/1 system-ui, sans-serif; letter-spacing: .03em;
  box-shadow: 0 2px 5px rgb(0 0 0 / .18);
}

/* Art Window */
.win {
  position: absolute; left: 6%; right: 6%; top: 9.2%; height: 50%;
  border-radius: 4cqw; overflow: hidden;
  box-shadow: inset 0 2px 5px rgb(0 0 0 / .35), inset 0 0 0 1px rgb(0 0 0 / .12);
}
.drop {
  position: absolute; left: 28%; right: 28%; bottom: 7%; height: 8%;
  border-radius: 50%; background: radial-gradient(closest-side, rgb(0 0 0 / .5), transparent);
  filter: blur(1.5px); opacity: 0; transition: opacity .4s;
}
.out .drop { opacity: 1; }

/* Card Name & Passive Trait */
.name {
  position: absolute; left: 7%; right: 7%; top: 61.5%;
  font: 800 6.8cqw/1.15 ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trait-box {
  position: absolute; left: 6.5%; right: 6.5%; top: 70.5%; height: 14.2%;
  background: rgb(127 127 127 / .14); border-radius: 3cqw;
  padding: 1.8cqw 2.8cqw; display: flex; align-items: center; justify-content: center;
  text-align: center; font: 600 3.8cqw/1.26 system-ui, sans-serif; opacity: .92;
}

/* Attack (Sword), Collector No., Health (Heart) */
.stat-atk, .stat-hp {
  position: absolute; bottom: 3.3%; z-index: 6;
  min-width: 18cqw; height: 10cqw; padding: 0 2.4cqw; border-radius: 99cqw;
  display: inline-flex; align-items: center; justify-content: center; gap: 1cqw;
  font: 900 5.2cqw/1 ui-rounded, system-ui, sans-serif; color: #fff;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 7px rgb(0 0 0 / .3), inset 0 1px 1.5px rgb(255 255 255 / .55);
}
.stat-atk { left: 5.5%; background: linear-gradient(145deg, #f59e0b, #b45309); border: 1cqw solid #fef3c7; }
.stat-hp { right: 5.5%; background: linear-gradient(145deg, #ef4444, #991b1b); border: 1cqw solid #fee2e2; }
.no {
  position: absolute; left: 0; right: 0; bottom: 5.4%; text-align: center;
  font: 600 3.4cqw/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; opacity: .6;
}

/* Pop-out Blender 3D Character Rig */
.pop {
  position: absolute; left: 13%; width: 74%; top: 8.5%; aspect-ratio: 1;
  transform: translateZ(.5px); transition: transform .7s var(--spring); pointer-events: none;
}
.out .pop { transform: translateZ(calc(var(--cw) * .14)); }
.pop .body { filter: drop-shadow(0 3px 5px rgb(0 0 0 / .3)); }

/* 3-Layer Optical Holographic Foil */
.holo, .glare { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; }
.holo {
  background: var(--rainbow) calc(var(--px) * 1%) calc(var(--py) * 1%) / 400% 400%;
  mix-blend-mode: color-dodge; opacity: calc(.3 + var(--hyp) * .6);
  filter: brightness(.7) contrast(1.5) saturate(1.4);
}
.holo::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: inherit; mask: var(--glitter) 0 0 / 140px 140px; filter: brightness(1.8);
}
.glare {
  background: radial-gradient(farthest-corner circle at calc(var(--px) * 1%) calc(var(--py) * 1%), rgb(255 255 255 / .8), rgb(255 255 255 / .12) 38%, rgb(0 0 0 / .3));
  mix-blend-mode: overlay; opacity: calc(.25 + var(--hyp) * .55);
}
.glaze {
  position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .28), inset 0 2px 1.5px rgb(255 255 255 / .8), inset 0 -2px 4px rgb(0 0 0 / .18);
  background: radial-gradient(42% 26% at calc(var(--px) * 1%) calc(var(--py) * 1%), rgb(255 255 255 / calc(.1 + var(--hyp) * .5)), #0000), linear-gradient(rgb(255 255 255 / .24), #0000 16%);
}
.glaze::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; mask: linear-gradient(#000 30%, #0000 88%);
  background: linear-gradient(112deg, #0000 44%, rgb(255 255 255 / .4) 44.4%, rgb(255 255 255 / .13) 52%, #0000 52.4%, #0000 54%, rgb(255 255 255 / .22) 54.3%, rgb(255 255 255 / .05) 56.4%, #0000 56.7%) calc((100 - var(--px)) * 1%) 0 / 220% 100%;
}

.common { --frame: linear-gradient(165deg, #fdfcf9, #ebe8e1); --text: #1b1a17; --edge: #cfcac0; }
.common .holo { inset: 9.2% 6% 40.8%; border-radius: 4cqw; mask: var(--glitter) 0 0 / 110px 110px; opacity: calc(.55 + var(--hyp) * .45); }
.common .holo::after { display: none; }
.rare { --frame: linear-gradient(165deg, #272d63, #11142e); --text: #eef0ff; --edge: #0b0d20; }
.holo-tier { --frame: linear-gradient(165deg, #3b0764, #171238); --text: #f5f3ff; --edge: #120829; }
.ultra { --frame: linear-gradient(135deg, #f9e7a8, #d6a43a 28%, #fff2c4 50%, #c38a26 72%, #f4d57e); --text: #3a2600; --edge: #94661a; }
.ultra .holo {
  mix-blend-mode: overlay; opacity: calc(.5 + var(--hyp) * .5);
  background: repeating-conic-gradient(from calc(var(--px) * 1deg) at 50% 36%, #0000 0 3deg, rgb(255 255 255 / .45) 4deg 5deg, #0000 6deg 10deg), var(--rainbow) calc(var(--px) * 1%) calc(var(--py) * 1%) / 400% 400%;
}

.new-pill {
  position: absolute; top: -8px; right: 12%; z-index: 12; pointer-events: none;
  background: #ef4444; color: #fff; font: 900 10px/1 system-ui, sans-serif;
  padding: 4px 7px; border-radius: 999px; transform: translateZ(8px);
  box-shadow: 0 4px 10px rgb(239 68 68 / .45); opacity: 0; transition: opacity .3s;
}
.out .new-pill { opacity: 1; }

/* 3D Confetti Canvas */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

/* Bottom Controls */
.bottom-bar {
  position: fixed; left: 50%; bottom: max(20px, 4.2vh); translate: -50% 0; z-index: 35;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.again {
  white-space: nowrap; font: 700 15px/1 system-ui, sans-serif; padding: 12px 20px;
  border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer;
  border: 1px solid rgb(0 0 0 / .1);
  box-shadow: 0 1px 0 rgb(255 255 255 / .9) inset, 0 -1px 0 rgb(0 0 0 / .04) inset, 0 1px 2px rgb(0 0 0 / .06), 0 10px 24px -12px rgb(0 0 0 / .25);
  transition: opacity .3s var(--ease-out), scale .16s var(--ease-out);
}
@starting-style { .again { opacity: 0; } }
.again:active { scale: .97; }
.again.secondary { background: #18181b; color: #fff; border-color: #18181b; }
.tear-tip {
  font-size: 12px; font-weight: 700; color: var(--muted); text-align: center;
  background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(8px);
  padding: 7px 15px; border-radius: 999px; pointer-events: none;
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgb(16 16 18 / .66);
  backdrop-filter: blur(10px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 18px; gap: 14px;
}
.zoom-stage { perspective: 1200px; width: min(300px, 78vw); aspect-ratio: 1 / 1.4; position: relative; }
.zoom-stage .card { width: 100%; height: 100%; left: 0; top: 0; margin: 0; }
.zoom-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.zoom-caption { color: #f4f4f5; font-size: 13px; font-weight: 600; text-align: center; max-width: 480px; }

.binder-card {
  background: #f5f3ee; color: var(--ink); width: min(940px, 95vw); max-height: 85vh;
  border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 28px 60px rgb(0 0 0 / .38);
}
.binder-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgb(0 0 0 / .08); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 5px; }
.flt-btn {
  border: 1px solid rgb(0 0 0 / .1); background: #fff; color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.flt-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.binder-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 10px; padding: 2px; }
.dex-cell {
  background: #fff; border: 1.5px solid rgb(0 0 0 / .08); border-radius: 14px; padding: 10px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer;
  position: relative; transition: transform .15s ease, border-color .15s;
}
.dex-cell:hover { transform: translateY(-2px); border-color: #2563eb; }
.dex-cell.in-squad { border-color: #10b981; box-shadow: 0 0 0 2px rgb(16 185 129 / .22); }
.dex-cell.locked { background: rgb(0 0 0 / .035); }
.dex-art { position: relative; width: 64px; height: 64px; }
.dex-cell.locked .dex-art { filter: brightness(0) opacity(.18); }
.mini-stats {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800; padding-top: 3px; border-top: 1px dashed rgb(0 0 0 / .08);
}

.squad-slots {
  display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 10px;
  overflow-x: auto; padding: 4px 2px;
}
.squad-slot {
  background: #fff; border: 1.5px dashed rgb(0 0 0 / .16); border-radius: 14px;
  min-height: 156px; padding: 10px 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; text-align: center;
}
.squad-slot.filled { border-style: solid; border-color: rgb(0 0 0 / .12); cursor: pointer; }
.squad-slot .slot-rig { position: relative; width: 58px; height: 58px; }
.bounty-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 260px; }
.bounty-row {
  background: #fff; border: 1px solid rgb(0 0 0 / .08); border-radius: 12px;
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

@media (pointer: coarse) {
  .slab:nth-of-type(-n+2) { display: none; }
  .orb .body { filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .held .orb { animation: none; }
}


/* ---------- Skill Badges on 3D Cards & Spire Buttons ---------- */
.win { top: 9%; height: 46.5%; }
.name { top: 57.5%; font-size: 6.3cqw; }
.card-skills {
  position: absolute; left: 6.5%; right: 6.5%; top: 65%; z-index: 4;
  display: flex; flex-wrap: nowrap; gap: 1.2cqw; overflow: hidden; align-items: center;
}
.sk-pill {
  font: 800 3.2cqw/1 system-ui, sans-serif;
  padding: 1.1cqw 2cqw; border-radius: 99cqw; white-space: nowrap;
  box-shadow: 0 1px 2px rgb(0 0 0 / .12);
}
.trait-box { top: 72%; height: 13%; font-size: 3.5cqw; line-height: 1.2; }

.pill-btn.spire-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}
.pill-btn.spire-btn:hover { filter: brightness(1.08); }
.again.spire-cta {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-color: rgba(255, 255, 255, 0.22);
}

/* ---------- 10-Floor Holo Spire Visual Battle Arena ---------- */
.tw-backdrop { padding: 10px; background: rgba(9, 10, 18, 0.84); }
.tw-shell {
  width: min(1140px, 98vw); height: min(860px, 95vh);
  background: #0f172a; color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 22px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65); overflow: hidden; position: relative;
}
.tw-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tw-top-left { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tw-top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tw-title { font-size: 16px; font-weight: 900; color: #fde047; white-space: nowrap; }

.tw-floor-track { display: flex; flex-wrap: wrap; gap: 4px; }
.tw-fnode {
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); color: #94a3b8; border: 1px solid rgba(255, 255, 255, 0.08);
}
.tw-fnode.done { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.tw-fnode.cur { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border-color: #fde68a; box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }

.tw-relic-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 26px; padding: 4px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07);
}
.tw-rchip {
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  background: rgba(250, 204, 21, 0.14); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.3);
  cursor: help;
}

/* Battle Stage Backdrop & Atmosphere */
.tw-arena {
  flex: 1; min-height: 0; position: relative; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(90% 85% at 50% 40%, #134e4a, #06281e 65%, #02120d);
}
.tw-arena[data-theme="astral"] { background: radial-gradient(90% 85% at 50% 40%, #312e81, #1e1b4b 62%, #09071a); }
.tw-arena[data-theme="ember"] { background: radial-gradient(90% 85% at 50% 40%, #7c2d12, #450a0a 62%, #180303); }

.tw-banner {
  align-self: center; z-index: 5;
  background: rgba(0, 0, 0, 0.52); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px;
  padding: 6px 16px; font-size: 12px; font-weight: 800; color: #f8fafc;
  text-align: center; max-width: 92%;
}

.tw-field {
  flex: 1; display: grid; grid-template-columns: 1.25fr auto 1fr;
  align-items: center; gap: 14px; padding: 6px 0; min-height: 0;
}
.tw-vs { font-size: 26px; opacity: 0.45; filter: drop-shadow(0 2px 8px #000); }
.tw-side { display: flex; align-items: center; gap: 10px; min-height: 0; }
.ally-side { justify-content: flex-start; }
.enemy-side { justify-content: space-around; flex-wrap: wrap; }

.tw-hero-unit {
  width: 112px; flex-shrink: 0; background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(96, 165, 250, 0.45); border-radius: 14px;
  padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.tw-minions-grid {
  flex: 1; display: grid; grid-template-columns: repeat(4, minmax(92px, 1fr)); gap: 8px;
}
.tw-slot-empty {
  height: 158px; border: 1.5px dashed rgba(255, 255, 255, 0.16); border-radius: 14px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.16);
}

.tw-unit {
  position: relative; background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid rgba(255, 255, 255, 0.18); border-radius: 14px;
  padding: 7px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.38); transition: transform 0.18s ease, border-color 0.18s;
}
.tw-unit.ally.taunt { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.28), 0 12px 24px rgba(0, 0, 0, 0.4); }
.tw-unit.enemy { width: 132px; cursor: pointer; padding: 9px 8px; }
.tw-unit.enemy.boss { width: 158px; border-color: #f59e0b; background: rgba(30, 15, 25, 0.86); }
.tw-unit.enemy.targeted { border-color: #ef4444; box-shadow: 0 0 0 2.5px rgba(239, 68, 68, 0.55), 0 14px 28px rgba(0, 0, 0, 0.45); }

.tw-intent {
  position: absolute; top: -24px; left: 50%; translate: -50% 0; white-space: nowrap;
  background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; color: #fde047;
}
.tw-u-top { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 10px; font-weight: 800; color: #cbd5e1; }
.tw-sh-pill { background: #1d4ed8; color: #fff; padding: 1px 5px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.tw-u-rig { position: relative; width: 62px; height: 62px; }
.tw-unit.boss .tw-u-rig { width: 82px; height: 82px; }
.tw-u-name { font-size: 11px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tw-sk-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.tw-sk-wrap .sk-pill { font-size: 9.5px; padding: 2px 5px; border-radius: 999px; }

.tw-u-bars { width: 100%; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.tw-atk-tag { background: #b45309; color: #fff; font-size: 10px; font-weight: 900; padding: 2px 5px; border-radius: 6px; white-space: nowrap; }
.tw-hpbar {
  position: relative; width: 100%; height: 15px; background: rgba(0, 0, 0, 0.55);
  border-radius: 999px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.14);
}
.tw-hpbar.sm { height: 14px; flex: 1; }
.tw-hpbar > i { display: block; height: 100%; background: linear-gradient(90deg, #16a34a, #4ade80); transition: width 0.22s ease; }
.tw-hpbar.enemy-hp > i { background: linear-gradient(90deg, #dc2626, #fb7185); }
.tw-hpbar > span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000;
}

/* Combat Lunge, Shake & Floating Damage VFX */
@keyframes lungeRight {
  0% { transform: translateX(0) scale(1); }
  45% { transform: translateX(56px) scale(1.12); z-index: 20; }
  100% { transform: translateX(0) scale(1); }
}
@keyframes lungeLeft {
  0% { transform: translateX(0) scale(1); }
  45% { transform: translateX(-56px) scale(1.12); z-index: 20; }
  100% { transform: translateX(0) scale(1); }
}
@keyframes hitShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-3deg); filter: brightness(1.6); }
  75% { transform: translateX(8px) rotate(3deg); }
}
@keyframes hitCrit {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18) rotate(-5deg); filter: brightness(2) drop-shadow(0 0 16px #facc15); }
  70% { transform: scale(0.94) rotate(4deg); }
}
.lunge-right { animation: lungeRight 0.34s var(--ease-out); }
.lunge-left { animation: lungeLeft 0.34s var(--ease-out); }
.hit-shake { animation: hitShake 0.32s ease; }
.hit-crit { animation: hitCrit 0.4s ease; }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(0.95); }
}
.tw-float {
  position: absolute; z-index: 30; pointer-events: none; white-space: nowrap;
  font: 900 15px/1 system-ui, sans-serif; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  animation: floatUp 0.92s var(--ease-out) forwards;
}
.tw-float.big { font-size: 19px; }

/* Bottom Player Hand & Mana Dock */
.tw-dock {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(2, 6, 23, 0.72); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; padding: 8px 12px; min-height: 158px;
}
.tw-mana-col { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; }
.tw-mana-orb {
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #60a5fa, #1d4ed8 62%, #1e1b4b);
  border: 2.5px solid #bfdbfe; box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
  display: flex; align-items: center; justify-content: center; gap: 2px;
  font-size: 15px; font-weight: 900; color: #fff;
}
.tw-mana-orb b { font-size: 22px; }
.tw-pile-info { font-size: 11px; font-weight: 700; color: #94a3b8; white-space: nowrap; }

.tw-hand-row {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 8px; overflow-x: auto; padding: 4px 2px;
}
.tw-hcard {
  width: 118px; flex-shrink: 0; background: #1e293b; color: #f8fafc;
  border: 2px solid rgba(255, 255, 255, 0.18); border-radius: 12px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  transition: transform 0.16s var(--ease-out), border-color 0.16s, opacity 0.16s;
}
.tw-hcard.playable { border-color: #38bdf8; box-shadow: 0 6px 16px rgba(56, 189, 248, 0.25); }
.tw-hcard.playable:hover { transform: translateY(-8px) scale(1.04); border-color: #fde047; }
.tw-hcard.dim { opacity: 0.52; }
.tw-hc-top { display: flex; justify-content: space-between; align-items: center; }
.tw-hc-cost {
  width: 20px; height: 20px; border-radius: 50%; background: #2563eb; color: #fff;
  font-size: 11px; font-weight: 900; display: grid; place-items: center; border: 1px solid #dbeafe;
}
.tw-hc-rar { font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 999px; }
.tw-hc-art { height: 52px; border-radius: 8px; position: relative; overflow: hidden; display: grid; place-items: center; }
.tw-hc-rig { position: relative; width: 48px; height: 48px; }
.tw-hc-name { font-size: 11px; font-weight: 900; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-hc-bot { display: flex; justify-content: space-between; font-size: 11px; font-weight: 900; padding-top: 2px; }

.tw-atk-btn {
  flex-shrink: 0; padding: 16px 18px; border-radius: 14px; border: 1px solid #fde68a;
  background: linear-gradient(145deg, #f59e0b, #dc2626); color: #fff;
  font: 900 13px/1.2 system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.4); transition: scale 0.15s, filter 0.15s;
}
.tw-atk-btn:hover:not(:disabled) { filter: brightness(1.1); }
.tw-atk-btn:active:not(:disabled) { scale: 0.96; }
.tw-atk-btn:disabled { opacity: 0.55; cursor: wait; }

/* Victory / Relic Choice Overlay & Deck Drawer */
.tw-overlay {
  position: absolute; inset: 0; z-index: 25; background: rgba(9, 12, 24, 0.84);
  backdrop-filter: blur(8px); display: grid; place-items: center; padding: 16px;
}
.tw-result-card {
  background: #1e293b; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 20px;
  padding: 20px; max-width: 680px; width: 100%; text-align: center;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}
.tw-relic-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 8px; }
.tw-relic-card {
  background: rgba(15, 23, 42, 0.9); border: 1.5px solid rgba(250, 204, 21, 0.35);
  border-radius: 14px; padding: 14px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.tw-relic-card:hover { transform: translateY(-4px); border-color: #fde047; background: rgba(30, 41, 59, 0.95); }

.tw-deck-panel {
  background: #1e293b; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px;
  padding: 12px; max-height: 290px; overflow-y: auto;
}
.tw-deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.tw-deck-item {
  background: #0f172a; border: 1.5px solid rgba(255, 255, 255, 0.1); border-radius: 11px;
  padding: 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
.tw-deck-item.picked { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3); }
.tw-deck-item.loan { opacity: 0.68; }

@media (max-width: 860px) {
  .tw-field { grid-template-columns: 1fr; gap: 8px; overflow-y: auto; }
  .tw-vs { display: none; }
  .tw-minions-grid { grid-template-columns: repeat(4, minmax(72px, 1fr)); }
}


/* ---------- Physical 2-Page Collector's Ring Binder ---------- */
.alb-backdrop { padding: 12px; background: rgba(10, 10, 14, 0.82); }
.alb-shell {
  width: min(1080px, 97vw); max-height: 94vh;
  background: linear-gradient(160deg, #2b1d16, #1c130f 60%, #140d0a);
  color: #f8fafc; border-radius: 24px; padding: 16px 20px;
  border: 2px solid #5c3d2e;
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.7), inset 0 0 0 2px rgba(251, 191, 36, 0.16);
  display: flex; flex-direction: column; gap: 11px; overflow: hidden;
}
.alb-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 10px; border-bottom: 1px dashed rgba(251, 191, 36, 0.25);
}
.alb-title-col { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 260px; }
.alb-pbar {
  width: min(380px, 100%); height: 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); overflow: hidden;
}
.alb-pbar > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #fde047, #34d399);
  transition: width 0.35s var(--ease-out);
}

.alb-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.alb-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.alb-tab {
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0; font-size: 12px; font-weight: 800; padding: 6px 12px;
  border-radius: 10px; cursor: pointer; transition: all 0.15s;
}
.alb-tab.active {
  background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff;
  border-color: #fde68a; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.alb-backdrop .flt-btn {
  background: rgba(255, 255, 255, 0.08); color: #cbd5e1; border-color: rgba(255, 255, 255, 0.14);
}
.alb-backdrop .flt-btn.active {
  background: #f8fafc; color: #0f172a; border-color: #fff;
}
.alb-select {
  background: rgba(255, 255, 255, 0.1); color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 5px 11px; cursor: pointer; outline: none;
}
.alb-select option { background: #1e293b; color: #f8fafc; }

/* Open Two-Page Binder Folio */
.alb-folio {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: 1fr 38px 1fr; align-items: stretch;
  background: #17171c; border-radius: 16px; padding: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 6px 22px rgba(0, 0, 0, 0.65);
}
.alb-page {
  display: grid; grid-template-columns: repeat(2, minmax(126px, 1fr));
  grid-auto-rows: 1fr; gap: 12px; padding: 10px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.03), transparent 70%),
    #23242b;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
}
.alb-spine {
  display: flex; flex-direction: column; align-items: center; justify-content: space-around;
  padding: 24px 0; position: relative;
  background: linear-gradient(90deg, rgba(0,0,0,0.5), rgba(255,255,255,0.05) 50%, rgba(0,0,0,0.5));
}
.alb-ring {
  width: 30px; height: 12px; border-radius: 999px;
  background: linear-gradient(180deg, #94a3b8, #f8fafc 42%, #475569 85%, #cbd5e1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.65), inset 0 1px 1px #fff;
}

/* Vinyl Pocket Sleeves */
.alb-pocket {
  position: relative; aspect-ratio: 1 / 1.38; min-height: 186px; max-height: 248px;
  margin: 0 auto; width: 100%; max-width: 178px;
  border-radius: 12px; padding: 7px;
  background: rgba(10, 12, 18, 0.62);
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.55);
  perspective: 800px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.alb-pocket.unlocked:hover {
  border-color: rgba(250, 204, 21, 0.65);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 0 14px rgba(250, 204, 21, 0.12);
}
.alb-pocket.in-squad {
  border-style: solid; border-color: rgba(16, 185, 129, 0.65);
}
.alb-card-wrap {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
}
.alb-card-wrap .card {
  position: relative; left: 0; top: 0; margin: 0;
  width: 100%; height: 100%;
  transition: transform 0.14s ease-out;
}
.alb-sleeve-gloss {
  position: absolute; inset: 3px; border-radius: 10px; pointer-events: none; z-index: 14;
  background: linear-gradient(128deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.03) 26%, transparent 28%, transparent 74%, rgba(255,255,255,0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.alb-pocket-meta {
  position: absolute; top: 4px; left: 6px; right: 6px; z-index: 16; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
}
.alb-stars {
  background: rgba(0, 0, 0, 0.72); color: #fde047;
  font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 999px;
}
.alb-sq-tag {
  background: #059669; color: #fff; font-size: 9.5px; font-weight: 900;
  padding: 2px 5px; border-radius: 999px;
}
.alb-qty {
  background: rgba(0, 0, 0, 0.74); color: #f8fafc;
  font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 999px;
}
.alb-inspect-hint {
  position: absolute; bottom: 8px; left: 50%; translate: -50% 0; z-index: 17;
  background: rgba(15, 23, 42, 0.88); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.4);
  font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; opacity: 0; transform: translateY(4px);
  transition: opacity 0.16s, transform 0.16s; pointer-events: none;
}
.alb-pocket.unlocked:hover .alb-inspect-hint { opacity: 1; transform: translateY(0); }

/* Locked / Empty Pocket Sleeves */
.alb-pocket.empty-slot { cursor: default; opacity: 0.4; }
.alb-slot-no { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: #64748b; }
.alb-emboss {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  width: 100%; height: 100%; padding: 8px 6px; text-align: center;
}
.alb-lock-no { font-size: 10px; font-weight: 800; color: #64748b; }
.alb-silhouette { position: relative; width: 64px; height: 64px; filter: brightness(0) invert(1) opacity(0.14); }
.alb-lock-name { font-size: 12px; font-weight: 800; color: #94a3b8; }
.alb-lock-rar { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; opacity: 0.8; }
.alb-craft-btn {
  border: 1px solid rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.12);
  color: #fde047; font-size: 10.5px; font-weight: 800; padding: 4px 8px;
  border-radius: 8px; cursor: pointer; transition: background 0.15s;
}
.alb-pocket.locked-slot:hover .alb-craft-btn { background: rgba(250, 204, 21, 0.26); }

.alb-foot {
  display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 2px;
}
.alb-page-ind { font-size: 12px; font-weight: 800; color: #e2e8f0; }

/* ---------- Split-Screen 3D Optical Gimbal Card Inspector ---------- */
.insp-backdrop { z-index: 95; padding: 14px; background: rgba(8, 10, 18, 0.88); }
.insp-shell {
  width: min(920px, 96vw); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(155deg, #1e293b, #0f172a);
  color: #f8fafc; border-radius: 24px; padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.7);
  display: grid; grid-template-columns: minmax(270px, 340px) 1fr; gap: 24px; align-items: center;
}
.insp-left {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.insp-left .zoom-stage {
  perspective: 1200px; width: min(275px, 72vw); aspect-ratio: 1 / 1.4; position: relative;
}
.insp-left .zoom-stage .card {
  width: 100%; height: 100%; left: 0; top: 0; margin: 0;
  transform-style: preserve-3d; transition: transform 0.12s ease-out;
}
.zoom-stage .face, .zoom-stage .pop, .zoom-stage .new-pill {
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}

/* Custom 3D Holo TCG Card Back */
.card-back {
  position: absolute; inset: 0; border-radius: calc(var(--cw) * .05);
  transform: rotateY(180deg) translateZ(5px);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: linear-gradient(145deg, #1e1b4b, #0f172a 55%, #311042);
  border: 6px solid #d4af37; padding: 12px;
  display: grid; place-items: center;
  box-shadow: inset 0 0 24px rgba(250, 204, 21, 0.28);
}
.cb-inner {
  width: 100%; height: 100%; border-radius: 10px;
  border: 1.5px dashed rgba(250, 204, 21, 0.45);
  background:
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.35), transparent 68%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0.04) 0 10deg, transparent 10deg 20deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  position: relative;
}
.cb-ring {
  width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid rgba(250, 204, 21, 0.65);
  box-shadow: 0 0 22px rgba(129, 140, 248, 0.55), inset 0 0 18px rgba(244, 114, 182, 0.45);
  position: absolute;
}
.cb-logo {
  font: 900 38px/1 ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, #fef08a, #f472b6, #60a5fa, #a7f3d0);
  -webkit-background-clip: text; color: transparent; z-index: 2;
}
.cb-sub { font-size: 9px; font-weight: 800; letter-spacing: 0.18em; color: #fde68a; z-index: 2; }

.insp-gimbal-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.insp-tip { font-size: 11px; color: #94a3b8; text-align: center; line-height: 1.4; }

.insp-right { display: flex; flex-direction: column; gap: 14px; }
.insp-dossier { display: flex; flex-direction: column; gap: 14px; }
.insp-head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.insp-rar { font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 999px; }
.insp-series { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #e2e8f0; }
.insp-no { font-size: 12px; font-weight: 800; color: #94a3b8; font-family: ui-monospace, monospace; margin-left: auto; }
.insp-title { margin: 2px 0 0; font-size: 24px; font-weight: 900; color: #fff; }
.insp-title small { font-size: 13px; font-weight: 700; color: #94a3b8; margin-left: 6px; }
.insp-own-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: rgba(0, 0, 0, 0.28); padding: 7px 12px; border-radius: 10px; font-size: 12px; font-weight: 800;
}

.insp-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.insp-stat-box {
  background: rgba(15, 23, 42, 0.72); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 3px;
}
.insp-stat-box .lbl { font-size: 11px; color: #94a3b8; font-weight: 700; }
.insp-stat-box b { font-size: 18px; font-weight: 900; }
.insp-stat-box b small { font-size: 11px; color: #94a3b8; font-weight: 600; }
.insp-stat-box.mana b { color: #60a5fa; }
.insp-stat-box.atk b { color: #fbbf24; }
.insp-stat-box.hp b { color: #f87171; }

.insp-section {
  background: rgba(15, 23, 42, 0.55); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.insp-sec-title { font-size: 12px; font-weight: 900; color: #fde047; }
.insp-skill-list { display: flex; flex-direction: column; gap: 7px; }
.insp-skill-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #e2e8f0; line-height: 1.35; }
.insp-lore { font-size: 12px; color: #94a3b8; font-style: italic; padding-top: 6px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.insp-close-row { display: flex; justify-content: flex-end; }

@media (max-width: 820px) {
  .alb-folio { grid-template-columns: 1fr; gap: 12px; }
  .alb-spine { display: none; }
  .insp-shell { grid-template-columns: 1fr; }
  .insp-close-row { justify-content: center; }
}


/* ---------- Account Login / Register & Manual Save System ---------- */
.pill-btn.save-btn {
  background: rgba(15, 23, 42, 0.88); color: #f8fafc; border-color: rgba(255, 255, 255, 0.16);
}
.pill-btn.save-btn.unsaved {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border-color: #fde68a;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.42);
}
.pill-btn.save-btn.saved {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff; border-color: rgba(167, 243, 208, 0.45);
}
.unsaved-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
  display: inline-block; animation: pulseDot 1s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.35; scale: 0.75; }
}

.auth-backdrop { z-index: 100; padding: 14px; background: rgba(8, 10, 18, 0.84); }
.auth-card {
  width: min(620px, 95vw); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(155deg, #1e293b, #0f172a);
  color: #f8fafc; border-radius: 22px; padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column; gap: 16px;
}
.auth-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: rgba(0, 0, 0, 0.3); padding: 5px; border-radius: 12px;
}
.auth-tab {
  border: 0; background: transparent; color: #94a3b8;
  font-size: 13px; font-weight: 800; padding: 9px 12px; border-radius: 9px;
  cursor: pointer; transition: all 0.15s;
}
.auth-tab.active {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.38);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: #cbd5e1; }
.auth-field input {
  background: rgba(15, 23, 42, 0.8); color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.16); border-radius: 11px;
  padding: 10px 13px; font-size: 14px; font-weight: 600; outline: none;
  transition: border-color 0.15s;
}
.auth-field input:focus { border-color: #60a5fa; }

.auth-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: #cbd5e1; line-height: 1.4; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); padding: 9px 11px; border-radius: 10px;
}
.auth-check input { margin-top: 2px; accent-color: #10b981; }

.auth-err {
  background: rgba(239, 68, 68, 0.16); border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5; font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 10px;
}
.auth-submit-btn {
  border: 0; border-radius: 12px; padding: 12px 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff;
  font-size: 14px; font-weight: 900; cursor: pointer;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35); transition: filter 0.15s, scale 0.15s;
}
.auth-submit-btn:hover { filter: brightness(1.08); }
.auth-submit-btn:active { scale: 0.98; }

.auth-status-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 14px; border-radius: 14px;
}
.auth-status-banner.ok { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.38); color: #a7f3d0; }
.auth-status-banner.warn { background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.45); color: #fde68a; }
.pill-btn.save-cta { background: #10b981; color: #fff; border-color: #34d399; }
.pill-btn.save-cta:hover { background: #059669; }
.pill-btn.danger-btn { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.pill-btn.danger-btn:hover { background: rgba(239, 68, 68, 0.28); }

.auth-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.auth-cmp-box {
  background: rgba(15, 23, 42, 0.72); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 7px;
}
.auth-cmp-box.saved-box { border-color: rgba(52, 211, 153, 0.3); }
.cmp-title { font-size: 12px; font-weight: 900; color: #fde047; padding-bottom: 4px; border-bottom: 1px dashed rgba(255, 255, 255, 0.1); }
.cmp-row { display: flex; justify-content: space-between; font-size: 12px; color: #cbd5e1; }
.cmp-row b { color: #fff; }
.auth-actions-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }


/* ---------- Player-to-Player Card Marketplace ---------- */
.pill-btn.mkt-hud-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff; border-color: rgba(254, 243, 199, 0.35);
  box-shadow: 0 5px 14px rgba(217, 119, 6, 0.3);
}
.pill-btn.mkt-hud-btn:hover { filter: brightness(1.08); }

.mkt-backdrop { z-index: 85; padding: 12px; background: rgba(8, 10, 18, 0.84); }
.mkt-shell {
  width: min(1060px, 97vw); height: min(840px, 93vh);
  background: linear-gradient(160deg, #1e293b, #0f172a 70%);
  color: #f8fafc; border-radius: 24px; padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column; gap: 12px; overflow: hidden;
}
.mkt-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mkt-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.mkt-backdrop .flt-btn {
  background: rgba(255, 255, 255, 0.08); color: #cbd5e1; border-color: rgba(255, 255, 255, 0.14);
}
.mkt-backdrop .flt-btn.active { background: #f8fafc; color: #0f172a; border-color: #fff; }

.mkt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.mkt-empty {
  flex: 1; min-height: 280px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; text-align: center;
  background: rgba(15, 23, 42, 0.5); border: 1.5px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px; padding: 24px; color: #94a3b8; font-size: 13px;
}
.mkt-empty b { color: #f8fafc; font-size: 15px; }

.mkt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px; padding: 4px 2px;
}
.mkt-item {
  background: rgba(15, 23, 42, 0.78); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 9px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35); transition: border-color 0.16s, transform 0.16s;
}
.mkt-item:hover { border-color: rgba(250, 204, 21, 0.45); transform: translateY(-2px); }

.mkt-card-box {
  position: relative; width: 100%; max-width: 158px; aspect-ratio: 1 / 1.4;
  margin: 0 auto; perspective: 800px; cursor: pointer;
}
.mkt-card-box .card {
  position: relative; left: 0; top: 0; margin: 0; width: 100%; height: 100%;
  transition: transform 0.14s ease-out;
}
.mkt-new-tag, .mkt-own-tag {
  position: absolute; top: -6px; left: 8px; z-index: 15; pointer-events: none;
  font-size: 10px; font-weight: 900; padding: 2px 7px; border-radius: 999px;
}
.mkt-new-tag { background: #10b981; color: #fff; box-shadow: 0 3px 8px rgba(16, 185, 129, 0.45); }
.mkt-own-tag { background: rgba(15, 23, 42, 0.88); color: #cbd5e1; border: 1px solid rgba(255, 255, 255, 0.16); }

.mkt-meta { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.mkt-seller { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #cbd5e1; gap: 4px; }
.mkt-seller small { color: #94a3b8; font-size: 10px; }
.mkt-note { font-size: 11px; color: #fde68a; background: rgba(250, 204, 21, 0.08); padding: 3px 7px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-buy-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.mkt-price { font-size: 16px; font-weight: 900; color: #fde047; font-variant-numeric: tabular-nums; }

.pill-btn.mkt-buy-btn {
  background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: #34d399; padding: 6px 11px;
}
.pill-btn.mkt-buy-btn:hover { filter: brightness(1.08); }
.pill-btn.dim-btn { background: rgba(255, 255, 255, 0.08); color: #94a3b8; border-color: rgba(255, 255, 255, 0.12); padding: 6px 11px; }
.pill-btn.mkt-cancel-btn { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); padding: 6px 10px; }

/* Sell Layout */
.mkt-sell-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; min-height: 0; flex: 1; }
.mkt-sell-left, .mkt-sell-right {
  background: rgba(15, 23, 42, 0.62); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
}
.mkt-inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.mkt-inv-cell {
  background: #0f172a; border: 1.5px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
  padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.mkt-inv-cell:hover { transform: translateY(-2px); border-color: #60a5fa; }
.mkt-inv-cell.active { border-color: #fde047; box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.3); background: rgba(30, 41, 59, 0.9); }

.mkt-sel-preview {
  display: flex; align-items: center; gap: 14px; background: rgba(0, 0, 0, 0.25);
  padding: 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Trade History */
.mkt-hist-list { display: flex; flex-direction: column; gap: 8px; }
.mkt-hist-row {
  background: rgba(15, 23, 42, 0.72); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 8px;
}
.mkt-hist-row.sold-me { border-color: rgba(74, 222, 128, 0.4); background: rgba(16, 185, 129, 0.09); }
.mkt-hist-row.bought-me { border-color: rgba(96, 165, 250, 0.35); }

@media (max-width: 820px) {
  .mkt-sell-layout { grid-template-columns: 1fr; }
}


/* ---------- Holo Gym PvP Ladder & 5v5 Auto-Battle Theater ---------- */
.pill-btn.gym-hud-btn {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff; border-color: rgba(255, 228, 230, 0.35);
  box-shadow: 0 5px 14px rgba(225, 29, 72, 0.34);
}
.pill-btn.gym-hud-btn:hover { filter: brightness(1.08); }

.gym-my-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.32);
}

.gym-ladder-list { display: flex; flex-direction: column; gap: 10px; }
.gym-rank-row {
  background: rgba(15, 23, 42, 0.78); border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px; padding: 12px 16px;
  display: grid; grid-template-columns: 126px 1.2fr auto 120px; align-items: center; gap: 14px;
  transition: transform 0.15s, border-color 0.15s;
}
.gym-rank-row:hover { transform: translateY(-2px); border-color: rgba(96, 165, 250, 0.4); }
.gym-rank-row.top-1 { border-color: #facc15; background: linear-gradient(90deg, rgba(250, 204, 21, 0.14), rgba(15, 23, 42, 0.85) 55%); }
.gym-rank-row.top-2 { border-color: #cbd5e1; background: linear-gradient(90deg, rgba(203, 213, 225, 0.12), rgba(15, 23, 42, 0.85) 55%); }
.gym-rank-row.top-3 { border-color: #fb923c; background: linear-gradient(90deg, rgba(251, 146, 60, 0.12), rgba(15, 23, 42, 0.85) 55%); }
.gym-rank-row.is-me { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.45); }

.gym-rk-badge { font-size: 14px; font-weight: 900; color: #fde047; white-space: nowrap; }
.gym-rk-lineup { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gym-mini-card {
  position: relative; width: 48px; height: 54px; border-radius: 10px;
  background: rgba(30, 41, 59, 0.92); border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.gym-mini-card:hover { transform: scale(1.12); border-color: #fde047; z-index: 5; }
.gm-stars { font-size: 8.5px; font-weight: 900; color: #fde047; line-height: 1; margin-top: -2px; }
.gym-rk-act { display: flex; justify-content: flex-end; }
.pill-btn.gym-chal-btn {
  background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; border-color: #fca5a5;
}
.pill-btn.gym-chal-btn:hover { filter: brightness(1.1); }

.gym-deploy-box {
  background: rgba(15, 23, 42, 0.58); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}

/* 5v5 Automatic Battle Replay Stadium */
.gym-stage { flex: 1; min-height: 490px; gap: 8px; }
.gym-vs-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; background: rgba(0, 0, 0, 0.42); padding: 8px 14px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.gym-fighter { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #fff; }
.gym-fighter small { font-size: 11px; color: #94a3b8; }
.gym-fighter.right { text-align: right; }
.gym-speed-bar { display: flex; gap: 5px; }

.gym-5v5-field {
  flex: 1; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 18px; min-height: 0; padding: 4px 6px;
}
.gym-team-col { display: flex; flex-direction: column; gap: 7px; }
.gym-unit {
  display: flex; align-items: center; gap: 10px;
  background: rgba(15, 23, 42, 0.84); border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px; padding: 6px 10px; position: relative;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); transition: opacity 0.25s, filter 0.25s;
}
.gym-unit.taunt { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25); }
.gym-unit.ko { opacity: 0.3; filter: grayscale(1); }
.gym-u-avatar { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.gym-u-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.gym-feed {
  height: 68px; overflow-y: auto; background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px;
  padding: 6px 12px; font-size: 11.5px; color: #cbd5e1; display: flex; flex-direction: column; gap: 3px;
}

@media (max-width: 860px) {
  .gym-rank-row { grid-template-columns: 1fr; gap: 8px; }
  .gym-rk-act { justify-content: flex-start; }
  .gym-5v5-field { grid-template-columns: 1fr; }
}


/* ================= MOBILE & TABLET ADAPTATION (iOS / Android) ================= */
.mob-nav { display: none; }

@media (max-width: 740px) {
  :root {
    --ph: min(340px, 48vh, 48dvh, 96vw);
  }

  .desk-mode-btn { display: none !important; }

  .hud {
    top: max(8px, env(safe-area-inset-top));
    left: 8px; right: 8px;
    flex-direction: column-reverse; align-items: stretch; gap: 6px;
  }
  .hud-right {
    justify-content: space-between; gap: 4px; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none;
  }
  .hud-right::-webkit-scrollbar { display: none; }
  .res-chip { padding: 5px 8px; font-size: 11px; white-space: nowrap; }
  .pill-btn { padding: 6px 10px; font-size: 11.5px; white-space: nowrap; }

  .pack-tabs { align-self: center; padding: 3px; }
  .pack-tab { padding: 5px 11px; font-size: 11.5px; }

  .toast {
    top: calc(88px + env(safe-area-inset-top));
    width: max-content; max-width: 92vw; text-align: center;
    font-size: 12px; padding: 8px 14px;
  }

  .bottom-bar {
    bottom: calc(68px + env(safe-area-inset-bottom));
    width: 94vw; gap: 6px;
  }
  .tear-tip { font-size: 11px; padding: 6px 12px; max-width: 92vw; }
  .again { font-size: 13px; padding: 10px 15px; border-radius: 11px; }

  /* Fixed Ergonomic Bottom App Bar */
  .mob-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
  }
  .mob-nav-btn {
    position: relative; border: 0; background: transparent; color: #e2e8f0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 4px 2px; font-size: 10.5px; font-weight: 800; cursor: pointer;
  }
  .mob-nav-btn:active { scale: 0.92; color: #fde047; }
  .mob-nav-btn > i { font-size: 18px; line-height: 1.1; }
  .mob-dot { position: absolute; top: 3px; right: 24%; }

  /* Prevent iOS Safari Auto-Zoom on Inputs */
  .auth-field input, .alb-select { font-size: 16px !important; }

  /* Full-Bleed Mobile Modals (dvh safe) */
  .modal-backdrop {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }
  .alb-shell, .mkt-shell, .tw-shell, .binder-card, .insp-shell, .auth-card {
    width: 100%; max-width: 100%;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 18px; padding: 12px; gap: 8px;
  }
  .tw-shell, .mkt-shell {
    height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  /* Horizontal Scrollable Filter / Tab Bars on Mobile */
  .alb-tabs, .filter-group {
    flex-wrap: nowrap; overflow-x: auto; max-width: 100%;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .alb-tabs::-webkit-scrollbar, .filter-group::-webkit-scrollbar { display: none; }
  .alb-tab, .flt-btn { flex-shrink: 0; }

  /* Mobile Binder & Inspector */
  .alb-folio { padding: 8px; gap: 8px; }
  .alb-page { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 6px; }
  .alb-pocket { min-height: 162px; padding: 5px; }
  .insp-left .zoom-stage { width: min(215px, 60vw); }
  .insp-title { font-size: 19px; }
  .insp-stats-grid { gap: 6px; }
  .insp-stat-box { padding: 7px 8px; }
  .insp-stat-box b { font-size: 15px; }

  /* Mobile Spire Battle Arena */
  .tw-arena { padding: 8px; }
  .tw-field {
    display: flex; flex-direction: column-reverse; justify-content: space-between;
    gap: 10px; overflow-y: auto;
  }
  .ally-side { width: 100%; flex-direction: column; gap: 6px; }
  .tw-hero-unit {
    width: 100%; flex-direction: row; justify-content: space-between; padding: 6px 10px;
  }
  .tw-hero-unit .tw-hpbar { max-width: 150px; }
  .tw-minions-grid { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .tw-slot-empty { height: 108px; font-size: 10px; }
  .tw-unit { padding: 5px 4px; }
  .tw-u-rig { width: 44px; height: 44px; }
  .tw-unit.enemy { width: 112px; padding: 6px; }
  .tw-unit.enemy.boss { width: 132px; }
  .tw-unit.boss .tw-u-rig { width: 58px; height: 58px; }

  .tw-dock {
    flex-wrap: wrap; min-height: auto; padding: 6px 8px; gap: 6px;
  }
  .tw-mana-col { flex-direction: row; gap: 8px; order: 2; }
  .tw-mana-orb { width: 44px; height: 44px; font-size: 12px; }
  .tw-mana-orb b { font-size: 16px; }
  .tw-hand-row {
    order: 1; width: 100%; flex: none; justify-content: flex-start;
    touch-action: pan-x; -webkit-overflow-scrolling: touch; padding: 2px;
  }
  .tw-hcard { width: 98px; padding: 5px; }
  .tw-hc-art { height: 42px; }
  .tw-hc-rig { width: 38px; height: 38px; }
  .tw-atk-btn { order: 3; flex: 1; padding: 11px 12px; font-size: 12.5px; }

  /* Mobile Market & Gym */
  .mkt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mkt-item { padding: 8px; gap: 6px; }
  .mkt-price { font-size: 14px; }

  .gym-5v5-field {
    grid-template-columns: 1fr 1fr !important; gap: 6px;
  }
  .gym-5v5-field .tw-vs { display: none; }
  .gym-unit { padding: 5px 6px; gap: 5px; }
  .gym-u-avatar { width: 32px; height: 32px; }
  .gym-u-info b { font-size: 10.5px !important; }
  .gym-vs-head { padding: 6px 8px; }
  .gym-fighter { font-size: 11.5px; }
}
