/* Inter, self-hosted (SIL Open Font License, see /inter-LICENSE.txt) so no third-party font requests */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #0b0b10; --bg2: #111118; --panel: rgba(22, 22, 30, 0.78); --panel-solid: #15151d; --line: rgba(255, 255, 255, 0.08);
  --text: #eceefa; --muted: #a2a8c3; --cyan: #fbbf24; --purple: #a855f7; --magenta: #ec4899; --gold: #fbbf24; --danger: #f87171; --ok: #4ade80;
  --t-common: #9ca3af; --t-uncommon: #22c55e; --t-rare: #3b82f6; --t-epic: #a855f7; --t-legendary: #f59e0b; --t-mythic: #f43f5e; --t-apex: #ffffff;
  --display: 'Inter', system-ui, sans-serif; --body: 'Inter', system-ui, sans-serif;
  --radius: 14px; --card-w: 168px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--body); overflow-x: hidden; -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1, 'cv11' 1; }
a { color: var(--cyan); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0 0 0.6em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.1rem; color: #fff; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* backdrop */
.backdrop { position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(220, 38, 38, 0.14), transparent 60%), radial-gradient(ellipse 60% 40% at 100% 100%, rgba(124, 58, 237, 0.08), transparent 60%), var(--bg); }

/* header */
header.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: rgba(6, 6, 11, 0.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; text-decoration: none; color: #fff; white-space: nowrap; }
.logo img { width: 30px; height: 27px; }
.logo b { font-weight: 800; background: linear-gradient(90deg, #f87171, #fbbf24); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav.main { display: flex; gap: 4px; flex: 1; }
nav.main a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
nav.main a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
nav.main a { transition: color 0.2s, background 0.2s; }
nav.main a[aria-current='page'] { color: #fff; background: rgba(255, 255, 255, 0.08); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.pack-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.85rem; padding: 6px 12px 6px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: #fff; text-decoration: none; white-space: nowrap; transition: background 0.2s; }
.pack-chip:hover { background: rgba(255, 255, 255, 0.09); }
.pack-chip img { width: 20px; height: 18px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; transition: background 0.2s; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); }
.user-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 12px; display: inline-flex; transition: transform 0.2s; }
.user-btn:hover { transform: scale(1.05); }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; background: var(--magenta); color: #fff; font-size: 0.7rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; }
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .menu-toggle { display: inline-block; }
  .logo span { display: none; }
  nav.main { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--panel-solid); padding: 10px; border-bottom: 1px solid var(--line); }
  nav.main.open { display: flex; }
  nav.main a { padding: 12px; }
}
@media (max-width: 520px) {
  header.top { gap: 8px; padding: 8px 12px; }
  .logo { font-size: 0.9rem; }
  .top-right { gap: 6px; }
  .pack-chip { padding: 5px 8px; }
  .icon-btn { width: 36px; height: 36px; }
  .top-right .avatar { width: 36px; height: 36px; }
  .row > label.field { flex: 1 1 100%; }
}

main:focus { outline: none; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 80px; }
footer.site { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 16px 40px; border-top: 1px solid var(--line); }

/* panels + controls */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(10px); }
.section { margin-top: 28px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.btn { font-family: var(--body); font-weight: 600; letter-spacing: 0; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: #fff; padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.9rem; min-height: 40px; transition: background 0.2s, transform 0.15s, box-shadow 0.2s, opacity 0.2s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(90deg, #f87171, #fbbf24); border: 0; color: #1a0c04; font-weight: 700; box-shadow: 0 6px 20px rgba(248, 113, 113, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(90deg, #fb8a8a, #fcd34d); box-shadow: 0 8px 26px rgba(251, 191, 36, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.danger.solid { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger.solid:hover:not(:disabled) { background: #ef4444; }
.btn.danger { border-color: rgba(248, 113, 113, 0.45); color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: rgba(220, 38, 38, 0.12); }
.btn.sm { padding: 6px 10px; min-height: 32px; font-size: 0.75rem; }
input, select, textarea { font: inherit; color: var(--text); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 40px; }
input:focus, select:focus, textarea:focus { border-color: rgba(248, 113, 113, 0.7); outline: none; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
input, select, textarea { transition: border-color 0.2s, box-shadow 0.2s; }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; min-height: 0; padding: 0; border: 0; background: transparent; cursor: pointer; --val: 60%; }
input[type='range']:focus { box-shadow: none; }
input[type='range']::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #ef4444 var(--val), rgba(255, 255, 255, 0.12) var(--val)); }
input[type='range']::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
input[type='range']::-moz-range-progress { height: 6px; border-radius: 3px; background: #ef4444; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); transition: transform 0.15s; }
input[type='range']::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
input[type='range']:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type='range']:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.35); }
.volume output { color: var(--text); font-weight: 600; }
input[type='checkbox'] { min-height: auto; width: 18px; height: 18px; accent-color: #ef4444; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; cursor: pointer; user-select: none; }
.chip input { width: 14px; height: 14px; }
.chip:has(input:checked) { border-color: var(--tc, var(--cyan)); background: color-mix(in srgb, var(--tc, var(--cyan)) 18%, transparent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b); transition: width 0.6s ease; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; }
.empty, .loading, .error-box { text-align: center; padding: 40px 16px; color: var(--muted); }
.error-box { color: var(--danger); }
.loading::after { content: ''; display: inline-block; width: 22px; height: 22px; margin-left: 10px; vertical-align: middle; border: 3px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tier-text { font-weight: 700; font-size: 0.72rem; letter-spacing: 0.06em; color: var(--tc); }
.tier-text.t-apex { background: linear-gradient(90deg, #f43f5e, #f59e0b, #22c55e, #22d3ee, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.avatar { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; background: rgba(0, 0, 0, 0.4); border: 2px solid var(--ac); flex: none; }
.avatar svg { width: 70%; height: 70%; }
.avatar.lg { width: 84px; height: 84px; border-radius: 18px; }

/* tier palette */
.t-common { --tc: var(--t-common); } .t-uncommon { --tc: var(--t-uncommon); } .t-rare { --tc: var(--t-rare); } .t-epic { --tc: var(--t-epic); }
.t-legendary { --tc: var(--t-legendary); } .t-mythic { --tc: var(--t-mythic); } .t-apex { --tc: #fff; }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr)); gap: 16px; }
.card-grid.large { --card-w: 240px; }
.card-grid.compact { --card-w: 150px; }
.card { position: relative; aspect-ratio: 5 / 7; border-radius: 12px; cursor: pointer; transform-style: preserve-3d; transition: transform 0.25s ease, box-shadow 0.25s;
  transform: perspective(800px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)); --mx: 50%; --my: 50%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 30%, #111) 0%, #0b0b14 60%); padding: 3px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px color-mix(in srgb, var(--tc) 55%, transparent); text-align: left; color: var(--text); border: 0; font: inherit; width: 100%; }
.card:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px color-mix(in srgb, var(--tc) 50%, transparent), 0 0 0 1px var(--tc); }
.card-inner { position: relative; height: 100%; border-radius: 10px; overflow: hidden; background: radial-gradient(120% 70% at 50% 110%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%), radial-gradient(90% 50% at 50% -10%, color-mix(in srgb, var(--tc) 14%, transparent), transparent 70%), linear-gradient(180deg, #14141f, #0a0a12); display: flex; flex-direction: column; container-type: inline-size; }
.card-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; gap: 4px; }
.rank { font-weight: 800; letter-spacing: -0.03em; font-size: clamp(0.9rem, 11cqi, 1.6rem); color: #fff; text-shadow: 0 0 12px color-mix(in srgb, var(--tc) 60%, transparent); line-height: 1; }
.tier-badge { font-size: clamp(0.5rem, 5.5cqi, 0.7rem); font-weight: 700; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--tc) 22%, transparent); color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent); letter-spacing: 0.06em; }
.thumb { position: relative; margin: 0 8px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 6px; font-weight: 800; font-size: clamp(0.55rem, 7cqi, 0.95rem); color: #fff;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 8px, transparent 8px 16px), radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--tc) 60%, transparent), #0a0a12 70%); text-shadow: 0 0 8px var(--tc); }
.card-body { padding: 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.card-name { font-weight: 700; letter-spacing: -0.01em; font-size: clamp(0.72rem, 8.5cqi, 1.1rem); line-height: 1.15; color: #fff; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { font-size: clamp(0.55rem, 6cqi, 0.78rem); color: var(--muted); line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: clamp(0.5rem, 5.5cqi, 0.72rem); color: var(--muted); }
.count { font-weight: 800; color: #fff; background: rgba(0, 0, 0, 0.6); border: 1px solid var(--tc); border-radius: 6px; padding: 1px 6px; }
.holo-badge { font-weight: 800; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; color: #050510; background: linear-gradient(90deg, #f0abfc, #67e8f9, #fde68a, #86efac, #f0abfc) 0 0 / 200% 100% repeat-x; animation: shift 3s linear infinite; }
.fav { color: var(--gold); }
.card .foil, .card .glare { position: absolute; inset: 3px; border-radius: 10px; pointer-events: none; }
.card .glare { background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.22), transparent 45%); opacity: 0; transition: opacity 0.2s; mix-blend-mode: overlay; }
.card:hover .glare { opacity: 1; }
.card.holo { padding: 3px; background: conic-gradient(from var(--ang, 0deg), #f0abfc, #67e8f9, #fde68a, #86efac, #a5b4fc, #f0abfc); animation: spinang 4s linear infinite; }
.card.holo .foil {
  background:
    radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 45%),
    repeating-linear-gradient(115deg, #ff8fa3 0%, #ffd38f 4%, #fff59e 8%, #a6f7c9 12%, #9fe3ff 16%, #c3b6ff 20%, #ffa6ec 24%, #ff8fa3 28%);
  background-size: 100% 100%, 220% 220%;
  background-position: center, var(--mx) var(--my);
  mix-blend-mode: color-dodge; opacity: 0.42; animation: holohue 6s linear infinite;
}
.card.holo .card-inner::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0) 0 6px, rgba(255, 255, 255, 0.05) 6px 7px); mix-blend-mode: overlay; }
@keyframes holohue { to { filter: hue-rotate(360deg); } }
.card.holo .glare { opacity: 0.8; }
.card.t-apex:not(.holo) { background: conic-gradient(from var(--ang, 0deg), #f43f5e, #f59e0b, #22c55e, #22d3ee, #a855f7, #f43f5e); animation: spinang 3s linear infinite; }
.card.t-apex .rank { text-shadow: 0 0 12px #fff, 0 0 24px var(--magenta); }
.card.t-mythic, .card.t-apex { box-shadow: 0 0 26px color-mix(in srgb, var(--tc) 45%, transparent); }
.card.t-apex { --tc: #fde68a; }
.card.unowned { filter: grayscale(1) brightness(0.35); cursor: default; }
.card.unowned .rank { text-shadow: none; }
.card.selected { outline: 3px solid var(--cyan); outline-offset: 3px; }
.card .sparkle { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; animation: sparkle 2.4s ease-in-out infinite; pointer-events: none; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spinang { to { --ang: 360deg; } }
@keyframes shift { to { background-position: 200% 0; } }
@keyframes sparkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1.2); } }

/* ---------- pack hero ---------- */
.hero { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center; padding: 28px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.pack { --pw: 200px; --ph: 300px; position: relative; width: var(--pw); height: var(--ph); border: 0; padding: 0; background: none; cursor: pointer; color: #fff;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.6)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); animation: packbob 4s ease-in-out infinite, foildrift 7s ease-in-out infinite alternate; will-change: transform, translate; transition: filter 0.3s, transform 0.35s cubic-bezier(.2, .8, .2, 1), scale 0.3s, --mx 0.4s;
  transform: perspective(900px) rotateX(var(--ry, 2deg)) rotateY(var(--rx, -5deg)); }
.pack:hover:not(:disabled) { filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.65)) brightness(1.06); scale: 1.03; animation: packbob 4s ease-in-out infinite; }
@property --mx { syntax: '<percentage>'; inherits: true; initial-value: 35%; }
@keyframes foildrift { from { --mx: 15%; } to { --mx: 85%; } }
.pack:disabled { filter: grayscale(0.8) brightness(0.55); cursor: not-allowed; animation: none; }
.bag { position: absolute; inset: 0; display: block; }
.bag-top, .bag-body { position: absolute; left: 0; right: 0; overflow: hidden;
  /* layers: edge shading, end shading, bright foil reflections (screen), dark creases (multiply), rainbow holo tint (overlay), warm glow, base color */
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0, rgba(255, 255, 255, 0) 4%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.4) 94%, rgba(0, 0, 0, 0.58) 100%) 0 0 / 100% 100%,
    linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 16%, rgba(255, 255, 255, 0.07) 45%, rgba(0, 0, 0, 0) 80%, rgba(0, 0, 0, 0.35) 100%) 0 0 / 100% var(--ph),
    linear-gradient(104deg, #000 6%, #c9c9c9 12%, #fff 13.5%, #8a8a8a 16%, #000 22%, #000 44%, #9a9a9a 49%, #e6e6e6 50.5%, #555 54%, #000 58%, #000 80%, #b0b0b0 85%, #000 91%) 0 0 / 170% var(--ph),
    linear-gradient(104deg, #fff 22%, #b9a9c2 30%, #fff 38%, #fff 60%, #a898b4 68%, #fff 76%) 0 0 / 170% var(--ph),
    linear-gradient(118deg, rgba(255, 92, 205, 0.45), rgba(255, 214, 102, 0.4), rgba(110, 255, 190, 0.38), rgba(102, 204, 255, 0.42), rgba(178, 140, 255, 0.45), rgba(255, 92, 205, 0.45)) 0 0 / 260% var(--ph),
    radial-gradient(80% 50% at 15% 90%, rgba(251, 146, 60, 0.55), transparent 65%) 0 0 / 100% var(--ph),
    linear-gradient(160deg, #6d28d9 0%, #a21caf 40%, #db2777 70%, #f97316 100%) 0 0 / 100% var(--ph);
  background-blend-mode: normal, normal, screen, multiply, soft-light, normal, normal;
  background-position: 0 0, 0 0, var(--mx) 0, var(--mx) 0, calc(100% - var(--mx)) 0, 0 0, 0 0; }
/* zig-zag crimp edges */
.bag-top { top: 0; height: 15%; z-index: 2; -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 12px 51% repeat-x, linear-gradient(#000 0 0) bottom / 100% 50% no-repeat;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 12px 51% repeat-x, linear-gradient(#000 0 0) bottom / 100% 50% no-repeat;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 93% 100%, 85% 84%, 76% 97%, 66% 85%, 57% 99%, 47% 86%, 38% 98%, 28% 84%, 19% 97%, 9% 85%, 0 96%); }
.bag-body { top: 11%; bottom: 0; background-position: 0 0, 0 calc(var(--ph) * -0.11), var(--mx) calc(var(--ph) * -0.11), var(--mx) calc(var(--ph) * -0.11), calc(100% - var(--mx)) calc(var(--ph) * -0.11), 0 calc(var(--ph) * -0.11), 0 calc(var(--ph) * -0.11);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 51% repeat-x, linear-gradient(#000 0 0) top / 100% 50% no-repeat;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 51% repeat-x, linear-gradient(#000 0 0) top / 100% 50% no-repeat; }
/* pillow shading so it reads as a filled bag */
.bag-top::after, .bag-body::after { content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; opacity: 0.75;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='300' viewBox='0 0 200 300'%3E%3Cfilter id='c' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.01 0.04' numOctaves='4' seed='7'/%3E%3CfeDiffuseLighting surfaceScale='4' lighting-color='%23fff'%3E%3CfeDistantLight azimuth='225' elevation='50'/%3E%3C/feDiffuseLighting%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.2' intercept='-0.75'/%3E%3CfeFuncG type='linear' slope='2.2' intercept='-0.75'/%3E%3CfeFuncB type='linear' slope='2.2' intercept='-0.75'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='200' height='300' filter='url%28%23c%29'/%3E%3Crect width='200' height='300' filter='url%28%23g%29'/%3E%3C/svg%3E") 0 0 / 100% var(--ph) no-repeat; }
.bag-body::after { background-position: 0 calc(var(--ph) * -0.11); }
.seam { position: absolute; left: 0; right: 0; top: 0; height: 60%; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0 1px, rgba(0, 0, 0, 0.18) 1px 3px, transparent 3px 5px), linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.05)); z-index: 1; }
.seam::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: rgba(255, 255, 255, 0.25); }
.seam.bottom { top: auto; bottom: 0; height: 9%; }
.seam.bottom::after { bottom: auto; top: -3px; }
.pack-face { position: absolute; inset: 9% 9% 14%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.62); border-radius: 14px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 14px rgba(255, 255, 255, 0.18); background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.22), transparent 62%); }
.demon-icon { width: 52%; height: auto; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)); user-select: none; }
.pack .pack-title { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; margin-top: 6px; color: #fff; text-shadow: 0 2px 10px rgba(76, 5, 25, 0.55); }
.pack .pack-sub { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #fff; padding: 3px 10px; background: rgba(0, 0, 0, 0.22); border-radius: 999px; }
@keyframes packbob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.pack-count { font-weight: 800; letter-spacing: -0.03em; font-size: 3.2rem; line-height: 1; }
.pack-count small { font-size: 1.2rem; color: var(--muted); }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .bg { stroke: rgba(255, 255, 255, 0.08); }
.ring .fg { stroke: url(#ringgrad); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring .label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .label b { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.full-badge { font-weight: 700; color: var(--gold); letter-spacing: 0.06em; font-size: 0.85rem; padding: 10px 16px; border: 1px solid rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); border-radius: 999px; }
.open-btn { font-size: 1rem; padding: 14px 34px; border-radius: 12px; }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------- opening overlay ---------- */
.opening { position: fixed; inset: 0; z-index: 100; background: radial-gradient(circle at 50% 45%, rgba(60, 10, 10, 0.9), rgba(0, 0, 0, 0.96)); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; animation: fadein 0.4s; transition: opacity 0.25s; }
.opening.closing { opacity: 0; }
.opening canvas { position: absolute; inset: 0; pointer-events: none; }
.opening .skip { position: absolute; top: 16px; right: 16px; z-index: 5; }
.opening .stage-pack { position: relative; z-index: 2; transition: transform 0.6s cubic-bezier(.2, .9, .3, 1.3); }
.opening .stage-pack .pack { animation: none; --pw: 230px; --ph: 345px; cursor: default; }
.stage-pack.torn .bag-top { transform-origin: 100% 100%; animation: tearoff 0.95s cubic-bezier(.45, 0, .2, 1) forwards; }
.stage-pack.torn .bag-body { animation: dropaway 0.6s 0.65s cubic-bezier(.5, 0, .75, 0) forwards; }
.bag-body::before { content: ''; position: absolute; left: 4%; right: 4%; top: 0; height: 35%; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse 60% 70% at 50% 0%, rgba(255, 244, 220, 0.95), rgba(251, 191, 36, 0.55) 35%, transparent 75%); }
.stage-pack.torn .bag-body::before { animation: spill 0.9s ease-out forwards; }
.stage-pack::before { content: ''; position: absolute; left: 50%; top: 12%; width: 560px; height: 340px; transform: translate(-50%, -100%) scaleY(0.2); transform-origin: 50% 100%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from -60deg at 50% 100%, rgba(255, 226, 170, 0.28) 0deg 3deg, transparent 3deg 11deg); -webkit-mask: radial-gradient(ellipse at 50% 100%, #000 15%, transparent 70%); mask: radial-gradient(ellipse at 50% 100%, #000 15%, transparent 70%); }
.stage-pack.torn::before { animation: rays 1.3s ease-out forwards; }
@keyframes tearoff { 0% { transform: none; } 22% { transform: rotate(-4deg); } 45% { transform: rotate(-14deg) translate(4px, -4px); } 100% { transform: translate(170px, -280px) rotate(-62deg); opacity: 0; } }
@keyframes dropaway { to { transform: translateY(240px) scale(0.94); opacity: 0; } }
@keyframes spill { 0% { opacity: 0; } 35% { opacity: 1; } 100% { opacity: 1; } }
@keyframes rays { 0% { opacity: 0; transform: translate(-50%, -100%) scaleY(0.2); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -100%) scaleY(1.1); } }
.opening.shake1 .stage-pack .pack { animation: shake 0.5s infinite; }
.opening.shake2 .stage-pack .pack { animation: shake 0.25s infinite; filter: drop-shadow(0 0 40px rgba(251, 146, 60, 0.55)); }
.opening.shake3 .stage-pack .pack { animation: shake 0.1s infinite; filter: drop-shadow(0 0 70px rgba(253, 230, 138, 0.8)) brightness(1.15); }
.opening .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
.opening .flash.go { animation: flash 0.7s ease-out; }
.frag { position: absolute; width: 14px; height: 14px; z-index: 3; background: linear-gradient(135deg, #f87171, #7f1d1d); animation: frag 1s ease-out forwards; }
.reveal-row { position: relative; z-index: 2; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 16px; max-width: 1200px; --card-w: 180px; }
.reveal-row .slot { width: clamp(120px, 17vw, 190px); perspective: 1000px; transition: opacity 0.3s, translate 0.4s; }
/* suspense before a (maybe) good card flips: the rest dim, this one lifts, glows neutral white and shakes harder each step */
.reveal-row.focus .slot:not(.tease) { opacity: 0.35; }
.slot.tease { translate: 0 -12px; }
.slot.tease .card-back { box-shadow: 0 0 28px rgba(255, 255, 255, 0.3); }
.slot[data-shake="1"] .card-back { animation: shake 0.5s infinite; }
.slot[data-shake="2"] .card-back { animation: shake 0.3s infinite; }
.slot[data-shake="3"] .card-back { animation: shake 0.15s infinite; }
.flipper { position: relative; aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(.3, 1.4, .5, 1); cursor: pointer; }
.flipper.flipped { transform: rotateY(180deg); }
.flipper .face { position: absolute; inset: 0; backface-visibility: hidden; }
.flipper .front { transform: rotateY(180deg); }
.card-back { width: 100%; height: 100%; border-radius: 12px; background: url('/extreme-demon.png') center / 42% no-repeat, radial-gradient(circle, #3b0a0a, #140404 70%); border: 2px solid rgba(239, 68, 68, 0.45); display: grid; place-items: center; font-size: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.slot .card { width: 100%; }
.slot.revealed .front .card { animation: pop 0.5s ease-out; }
.slot.big-reveal .front .card { box-shadow: 0 0 60px var(--tc), 0 0 120px var(--tc); }
.special { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 20px; text-align: center; padding: 20px;
  background: radial-gradient(circle, color-mix(in srgb, var(--tc) 35%, transparent), rgba(0, 0, 0, 0.92) 65%); animation: fadein 0.3s; }
.special .rays { position: absolute; inset: -50%; background: repeating-conic-gradient(color-mix(in srgb, var(--tc) 35%, transparent) 0 8deg, transparent 8deg 20deg); animation: spin 14s linear infinite; mask-image: radial-gradient(circle, #000 10%, transparent 60%); }
.special h2 { position: relative; font-weight: 800; letter-spacing: -0.03em; font-size: clamp(2rem, 8vw, 4.5rem); color: #fff; text-shadow: 0 0 20px var(--tc), 0 0 50px var(--tc); animation: zoomin 0.8s cubic-bezier(.2, 1.4, .4, 1); margin: 0; }
/* card height follows the window height too, so heading + card + button fit on short screens (e.g. laptops with display scaling) */
.special .card { position: relative; flex: none; width: min(300px, 70vw, max(150px, (100dvh - 320px) * 5 / 7)); animation: zoomin 1s cubic-bezier(.2, 1.4, .4, 1); }
.summary { position: relative; z-index: 2; text-align: center; padding: 20px; width: min(1100px, 100%); max-height: 100vh; overflow-y: auto; }
.reveal-label { text-align: center; font-size: 0.78rem; margin-top: 8px; min-height: 1.2em; }
@keyframes shake { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-6px, 2px) rotate(-3deg); } 50% { transform: translate(5px, -3px) rotate(2deg); } 75% { transform: translate(-3px, 4px) rotate(-1deg); } }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
@keyframes frag { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes zoomin { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }

/* modal, toasts, dropdown */
.modal-bg { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.75); display: grid; place-items: center; padding: 16px; animation: fadein 0.2s; }
.modal { animation: modalin 0.25s cubic-bezier(.2, .8, .2, 1); position: relative; width: min(900px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
/* sticky so it stays in reach while a tall popup scrolls; the negative bottom margin keeps it from pushing content down */
.modal .close { position: sticky; top: 0; float: right; z-index: 6; margin: -10px -10px -32px 0; }
html.modal-open { overflow: hidden; scrollbar-gutter: stable; }
.modal-bg { overscroll-behavior: contain; }
.detail { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 22px; }
@media (max-width: 640px) { .detail { grid-template-columns: 1fr; } .detail > .card { max-width: 260px; margin: 0 auto; } }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 0.85rem; }
dl.kv dd { margin: 0; word-break: break-word; }
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--panel-solid); border: 1px solid var(--line); border-left: 4px solid var(--cyan); padding: 12px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: fadein 0.3s; }
.toast.err { border-left-color: var(--danger); }
.dropdown { animation: dropin 0.18s ease-out; position: absolute; right: 16px; top: calc(100% + 6px); width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); }
.notif { padding: 10px; border-radius: 8px; font-size: 0.88rem; }
.notif.unread { background: rgba(34, 211, 238, 0.08); }
.notif time { display: block; color: var(--muted); font-size: 0.75rem; }

/* lists */
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.list-row + .list-row { margin-top: 8px; }
.friend-actions { margin-left: auto; gap: 6px; }
/* phones: name and role badge stay on one line, the buttons get their own full-width row underneath */
@media (max-width: 520px) {
  .friend-row { flex-wrap: wrap; }
  .friend-row > a { flex-wrap: nowrap; }
  .friend-actions { margin-left: 0; width: 100%; flex-wrap: nowrap; }
  .friend-actions > * { flex: 1; justify-content: center; text-align: center; }
}
.level-thumb { width: 96px; aspect-ratio: 16 / 9; border-radius: 6px; object-fit: cover; background: #111; flex: none; }
.level-thumb.ph { display: grid; place-items: center; font-size: 0.6rem; font-family: var(--display); color: var(--muted); text-align: center; overflow: hidden; }
.idx-row { cursor: pointer; }
.idx-row:hover { background: rgba(255, 255, 255, 0.04); }
.status { font-family: var(--display); font-weight: 700; font-size: 0.72rem; padding: 3px 8px; border-radius: 6px; border: 1px solid currentColor; }
.status.pending { color: var(--gold); background: rgba(251, 191, 36, 0.08); }
.status.completed { color: #4ade80; background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.55); }
.status.rejected { color: #f87171; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.55); }
.status.cancelled, .status.invalid, .status.expired { color: var(--muted); }
.trade-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start; }
.trade-sides .arrow { font-size: 2rem; align-self: center; color: var(--cyan); }
@media (max-width: 760px) { .trade-sides { grid-template-columns: 1fr; } .trade-sides .arrow { transform: rotate(90deg); justify-self: center; } }
.mini-cards { --card-w: 120px; }
.lb li { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.lb ol { padding-left: 0; list-style: none; margin: 0; counter-reset: lb; }
.lb li::before { counter-increment: lb; content: counter(lb); font-family: var(--display); width: 22px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button[aria-selected='true'] { border-color: var(--cyan); color: var(--cyan); }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-w); gap: 14px; overflow-x: auto; padding: 6px 2px 12px; scroll-snap-type: x mandatory; }
.hscroll > * { scroll-snap-align: start; }
.attribution { font-size: 0.78rem; color: var(--muted); }
.auth-wrap { max-width: 420px; margin: 6vh auto; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick button { background: none; border: 2px solid var(--line); border-radius: 12px; padding: 4px; cursor: pointer; }
.avatar-pick button[aria-pressed='true'] { border-color: var(--cyan); }
code, pre { font-family: ui-monospace, monospace; font-size: 0.82rem; }
pre { background: rgba(0, 0, 0, 0.4); padding: 10px; border-radius: 8px; overflow-x: auto; }

/* reduced motion: OS setting or in-app toggle */
@media (prefers-reduced-motion: reduce) { html:not(.motion-on) * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
html.reduce-motion * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
html.reduce-motion .card { transform: none; }

/* page + overlay transitions */
main > * { animation: pagein 0.35s cubic-bezier(.2, .7, .2, 1) both; }
main > *:nth-child(2) { animation-delay: 0.04s; } main > *:nth-child(3) { animation-delay: 0.08s; }
@keyframes pagein { from { opacity: 0; transform: translateY(10px); } }
@keyframes modalin { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes dropin { from { opacity: 0; transform: translateY(-6px); } }
.card-grid > .card { animation: pagein 0.3s ease both; }
/* account menu */
.dropdown.menu { width: 230px; padding: 6px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; transition: background 0.15s; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: rgba(255, 255, 255, 0.07); }
.menu #logoutBtn { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head div { display: flex; flex-direction: column; line-height: 1.3; }

.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.auth-logo { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; }
.auth-logo img { width: 48px; height: auto; }
.auth-logo b { background: linear-gradient(90deg, #f87171, #fbbf24); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb li { padding: 10px 8px; border-radius: 10px; }
.lb li + li { border-top: 1px solid var(--line); }
.lb li.you { background: rgba(251, 191, 36, 0.07); }
.lb li.p1::before { color: #fbbf24; font-weight: 800; } .lb li.p2::before { color: #d1d5db; font-weight: 800; } .lb li.p3::before { color: #d97706; font-weight: 800; }
.lb li::before { font-family: var(--body); width: 28px; }

/* ko-fi + favorite stars */
.kofi { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; color: #fff; text-decoration: none; background: #29abe0; transition: background 0.2s, transform 0.15s; }
.kofi:hover { background: #33bdf2; transform: translateY(-1px); }
@media (max-width: 700px) { .kofi span { display: none; } .kofi { padding: 8px; } }
.card-wrap { position: relative; animation: pagein 0.3s ease both; }
.card-wrap .card { animation: none; }
.fav-star { position: absolute; right: 8px; bottom: 8px; z-index: 5; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(10, 10, 14, 0.75);
  color: rgba(255, 255, 255, 0.55); font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(4px); transition: color 0.15s, transform 0.15s, background 0.15s; }
.fav-star:hover { color: #fde68a; transform: scale(1.1); }
.fav-star[aria-pressed='true'] { color: #facc15; border-color: rgba(250, 204, 21, 0.6); text-shadow: 0 0 8px rgba(250, 204, 21, 0.6); }
.card-wrap .card-foot .fav { display: none; }
.card-wrap .card-foot { padding-right: 34px; }

/* stacked packs behind the front one */
.pack .layer { position: absolute; inset: 0; display: block; pointer-events: none; transition: transform 0.3s; }
.pack .layer .pack-face { opacity: 0.5; }
.layer .glints { display: none; }
.pack > .bag { z-index: 1; }
.pack .layer { transform-origin: 50% 115%; z-index: calc(-1 * var(--i)); /* pivot just below the packs, like a hand of cards */
  transform: translateX(calc(var(--shift, 0px) - var(--i) * 6px)) rotate(calc(var(--fan, 0deg) - var(--i) * 3.5deg)); filter: brightness(calc(0.8 - var(--i) * 0.045)) saturate(1.1); }
.pack .layer[hidden] { display: none; }
.pack { isolation: isolate; }
.stage-pack.torn .layer { animation: dropaway 0.6s 0.65s cubic-bezier(.5, 0, .75, 0) forwards; }
.summary .card { animation: pop 0.45s ease-out both; }
.summary-grid { --card-w: 170px; } .summary-grid.many { --card-w: 150px; }
.summary > .row:last-child { position: sticky; bottom: 0; padding: 26px 0 8px; }
.summary > .row:last-child .btn:not(.primary) { background: #f4f4f7; color: #111118; border-color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); }
.summary > .row:last-child .btn:not(.primary):hover { background: #fff; }
.summary > .row:last-child .btn.primary { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); }

.special.lite { background: radial-gradient(circle, color-mix(in srgb, var(--tc) 22%, transparent), rgba(0, 0, 0, 0.88) 60%); }
.special.lite .rays { opacity: 0.45; animation-duration: 24s; }
.special.lite h2 { font-size: clamp(1.6rem, 5.5vw, 3rem); text-shadow: 0 0 18px var(--tc); }
.special.lite .card { width: min(260px, 64vw); }

/* foil glints */
.glints { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.glint { position: absolute; width: 12px; height: 12px; opacity: 0; animation: twinkle 3.2s ease-in-out infinite;
  background: radial-gradient(circle, #fff 0 1.2px, transparent 2px), linear-gradient(#0000 45%, rgba(255, 255, 255, 0.9) 50%, #0000 55%), linear-gradient(90deg, #0000 45%, rgba(255, 255, 255, 0.9) 50%, #0000 55%);
  will-change: transform, opacity; }
@keyframes twinkle { 0%, 70%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); } 82% { opacity: 1; transform: scale(1) rotate(45deg); } }

/* trade builder */
.trade-pick .card-wrap.pickable { cursor: pointer; }
.trade-pick .card-wrap.picked .card { outline: 3px solid #fbbf24; outline-offset: 2px; }
.pick-badge { position: absolute; top: -8px; right: -6px; z-index: 6; background: linear-gradient(90deg, #f87171, #fbbf24); color: #1a0c04; font-weight: 800; font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); }
.pick-minus { position: absolute; top: -8px; left: -6px; z-index: 6; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25); background: #1a1a22; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.pick-minus:hover { background: #2a2a34; }
.trade-tray { position: sticky; bottom: 12px; z-index: 20; margin-top: 18px; background: rgba(21, 21, 29, 0.96); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45); }
.tray-sides { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: start; }
.tray-sides .arrow { font-size: 1.4rem; color: var(--cyan); align-self: center; }
@media (max-width: 700px) { .tray-sides { grid-template-columns: 1fr; } .tray-sides .arrow { display: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 96px; overflow-y: auto; }
.pick-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; padding: 4px 4px 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent); }
.pick-chip button { border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; line-height: 1; }
.pick-chip button:hover { background: rgba(248, 113, 113, 0.4); }

/* trade status */
.trade-banner { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); margin: 8px 0 16px; }
.trade-banner p { margin: 2px 0 0; color: var(--muted); }
.trade-banner b { font-size: 1.05rem; }
.trade-banner-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; }
.trade-banner.info { background: rgba(251, 191, 36, 0.07); border-color: rgba(251, 191, 36, 0.35); } .trade-banner.info .trade-banner-icon { background: rgba(251, 191, 36, 0.18); }
.trade-banner.ok { background: rgba(74, 222, 128, 0.07); border-color: rgba(74, 222, 128, 0.4); } .trade-banner.ok .trade-banner-icon { background: rgba(74, 222, 128, 0.2); color: var(--ok); }
.trade-banner.void { background: rgba(248, 113, 113, 0.07); border-color: rgba(248, 113, 113, 0.45); } .trade-banner.void .trade-banner-icon { background: rgba(248, 113, 113, 0.2); color: var(--danger); }
.trade-view { position: relative; overflow: hidden; }
.trade-view.is-void .trade-sides { filter: grayscale(0.6); opacity: 0.7; }
.void-tag { position: absolute; top: 14px; right: 16px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.trade-msg { font-style: italic; }
.report-options { display: grid; gap: 8px; }
.report-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.report-option:hover { background: rgba(255, 255, 255, 0.04); }
.report-option:has(input:checked) { border-color: #fbbf24; background: rgba(251, 191, 36, 0.07); }
input[type='radio'] { accent-color: #fbbf24; width: 18px; height: 18px; min-height: 0; }

/* copies badge + copies popup */
.copies-chip { position: absolute; top: 34%; left: 10px; z-index: 3; font-weight: 800; font-size: clamp(0.65rem, 7cqi, 0.9rem); color: #1a0c04; background: linear-gradient(90deg, #f87171, #fbbf24); border-radius: 999px; padding: 2px 8px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55); }
.copies-chip small { font-weight: 700; opacity: 0.8; }
.copies-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; padding-right: 40px; }
/* --cols (set from the copy count, max 5) sizes the popup; auto-fit drops empty columns so the cards sit centered */
.modal.copies { width: min(1140px, 100%, max(440px, calc(var(--cols, 5) * 218px + 48px))); } /* +48: padding, border and room for a scrollbar */
.copies-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 200px)); justify-content: center; gap: 18px; margin-top: 16px; }
.copy { position: relative; display: flex; flex-direction: column; gap: 8px; }
/* trade picker: small panel next to the clicked card, cards at the trade grid's size (--w) */
.pick-pop { position: absolute; z-index: 120; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 12px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); animation: dropin 0.15s ease-out; }
.pick-pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 0.85rem; }
.pick-pop-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(var(--cols) * var(--w) - 60px); }
.pick-pop-head .icon-btn { margin-left: auto; width: 30px; height: 30px; flex: none; }
.pick-pop-grid { display: grid; grid-template-columns: repeat(var(--cols), var(--w)); gap: 10px; max-width: calc(100vw - 40px); }
.pick-copy { position: relative; border-radius: 12px; cursor: pointer; }
.pick-copy.picked .card { outline: 3px solid #fbbf24; outline-offset: 2px; }
.pick-copy:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.pick-copy-note { position: absolute; left: 6px; bottom: 6px; z-index: 6; font-size: 0.62rem; font-weight: 700; color: var(--gold); background: rgba(10, 10, 14, 0.85); padding: 2px 6px; border-radius: 6px; }
.copy-info { display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; }
.copy-actions { gap: 6px; }
.copy-actions .btn { flex: 1; }
/* admin reports */
.admin-tabs a[aria-selected='true'] { border-color: var(--cyan); color: var(--cyan); }
.dot-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 0.7rem; padding: 0 5px; }
.report-card { margin-bottom: 14px; }
.report-reason { margin: 12px 0; padding: 12px 14px; border-left: 3px solid #fbbf24; background: rgba(251, 191, 36, 0.06); border-radius: 0 10px 10px 0; font-size: 1rem; }
.report-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.report-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.warn { color: #fbbf24; }
/* settings + legal */
.danger-zone { border-color: rgba(248, 113, 113, 0.35); }
.legal { max-width: 760px; margin: 0 auto; line-height: 1.7; }
.legal h2 { margin-top: 1.6em; }
.legal li { margin: 4px 0; }
/* whole fan turns right as it grows (half the spread), so it stays centered and upright */
.pack > .bag { transform-origin: 50% 115%; transform: translateX(var(--shift, 0px)) rotate(var(--fan, 0deg)); transition: transform 0.3s; }
.hero { overflow-x: clip; } /* the turned fan can poke past narrow screens */
code { overflow-wrap: anywhere; }

.discord-btn { width: 100%; background: #5865f2; border-color: #5865f2; color: #fff; font-size: 1rem; padding: 12px 18px; margin: 8px 0 4px; }
.discord-btn:hover:not(:disabled) { background: #6b77f5; }
.legacy-login { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.legacy-login summary { cursor: pointer; }
img.avatar { object-fit: cover; padding: 0; border: 2px solid rgba(255, 255, 255, 0.15); background: #1a1a22; }

/* floating bug report button */
.bug-btn { position: fixed; left: 16px; bottom: 16px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px;
  background: #1a1a22; color: var(--text); border: 1px solid rgba(255, 255, 255, 0.16); font: 600 0.85rem var(--body); cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); transition: background 0.2s, transform 0.15s; }
.bug-btn:hover { background: #24242e; transform: translateY(-1px); }
@media (max-width: 700px) { .bug-btn { padding: 8px 12px; font-size: 0.78rem; } }
.bug-text { white-space: pre-wrap; }

/* role badges */
.role-badge { display: inline-flex; align-items: center; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 999px; vertical-align: middle; line-height: 1.5; white-space: nowrap; }
.role-badge.admin { color: #c7d2fe; background: rgba(99, 102, 241, 0.2); border: 1px solid rgba(129, 140, 248, 0.55); }
.role-badge.owner { color: #1a0c04; background: linear-gradient(90deg, #f87171, #fbbf24); box-shadow: 0 0 10px rgba(251, 191, 36, 0.35); }
h1 .role-badge { font-size: 0.75rem; padding: 3px 10px; }

/* Touch devices: no continuous foil drift. Animating --mx repaints the foil every frame, which phones can't keep up with. */
@media (hover: none), (pointer: coarse) {
  .pack, .pack:hover:not(:disabled) { animation: packbob 4s ease-in-out infinite; }
}
.role-badge.mod { color: #a7f3d0; background: rgba(16, 185, 129, 0.18); border: 1px solid rgba(52, 211, 153, 0.5); }

/* trade builder filters + phone layout */
.trade-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; align-items: center; }
.trade-filters .tf-search { grid-column: 1 / -1; }
.side-tabs { display: none; }
.admin-trade { flex-wrap: wrap; }
@media (max-width: 700px) {
  .side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: sticky; top: 56px; z-index: 15; margin: 0 -16px 10px; padding: 6px 16px; background: var(--bg, #06060b); }
  .side-tabs [aria-selected='true'] { border-color: var(--cyan); color: var(--cyan); background: var(--panel-solid); }
  .trade-pick { display: block; }
  .trade-pick[data-show='offer'] [data-side='request'], .trade-pick[data-show='request'] [data-side='offer'] { display: none; }
  .trade-pick .panel { padding: 12px; }
  .trade-pick .panel h2 { display: none; }
  .trade-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .trade-filters :is(input:not([type="checkbox"]), select) { min-width: 0; width: 100%; }
  .trade-filters label.check { font-size: 0.85rem; grid-column: 1 / -1; }
  .trade-pick .mini-cards { --card-w: 100px; gap: 10px; }
  .trade-tray { bottom: 0; margin: 12px -16px 0; border-radius: 14px 14px 0 0; padding: 10px 12px; }
  .trade-tray .tray-sides { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; font-size: 0.85rem; }
  .trade-tray .chips { flex-wrap: nowrap; overflow-x: auto; max-height: none; margin-top: 4px; }
  .trade-tray .pick-chip { white-space: nowrap; }
  .trade-tray .row { margin-top: 8px !important; gap: 8px; flex-wrap: nowrap; }
  .trade-tray #tmsg { min-width: 0 !important; }
  body:has(.trade-tray) .bug-btn { display: none; } /* it would cover the Review button */
}

/* phones: denser cards, stats and tables, filters folded away */
.filters-toggle { display: none; }
.nowrap { white-space: nowrap; }
@media (max-width: 520px) {
  .card-grid, .card-grid.compact { --card-w: 100px; gap: 8px; }
  .card-grid.large { --card-w: 150px; gap: 10px; }
  .summary .card-grid { --card-w: 100px; }
  .summary { padding: 14px 10px; }
  .summary > .row:last-child { padding-top: 14px; gap: 8px; }
  .summary > .row:last-child .btn { padding: 8px 12px; font-size: 0.85rem; }
  .copies-grid { grid-template-columns: repeat(auto-fit, 140px); gap: 10px; } /* fixed width: the column count is worked out from the max, so a range would fit only one */
  .modal { padding: 16px; }
  .detail > .card { max-width: 170px; }
  .copy-actions .btn { white-space: nowrap; padding: 6px 8px; }
  .hscroll { --card-w: 120px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; }
  .stat b { font-size: 1.1rem; }
  .stat span { font-size: 0.7rem; }
  .panel { padding: 14px; }
  .section { margin-top: 20px; }
  th, td { padding: 6px; }
  table { font-size: 0.8rem; }
  .filters-toggle { display: inline-flex; }
  .hide-sm { display: none; }
  .collapsible:not(.open) :is(.field, .check, fieldset, [role='group']):not(.keep) { display: none; }
  .collapsible:not(.open) .row + .row { margin-top: 0 !important; }
}
/* tiny cards (3 per row on phones): name and rank only; creator/verifier are in the card popup */
@container (max-width: 120px) {
  .card-meta { display: none; }
  .card-top { padding: 5px 6px; }
  .tier-badge { padding: 1px 3px; letter-spacing: 0; font-size: 0.45rem; }
  .rank { font-size: 0.85rem; }
}
.stat-link { display: block; text-decoration: none; color: inherit; transition: border-color 0.2s; }
.stat-link:hover { border-color: var(--cyan); }
.stat .stat-new { font-size: 0.8rem; font-weight: 700; color: var(--ok); white-space: nowrap; }
.user-row { flex-wrap: wrap; }

/* invite bonus packs */
.bonus-chip { color: var(--ok); font-weight: 800; }
.bonus-count { font-size: 1rem; font-weight: 700; color: var(--ok); letter-spacing: 0; white-space: nowrap; }
.invite-card { display: grid; justify-items: center; gap: 8px; max-width: 230px; padding: 12px 16px; text-align: center; font-size: 0.85rem; border: 1px solid rgba(251, 191, 36, 0.4); border-radius: 12px; background: rgba(251, 191, 36, 0.08); }
.invite-card .btn { border-color: rgba(251, 191, 36, 0.6); color: var(--gold); }
.invite-card .btn:hover { background: rgba(251, 191, 36, 0.15); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--gold); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkish:hover { color: #fff; }

/* trade duplicate markers */
.own-tag { display: block; margin-top: 6px; text-align: center; font-size: 0.72rem; font-weight: 700; padding: 3px 6px; border-radius: 6px; border: 1px solid; line-height: 1.2; }
.own-tag.new { color: var(--ok); border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.1); }
.own-tag.dupe { color: var(--muted); border-color: var(--line); background: rgba(255, 255, 255, 0.04); }
.own-tag.spare { color: #93c5fd; border-color: rgba(147, 197, 253, 0.45); background: rgba(147, 197, 253, 0.08); }
.own-tag.last { color: var(--gold); border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); }

/* leaderboard rank on profiles */
.rank-badge { font-size: 0.95rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; text-decoration: none; color: #fff; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); letter-spacing: 0; }
.rank-badge:hover { border-color: var(--cyan); }
.rank-badge.r1 { color: #1a1204; background: linear-gradient(135deg, #fde68a, #f59e0b); border-color: #fbbf24; box-shadow: 0 0 16px rgba(251, 191, 36, 0.45); }
.rank-badge.r2 { color: #111; background: linear-gradient(135deg, #f1f5f9, #94a3b8); border-color: #cbd5e1; }
.rank-badge.r3 { color: #1a0c04; background: linear-gradient(135deg, #fdba74, #b45309); border-color: #f59e0b; }

/* announcement banner */
.announce { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 8px 16px; background: linear-gradient(90deg, rgba(239, 68, 68, 0.18), rgba(251, 191, 36, 0.18)); border-bottom: 1px solid rgba(251, 191, 36, 0.35); font-size: 0.9rem; text-align: center; }
.announce .icon-btn { width: 28px; height: 28px; flex: none; }
.flag-row { flex-direction: column; align-items: flex-start; gap: 6px; }
.flag-reasons { margin: 0; padding-left: 18px; color: var(--gold); }

/* badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); font: inherit; cursor: pointer; transition: transform 0.15s, background 0.2s, border-color 0.2s; }
.badge:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.16); }
.badge-ico { display: inline-flex; filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.55)); }
.badge-svg.holo { animation: holohue 6s linear infinite; }
.badge-name { font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.2; }
.badge.locked .badge-svg, .badge-detail.locked > .badge-stage .badge-svg { filter: grayscale(1) brightness(0.55); opacity: 0.55; animation: none; }
.badge.locked .badge-name { color: var(--muted); }
.badge-bar { width: 70%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.badge-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b); border-radius: 4px; }
.badge-detail { text-align: center; display: grid; justify-items: center; gap: 4px; padding-top: 8px; }
.badge-detail h2 { margin: 10px 0 0; }
.badge-detail .badge-stage { width: 120px; height: 120px; }
/* Pop-in grows the icon's real size inside a fixed stage instead of transform: scale, which browsers draw from a
   low-res snapshot until the animation ends. The SVG re-renders at every size, so it stays sharp. */
.badge-stage { display: grid; place-items: center; }
.badge-stage .badge-ico { width: 100%; height: 100%; animation: badgepop 0.6s ease-out var(--d, 0s) both; }
.badge-stage .badge-svg { width: 100%; height: 100%; }
@keyframes badgepop { from { width: 40%; height: 40%; rotate: -12deg; opacity: 0; } 60% { width: 108%; height: 108%; rotate: 3deg; opacity: 1; } to { width: 100%; height: 100%; rotate: 0deg; opacity: 1; } }
.new-badges { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 14px 0 4px; }
.new-badges .badge-stage { width: 64px; height: 64px; }
.new-badges .badge { animation: fadein 0.3s var(--d, 0s) both; background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.4); }
@media (max-width: 520px) { .badge-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; } .badge { padding: 10px 4px 8px; } }
.modal.narrow { width: min(380px, 100%); }
.badge-bar.wide { width: 60%; height: 6px; }
.tier-dots { display: flex; gap: 3px; }
.tier-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.tier-dots i.on { background: var(--gold); }
.badge-path { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); width: 100%; }
.badge-step { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; font-size: 0.62rem; line-height: 1.15; text-align: center; padding: 6px 2px; border-radius: 10px; border: 1px solid transparent;; background: none; color: var(--text); font-family: inherit; cursor: pointer; }
.badge-step:hover { background: rgba(255, 255, 255, 0.05); }
.badge-step.current { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); }
.badge-step.locked .badge-svg { filter: grayscale(1) brightness(0.55); opacity: 0.5; animation: none; }
.badge-step.locked span { color: var(--muted); }

/* admin paged lists */
.section-sm { margin-top: 12px; }
.admin-filter select, .admin-filter input { flex: 1 1 160px; min-width: 0; }
.audit-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.audit-row code { flex: 1 1 100%; color: var(--muted); word-break: break-all; }
.audit-action { color: var(--gold); font-weight: 600; }
