:root {
  --bg: #070707; --panel: #131313; --panel2: #1b1b1c; --line: #262628; --text: #f4f5f7; --muted: #9a9ea8; --teal: #2fd4c1;
  --accent: #ff7a1a; --accent2: #ffb347; --good: #3ddc84; --bad: #ff5d5d;
  --rookie: #b9855a; --pro: #c7d0da; --vet: #f2c230; --hof: #35d4ff; --franchise: #ff3d8b;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: .01em; }
.fine { color: var(--muted); font-size: .8rem; line-height: 1.4; margin: .4rem 0; }
.blurb { color: var(--muted); margin: .3rem 0 .8rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .6rem 1.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; }
.btn:hover:not(:disabled) { background: #272b35; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #17100a; }
.btn.primary:hover:not(:disabled) { background: var(--accent2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: .3rem .8rem; font-size: .85rem; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, .packhold:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

main { padding: 1.4rem; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem 1.4rem; margin-bottom: 1.2rem; }
.page-head p { color: var(--muted); margin: 0; flex: 1; }
.empty-state { text-align: center; color: var(--muted); padding: 3rem 1rem; }

/* Pack art placeholder (replaced by --asset-pack-*.png when present) */
.packart { position: relative; width: min(190px, 62%); aspect-ratio: 3 / 4; margin: .4rem auto; background: linear-gradient(160deg, #ff9a3d, #c2410c 60%, #7c2d12); border-radius: 8px; clip-path: polygon(0 3%, 4% 0, 8% 3%, 12% 0, 16% 3%, 20% 0, 24% 3%, 28% 0, 32% 3%, 36% 0, 40% 3%, 44% 0, 48% 3%, 52% 0, 56% 3%, 60% 0, 64% 3%, 68% 0, 72% 3%, 76% 0, 80% 3%, 84% 0, 88% 3%, 92% 0, 96% 3%, 100% 0, 100% 97%, 96% 100%, 92% 97%, 88% 100%, 84% 97%, 80% 100%, 76% 97%, 72% 100%, 68% 97%, 64% 100%, 60% 97%, 56% 100%, 52% 97%, 48% 100%, 44% 97%, 40% 100%, 36% 97%, 32% 100%, 28% 97%, 24% 100%, 20% 97%, 16% 100%, 12% 97%, 8% 100%, 4% 97%, 0 100%); }
.packart::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.28) 45%, transparent 60%); }
.packart.has-art { background-color: transparent; background-position: center; background-size: 100% 100%; background-repeat: no-repeat; clip-path: none; border-radius: 0; }
.packart.has-art::after, .packart.has-art .pa-inner { display: none; }
.pa-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .1rem; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.pa-inner b { font-size: 1.7rem; letter-spacing: .12em; font-weight: 900; }
.pa-inner i { font-style: normal; font-size: 1.1rem; letter-spacing: .3em; font-weight: 700; }
.pa-inner em { font-style: normal; margin-top: .6rem; font-size: .7rem; letter-spacing: .18em; background: rgba(0,0,0,.35); padding: .2rem .6rem; border-radius: 999px; }
.pa-ball { width: 34px; height: 34px; margin-bottom: .4rem; }
.p-box { background: linear-gradient(160deg, #3b4252, #14171d 70%); border: 3px solid var(--accent); aspect-ratio: 4/3; width: min(300px, 92%); clip-path: none; border-radius: 10px; }
.p-box.has-art { border: 0; }
.p-pass.has-art { width: min(200px, 70%); }
.p-draft { background: linear-gradient(160deg, #3d6cf2, #1b2a6b 65%, #0d1233); }
.p-pass { background: linear-gradient(160deg, #a45cff, #4b1b99 65%); }

/* Cards (placeholder art: CSS gradients; frames replaced by --asset-card-frame-*.png) */
.ucard { --ink: #1a1305; position: relative; container-type: inline-size; width: 100%; aspect-ratio: 5 / 7; text-align: left; }
.ucard.flips { perspective: 900px; }
.ucard.size-sm { width: 100%; }
.ucard.size-md { width: 100%; max-width: 220px; margin: 0 auto; }
.ucard.size-lg { max-width: 300px; margin: 0 auto; }
.ucard .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2,.8,.2,1); transform: rotateY(180deg); }
.ucard.up .flip { transform: rotateY(0); }
.face, .back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 7% / 5%; overflow: hidden; }
.back { transform: rotateY(180deg); background: #14171d; border: 2px solid #2d3340; }
.backart { position: absolute; inset: 0; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #171a21 0 10px, #1d212a 10px 20px) center/cover; }
.backart.has-art { background-size: 100% 100%; }
.backart.has-art .ball { display: none; }
.backart .ball { width: 30cqw; height: 30cqw; }
.frame { position: absolute; inset: 0; background-size: 102% 102%; background-position: center; background-repeat: no-repeat; }
.frame:not(.has-art) { background: linear-gradient(155deg, #3a4150, #1b1f28 60%, #0f1218); }
.tier-rookie .frame:not(.has-art) { background: linear-gradient(155deg, #d9a273, #8c5a35 55%, #5b3820); }
.tier-pro .frame:not(.has-art) { background: linear-gradient(155deg, #f4f7fa, #aab4c0 55%, #6f7a88); }
.tier-vet .frame:not(.has-art) { background: linear-gradient(155deg, #ffe58a, #d9a400 55%, #8a6500); }
.tier-hof .frame:not(.has-art) { background: linear-gradient(155deg, #9be8ff, #1e90c8 50%, #0a2f63); }
.tier-franchise .frame:not(.has-art) { background: linear-gradient(155deg, #ff82b6, #c1166d 45%, #3a0a52); }
.face { color: #fff; background: #0b0c10; }
.ucard.flat .face { position: absolute; inset: 0; border-radius: 7% / 5%; overflow: hidden; }
.portrait { position: absolute; overflow: hidden; }
.portrait .logo-bg { position: absolute; left: 10%; top: 10%; width: 80%; height: 70%; object-fit: contain; opacity: .1; }
.portrait .shot { position: absolute; left: 50%; bottom: 0; width: 132%; max-width: none; height: auto; transform: translateX(-50%); }
.initials { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-size: 26cqw; font-weight: 900; opacity: .6; }
.portrait .tlogo { position: absolute; right: 2.5cqw; top: 2.5cqw; width: 9cqw; height: 9cqw; object-fit: contain; }
.tierchip { position: absolute; left: 2.5cqw; bottom: 9cqw; font-size: 3.6cqw; font-weight: 900; letter-spacing: .14em; padding: .5cqw 1.8cqw; border-radius: 99px; background: rgba(0,0,0,.6); color: var(--tier); border: .35cqw solid var(--tier); }
.statstrip { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2cqw 1cqw; text-align: center; font-size: 3.5cqw; font-weight: 600; letter-spacing: .04em; white-space: nowrap; background: linear-gradient(transparent, rgba(0,0,0,.78)); text-shadow: 0 1px 2px #000; }
.statstrip b { font-size: 4.3cqw; }
.badgebox { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; text-shadow: 0 .3cqw .8cqw rgba(0,0,0,.95); }
.badgebox .ovr { font-weight: 900; letter-spacing: -.03em; }
.badgebox .pos { font-weight: 800; letter-spacing: .05em; margin-top: .6cqw; color: var(--tier); }
.platebox { position: absolute; display: flex; align-items: center; justify-content: center; }
.platebox .name { font-weight: 900; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; line-height: 1; text-shadow: 0 .3cqw 1cqw rgba(0,0,0,.9); }
.badgebox.synthetic { background: linear-gradient(160deg, rgba(20,22,30,.92), rgba(8,9,13,.92)); border: .5cqw solid var(--tier); border-radius: 18%; box-shadow: 0 0 2cqw rgba(0,0,0,.6); }
.platebox.synthetic { background: linear-gradient(rgba(10,11,16,.92), rgba(4,5,8,.92)); border-top: .4cqw solid var(--tier); border-bottom: .4cqw solid var(--tier); }
.ucard.ed-draft .tierchip { background: #fff; color: #10131c; border-color: #fff; }
.badge { position: absolute; z-index: 3; top: 4px; right: 4px; font-size: .62rem; font-weight: 900; letter-spacing: .08em; padding: .15rem .45rem; border-radius: 999px; background: #fff; color: #111; }
.badge.new { background: var(--good); }
.badge.dupe { background: #596073; color: #fff; }
.badge.copies { background: var(--accent); }
.face .badge { top: auto; bottom: 10.5%; right: 4%; font-size: 4.4cqw; padding: .5cqw 2.6cqw; z-index: 4; }
.ucard.dim .face::after { content: ""; position: absolute; inset: 0; background: rgba(6,6,8,.72); z-index: 5; }
.ucard.dim .notowned { position: absolute; inset: auto 0 38% 0; text-align: center; font-weight: 800; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #cfd5e2; z-index: 2; }
.ucard.just .flip { animation: pop .7s ease; }
@keyframes pop { 0% { transform: rotateY(180deg) scale(.9); } 55% { transform: rotateY(0) scale(1.1); } 100% { transform: rotateY(0) scale(1); } }
button.slot { all: unset; display: block; cursor: pointer; border-radius: 10px; position: relative; }
button.slot:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }
button.slot:hover .ucard.up .flip { transform: translateY(-3px); }

/* Dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 0; max-width: min(900px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.72); }
.dlg-body { padding: 1.4rem; position: relative; }
.card-detail { display: grid; grid-template-columns: 260px 1fr; gap: 1.4rem; align-items: start; }
.cd-info { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.cd-info h3 { font-size: 1.5rem; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }
.team-btn { display: flex; flex-direction: column; align-items: center; gap: .2rem; background: var(--panel2); border: 1px solid var(--line); border-bottom: 3px solid var(--team); border-radius: 12px; padding: .7rem .4rem; cursor: pointer; text-align: center; }
.team-btn:hover { background: #272b35; }
.team-btn img { width: 42px; height: 42px; object-fit: contain; }
.team-btn span { font-weight: 700; font-size: .85rem; }
.team-btn small { color: var(--muted); }
.confirm { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin: 1rem 0; }
.confirm p { flex-basis: 100%; margin: 0; }
.close { margin-top: .4rem; }


/* grids: skip layout/paint for off-screen cards */
.index-grid .slot, .haul-grid .slot, .sets-grid .settile, .ach-grid .ach { content-visibility: auto; contain-intrinsic-size: auto 220px; }
.ucard .portrait { contain: paint; }
.statstrip, .platebox .name { overflow: hidden; text-overflow: clip; }
