/* 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.94); 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: 1120px) { /* below this the full nav plus the header buttons no longer fit on one line */
  .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 */
/* no backdrop blur on panels or the header: redrawing it behind every panel on every scrolled frame made scrolling stutter */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.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; line-height: 1.2; 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: 1px solid transparent; 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; }
/* Lenis (eased wheel scrolling), from its lenis.css. autoToggle pauses it while html is overflow: hidden (modal-open). */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }
.lenis.lenis-autoToggle { transition-property: overflow; transition-duration: 1ms; transition-behavior: allow-discrete; }
.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; }
.lb li::before { content: attr(data-rank); 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); }
/* padding gives the card glow room inside the scroll box; the negative margin keeps the layout where it was, except
   below, where the scrollbar needs real space or it would sit on the next section */
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-w); gap: 14px; overflow-x: auto; padding: 32px 32px 26px; margin: -32px -32px -6px; scroll-padding-inline: 32px; scroll-snap-type: x mandatory; }
.hscroll > * { scroll-snap-align: start; }
/* A visible scrollbar so it's clear the row scrolls. Chrome and Safari draw these always-on (even on phones, which
   otherwise hide them until you scroll); the track is inset by the glow padding so it lines up with the cards. */
.hscroll::-webkit-scrollbar { height: 6px; }
.hscroll::-webkit-scrollbar-track { margin: 0 32px; border-radius: 3px; background: var(--line); }
.hscroll::-webkit-scrollbar-thumb { border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.hscroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.45); }
@supports not selector(::-webkit-scrollbar) { .hscroll { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.28) transparent; } }
.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; }
/* Top 3: a tinted background and outline in their medal color (gold, silver, bronze) */
.lb li.p1 { --medal: #fbbf24; } .lb li.p2 { --medal: #d1d5db; } .lb li.p3 { --medal: #d97706; }
.lb li.podium { border: 1px solid color-mix(in srgb, var(--medal) 55%, transparent); background: color-mix(in srgb, var(--medal) 10%, transparent); }
.lb li.podium + li { margin-top: 6px; }
/* Community rare pulls: each row tinted and outlined in the pull's rarity color */
.feed-row { border-color: color-mix(in srgb, var(--tc) 45%, transparent); background: color-mix(in srgb, var(--tc) 8%, transparent); }

/* ko-fi + favorite stars */
.kofi { border: 0; font-family: inherit; cursor: pointer; 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; }
/* The foil shine (--mx, animated on .pack) stays still on the packs behind: with a full stack, repainting all 10 bags
   every frame halved the home page's scroll frame rate. Only the front pack's shine moves. */
.pack .layer { --mx: 35%; }
.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 */
.card-wrap.pickable { cursor: pointer; }
.card-wrap[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.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; }
}

/* 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-svg.prism { animation: prismshine 5s linear infinite; }
@keyframes prismshine {
  0% { filter: hue-rotate(0deg) drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)); }
  50% { filter: hue-rotate(180deg) drop-shadow(0 0 8px rgba(255, 255, 255, 0.6)); }
  100% { filter: hue-rotate(360deg) drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)); }
}
.badge.final { border-color: transparent; background: linear-gradient(#15151f, #15151f) padding-box, linear-gradient(90deg, #ff8fa3, #ffd38f, #fff59e, #a6f7c9, #9fe3ff, #c3b6ff, #ffa6ec, #ff8fa3) border-box 0 0 / 200% 100%; animation: prismborder 4s linear infinite; }
.badge.final:hover { border-color: transparent; background: linear-gradient(#1c1c28, #1c1c28) padding-box, linear-gradient(90deg, #ff8fa3, #ffd38f, #fff59e, #a6f7c9, #9fe3ff, #c3b6ff, #ffa6ec, #ff8fa3) border-box 0 0 / 200% 100%; }
@keyframes prismborder { to { background-position: 0 0, 200% 0; } }
.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(88px, 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: 80px; 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; }

/* crafting */
.craft-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; gap: 12px; }
.craft-slot { aspect-ratio: 5 / 7; border-radius: 12px; border: 2px dashed var(--line); background: rgba(255, 255, 255, 0.02); padding: 0; font: inherit; color: inherit; }
.craft-slot.filled { border: 0; background: none; cursor: pointer; }
.craft-pick .mini-cards { --card-w: 120px; }
@media (max-width: 520px) {
  .craft-core { width: 150px; }
  .craft-slots { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .craft-pick .mini-cards { --card-w: 100px; gap: 10px; }
}
:where(.craft-core) { --tc: rgba(255, 255, 255, 0.6); --charge: 0; --ring: transparent, var(--tc), transparent 35%, var(--tc), transparent 70%, var(--tc); } /* zero specificity, so a .t-* tier class can set --tc */
.craft-core { position: relative; isolation: isolate; width: 190px; aspect-ratio: 5 / 7; margin: 0 auto 22px; display: grid; place-items: center;
  border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.18); background: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.05), transparent 70%), rgba(10, 10, 18, 0.6);
  transition: border-color 0.3s, box-shadow 0.4s; }
.craft-core::before { content: ''; position: absolute; inset: -14px; z-index: -1; border-radius: 24px; opacity: 0; transition: opacity 0.4s; filter: blur(16px);
  background: conic-gradient(from var(--ang, 0deg), var(--ring)); }
.craft-core-face { width: 100%; padding: 14px 12px; transition: opacity 0.25s; }
.craft-core-title { display: block; margin-bottom: 12px; text-align: center; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.craft-core-hint { display: block; text-align: center; font-size: 0.85rem; color: var(--muted); }
.craft-odd { margin-bottom: 12px; }
.craft-odd-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.craft-odd-top b { font-size: 1rem; }
.craft-bar { display: block; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.craft-bar i { display: block; height: 100%; border-radius: inherit; background: var(--tc); box-shadow: 0 0 10px var(--tc); transition: width 0.3s; }
/* charging: the glow ring grows with every card that lands, then the whole card shakes harder and harder */
.craft-core.charging { border: 2px solid color-mix(in srgb, var(--tc) 70%, transparent); box-shadow: 0 0 30px color-mix(in srgb, var(--tc) 45%, transparent), inset 0 0 40px color-mix(in srgb, var(--tc) 30%, transparent); }
.craft-core.charging::before { opacity: calc(0.2 + var(--charge) * 0.8); animation: spinang 1.6s linear infinite; }
.craft-core.charging .craft-core-face, .craft-core.flash .craft-core-face { opacity: 0; }
.craft-core[data-shake="1"] { animation: shake 0.4s infinite; }
.craft-core[data-shake="2"] { animation: shake 0.22s infinite; }
.craft-core[data-shake="3"] { animation: shake 0.1s infinite; box-shadow: 0 0 60px #fff, inset 0 0 50px rgba(255, 255, 255, 0.6); }
.craft-core[data-shake="2"]::before { animation-duration: 0.8s; inset: -20px; }
.craft-core[data-shake="3"]::before { animation-duration: 0.4s; inset: -30px; }
.craft-core.hush { animation: none; box-shadow: 0 0 80px #fff, inset 0 0 60px rgba(255, 255, 255, 0.8); }
.craft-core.hush::before { animation-play-state: paused; opacity: 1; inset: -34px; }
.craft-spark { position: absolute; left: 50%; top: 50%; z-index: 2; width: 4px; height: 4px; margin: -2px; border-radius: 50%; pointer-events: none; }
.craft-slots.firing { display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(5 * 120px + 4 * 12px); margin: 0 auto; } /* 5 per row at most */
.craft-slots.firing .craft-slot { width: 120px; }
.craft-veil { position: fixed; inset: 0; z-index: 90; background: radial-gradient(circle, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.88) 70%); animation: craftveil 0.8s ease both; transition: opacity 0.7s; }
.craft-veil.out { opacity: 0; }
@keyframes craftveil { from { opacity: 0; } }
main.craft-focus .craft-bench { position: relative; z-index: 91; background: transparent; border-color: transparent; backdrop-filter: none; }
main.craft-focus .craft-bench > .row { visibility: hidden; }
.craft-core.flash { border: 2px solid #fff; }
.craft-core.flash::after { content: ''; position: absolute; inset: -60px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, 0.8) 30%, transparent 65%); animation: craftflash 0.45s ease-out forwards; pointer-events: none; }
@keyframes craftflash { from { opacity: 0; transform: scale(0.3); } 35% { opacity: 1; } to { opacity: 0; transform: scale(1.8); } }
.craft-core.done { border-color: transparent; background: none; }
.craft-core.done .craft-core-face { padding: 0; }
.craft-core.reveal::before { opacity: 0.7; animation: spinang 4s linear infinite, craftfade 3s ease-out forwards; }
@keyframes craftfade { 0%, 40% { opacity: 0.9; } to { opacity: 0.25; } }
.craft-core.reveal:is(.t-epic, .t-legendary, .t-mythic)::after { content: ''; position: absolute; inset: -70px; z-index: -2; pointer-events: none; animation: spinang 14s linear infinite, raysin 0.8s ease-out both;
  background: repeating-conic-gradient(from var(--ang, 0deg), color-mix(in srgb, var(--tc) 40%, transparent) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%); }
@keyframes raysin { from { opacity: 0; scale: 0.4; } }
.craft-result { animation: craftreveal 0.7s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes craftreveal { from { opacity: 0; transform: perspective(600px) rotateY(100deg) scale(0.4); filter: brightness(4); } to { opacity: 1; transform: none; filter: none; } }
.craft-slot.craft-burn .card { animation: shake 0.26s 1; box-shadow: 0 0 26px var(--tc), 0 0 0 2px var(--tc); }
.craft-dust { position: fixed; z-index: 200; margin: -3px 0 0 -3px; border-radius: 50%; pointer-events: none; }
main.crafting .craft-pick { opacity: 0.5; pointer-events: none; transition: opacity 0.3s; }
@media (max-width: 520px) { .craft-slots.firing .craft-slot { width: calc((100% - 24px) / 5); } }

/* direct messages: chat button bottom right, panel above it (full screen on phones) */
.toasts { bottom: 80px; }
.dm-btn { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #f87171, #fbbf24); color: #1a0c04; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); transition: transform 0.15s; }
.dm-btn:hover { transform: translateY(-2px); }
.dm-btn .dot { position: absolute; top: -2px; right: -2px; background: var(--magenta); color: #fff; font-size: 0.7rem; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; padding: 0 4px; }
.dm-panel { position: fixed; right: 16px; bottom: 80px; z-index: 45; width: min(360px, calc(100vw - 32px)); height: min(520px, calc(100vh - 160px)); display: flex; flex-direction: column;
  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.18s ease-out; overflow: hidden; }
.dm-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dm-head > :last-child { margin-left: auto; }
.dm-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-body { flex: 1; overflow-y: auto; padding: 8px; }
.dm-convo { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dm-convo:hover { background: rgba(255, 255, 255, 0.05); }
.dm-convo.unread b { color: #fbbf24; }
.dm-convo-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dm-convo-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-thread { display: flex; flex-direction: column; gap: 6px; }
.dm-msg { max-width: 80%; align-self: flex-start; }
.dm-msg p { margin: 0; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-msg.mine { align-self: flex-end; text-align: right; }
.dm-msg.mine p { border-radius: 14px 14px 4px 14px; background: linear-gradient(135deg, #f87171, #fbbf24); color: #1a0c04; text-align: left; }
.dm-msg p.deleted { font-style: italic; color: var(--muted); background: none; border: 1px dashed var(--line); }
.dm-meta { display: inline-flex; gap: 6px; align-items: center; font-size: 0.68rem; color: var(--muted); padding: 0 6px; }
.dm-meta button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; opacity: 0; transition: opacity 0.15s; }
.dm-msg:hover .dm-meta button, .dm-meta button:focus-visible { opacity: 1; }
@media (hover: none) { .dm-meta button { opacity: 0.85; padding: 8px 6px; margin: -8px -2px; font-size: 0.78rem; } } /* bigger tap targets, same layout */
.dm-msg.editing p { outline: 2px solid #fbbf24; outline-offset: 2px; }
.profile-head { position: relative; z-index: 5; }
.dm-form { padding: 10px; border-top: 1px solid var(--line); }
.dm-form .row { gap: 8px; align-items: flex-end; flex-wrap: nowrap; }
.dm-form textarea { flex: 1; resize: none; min-width: 0; }
.dm-editing { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: #fbbf24; margin-bottom: 6px; }
.dm-editing[hidden] { display: none; }
.report-context { margin-top: 6px; }
.report-context p { margin: 4px 0; padding: 4px 8px; border-radius: 6px; }
.report-context p.reported { background: rgba(248, 113, 113, 0.15); }
.menu .menu-bug { display: none; }
/* The trade tray sits at the bottom edge, where the floating button would cover its message field or Review button
   (phones and tablets alike): there, Report a bug moves into the user menu. */
body:has(.trade-tray) .bug-btn { display: none; }
body:has(.trade-tray) .menu .menu-bug { display: block; }
.profile-head.other { padding-right: 64px; }
.profile-head > .row:last-child { align-self: flex-end; } /* buttons sit on the bottom edge (next to the friend icon on other profiles) */
.profile-head:not(.other) > .row:last-child { margin-left: auto; } /* stays on the right even when it wraps under the name on phones */
.more-wrap { position: absolute; top: 10px; right: 10px; }
.more-wrap .dropdown { right: 0; top: calc(100% + 4px); z-index: 30; }
.more-btn { background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.more-btn:hover, .more-btn[aria-expanded='true'] { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.friend-icon { position: absolute; right: 14px; bottom: 17px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--muted); transition: background 0.15s, color 0.15s, border-color 0.15s; }
.friend-icon:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.friend-icon.outgoing, .friend-icon.incoming { color: #fbbf24; border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.12); }
.friend-icon.incoming { animation: friendpulse 1.6s ease-in-out infinite; }
.friend-icon.friends { color: var(--ok); border-color: rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.12); }
@keyframes friendpulse { 50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.15); } }
.pick-copy.unusable { cursor: not-allowed; }
.pick-copy.unusable .card { filter: grayscale(1) brightness(0.55); }
.menu .danger-item { color: var(--danger); }
@media (max-width: 700px) {
  .bug-btn { display: none; }
  .menu .menu-bug { display: block; }
  .dm-btn { width: 46px; height: 46px; right: 12px; bottom: 12px; }
  body:has(.trade-tray) .dm-btn { display: none; }
  .dm-panel { inset: 0; width: auto; height: auto; border-radius: 0; z-index: 150; }
}
/* Supporter badge: given by the owner to Ko-fi donators */
.supporter-badge { display: inline-grid; place-items: center; flex: none; width: 21px; height: 21px; border-radius: 50%; color: #fff; background: #ec4899; box-shadow: 0 0 8px rgba(236, 72, 153, 0.5); vertical-align: middle; }
.supporter-badge svg { display: block; width: 62%; height: 62%; }
.role-badge + .supporter-badge { margin-left: 4px; }
.supporter-badge:not(.lg) { cursor: pointer; }
h1 .supporter-badge { width: 32px; height: 32px; box-shadow: 0 0 12px rgba(236, 72, 153, 0.5); }
h2 .supporter-badge { width: 26px; height: 26px; }
.supporter-badge.lg { width: 56px; height: 56px; box-shadow: 0 0 22px rgba(236, 72, 153, 0.55); }
.support-pop { width: min(300px, calc(100vw - 32px)); padding: 16px; text-align: center; }
.support-pop p { margin: 10px 0; }
.support-show { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 4px; }
.support-pop .kofi { justify-content: center; margin-top: 6px; padding: 9px 16px; }
.support-pop .kofi span { display: inline; }

/* ---------- profile customization ---------- */
.uname { color: var(--nc); }
.uname.glow { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--nc) 75%, transparent)) drop-shadow(0 0 10px color-mix(in srgb, var(--nc2) 45%, transparent)); }
.lb .uname { font-weight: 700; } /* thicker on the leaderboard so name colors read at a glance */
.cz-preview .profile-banner.is-level { cursor: grab; touch-action: none; }
.cz-preview .profile-banner.is-level:active { cursor: grabbing; }
.uname.grad { background: linear-gradient(90deg, var(--nc), var(--nc2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Theme color: accents on the profile page only */
.profile-page { --pc: #fbbf24; }
.profile-page .profile-head { border-color: color-mix(in srgb, var(--pc) 40%, var(--line)); box-shadow: 0 10px 40px -18px color-mix(in srgb, var(--pc) 55%, transparent); }
.profile-page .section > h2 { color: color-mix(in srgb, var(--pc) 65%, #fff); }
.profile-page .bar i { background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 55%, #fff), var(--pc)); }
.profile-page .rank-badge:not(.r1):not(.r2):not(.r3) { border-color: color-mix(in srgb, var(--pc) 55%, transparent); }
/* Banner: full width across the top of the profile card; the avatar overlaps its bottom edge. A fixed 5:1 shape (not a fixed
   height), so a level thumbnail's saved crop shows the same part of the image at every screen width, and in the editor preview. */
.profile-banner { position: relative; flex: 0 0 calc(100% + 36px); aspect-ratio: 5 / 1; margin: -18px -18px -6px; border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; background-size: cover; background-position: center; }
.profile-head.other .profile-banner { flex-basis: calc(100% + 82px); margin-right: -64px; }
/* Avatar overlapping the banner, with the leaderboard rank on a plate in the space under it */
.profile-side { position: relative; z-index: 1; margin-top: -56px; align-self: flex-start; display: grid; justify-items: center; gap: 10px; }
.profile-side .avatar.lg { box-shadow: 0 0 0 4px var(--panel-solid); background: var(--panel-solid); }
.rank-plate { --medal: #9ca3af; width: 84px; display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; border-radius: 12px; text-decoration: none; line-height: 1.1;
  color: color-mix(in srgb, var(--medal) 80%, #fff); border: 1px solid color-mix(in srgb, var(--medal) 50%, transparent); background: color-mix(in srgb, var(--medal) 9%, rgba(255, 255, 255, 0.02)); transition: border-color 0.15s, background 0.15s; }
.rank-plate:hover { border-color: var(--medal); background: color-mix(in srgb, var(--medal) 15%, rgba(255, 255, 255, 0.02)); }
.rank-plate b { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.rank-plate span { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
/* Top 3 in medal colors, the same as their leaderboard rows; everyone else plain, so the medals stand out */
.rank-plate:not(.r1, .r2, .r3) { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, 0.03); }
.rank-plate.r1 { --medal: #fbbf24; } .rank-plate.r2 { --medal: #d1d5db; } .rank-plate.r3 { --medal: #d97706; }
.banner-tag { position: absolute; right: 10px; bottom: 8px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; }
.profile-head .more-btn { background: rgba(0, 0, 0, 0.45); color: #fff; }
.banner-tag.joined { right: auto; bottom: auto; left: 10px; top: 8px; font-weight: 500; color: rgba(255, 255, 255, 0.85); } /* the corner the ⋯ menu doesn't use */
.profile-bio { margin: 6px 0 0; font-size: 1rem; line-height: 1.5; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.profile-bio.muted { color: var(--muted); }
@media (max-width: 520px) { .profile-side { margin-top: -44px; } }
/* Editor */
.modal.customize { width: min(760px, 100%); }
.cz-preview { position: relative; padding: 14px; border-radius: var(--radius); background: var(--bg); border: 1px dashed var(--line); }
.cz-preview .profile-head { margin: 0; }
/* Pinned while the controls scroll, so changes (and the banner crop drag) stay in view; only where there's room for it */
@media (min-height: 760px) { .cz-preview { position: sticky; top: 0; z-index: 8; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.8); } }
.cz-label { position: absolute; top: -9px; left: 14px; z-index: 6; padding: 0 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--panel-solid); }
.cz-names { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin-top: 18px; }
.cz-grid h3 { margin: 0 0 2px; font-size: 1rem; }
.cz-grid p { margin: 0 0 10px; }
.cz-wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .cz-grid { grid-template-columns: 1fr; } }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--sw); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.swatch[aria-checked='true'], .swatch.custom.on { border-color: #fff; box-shadow: 0 0 0 2px var(--panel-solid), 0 0 12px var(--sw); }
.swatch.none { background: transparent; border-color: var(--line); font-size: 0.8rem; }
.swatch.none[aria-checked='true'] { border-color: #fff; }
.swatch.custom { background: conic-gradient(#f87171, #fbbf24, #4ade80, #38bdf8, #c084fc, #f87171); color: #fff; text-shadow: 0 1px 3px #000; }
.swatch.custom.on { background: var(--sw); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.cz-perk { margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px solid rgba(236, 72, 153, 0.35); background: rgba(236, 72, 153, 0.07); display: grid; gap: 8px; }
.cz-perk.locked { opacity: 0.75; }
.cz-perk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cz-perk input[type='color'], .color-field input { width: 38px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; vertical-align: middle; }
.color-field { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.angle-pick { gap: 4px; }
.angle-pick .btn[aria-checked='true'] { border-color: var(--cyan); color: var(--cyan); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset { width: 56px; height: 30px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.cz-search { width: 100%; margin-bottom: 10px; }
.cz-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.cz-level:disabled { cursor: not-allowed; opacity: 0.45; }
.cz-nothumb { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 5px; background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 0.7rem; }
#czLevelsPager .pager { margin-top: 10px; }
.cz-level { display: grid; gap: 4px; padding: 4px; border-radius: 8px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.04); cursor: pointer; color: var(--text); text-align: left; font-size: 0.75rem; }
.cz-level img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; }
.cz-level span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-level[aria-pressed='true'] { border-color: var(--cyan); }
/* Save stays in reach while the controls scroll */
.cz-actions { position: sticky; bottom: -18px; z-index: 7; margin: 18px -18px -18px; padding: 12px 18px; background: var(--panel-solid); border-top: 1px solid var(--line); }

/* ---------- clans ---------- */
.clan-tag { font-weight: 800; color: #fbbf24; text-decoration: none; letter-spacing: 0.02em; white-space: nowrap; }
.clan-tag, .clan-tag:hover { text-decoration: none; }
.clan-tag:hover { color: #fde68a; text-shadow: 0 0 10px rgba(251, 191, 36, 0.45); }
.clan-tag.big { font-size: 0.9em; }
.clan-row { gap: 8px; text-decoration: none; color: var(--text); }
.clan-row .uname { font-weight: 700; }
.clan-panel { margin-bottom: 14px; display: grid; gap: 10px; }
.clan-invite { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }
.clan-preview { font-size: 1.2rem; margin-bottom: 14px; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--line); }
.clan-member { flex-wrap: wrap; }
/* Clan titles: quieter than the site role badges (outline, no fill, no caps) */
.clan-role { display: inline-flex; align-items: center; font-size: 0.7rem; font-weight: 600; line-height: 1.4; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.clan-role.leader { color: #fcd34d; border-color: rgba(251, 191, 36, 0.4); }
.clan-role.co { color: color-mix(in srgb, #fcd34d 60%, var(--muted)); border-color: rgba(251, 191, 36, 0.22); }
.clan-actions { gap: 6px; }

/* ---------- username autocomplete ---------- */
.suggest-wrap { position: relative; display: block; }
.suggest-wrap > input { width: 100%; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; max-height: 280px; overflow-y: auto; padding: 4px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55); }
.suggest-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.suggest-item .avatar { width: 28px; height: 28px; border-radius: 7px; }
.suggest-item:hover, .suggest-item.active { background: rgba(255, 255, 255, 0.07); }
.suggest-empty { padding: 8px 10px; color: var(--muted); font-size: 0.85rem; }
/* The open dropdown's panel sits above the panels after it (they'd otherwise paint over the dropdown) */
.panel:has(> * .suggest:not([hidden])), .panel:has(.suggest:not([hidden])) { position: relative; z-index: 20; }
/* Apex pulls: a moving rainbow outline over a rainbow-tinted background, and rainbow text for the tier, so they stand out */
.feed-row.t-apex {
  --rainbow: linear-gradient(90deg, #f43f5e, #f59e0b, #facc15, #22c55e, #22d3ee, #6366f1, #a855f7, #f43f5e);
  border-color: transparent;
  background: linear-gradient(rgba(14, 14, 20, 0.8), rgba(14, 14, 20, 0.8)) padding-box, var(--rainbow) border-box;
  background-size: 100% 100%, 200% 100%;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.3);
  animation: apexslide 4s linear infinite;
}
.feed-row.t-apex > span:first-child { background: var(--rainbow); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; animation: apextext 4s linear infinite; }
@keyframes apexslide { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 200% 0; } }
@keyframes apextext { from { background-position: 0 0; } to { background-position: 200% 0; } }
.join-chip { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; color: #86efac; border: 1px solid rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.08); white-space: nowrap; }
.join-chip.closed { color: var(--muted); border-color: var(--line); background: rgba(255, 255, 255, 0.03); }
h1 .join-chip { font-size: 0.7rem; vertical-align: middle; }
.join-mode { border: 0; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.join-mode legend { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.join-mode .check { align-items: flex-start; }
.invite-dot { margin-left: 6px; min-width: 16px; height: 16px; font-size: 0.65rem; font-weight: 700; vertical-align: 1px; box-shadow: 0 0 8px rgba(239, 68, 68, 0.55); }
.icon-btn .dot.invite-menu-dot { background: #ef4444; } /* same red as the Clans badge it stands in for */

/* ---------- skeleton loading ---------- */
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.045) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.045) 75%) 0 0 / 200% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { from { background-position: 150% 0; } to { background-position: -50% 0; } }
html.reduce-motion .skel { animation: none; }
@media (prefers-reduced-motion: reduce) { html:not(.motion-on) .skel { animation: none; } }
.skel-wrap { animation: fadein 0.3s 0.15s both; } /* fast loads never flash a skeleton */
.skel-line { height: 12px; margin: 8px 0; }
.skel-line.skel-big { height: 18px; margin-bottom: 14px; }
.skel-line.skel-name { height: 30px; margin: 4px 0 12px; border-radius: 8px; }
.skel-title { height: 34px; margin: 8px 0 20px; border-radius: 8px; }
.skel-end { margin-left: auto !important; }
.skel-card { aspect-ratio: 5 / 7; border-radius: 12px; }
.skel-avatar { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.skel-avatar-lg { width: 84px; height: 84px; border-radius: 18px; box-shadow: 0 0 0 4px var(--panel-solid); }
.skel-plate { width: 84px; height: 46px; border-radius: 12px; }
.skel-badge { aspect-ratio: 1; border-radius: 14px; }
.skel-bar { height: 8px; border-radius: 4px; margin: 12px 0; }
.skel-input { height: 42px; border-radius: 10px; }
.skel-thumb { width: 96px; aspect-ratio: 16 / 9; border-radius: 6px; flex: none; }
.skel-banner.profile-banner { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.skel-row { display: flex; align-items: center; gap: 12px; }
.skel-row .skel-line { margin: 0; }
.index-skel { padding: 10px 6px; }
.index-skel + .index-skel { border-top: 1px solid var(--line); }
.lb li .skel-line { margin: 0; }
/* Name next to the avatar even on phones: 200px min only applies where there's room for it */
.profile-id { flex: 1; min-width: 200px; }
@media (max-width: 520px) { .profile-id { min-width: 0; } .profile-id h1 { overflow-wrap: anywhere; } }
/* Leaderboard rows stay on one line; long names truncate instead of wrapping */
.lb li .row { flex-wrap: nowrap; min-width: 0; }
.lb li .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb li > b { flex: none; white-space: nowrap; }
@media (max-width: 520px) { .lb li { gap: 8px; } .lb li .row { column-gap: 6px !important; } }
.lb li .row > a:first-child { flex: none; } /* the avatar link: never squished by a long name */
@media (max-width: 520px) {
  /* Players: the level count drops to a second row under the name, so the name keeps the full width */
  .lb ol.players li { flex-wrap: wrap; row-gap: 2px; }
  .lb ol.players li > :first-child { flex: 1 1 0; }
  .lb ol.players li > b { flex: 1 0 100%; box-sizing: border-box; padding-left: 82px; font-size: 0.9rem; white-space: normal; } /* 82px: rank + avatar + gaps; the (xx% HOLO) part wraps whole onto its own line when narrow */
  /* Clans: tag and name on top; member count, Open chip and score on a second row. The link box is dropped (display: contents,
     still clickable) so its parts and the score, which sits outside it, share one grid. */
  .lb li:has(> .clan-row) { display: grid; grid-template-columns: 28px auto minmax(0, 1fr) auto; gap: 2px 6px; }
  .lb .clan-row { display: contents; }
  .lb .clan-row .uname { grid-column: 3 / -1; }
  .lb .clan-row .clan-meta { grid-column: 2 / 4; }
  .lb li:has(> .clan-row) > b { margin-left: 0 !important; font-size: 0.9rem; } /* !important: beats the inline auto margin */
}
.owners-list { max-height: min(60vh, 520px); overflow-y: auto; }
/* Index: the verifier and publisher columns go first when space runs out; below 700px each level becomes a compact card
   (thumbnail left, rank + name, rarity and owned under it, Owners on the right) instead of a table wider than the screen */
.idx-table .idx-own { white-space: nowrap; }
@media (max-width: 960px) { .idx-table .hide-md { display: none; } }
@media (max-width: 700px) {
  .idx-table thead { display: none; }
  .idx-table, .idx-table tbody { display: block; }
  .idx-table tr { display: grid; grid-template-columns: 72px auto minmax(0, 1fr) auto; grid-template-areas: 'thumb rank name act' 'thumb tier tier act' 'thumb own own act';
    column-gap: 8px; row-gap: 2px; align-items: center; padding: 8px 0; }
  .idx-table tr + tr { border-top: 1px solid var(--line); }
  .idx-table td { padding: 0; border: 0; }
  .idx-table .idx-thumb { grid-area: thumb; } .idx-table .idx-thumb .level-thumb { width: 72px; }
  .idx-table .idx-rank { grid-area: rank; } .idx-table .idx-name { grid-area: name; overflow-wrap: anywhere; }
  .idx-table .idx-tier { grid-area: tier; font-size: 0.8rem; } .idx-table .idx-own { grid-area: own; font-size: 0.8rem; }
  .idx-table .idx-act { grid-area: act; }
}
@media (max-width: 400px) { /* thumbnails would be too small to make out by now: drop them */
  .idx-table .idx-thumb { display: none; }
  .idx-table tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'rank name act' 'tier tier act' 'own own act'; }
}
.craft-skip { position: fixed; top: 16px; right: 16px; z-index: 95; } /* above the veil, like the pack opening's Skip */
/* Maintenance page (public/maintenance.html) */
.maintenance { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 24px 16px; max-width: 560px; margin: 0 auto; }
.maintenance img { filter: drop-shadow(0 0 24px rgba(248, 113, 113, 0.35)); margin-bottom: 8px; }
.maintenance p { margin: 0; }
.lb-holo { font-weight: 600; font-size: 0.8em; white-space: nowrap; background: linear-gradient(90deg, #f0abfc, #67e8f9, #fde68a); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* ---------- duels (tester prototype) ---------- */
.duel-bar { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin: 12px 0; padding: 12px 16px; }
.duel-bar .neg { color: var(--danger); }
.duel-outcome { font-size: 1.2rem; } .duel-outcome.won { color: var(--ok); } .duel-outcome.lost { color: var(--danger); }
.duel-zones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.duel-zone { display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 320px; transition: border-color 0.15s, box-shadow 0.15s; }
.duel-zone header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.duel-zone.targetable { cursor: pointer; border-color: rgba(251, 191, 36, 0.6); box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35) inset; }
.duel-zone.cap-you { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.duel-zone.cap-them { border-color: color-mix(in srgb, var(--danger) 60%, transparent); opacity: 0.8; }
.duel-side { display: flex; flex-wrap: wrap; gap: 6px; min-height: 92px; align-content: flex-start; }
.duel-side.theirs { align-content: flex-end; }
.duel-score { display: grid; grid-template-columns: 2ch 1fr 2ch; gap: 8px; align-items: center; font-weight: 800; }
.duel-score .you { color: var(--ok); } .duel-score .them { color: var(--danger); text-align: right; }
.duel-score .track { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.duel-score .track i { position: absolute; top: 0; bottom: 0; } .duel-score .track i.you { left: 0; background: var(--ok); } .duel-score .track i.them { right: 0; background: var(--danger); }
.duel-hand { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.duel-card { width: 112px; padding: 6px 7px; border-radius: 9px; background: color-mix(in srgb, var(--tc) 10%, var(--panel-solid)); border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; line-height: 1.2; user-select: none; }
.duel-card .dc-top { display: flex; justify-content: space-between; align-items: center; }
.duel-card .dc-cost { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1e3a8a; color: #bfdbfe; font-weight: 800; }
.duel-card .dc-power { font-size: 1.05rem; font-weight: 800; color: var(--tc); }
.duel-card .dc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-card .dc-ability { color: #fde68a; font-weight: 600; }
.duel-card .dc-loaner { color: var(--muted); font-style: italic; }
.duel-hand .duel-card[data-pick] { cursor: pointer; transition: transform 0.12s; }
.duel-hand .duel-card[data-pick]:hover { transform: translateY(-2px); }
.duel-card.selected { outline: 2px solid #fbbf24; transform: translateY(-3px); }
.duel-card.too-costly { opacity: 0.45; }
.duel-card.staged { border-style: dashed; cursor: pointer; opacity: 0.85; }
.duel-style { font-size: 0.68rem; font-weight: 700; } .st-precision { color: #67e8f9; } .st-endurance { color: #fb923c; } .st-memory { color: #c084fc; }
.duel-log + .duel-log { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.duel-log ul { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 700px) {
  .duel-zones { grid-template-columns: 1fr; }
  .duel-zone { min-height: 0; }
  .duel-side { min-height: 0; }
  .duel-card { width: calc(50% - 3px); }
  .duel-hand .duel-card { width: calc(33.33% - 6px); min-width: 96px; }
}
