/* 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; }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/exo-2-latin.woff2') format('woff2'); }
: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: #fbbf24; --t-mythic: #f43f5e; --t-apex: #ffffff; --t-limited: #2dd4bf; --obsidian: #07090d;
  --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; }
html { overflow-x: clip; } /* mobile browsers pan the page sideways when something pokes out, even with body overflow-x: hidden; clip keeps sticky elements working */
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--body); overflow-x: hidden; overflow-x: clip; -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: 1460px) { /* below this the full nav (with Duels and its Beta tag) plus the header buttons (Discord, Support) no longer fit on one line: ~1445px */
  .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%; }
}

body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; } /* footer's margin-top: auto keeps it at the bottom. main can't just grow, a page load has 2 mains */
main:focus, #rulesModal h1:focus { outline: none; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 16px 80px; }
footer.site { margin-top: auto; text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 16px 84px; border-top: 1px solid var(--line); } /* bottom room: the chat button (fixed, bottom right) covered the Rules link */

/* 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; }
/* iPhones zoom in on any field under 16px when it's focused and don't zoom back out */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
option, optgroup { background: var(--panel-solid); color: var(--text); }
option:checked { background: color-mix(in srgb, var(--cyan) 25%, var(--panel-solid)); }
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; }
.pager:has(+ :is(.panel, [data-resize])) { margin: 0 0 12px; } /* the copy above a list */
.pager-jump { width: 4.5em; min-height: 32px; padding: 4px 8px; text-align: center; }
.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; }
.duel-foe { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }

/* 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; }
.t-limited { --tc: var(--t-limited); }
.tier-text.t-limited { background: linear-gradient(90deg, var(--t-limited), #3b4a55, var(--t-limited)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 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; transition: transform 0.25s ease, box-shadow 0.25s; --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%; }
/* 3D only while a card is tilted (the pointer sets --rx): a 3D transform on every card made each one, and its inner
   parts, a separate GPU layer, hundreds on a page, enough to crash phones when opening 10 packs */
.card[style*='--rx'] { transform: perspective(800px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)); }
.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 .spike-art { width: 100%; height: 100%; 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; overflow-wrap: anywhere; } /* one long word (SUPERHATEMEWORLD) breaks instead of being cut off */
.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:not(.holo):not(:hover) .glare { display: none; } /* an invisible glare still cost each card a GPU layer */
.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%;
  /* the 220% stripe tile, kept within 0-100% so its repeated edge never shows */
  background-position: center, clamp(0%, var(--fx, var(--mx)), 100%) clamp(0%, var(--fy, var(--my)), 100%);
  background-repeat: no-repeat;
  /* no animation of its own: the colours shift only with the light (pointer, 3D turn), so it reacts to movement */
  mix-blend-mode: color-dodge; opacity: 0.45; filter: hue-rotate(var(--hue, 0deg));
}
.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.08) 6px 7px); mix-blend-mode: overlay; }
@keyframes holohue { to { filter: hue-rotate(360deg); } }
/* phones: the hue cycle repaints every holo card every frame, which heats and slows them down; the shine stays */
@media (pointer: coarse) { .card.holo .foil { animation: none; } }
.card.holo .glare { opacity: 0.8; }
/* In a grid a holo card only animates under the pointer: a screen full of animating holos lagged even fast machines. */
.card-grid .card:not(:hover) :is(.foil, .holo-badge, .sparkle) { animation: none; }
.card-grid .card:not(:hover) .sparkle { opacity: 0.6; }
.card-grid .card:not(:hover) .glare { display: none; }
.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-limited:not(.holo) { background: linear-gradient(150deg, var(--t-limited) 0%, var(--obsidian) 35%, #1b2a30 55%, var(--obsidian) 75%, var(--t-limited) 100%); }
.card.t-limited .card-inner { background:
  radial-gradient(90% 35% at 50% 105%, rgba(45, 212, 191, 0.18), transparent 70%),
  linear-gradient(125deg, transparent 30%, rgba(45, 212, 191, 0.10) 38%, transparent 46%, transparent 62%, rgba(45, 212, 191, 0.06) 68%, transparent 74%),
  linear-gradient(200deg, #1a2328 0%, var(--obsidian) 40%, #0d1418 70%, #02030a 100%); }
.card.t-limited .tier-badge { background: var(--obsidian); }
.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); } }

/* ---------- printed look ----------
   Cards read as printed card stock: a solid frame in the rarity's ink, dark ink instead of black, paper grain. */
:root { --card-corner: 4.6% / 3.3%; }
.card { padding: 3.6%; border-radius: var(--card-corner);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 78%, #3a3430), color-mix(in srgb, var(--tc) 58%, #1d1a18));
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.35), 0 10px 18px -6px rgba(0, 0, 0, 0.5); }
.card.t-legendary { background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 90%, #3a3430), color-mix(in srgb, var(--tc) 74%, #1d1a18)); } /* yellow ink: the dark mix above turned it brown */
.card:hover { box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5), 0 8px 14px rgba(0, 0, 0, 0.35), 0 22px 30px -10px rgba(0, 0, 0, 0.6); }
.card.t-mythic, .card.t-apex { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.35), 0 10px 18px -6px rgba(0, 0, 0, 0.5); }
/* in grids the contact shadow is unblurred (a blurred one was ~40% of a grid's raster time); a card on its own keeps the blur */
.card-grid .card, .card-grid .card:hover { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 3px 0 -1px rgba(0, 0, 0, 0.35), 0 5px 0 -3px rgba(0, 0, 0, 0.2); }
/* keyline: the thin printed line where the frame meets the art */
.card-inner { border-radius: 3% / 2.2%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 0 2px color-mix(in srgb, var(--tc) 40%, rgba(255, 255, 255, 0.25));
  background: radial-gradient(120% 60% at 50% 115%, color-mix(in srgb, var(--tc) 16%, transparent), transparent 70%), linear-gradient(180deg, #23212a, #17161c); }
/* the gloss coat over the printed face */
.card-inner::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, 0.022)); }
/* paper over the whole card: fine grain and mottling, mostly dark. No blend modes (they cost a layer per card). */
:root { --paper: url("/paper-grain.png"), url("/paper-mottle.png"); } /* pre-rendered grain tiles: as SVG filters the grain was redrawn per card */
.card::after, .card-back::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--paper); }
/* printed text: off-white ink with slightly soft edges (ink spreads into paper), no digital drop shadow */
.card .rank, .card.t-apex .rank, .card .card-name { color: #efe9dd; text-shadow: 0 0 0.6px rgba(239, 233, 221, 0.7); }
.card .card-meta, .card .card-foot { text-shadow: 0 0 0.5px currentColor; }
.card .tier-badge { text-shadow: 0 0 0.4px rgba(23, 19, 15, 0.8); }
.tier-badge { background: color-mix(in srgb, var(--tc) 82%, #2a2420); color: #17130f; border: 0; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); }
.card.t-limited .tier-badge { background: var(--t-limited); }
.card-name { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
.card-meta, .card-foot { color: color-mix(in srgb, var(--muted) 80%, #c9c2b5); }
/* the picture is a window printed into the card: a dark rule and a slight shade at the top edge */
.thumb { border: 0; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 0 2px color-mix(in srgb, var(--tc) 30%, rgba(255, 255, 255, 0.15)); }
.thumb { margin-top: 2px; } /* the picture's 2px ring sits outside its box: without this the top row looks squeezed toward it */
.thumb::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle, rgba(0, 0, 0, 0.13) 0 30%, transparent 40%) 0 0 / 2px 2px, radial-gradient(circle, rgba(255, 255, 255, 0.04) 0 26%, transparent 36%) 1px 1px / 2px 2px; }
.thumb img { filter: saturate(0.88) contrast(0.93) brightness(1.03) sepia(0.06); }
.thumb .ph { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6); }
/* foil frames: static metallic gradients; the shine is the glare, which follows the pointer (or the 3D viewer's light) */
.card.holo { animation: none; }
.card.holo { padding: 3.6%; background: linear-gradient(135deg, #d9c2e6, #b9e3ea 22%, #ece0b0 42%, #bfe6c9 60%, #c5c4ea 80%, #e2c3dc); }
/* Apex keeps its spinning rainbow border as a holo too (the holo shows in the foil over the card) */
.card.t-apex.holo { background: conic-gradient(from var(--ang, 0deg), #f43f5e, #f59e0b, #22c55e, #22d3ee, #a855f7, #f43f5e); animation: spinang 3s linear infinite; }
.card .sparkle { display: none; }

/* ---------- 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;
  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: brightness(1.06); scale: 1.03; animation: packbob 4s ease-in-out infinite; }
/* The pack's shadow is a gradient behind it, not filter: drop-shadow, which re-blurred the pack and its fan every frame. */
.pack::before { content: ''; position: absolute; inset: 3% -9% -9%; z-index: -10; pointer-events: none; transition: opacity 0.3s, translate 0.3s;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.35) 60%, transparent); translate: 0 12px; opacity: 0.9; }
.pack:hover:not(:disabled)::before { opacity: 1; translate: 0 18px; }
@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; } }
/* ---------- printed pack ----------
   The face is printed art instead of a glowing frame, and the foil wrinkles where the seals pinch it. */
/* pinch wrinkles: fine diagonal creases fanning out from each seal, catching the same moving light */
.wrinkles { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: overlay;
  background:
    repeating-linear-gradient(80deg, rgba(255, 255, 255, 0.28) 0 1px, rgba(0, 0, 0, 0.32) 1px 3px, transparent 3px 11px) 0 0 / 100% 9% no-repeat,
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.22) 0 1px, rgba(0, 0, 0, 0.3) 1px 3px, transparent 3px 13px) 0 100% / 100% 10% no-repeat;
  -webkit-mask: linear-gradient(#000, transparent 9%, transparent 90%, #000); mask: linear-gradient(#000, transparent 9%, transparent 90%, #000); }
.tear-mark { position: absolute; left: 7%; bottom: 22%; z-index: 2; font-size: calc(var(--pw) * 0.034); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255, 236, 200, 0.75); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); white-space: nowrap; }
.pack-face { inset: 12% 8% 14%; gap: 0; justify-content: flex-start; padding-top: 2%; border: 0; border-radius: 10px; background: none;
  box-shadow: inset 0 0 0 1px rgba(250, 214, 140, 0.55), inset 0 0 0 3px rgba(60, 8, 10, 0.6), inset 0 0 0 4px rgba(250, 214, 140, 0.35); }
/* printed starburst behind the demon */
.pack-rays { position: absolute; left: 50%; top: 40%; width: 150%; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; opacity: 0.55;
  background: repeating-conic-gradient(from 0deg, rgba(255, 190, 110, 0.5) 0 6deg, transparent 6deg 15deg);
  -webkit-mask: radial-gradient(closest-side, #000 15%, transparent 70%); mask: radial-gradient(closest-side, #000 15%, transparent 70%); }
.pack .demon-icon { position: relative; width: 50%; margin-top: 4%; filter: drop-shadow(0 4px 0 rgba(40, 4, 6, 0.65)) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5)); }
/* logo: white printed ink with a crisp dark outline (paint-order puts the stroke under the fill), a small EXTREME over a big DEMON */
.pack .pack-title { position: relative; display: flex; flex-direction: column; align-items: center; margin-top: 6%; line-height: 0.9; text-transform: uppercase;
  font-weight: 900; font-size: calc(var(--pw) * 0.075); letter-spacing: 0.2em; color: #fff; text-shadow: 0 3px 0 rgba(40, 6, 30, 0.55), 0 6px 14px rgba(0, 0, 0, 0.35);
  -webkit-text-stroke: calc(var(--pw) * 0.018) #2b0a24; paint-order: stroke fill; }
.pack .pack-title b { font-weight: 900; font-size: 1.85em; letter-spacing: 0.03em; }
/* the 5 CARDS ribbon: printed band with notched ends */
.pack .pack-sub { position: relative; margin-top: 7%; padding: 0.45em 1.6em; border-radius: 0; background: linear-gradient(180deg, #f3d38a, #c58f2c); color: #2a0608;
  font-size: calc(var(--pw) * 0.05); font-weight: 900; letter-spacing: 0.22em; text-shadow: 0 1px 0 rgba(255, 245, 210, 0.6);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); }

.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; width: 100%; height: 100%; pointer-events: none; }
.opening { --screen-h: 100vh; --skip-bottom: clamp(8px, var(--screen-h) * 0.06 - 24px, 36px); --skip-room: calc(var(--skip-bottom) + 56px); --hint-room: calc(var(--skip-room) + 36px);
  --pack-h: min(345px, (var(--screen-h) - 20px - var(--hint-room)) / 1.2); }
@supports (height: 1dvh) { .opening { --screen-h: 100dvh; } }
.opening:focus-visible { outline: 0; border-radius: 0; }
.opening .skip { position: absolute; bottom: var(--skip-bottom); left: 50%; translate: -50% 0; z-index: 7; min-width: 88px; min-height: 44px; padding: 8px 16px;
  border: 1px solid #111118; background: #f4f4f7; color: #111118; font-size: 0.875rem; font-weight: 600; animation: skipin 0.3s 0.5s backwards; }
@keyframes skipin { from { opacity: 0; visibility: hidden; } }
.opening .skip:hover { background: #fff; }
.opening .skip:active { background: #c9cbd6; transform: translateY(2px); transition-duration: 0s; }
.opening .skip:focus-visible { box-shadow: 0 0 0 7px #111118; }
.opening.closing .skip { display: none; }
.opening .stage-pack { position: relative; z-index: 2; margin-bottom: max(0px, 2 * (var(--hint-room) + 12px + 0.6 * var(--pack-h)) - var(--screen-h)); transition: transform 0.6s cubic-bezier(.2, .9, .3, 1.3); }
.opening .stage-pack .pack { display: block; animation: none; --pw: calc(var(--pack-h) * 2 / 3); --ph: var(--pack-h); cursor: default; }
.stage-pack.emptied .bag-body, .stage-pack.emptied .pack-cards { animation: dropaway 0.6s 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; }
.opening.tearable { cursor: grab; touch-action: none; user-select: none; } /* a swipe can start anywhere; only the part over the pack tears */
.opening.tearable:active { cursor: grabbing; }
.opening.tearable .pack { cursor: pointer; }
/* the cards inside: under the seal and in front of nothing but the pack's back, so the body hides all but what sticks out */
.pack-cards { position: absolute; left: 12%; right: 12%; top: 5%; aspect-ratio: 5 / 7; z-index: 0; transition: translate 0.38s cubic-bezier(.2, .9, .3, 1.25); }
.pack-cards .card-back { position: absolute; inset: 0; border-radius: 8px; }
.stage-pack .bag-body { z-index: 1; }
.stage-pack.rise .pack-cards { translate: 0 -24%; }
.card-back.flying { position: fixed; z-index: 6; margin: 0; transform-origin: 0 0; pointer-events: none; will-change: transform; }
/* the rip: a dark slit with white torn-foil edges along the seal line, jagged below; JS grows it from the pulled side */
.rip { position: absolute; left: 0; right: 0; top: 12.6%; height: 3.2%; z-index: 3; pointer-events: none; clip-path: inset(0 100% 0 0);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0 1.5px, rgba(255, 248, 235, 0.55) 1.5px 3px, #12040c 3px calc(100% - 3px), rgba(255, 255, 255, 0.8) calc(100% - 3px));
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 7px 55% repeat-x, linear-gradient(#000 0 0) top / 100% 46% no-repeat;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 7px 55% repeat-x, linear-gradient(#000 0 0) top / 100% 46% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
/* the guide until the pull starts: a glowing dashed tear line, and a touch dot sweeping along it with a trail */
.tear-guide { position: absolute; left: 3%; right: 3%; top: 10%; height: 8%; z-index: 4; pointer-events: none; transition: opacity 0.25s; }
.stage-pack.pulling .tear-guide { opacity: 0; }
/* Transforms only (the compositor runs them): background-position and left repainted the pack every frame. */
.tear-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; translate: 0 -50%; overflow: hidden; filter: drop-shadow(0 0 4px rgba(255, 220, 160, 0.9)); }
.tear-line::before { content: ''; position: absolute; inset: 0 0 0 -12px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0 7px, transparent 7px 12px);
  animation: tearline 0.9s linear infinite; }
@keyframes tearline { to { transform: translateX(12px); } }
/* the sweeping touch: a full-width track that slides by its own width (so 100% is the line's length), the dot and its trail on it */
.tear-finger { position: absolute; top: 50%; left: 0; width: 100%; height: 0; animation: tearsweep 1.7s cubic-bezier(.55, 0, .35, 1) infinite; }
.tear-finger::before { content: ''; position: absolute; left: 0; top: 0; width: 18px; height: 18px; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 35%, rgba(255, 255, 255, 0.5) 45%, transparent 70%); box-shadow: 0 0 14px 4px rgba(255, 230, 180, 0.7);
  animation: tearpulse 1.7s cubic-bezier(.55, 0, .35, 1) infinite; }
.tear-finger::after { content: ''; position: absolute; right: 100%; top: 0; width: 70px; height: 6px; translate: 0 -50%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 210, 0.75)); }
@keyframes tearsweep { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 72% { transform: translateX(100%); opacity: 1; } 85%, 100% { transform: translateX(100%); opacity: 0; } }
@keyframes tearpulse { 0% { scale: 0.6; } 12%, 72% { scale: 1; } 85%, 100% { scale: 0.6; } }
.stage-pack.tearable .bag-body::before { opacity: calc(var(--tp, 0) * 0.9); }
.tear-hint { position: absolute; left: 50%; bottom: max(8vh, var(--skip-room)); width: max-content; max-width: calc(100vw - 32px); translate: -50% 0; z-index: 5;
  color: rgba(255, 255, 255, 0.85); font-weight: 700; text-align: center; animation: fadein 0.4s 5s both; }
.tear-hint span::after { content: ' ⟶'; display: inline-block; animation: tearnudge 1.4s ease-in-out infinite; }
@keyframes tearnudge { 50% { translate: 8px 0; } }
.opening .loading { position: relative; color: rgba(255, 255, 255, 0.85); font-weight: 700; animation: fadein 0.4s 0.15s both; }
@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; }
.opening.shake3 .stage-pack .pack { animation: shake 0.1s infinite; }
/* The shake's glow is a gradient behind the fan, not a filter on the pack: one re-blurred the whole fan every frame. */
.opening .stage-pack::after { content: ''; position: absolute; inset: -45% -95%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(closest-side, rgba(251, 146, 60, 0.6), rgba(251, 146, 60, 0.32) 55%, transparent); }
.opening.shake2 .stage-pack::after { opacity: 1; }
.opening.shake3 .stage-pack::after { opacity: 1; background: radial-gradient(closest-side, rgba(253, 230, 138, 0.8), rgba(220, 180, 90, 0.42) 55%, transparent); }
.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(min(120px, (100vw - 62px) / 3), 17vw, 190px); perspective: 1000px; transition: opacity 0.3s, translate 0.4s; }
@media (max-height: 700px) { .reveal-row { margin-bottom: var(--skip-room); } }
@media (max-height: 592px) and (orientation: landscape) {
  .reveal-row { flex-wrap: nowrap; max-width: 100%; }
  .reveal-row .slot { width: min(190px, 17vw, (var(--screen-h) - 165px) * 5 / 7); }
}
/* 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); }
/* each face hidden outright once edge-on: backface-visibility alone let the back's layers show over the revealed card */
.flipper .front { visibility: hidden; }
.flipper.flipped .front { visibility: visible; transition: visibility 0s 0.15s; }
.flipper.flipped .back { visibility: hidden; transition: visibility 0s 0.15s; }
.card-back { position: relative; width: 100%; height: 100%; border-radius: 12px; display: grid; place-items: center; font-size: 0;
  background: url('/extreme-demon.png') center / 42% no-repeat, radial-gradient(circle at 50% 45%, #4c1311, #2a0b0a 55%, #1c0807 85%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.35), 0 10px 18px -6px rgba(0, 0, 0, 0.5); }
/* printed frame (inset rings: the red border, a dark keyline, a faint lighter-red pinstripe) and the gloss coat */
.card-back::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 7px #6a1a16, inset 0 0 0 8px rgba(0, 0, 0, 0.55), inset 0 0 0 9px rgba(168, 52, 44, 0.45), inset 0 0 0 10px rgba(0, 0, 0, 0.3);
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, 0.04)); }
.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 { --pull-title: clamp(2rem, 8vw, 4.5rem); --card-room: calc(var(--screen-h) - var(--skip-room) - 194px - 1.55 * var(--pull-title)); position: absolute; inset: 0; z-index: 6;
  background: radial-gradient(circle, color-mix(in srgb, var(--tc) 35%, transparent), rgba(0, 0, 0, 0.92) 65%); animation: fadein 0.3s; }
.special-fit { position: absolute; inset: 0 0 var(--skip-room); display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 20px; text-align: center; padding: 0 20px 20px; overflow-y: auto; }
/* keeps it centered on the whole screen, and only moves it up when Skip needs the room */
.special-fit::before { content: ''; flex: 0 1 var(--skip-room); }
/* a square just big enough for the visible rays: twice the screen (inset: -50%) was a ~47 MB layer on a phone, plus its mask */
.special .rays { position: absolute; left: 50%; top: 50%; width: min(170vmin, 1400px); aspect-ratio: 1; margin: calc(min(170vmin, 1400px) / -2) 0 0 calc(min(170vmin, 1400px) / -2);
  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(closest-side, #000 15%, transparent); }
.special h2 { position: relative; font-weight: 800; letter-spacing: -0.03em; font-size: var(--pull-title); 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 + buttons fit on short screens (e.g. laptops with display scaling) */
/* the card's % padding (its frame) is measured against its parent's width: the wrapper is the card's own width, not the overlay's */
.special-card { position: relative; flex: none; width: min(300px, 70vw, max(150px, min(var(--screen-h) - 320px, var(--card-room)) * 5 / 7)); }
.special .card { width: 100%; 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 > .inspect { max-width: 280px; width: 100%; 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 { position: relative; background: var(--panel-solid); border: 1px solid var(--line); padding: 12px 14px 12px 20px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: fadein 0.3s; }
/* the code box takes the invite card's width: its input has no width of its own, so the card sets the column */
.bonus-col { display: grid; gap: 10px; }
.redeem-form { gap: 6px; flex-wrap: nowrap; }
.redeem-form input { flex: 1; width: 0; min-width: 0; min-height: 34px; padding: 6px 10px; }
.toast::before { content: ''; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--cyan); }
.toast.err::before { background: 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%; } /* wraps: four buttons in one row stuck out of the box on narrow phones */
  .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); }
.status.reversed { color: #f87171; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.55); } /* staff gave the cards back */
.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; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button[aria-selected='true'] { border-color: var(--cyan); color: var(--cyan); }
.btn[data-layout][aria-pressed='true'] { border-color: var(--cyan); color: var(--cyan); } /* Compact / Large: which one is on */
/* 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 16px 26px; margin: -32px -16px -6px; scroll-padding-inline: 16px; scroll-snap-type: x mandatory; }
.hscroll > * { scroll-snap-align: start; }
/* an always-visible scrollbar, so it's clear the row scrolls */
.hscroll::-webkit-scrollbar { height: 6px; }
.hscroll::-webkit-scrollbar-track { margin: 0 16px; 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 */
/* route()'s swap: the old page fades out quickly while GSAP rises the new one in; the header and nav stay put */
main:not([style]) { view-transition-name: page; }
::view-transition-group(page), ::view-transition-new(page) { animation: none; } /* no sliding between the two pages' boxes: a scrolled old page would fly in from far away */
::view-transition-old(page) { animation: 0.14s ease-in both vt-out; }
@keyframes vt-out { to { opacity: 0; } }
main.leaving { opacity: 0.55; transition: opacity 0.2s 0.15s; }
main[inert] { pointer-events: none; } /* older phones ignore inert, so taps would still reach the old page */
@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 backwards; }
.card-grid > [data-flip-id], .card-wrap[data-flip-id] { animation: none; } /* renderSoft (GSAP) moves these: a CSS animation would override it */
.flipping .card[data-flip-id] { transition: box-shadow 0.25s; } /* while GSAP glides cards, the tilt's transform transition would lag behind it */
/* 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; min-width: 0; overflow-wrap: anywhere; } /* a long name wraps: it used to push the menu wider than its box, which then scrolled sideways (and hid the left of every item) */
.menu .menu-gear { display: grid; place-items: center; width: 34px; height: 34px; margin-left: auto; padding: 0; flex: none; color: var(--muted); border-radius: 8px; }
.menu .menu-gear svg { width: 18px; height: 18px; } .menu .menu-gear:hover { color: var(--text); }

.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; }
/* 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); }
.kofi.discord-link { background: #5865f2; }
.kofi.discord-link svg { width: 18px; height: 18px; } /* shared DISCORD_ICON is 20px; match the Ko-fi icon */
.kofi.discord-link:hover { background: #6d78f5; }
@media (max-width: 700px) { .kofi span { display: none; } .kofi { padding: 8px; } }
.card-wrap { position: relative; animation: pagein 0.3s ease backwards; } /* not "both": a held transform animation keeps every card on its own GPU layer */
.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.88);
  color: rgba(255, 255, 255, 0.55); font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: color 0.15s, transform 0.15s, background 0.15s; } /* no backdrop blur: it made every card on the page a GPU layer */
.fav-star:hover { 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; }
/* The packs behind are a picture of one (pack-front.webp), not live bags: 9 bags were ~90 GPU layers redrawn every frame. */
.pack .layer { background: url(/pack-front.webp) center / 100% 100% no-repeat; }
.pack .layer > .bag { 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; }
.falling-pack, .falling-pack > span { position: absolute; inset: 0; }
.falling-pack { pointer-events: none; }
.falling-pack > span { transform-origin: 50% 115%; }
.pack .falling-pack .first-pack { background: none; filter: none; --mx: inherit; }
.pack .falling-pack .bag { display: block; }
.pack .falling-pack .pack-face { opacity: 1; }
.pack.empty-spot { transition-property: scale, transform; }
.pack.empty-spot > .bag { filter: grayscale(0.8) brightness(0.55); }
.pack.first-lands > .bag > * { visibility: hidden; }
.pack:is(.empty-spot, .first-lands) > .bag .glints { display: none; }
.stage-pack.emptied .layer { animation: dropaway 0.6s cubic-bezier(.5, 0, .75, 0) forwards; }
/* In the opening the stacked packs are one shared image (pack-back.webp): live bags crashed phones opening many packs. */
.opening .pack .layer { filter: none; background: url(/pack-back.webp) center / 100% 100% no-repeat; }
.opening .pack .layer > .bag { display: none; }
/* the page under the opening overlay isn't seen: don't keep it rendered (and its own pack animating) the whole time */
html.pack-open :is(#header, #main, .backdrop, footer.site, .dm-btn) { display: none; }
/* display: none would move the page when they come back */
html.hush :is(#toasts, .dm-panel, .announce) { visibility: hidden; }
.summary .card { animation: pop 0.45s ease-out backwards; } /* not "both": see .card-wrap */
/* Open all: no per-card pop, holo spin or sparkles, and offscreen cards skip rendering, so many cards stay light on phones */
.summary-grid.many .card, .summary-grid.many .card * { animation: none !important; }
.summary-grid.many .card-wrap { content-visibility: auto; contain-intrinsic-size: auto 210px; }
.summary-grid.many .card-wrap.is-new { padding: 5px; margin: -5px; } /* content-visibility clips to the box: room for the new-card outline */
.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 { --pull-title: clamp(1.6rem, 5.5vw, 3rem); 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 { text-shadow: 0 0 18px var(--tc); }
.special.lite .special-card { width: min(260px, 64vw, max(150px, var(--card-room) * 5 / 7)); }

/* 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; }
/* 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: 50%; top: 74%; transform: translateX(-50%); white-space: nowrap; 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; }
/* 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; }
.rules h1 { margin-bottom: 0.3em; }
.rules-warn { border: 1px solid var(--danger); background: rgba(248, 113, 113, 0.1); border-radius: var(--radius); padding: 4px 16px; margin: 16px 0; }
.rules-warn h2 { color: var(--danger); margin-top: 0.8em; }
/* 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; }

.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); }
.role-badge.headmod { color: #a5f3fc; background: rgba(6, 182, 212, 0.18); border: 1px solid rgba(34, 211, 238, 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 */
.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; }
  .modal { padding: 16px; }
  .detail > .inspect { max-width: 220px; }
  .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; }
  .hide-sm { display: none; }
}
/* 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); }
/* Pack results: new cards stand out (ring + bold tag), with the count under the best pull. */
.own-tag.pack-tag { font-size: 0.8rem; letter-spacing: 0.06em; padding: 4px 8px; background: rgba(74, 222, 128, 0.18); }
.summary .card-wrap.is-new > .card { outline: 2px solid var(--ok); outline-offset: 3px; } /* follows the card's own corners */
.pack-new { margin: 8px 0 14px; font-weight: 800; color: var(--ok); } .pack-new.none { color: var(--muted); font-weight: 400; }
.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; padding: 0; } .announce .icon-btn svg { display: block; }
.flag-row { flex-direction: column; align-items: flex-start; gap: 6px; }
.flag-reasons { margin: 0; padding-left: 18px; color: var(--gold); }
.flag-funnel, .flag-actions { gap: 6px; }
.flag-funnel-text { color: var(--danger); }
.score-line .loss { color: var(--danger); } .score-line .gain { color: var(--ok); }
.value-line { display: block; margin-top: 4px; }
.one-sided { display: block; margin-top: 6px; color: var(--danger); font-weight: 600; }
/* A card's +/- score sits on the card itself, in the empty strip at its bottom (cards are 5:7, so 140cqw is the card's
   height), so trade grids stay as tall as before. Bottom right: the HOLO chip is bottom left. */
.card-wrap:has(> .worth), .pick-copy:has(> .worth) { container-type: inline-size; }
.pick-copy > .worth { z-index: 6; }
.worth { position: absolute; z-index: 2; top: calc(140cqw - 25px); right: 7px; font-size: 0.72rem; font-weight: 800; line-height: 1;
  padding: 3px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.72); font-variant-numeric: tabular-nums; }
.worth.gain { color: var(--ok); } .worth.loss { color: var(--danger); }
/* crafting outcomes: lose / win / big win */
.craft-lose { --tc: var(--danger); } .craft-win { --tc: var(--ok); } .craft-big { --tc: var(--gold); }
.craft-odd-sub { display: block; font-size: 0.7rem; color: var(--muted); }
#trayScore:empty { display: none; }

/* 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); }

/* tournament badges: small 16:10 images in a row */
.tourney-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 -12px; } /* -12px: the next section's 28px margin plus its heading's line gap would leave more room below than above */
.tourney-badge { display: block; width: 128px; aspect-ratio: 16 / 10; padding: 0; border: 0; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); transition: transform 0.15s; overflow: hidden; background: none; cursor: default; }
button.tourney-badge { cursor: pointer; }
.tourney-badge:hover { transform: translateY(-2px); }
.tourney-badge img { width: 100%; height: 100%; }
.tourney-badge img, img.tourney-badge { object-fit: cover; display: block; } /* no width on img.tourney-badge: it outranked the 128px and stretched the badge full width for non-staff */


/* 3D card viewer (cardViewer / wireViewer in app.js) */
.inspect { outline: none; display: grid; gap: 10px; justify-items: center; align-content: start; }
.inspect-stage { width: 100%; padding: 18px 0; display: grid; place-items: center; perspective: 1100px; cursor: grab; touch-action: none; user-select: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.05), transparent); }
.inspect-stage:active { cursor: grabbing; }
.inspect-card { --thick: 5px; position: relative; width: 82%; aspect-ratio: 5 / 7; transform-style: preserve-3d; will-change: transform; }
@supports (width: 1cqi) { .inspect-card { --thick: 1.4cqi; container-type: inline-size; } }
.inspect-face { position: absolute; inset: 0; backface-visibility: hidden; }
.inspect-face.front { transform: translateZ(calc(var(--thick) / 2 + 0.1px)); }
.inspect-face.back { transform: rotateY(180deg) translateZ(calc(var(--thick) / 2 + 0.1px)); }
.inspect-face .card { height: 100%; cursor: inherit; }
.inspect img { -webkit-user-drag: none; user-select: none; pointer-events: none; }
.inspect-face .card .glare, .inspect-face.back .glare { display: block; opacity: 1; position: absolute; inset: 0; border-radius: var(--card-corner); pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.3), transparent 50%); mix-blend-mode: overlay; }
/* you can't really see this ring, but some browsers don't smooth a layer's edge, so it needs room past it */
.inspect-face.back .card-back, .inspect-rim { border-radius: var(--card-corner); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.01); }
/* lines under 2px break up when tilted */
.inspect-face.back .card-back::before { box-shadow: inset 0 0 0 3.6cqi #6a1a16, inset 0 0 0 calc(3.6cqi + 2px) rgba(0, 0, 0, 0.55), inset 0 0 0 calc(3.6cqi + 4px) rgba(168, 52, 44, 0.45), inset 0 0 0 calc(3.6cqi + 6px) rgba(0, 0, 0, 0.3); }
.inspect-shade { position: absolute; inset: 0; border-radius: var(--card-corner); background: #000; pointer-events: none; z-index: 3; }
.inspect-face.front .inspect-shade { opacity: var(--shade-front, 0); }
.inspect-face.back .inspect-shade { opacity: var(--shade-back, 0); }
.inspect-card { --stock: color-mix(in srgb, var(--tc, #888) 35%, #d8d2c4); }
.inspect-rim { position: absolute; inset: 1px; background: linear-gradient(to bottom right, color-mix(in srgb, var(--stock), #000 18%) 48%, color-mix(in srgb, var(--stock), #000 50%) 52%); }
.inspect-side { position: absolute; height: var(--thick); background: color-mix(in srgb, var(--stock), #000 var(--dim)); }
@supports not (color: color-mix(in srgb, red, blue)) {
  .inspect-rim, .inspect-side { background: #8f8b81; }
  .inspect-face .card-inner { background: linear-gradient(180deg, #23212a, #17161c); }
  .inspect-face .tier-badge { background: var(--tc); }
}
.inspect-tools { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .inspect-card { will-change: auto; } }

/* 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); }
/* 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. */
/* touch screens of any size (tablets too): in a duel the floating buttons sat on the action bar; Report a bug moves to the menu */
.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) {
  .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); }
/* Verified badge: given by staff. A scalloped seal in the site's amber, a dark check on top. The glow is a filter on the
   wrapper so it follows the seal's edge (a mask on the same element would cut it off). */
.verified-badge { position: relative; display: inline-grid; place-items: center; flex: none; width: 21px; height: 21px; vertical-align: middle; margin-left: 4px; color: #3b1d02; filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.55)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
.verified-badge::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 32% 26%, #fff7d6 0, #fde68a 22%, #fbbf24 55%, #d97706 100%); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8A2.7 2.7 0 0 1 16.6 4A2.7 2.7 0 0 1 20 7.4A2.7 2.7 0 0 1 21.2 12A2.7 2.7 0 0 1 20 16.6A2.7 2.7 0 0 1 16.6 20A2.7 2.7 0 0 1 12 21.2A2.7 2.7 0 0 1 7.4 20A2.7 2.7 0 0 1 4 16.6A2.7 2.7 0 0 1 2.8 12A2.7 2.7 0 0 1 4 7.4A2.7 2.7 0 0 1 7.4 4A2.7 2.7 0 0 1 12 2.8Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8A2.7 2.7 0 0 1 16.6 4A2.7 2.7 0 0 1 20 7.4A2.7 2.7 0 0 1 21.2 12A2.7 2.7 0 0 1 20 16.6A2.7 2.7 0 0 1 16.6 20A2.7 2.7 0 0 1 12 21.2A2.7 2.7 0 0 1 7.4 20A2.7 2.7 0 0 1 4 16.6A2.7 2.7 0 0 1 2.8 12A2.7 2.7 0 0 1 4 7.4A2.7 2.7 0 0 1 7.4 4A2.7 2.7 0 0 1 12 2.8Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.verified-badge svg { position: relative; display: block; width: 100%; height: 100%; }
.verified-badge + .role-badge, .verified-badge + .supporter-badge { margin-left: 4px; }
h1 .verified-badge { width: 30px; height: 30px; filter: drop-shadow(0 0 7px rgba(251, 191, 36, 0.55)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
h2 .verified-badge { width: 25px; height: 25px; }

/* ---------- 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)); }
.cz-preview .profile-banner.is-level { cursor: grab; touch-action: none; }
.cz-preview .profile-banner.is-level:active { cursor: grabbing; }
/* the gradient flows along the name: nc → nc2 → nc repeats seamlessly every 200% */
.uname.grad { background: linear-gradient(90deg, var(--nc), var(--nc2), var(--nc)) 0 0 / 200% 100% repeat-x; -webkit-background-clip: text; background-clip: text; color: transparent; animation: namegrad 7s linear infinite; }
@keyframes namegrad { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .uname.grad { animation: none; } }
/* 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 across the profile card's top, the avatar over its edge; a fixed 5:1 shape so a level banner's crop shows the same part. */
.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: var(--tc, #fbbf24); text-decoration: none; letter-spacing: 0.02em; white-space: nowrap; }
.clan-tag, .clan-tag:hover { text-decoration: none; }
a.clan-tag:hover { color: var(--tc, #fde68a); text-shadow: 0 0 10px color-mix(in srgb, var(--tc, #fbbf24) 45%, transparent); }
.clan-tag.big { font-size: 0.9em; }
.rank-list { container-type: inline-size; --u: 0.45px; }
.rank-list ol { margin: 0; padding: 0; list-style: none; }
.rank-list li { --rank: #a3a3a3; --rank-fill: #141414, #1e1e1e; --rank-frame: #4b4b4b, #353333; }
.rank-list li + li { margin-top: calc(24 * var(--u)); }
.rank-list li.p1 { --rank: #ffbd59; --rank-fill: #4c4003, #322406 25%, #4c4418 50%, #483d06 75%, #1b1910; --rank-frame: #a29c4a, #827a0e; }
.rank-list li.p2 { --rank: #d9d9d9; --rank-fill: #32322e, #282726 25%, #3e3d3b 50%, #353534 75%, #282827; --rank-frame: #a6a6a6, #6c6c6c; }
.rank-list li.p3 { --rank: #ff914d; --rank-fill: #402907, #362807 25%, #443419 50%, #37260d 75%, #2f1b02; --rank-frame: #996f49, #875418; }
.rank-card { display: grid; grid-template-columns: calc(96 * var(--u)) minmax(0, 1fr) minmax(calc(320 * var(--u)), auto) auto auto; align-items: center; column-gap: calc(30 * var(--u)); height: 44px;
  position: relative; padding: 0 calc(30 * var(--u)) 0 0; border: calc(2.2 * var(--u)) solid transparent; border-radius: calc(25.4 * var(--u)); color: #fff; text-decoration: none; font-family: 'Exo 2', var(--body); white-space: nowrap;
  background: linear-gradient(135deg, var(--rank-fill)) border-box padding-box, linear-gradient(90deg, var(--rank-frame)) border-box; }
@supports (background: linear-gradient(calc(180deg - atan2(1px, 1cqw)), red, red)) { .rank-card { background-image: linear-gradient(calc(180deg - atan2(calc(0.4 * 635 * var(--u)), 100cqw)), var(--rank-fill)), linear-gradient(90deg, var(--rank-frame)); } }
@media (hover: hover) { a.rank-card:hover { box-shadow: inset 0 0 0 100vmax rgba(255, 255, 255, 0.05); } }
a.rank-card:active { box-shadow: inset 0 0 0 100vmax rgba(255, 255, 255, 0.1); }
.you .rank-card { box-shadow: inset 0 0 0 100vmax rgba(251, 191, 36, 0.08); }
.rank-no { justify-self: center; color: var(--rank); font-weight: 700; font-size: calc(48 * var(--u) * min(1, 3 / var(--digits))); line-height: 1; }
.rank-id { display: flex; align-items: baseline; gap: 0.3em; min-width: 0; }
.rank-id .row { flex-wrap: nowrap; min-width: 0; color: inherit; }
@media (hover: hover) { .rank-id a:hover .uname { text-decoration: underline; } }
.rank-id .avatar { width: calc(56 * var(--u)); height: calc(56 * var(--u)); border-radius: calc(14 * var(--u)); }
.rank-card .clan-tag { flex: none; font-weight: 700; font-size: calc(32 * var(--u)); line-height: normal; letter-spacing: 0; }
@supports (color: oklch(from red max(l, 0.5) c h)) { .rank-card .clan-tag { color: oklch(from var(--tc, #fbbf24) max(l, 0.58) c h); } }
:is(.rank-name, .rank-id .uname) { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: calc(42.66 * var(--u)); line-height: normal; }
:is(.lb-holo, .join-pill) { grid-area: 1 / 3; }
.join-pill { justify-self: start; height: calc(48 * var(--u)); padding: 0 calc(12.2 * var(--u)) 0 calc(17.8 * var(--u)); border: calc(4 * var(--u)) solid rgba(190, 219, 140, 0.4375); border-radius: calc(11.84 * var(--u));
  color: #7ed957; font-weight: 400; font-size: calc(29.33 * var(--u)); line-height: calc(40 * var(--u)); text-transform: uppercase;
  background: linear-gradient(135deg, rgba(25, 176, 27, 0.25), rgba(176, 233, 171, 0.25) 33.33%, rgba(220, 246, 220, 0.25) 66.67%, rgba(89, 201, 37, 0.25)) padding-box; }
.join-pill b { font-weight: 700; }
.join-pill-dot { margin: 0 calc(7.57 * var(--u)) 0 calc(9.48 * var(--u)); font-size: calc(45.33 * var(--u)); line-height: 0; vertical-align: calc(6.85 * var(--u)); }
.join-pill-min { font-size: calc(27.11 * var(--u)); }
.join-pill.closed { color: rgba(255, 255, 255, 0.67); border-color: rgba(207, 207, 207, 0.4375);
  background: linear-gradient(135deg, rgba(133, 133, 133, 0.25), rgba(220, 220, 220, 0.25) 33.33%, rgba(240, 240, 240, 0.25) 66.67%, rgba(165, 165, 165, 0.25)) padding-box; }
.rank-pts, .rank-stat { text-align: right; font-weight: 400; font-size: calc(29.33 * var(--u)); line-height: normal; }
.rank-pts { min-width: 15ch; color: rgba(255, 255, 255, 0.98); }
.rank-stat { min-width: 12ch; color: rgba(255, 255, 255, 0.67); }
.rank-list .skel-rank { height: 44px; border-radius: calc(25.4 * var(--u)); }
@container (max-width: 600px) {
  .rank-card { grid-template: 'no . id id' auto 'no . pts stat' auto 'no . more more' auto / calc(96 * var(--u)) calc(24 * var(--u)) auto minmax(0, 1fr);
    column-gap: 0; row-gap: calc(4 * var(--u)); height: auto; padding: calc(28 * var(--u)) calc(30 * var(--u)) calc(28 * var(--u)) 0; }
  .rank-no { grid-area: no; font-size: calc(48 * var(--u) * min(1, 2.2 / var(--digits))); }
  .rank-id { grid-area: id; }
  .rank-id .avatar { width: calc(128 * var(--u)); height: calc(128 * var(--u)); margin-bottom: calc(-128 * var(--u)); border-radius: calc(32 * var(--u)); }
  .rank-id > .row > :first-child { align-self: start; }
  :is(.rank-pts, .rank-stat) { min-width: 0; text-align: left; color: rgba(255, 255, 255, 0.67); }
  .rank-pts { grid-area: pts; }
  .rank-stat { grid-area: stat; overflow: hidden; text-overflow: ellipsis; }
  .rank-stat::before { content: '·'; content: '·' / ''; margin: 0 0.4em; }
  .rank-num { font-weight: 700; color: rgba(255, 255, 255, 0.98); }
  :is(.lb-holo, .join-pill) { grid-area: more; }
  .rank-card:has(.avatar) :is(.rank-pts, .lb-holo) { margin-left: calc(128 * var(--u) + 8px); }
  .rank-list .skel-rank { height: calc(190 * var(--u)); }
}
.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 */

.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; }
.filter-bar > .btn { grid-area: 1 / 2; }
.filter-search { position: relative; }
.filter-search input { width: 100%; padding-right: 44px; }
.filter-search button { position: absolute; inset: 0 0 0 auto; width: 44px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.filter-search button:hover { color: #fff; }
.filter-search input:placeholder-shown + button { display: none; }
.filter-search input, .filter-bar > .btn, .filter-more :is(label.field > *, .btn), .filter-head select { min-height: 44px; }
@media (pointer: coarse) { .filter-head .btn { min-height: 44px; } }
.filter-rarity { grid-area: 2 / 1 / auto / span 2; display: flex; gap: 16px; min-width: 0; margin: 0; padding: 0; border: 0; }
.filter-rarity:has(:checked) input:not(:checked) + i { opacity: 0.45; }
.chevron { transition: transform 0.2s; }
[aria-expanded='true'] > .chevron { transform: rotate(180deg); }
.filter-pick { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border-radius: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; user-select: none; touch-action: manipulation; }
.filter-pick:has(:focus-visible) { outline: 3px solid var(--cyan); outline-offset: 2px; }
.filter-pick input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.filter-pick i { flex: none; font-style: normal; transition: transform 0.3s cubic-bezier(.2, .9, .3, 1.3), opacity 0.2s; }
.filter-pick input:checked + i { transform: translateY(-3px) rotate(-8deg) scale(1.15); }
.filter-pick input:checked ~ span { color: #fff; }
@media (hover: hover) {
  .filter-pick:hover span { color: #fff; }
  .filter-pick:hover input:not(:checked) + i { transform: translateY(-2px); opacity: 1; }
}
.filter-pick:hover input:active + i, .filter-pick input:active + i { transform: scale(0.9); }
.tier-card { --tier-card-w: 20px; position: relative; display: grid; place-items: center; width: var(--tier-card-w); height: calc(var(--tier-card-w) * 1.4); border-radius: 2px; color: #17130f; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 90%, #3a3430), color-mix(in srgb, var(--tc) 74%, #1d1a18)); }
.t-apex > .tier-card { background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #22d3ee, #a855f7, #f43f5e); }
.tier-card::before { content: ''; position: absolute; inset: 2px; border-radius: 1px; background: linear-gradient(color-mix(in srgb, var(--tc) 45%, #17161c) 0 0) 50% 4px / calc(100% - 4px) calc(100% / 3) no-repeat, #1d1c22; }
.filter-pick input:checked + .tier-card::before { content: none; }
.tier-card svg { width: calc(var(--tier-card-w) * 1.5); height: calc(var(--tier-card-w) * 1.5); margin: calc(var(--tier-card-w) * -0.25); transform: scale(0); transition: transform 0.3s cubic-bezier(.2, .9, .3, 1.3); }
.filter-pick input:checked + .tier-card svg { transform: none; }
.fav-mark { width: 1.1em; font-size: 1.3rem; line-height: 1; text-align: center; }
.fav-mark::before { content: '☆'; }
.filter-pick input:checked + .fav-mark { color: var(--gold); }
.filter-pick input:checked + .fav-mark::before { content: '★'; }
.copies-mark { padding: 1px 7px; border: 1px solid; border-radius: 999px; font-weight: 800; }
.filter-pick input:checked + .copies-mark { border-color: transparent; background: linear-gradient(90deg, #f87171, #fbbf24) border-box; color: #1a0c04; }
.filter-more { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 10px; animation: dropin 0.18s ease-out; }
.filter-more input[type='number'] { width: 100px; }
.filter-person { flex: 1 1 160px; }
.filter-last { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
.filter-size { min-width: 0; margin: 0; padding: 0; border: 0; }
.filter-size legend { margin-bottom: 6px; padding: 0; color: var(--muted); font-size: 0.85rem; }
.filter-size .btn + .btn { margin-left: 6px; }
.filter-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 12px; }
.filter-found { min-width: 6.5em; }
.filter-on { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.filter-on:empty { display: none; }
.filter-on .holo-badge { animation: none; }
.filter-name { overflow: hidden; max-width: 22ch; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.filter-why { display: grid; grid-template-columns: minmax(0, max-content) 12.5em; align-items: center; justify-content: center; gap: 8px 12px; text-align: left; }
.filter-why > :only-child { grid-column: 1 / -1; justify-self: center; }
.filter-why .btn { justify-self: end; min-width: 0; max-width: 100%; }
.just-on { animation: pop 0.3s; }
.filter-head select { margin-left: auto; }
#colGrid[aria-busy='true'] > .card-grid, #colFilters:has(+ #colGrid[aria-busy='true']) .filter-total,
#idxGrid[aria-busy='true'] > .table-wrap, #idxFilters:has(+ #idxGrid[aria-busy='true']) .filter-total { opacity: 0.55; transition: opacity 0.2s 0.15s; }
.filter-done, .filter-behind { display: none; }
@media (min-width: 1180px) {
  .filter-bar { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 20px; }
  .filter-bar > .btn, .filter-rarity { grid-area: auto; }
}
@media (max-width: 800px) { .filter-rarity { display: grid; grid-template-columns: repeat(4, auto); gap: 0; } }
@media (max-width: 700px) {
  .filter-bar, .filter-head { column-gap: 8px; }
  .filter-bar .chevron { display: none; }
  .filter-search input:placeholder-shown { padding-right: 12px; }
  .filter-found { flex: none; }
  .filter-head:has(> .btn:not([hidden])) .filter-found { width: min-content; min-width: 3em; line-height: 1.2; }
  .filter-on { order: 1; flex-basis: 100%; }
  .filter-head select { flex: 1 1 100px; min-width: 0; max-width: 210px; }
  .filter-more { position: fixed; z-index: 60; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-height: 75dvh; padding: 18px 16px 0; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 18px 18px 0 0; background: var(--panel-solid); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45); animation-name: modalin; }
  .filter-more label.field > * { width: 100%; min-width: 0; }
  .filter-owned, .filter-person, .filter-last, .filter-done { grid-column: 1 / -1; }
  .filter-variant { grid-column: span 2; }
  .filter-more:not(:has(.filter-variant)) > label:has([type='number']) { grid-column: span 2; }
  .filter-last { justify-content: space-between; }
  .filter-done { position: sticky; z-index: 2; bottom: 0; display: grid; margin-inline: -16px; padding: 8px 16px 14px; background: inherit; }
  .filter-done .btn { gap: 4px; }
  .filter-more:not([hidden]) + .filter-behind { display: block; position: fixed; z-index: 59; inset: 0; }
  body:has(.filter-more:not([hidden])) .dm-btn { display: none; }
}
@media (max-width: 380px) { .tier-card { --tier-card-w: 16px; } }
@media (max-width: 359px) {
  .filter-search input::placeholder, .filter-found { font-size: 0.8rem; }
  .filter-head { column-gap: 4px; }
  .filter-head select, .filter-more :is(select, [type='number']) { padding-inline: 4px; }
}
@media (max-width: 340px) { .filter-rarity { grid-template-columns: repeat(2, auto); } }

/* ---------- 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); }
/* 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; } }
.owners-list { max-height: min(60vh, 520px); overflow-y: auto; }
/* Index: verifier and publisher columns go first when space runs out; below 700px each level is a compact card. */
.idx-table .idx-own { white-space: nowrap; }
/* fixed column widths: sized from each page's contents, the columns shifted as you filtered. Level and the two names share the rest. */
@media (min-width: 701px) {
  .idx-table { table-layout: fixed; }
  /* on the cells too, not only the headers: a row lifted out for its fade-out (renderSoft) has no header row to size it */
  .idx-table .idx-rank { width: 84px; } .idx-table .idx-thumb { width: 118px; } .idx-table .idx-who { width: 17%; }
  .idx-table .idx-tier { width: 116px; } .idx-table .idx-own { width: 120px; } .idx-table .idx-act { width: 104px; }
  .idx-table td { overflow-wrap: anywhere; } /* a long name wraps inside its column instead of widening it */
}
@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 { justify-self: start; font-weight: 700; font-size: calc(29.33 * var(--u)); line-height: normal; white-space: nowrap; background: linear-gradient(90deg, #f0abfc, #67e8f9, #fde68a); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* ---------- duels (tester prototype) ---------- */
/* A duel card: its own simple face (tier colour, name, art, labelled cost / attack / HP, ability). Hover or focus enlarges it. */
.dcard { position: relative; width: var(--dw, 128px); flex: none; aspect-ratio: 5 / 7; z-index: 1; }
.dcard > span { position: absolute; z-index: 3; font-weight: 800; line-height: 1; pointer-events: none; }
.dc-face { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 12px; overflow: hidden; container-type: inline-size;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 35%, #111), #0b0b14 65%); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 70%, transparent), 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s, box-shadow 0.15s; }
.dc-head { display: flex; align-items: center; gap: 5px; min-width: 0; }
.dc-cost { flex: none; padding: 2px 6px; border-radius: 999px; background: #1d4ed8; color: #fff; font-weight: 800; font-size: clamp(0.6rem, 10cqi, 0.85rem); }
.dc-name { min-width: 0; font-weight: 700; font-size: clamp(0.6rem, 9.5cqi, 0.9rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-art { flex: 1 1 auto; min-height: 0; border-radius: 8px; overflow: hidden; background: #000; }
.dc-art img, .dc-art .ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-art .ph { display: grid; place-items: center; padding: 4px; text-align: center; font-size: 0.6rem; color: var(--muted); }
.dc-ab { flex: none; padding: 3px 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(253, 230, 138, 0.35); color: #fde68a; text-align: center; line-height: 1.2; font-size: clamp(0.55rem, 8.5cqi, 0.75rem); }
.dc-ab b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-ab small { display: none; margin-top: 2px; color: #fef3c7; font-weight: 400; }
.dc-stats { flex: none; display: flex; gap: 4px; }
.dc-atk, .dc-hp { flex: 1; text-align: center; padding: 2px 0; border-radius: 6px; font-weight: 800; color: #fff; font-size: clamp(0.65rem, 11cqi, 1rem); }
.dc-atk { background: linear-gradient(135deg, #f59e0b, #c2410c); } .dc-hp { background: linear-gradient(135deg, #ef4444, #991b1b); }
.dc-atk.up { box-shadow: 0 0 0 2px #fde68a inset; }
.dc-hp.hurt { background: linear-gradient(135deg, #7f1d1d, #450a0a); color: #fca5a5; }
/* hover / focus shows an enlarged copy above the page (duelPreview), so nothing covers or clips it */
.dcard:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 12px; }
.duel-preview { position: absolute; z-index: 3; pointer-events: none; filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.7)); animation: previewIn 0.12s ease-out; }
.duel-preview .dcard { --dw: 100%; }
@keyframes previewIn { from { opacity: 0; transform: scale(0.9); } }
.dcard.fresh .dc-face { filter: saturate(0.5) brightness(0.75); }
.dcard.pickable { cursor: pointer; }
.dcard.selected .dc-face { box-shadow: 0 0 0 3px #fbbf24, 0 10px 28px rgba(251, 191, 36, 0.35); }
.dcard.unaffordable { opacity: 0.55; }
.dcard.empty-slot { border: 2px dashed var(--line); border-radius: 12px; }
/* The table: their side on top, a middle line, your side below, like across a board */
.duel-table { margin-top: 12px; padding: 14px; border-radius: 18px; background: radial-gradient(ellipse at center, rgba(127, 29, 29, 0.25), rgba(0, 0, 0, 0.35) 70%), #0e0e14; border: 1px solid var(--line); }
.duel-player { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.duel-player .attempts { font-weight: 800; color: #f87171; font-size: 1.05rem; }
.duel-player .energy { display: inline-flex; align-items: center; gap: 5px; } .duel-player .energy i { width: 16px; height: 16px; transform: rotate(45deg); border-radius: 3px; background: rgba(96, 165, 250, 0.16); border: 1.5px solid rgba(96, 165, 250, 0.55); }
.duel-player .energy i.on { background: #3b82f6; border-color: #93c5fd; box-shadow: 0 0 8px #3b82f6; }
.duel-player .energy small { margin-left: 8px; font-size: 0.95rem; font-weight: 800; color: #93c5fd; font-variant-numeric: tabular-nums; white-space: nowrap; } .duel-player .energy small span { font-weight: 600; color: var(--muted); } .duel-player .en-word { font-style: normal; }
.duel-board { --dw: 100%; display: grid; grid-template-columns: repeat(var(--lanes), minmax(0, 1fr)); gap: 12px 14px; margin: 14px auto; max-width: 720px; }
.duel-board .slot { aspect-ratio: 5 / 7; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.06); position: relative; }
.duel-board .slot .dcard { width: 100%; }
.duel-board .slot.target { border: 2px dashed #fbbf24; background: rgba(251, 191, 36, 0.08); cursor: pointer; animation: slotpulse 1.4s ease-in-out infinite; }
@keyframes slotpulse { 50% { background: rgba(251, 191, 36, 0.16); } }
.slot-empty { color: var(--muted); font-size: 0.75rem; }
.duel-mid { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; border-top: 1px dashed rgba(255, 255, 255, 0.12); border-bottom: 1px dashed rgba(255, 255, 255, 0.12); }
.turn-you { color: #fbbf24; }
.duel-outcome { font-size: 1.15rem; } .duel-outcome.won { color: var(--ok); } .duel-outcome.lost { color: var(--danger); }
.duel-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
/* End turn always in reach: the board is taller than a laptop screen, and the bar sat below it */
.duel-actions { position: sticky; bottom: 0; z-index: 50; background: var(--panel-solid); box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.55); }
body:has(.duel-actions) .dm-btn { display: none; } /* it would sit on the bar; the duel has its own chat */
.duel-hand, .duel-row { --dw: 118px; display: flex; gap: 14px; overflow-x: auto; padding: 14px 10px 14px; margin-top: 6px; }
.duel-row { flex-wrap: wrap; overflow: visible; }
@media (hover: hover) and (min-width: 641px) { .duel-hand { flex-wrap: wrap; overflow: visible; } } /* room for a hovered card to grow; touch screens scroll instead */
@media (hover: none) { .duel-hand { mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); } } /* touch, phone or tablet: the fade says it scrolls */
/* with a mouse: one row that overlaps when full (the spacing comes from layoutHand); the card nearest the pointer grows
   up from its bottom edge and the others ease aside (spreadHand) */
.duel-hand.fan { flex-wrap: nowrap; gap: 0; position: relative; }
.duel-hand.fan > .dcard + .dcard { margin-left: var(--ov, 14px); }
.duel-hand.fan > .dcard { transform-origin: 50% 100%; transition: translate 0.2s cubic-bezier(0.22, 1, 0.36, 1), scale 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
.duel-hand.fan > .dcard.focus { z-index: 6; }
.duel-hand.fan > .dcard.focus:not(.selected) .dc-face { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6); }
.duel-hand.fan > .dcard.dragging { transition: none; }
.deck-row { --dw: 104px; } .deck-pool { --dw: 112px; }
.deck-row .dcard[data-remove] { touch-action: none; } /* a finger drags the card to move it instead of scrolling the page */
.duel-history { margin: 0; padding-left: 20px; max-height: 260px; overflow-y: auto; } .duel-history li { margin: 2px 0; } .duel-history li.them { color: #fca5a5; }
.neg { color: var(--danger); }
@media (max-width: 640px) {
  .duel-table { padding: 8px; margin-inline: -8px; }
  .duel-board { gap: 10px 8px; }
  .duel-hand { --dw: 96px; } .deck-row, .deck-pool { --dw: 92px; }
  .deck-row { --dw: 64px; gap: 8px; } /* the whole deck in ~3 short rows, so the cards to add are close; a tap shows one big */
}
/* Duels v4: whose turn it is, card status, the action panel, the match log and the turn replay */
.duel-banner { font-weight: 600; min-height: 1.4em; }
/* the middle line is always one line: long move text ends in "…" (the log has it whole), so the field never changes height */
.duel-mid { gap: 10px; } .duel-banner { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .duel-mid > .row { flex: none; white-space: nowrap; }
/* touch: holding a card is how you drag it, so no "save image" / text-selection menu on cards */
.dcard, .dcard img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } .dcard img { -webkit-user-drag: none; pointer-events: none; }
.slot { overflow: visible; }
.duel-player { position: relative; }
.duel-player.active { background: rgba(251, 191, 36, 0.07); box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.45) inset; }
.turn-chip { padding: 2px 10px; border-radius: 999px; background: #fbbf24; color: #1c1300; font-weight: 800; font-size: 0.75rem; }
.duel-player.them .turn-chip { background: #f87171; color: #250606; }
.dcard.ready .dc-face { box-shadow: 0 0 0 2px #4ade80, 0 0 16px rgba(74, 222, 128, 0.45); }
.dcard.guarded .dc-face { box-shadow: 0 0 0 3px #60a5fa, 0 0 14px rgba(96, 165, 250, 0.5); }
.dcard.ready.guarded .dc-face { box-shadow: 0 0 0 2px #4ade80, 0 0 0 5px #60a5fa; }
.dcard.disabled .dc-face { filter: grayscale(0.85) brightness(0.85); }
.dc-ab.off, .struck { text-decoration: line-through; opacity: 0.65; }
.dc-status { position: absolute; z-index: 3; top: 30px; right: 6px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; line-height: 1; }
.duel-act-main { flex: 1 1 320px; min-width: 0; }
.duel-act-side { gap: 8px; margin-left: auto; }
.duel-info .status-line { display: inline-flex; margin-right: 12px; }
.duel-log { margin: 0; padding: 0; list-style: none; max-height: 300px; overflow-y: auto; font-size: 0.9rem; }
.duel-log li { padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.duel-log li.them { color: #fca5a5; } .duel-log li.turn { color: var(--muted); font-weight: 700; padding-top: 10px; }
.dcard.spell .dc-face { background: linear-gradient(160deg, color-mix(in srgb, #a78bfa 40%, #111), #120b1f 65%); }
.dc-art { position: relative; }
.dc-kind { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(76, 29, 149, 0.9); color: #ede9fe; font-weight: 800; font-size: clamp(0.5rem, 8cqi, 0.7rem); }
.dcard.target .dc-face { box-shadow: 0 0 0 3px #f87171, 0 0 18px rgba(248, 113, 113, 0.6); }
.slot.yours .dcard.target .dc-face { box-shadow: 0 0 0 3px #4ade80, 0 0 18px rgba(74, 222, 128, 0.55); }
.duel-player.target { cursor: pointer; box-shadow: 0 0 0 2px #f87171 inset, 0 0 18px rgba(248, 113, 113, 0.35); }
.turn-chip.hit { background: #f87171; color: #250606; }
.duel-next { margin-top: 4px; color: #fde68a; }
@media (max-width: 640px) {
  .dc-face > .dc-status { transform: scale(0.8); transform-origin: top right; top: 22px; right: 3px; }
  .duel-act-side { width: 100%; justify-content: space-between; }
  .duel-actions .btn.sm { padding: 8px 10px; } /* bigger tap targets */
  .duel-log { max-height: 220px; }
}
.duel-pop { position: absolute; left: 50%; top: 35%; z-index: 9; transform: translate(-50%, 0); font-weight: 900; font-size: 1.5rem; pointer-events: none; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9); animation: popup 1.1s ease-out forwards; }
.duel-pop.dmg { color: #f87171; } .duel-pop.heal { color: #4ade80; } .duel-pop.big { font-size: 2rem; top: -10px; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, 8px) scale(0.7); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }
.anim-enter { animation: dEnter 0.5s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes dEnter { from { opacity: 0; transform: translateY(40px) scale(0.6) rotate(-6deg); } to { opacity: 1; transform: none; } }
.anim-slide { animation: dSlide 0.45s ease-out; } @keyframes dSlide { from { opacity: 0.3; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.anim-glow .dc-face { animation: dGlow 0.6s ease-out; } @keyframes dGlow { 50% { box-shadow: 0 0 0 4px #fde68a, 0 0 30px rgba(253, 230, 138, 0.7); } }
.anim-lunge-up { animation: dLungeUp 0.5s ease-in-out; } @keyframes dLungeUp { 40% { transform: translateY(-38%) scale(1.06); } }
.anim-lunge-down { animation: dLungeDown 0.5s ease-in-out; } @keyframes dLungeDown { 40% { transform: translateY(38%) scale(1.06); } }
.anim-hit { animation: dHit 0.45s ease-out; } @keyframes dHit { 15%, 55% { transform: translateX(-6px) rotate(-2deg); filter: brightness(1.8) saturate(0.4); } 35%, 75% { transform: translateX(6px) rotate(2deg); } }
.anim-die { animation: dDie 0.6s ease-in forwards; } @keyframes dDie { 30% { filter: brightness(2.2); transform: scale(1.05); } 100% { opacity: 0; transform: scale(0.6) rotate(8deg); filter: blur(4px) grayscale(1); } }
@media (prefers-reduced-motion: reduce) { html:not(.motion-on) [class*='anim-'], html:not(.motion-on) .duel-pop { animation: none !important; } }
.duel-timer { font-variant-numeric: tabular-nums; color: #fde68a; }
.duel-timer.urgent { color: #f87171; animation: timerpulse 0.5s ease-in-out infinite alternate; }
@keyframes timerpulse { to { opacity: 0.5; } }
/* your turn's last seconds: the whole table pulses red */
.duel-table.time-low { animation: timelow 0.8s ease-in-out infinite alternate; }
@keyframes timelow { from { box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.5), 0 0 12px rgba(248, 113, 113, 0.2); } to { box-shadow: inset 0 0 0 3px #f87171, 0 0 34px rgba(248, 113, 113, 0.6); } }
@media (prefers-reduced-motion: reduce) { .duel-table.time-low { animation: none; box-shadow: inset 0 0 0 3px #f87171; } }
/* Duels v6: dragging, the targeting arrow and the effects layer */
/* Duel effects (cast spells, hits, banners) sit over the board but under any popup (.modal-bg is 150): an open
   settings or card popup stays on top. */
#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 140; overflow: hidden; }
.fx-num { position: absolute; font-weight: 900; font-size: 1.9rem; letter-spacing: -0.02em; text-shadow: 0 3px 0 #000, 0 0 14px rgba(0, 0, 0, 0.85); white-space: nowrap; }
.fx-num.dmg { color: #f87171; } .fx-num.heal { color: #4ade80; } .fx-num.big { font-size: 2.8rem; }
.fx-spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.35); }
.fx-ring { position: absolute; width: 120px; height: 120px; border: 3px solid; border-radius: 50%; }
.fx-orb { position: absolute; width: 48px; height: 48px; border-radius: 50%; filter: drop-shadow(0 0 14px #a78bfa); }
.fx-arrow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fx-arrow-line { fill: none; stroke: #fbbf24; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 16 12; animation: arrowdash 0.5s linear infinite; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
.fx-arrow-head { fill: #fbbf24; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
.fx-arrow.hot .fx-arrow-line { stroke: #f87171; filter: drop-shadow(0 0 9px rgba(248, 113, 113, 0.95)); } .fx-arrow.hot .fx-arrow-head { fill: #f87171; }
@keyframes arrowdash { to { stroke-dashoffset: -28; } }
.drag-ghost { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.65)); }
.drag-ghost.hot .dc-face { box-shadow: 0 0 0 3px #4ade80, 0 0 26px rgba(74, 222, 128, 0.75); }
.dcard.dragging { opacity: 0.3; }
.duel-dragging, .duel-dragging * { user-select: none; cursor: grabbing !important; }
.duel-dragging .dcard:hover .dc-face { transform: none; }
.duel-dragging .dcard:hover .dc-ab small { display: none; }
.duel-dragging .dcard.drop-hover .dc-face { transform: scale(1.07); box-shadow: 0 0 0 4px #f87171, 0 0 26px rgba(248, 113, 113, 0.8); }
.duel-dragging .slot.yours .dcard.drop-hover .dc-face { box-shadow: 0 0 0 4px #4ade80, 0 0 26px rgba(74, 222, 128, 0.8); }
.slot.drop-hover { background: rgba(74, 222, 128, 0.16) !important; border-color: #4ade80 !important; }
.duel-player.drop-hover { background: rgba(248, 113, 113, 0.18); }
#duelBoard.drop-hover, .duel-table.cast-target .duel-board { outline: 2px dashed rgba(196, 181, 253, 0.7); outline-offset: 6px; border-radius: 12px; }
.dcard img { -webkit-user-drag: none; }
.duel-hand .dcard { touch-action: pan-x; } /* sideways scrolls the hand on touch; up drags the card */
.slot.yours .dcard { touch-action: none; }
.slot.yours .dcard.ready { cursor: grab; }
/* Duels v7: stat badges, piles and the end screen */
.dc-head { padding-left: 30px; min-height: 22px; }
.dc-status { top: 34px; }
/* piles */
.duel-hand-row { display: flex; align-items: flex-end; gap: 10px; }
.duel-hand-row .duel-hand { flex: 1; min-width: 0; }
.duel-piles { display: flex; gap: 12px; flex: none; padding: 14px 4px; }
.pile { position: relative; width: 74px; aspect-ratio: 5 / 7; }
.pile-back { position: absolute; inset: 0; border-radius: 9px; transform: translate(calc(var(--i, 0) * -2px), calc(var(--i, 0) * -3px));
  background: url(/extreme-demon.png) center / 55% no-repeat, repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 6px, transparent 6px 12px), radial-gradient(circle at 50% 40%, #4c1d95, #1e1036 70%);
  border: 2px solid #a78bfa; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55); }
.pile-back.is-empty { background: none; border: 2px dashed rgba(255, 255, 255, 0.18); box-shadow: none; }
.pile-top { position: absolute; inset: 0; --dw: 100%; }
.pile-top .dcard { pointer-events: none; } .pile-top .dc-ab small { display: none !important; }
.pile-count { position: absolute; right: -8px; bottom: -8px; z-index: 4; min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: #0b0b14; border: 2px solid #a78bfa; color: #fff; font-weight: 900; font-size: 0.8rem; }
.pile-label { position: absolute; left: 0; right: 0; top: -18px; text-align: center; font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.discard-pile .pile-count { border-color: #fbbf24; }
.duel-piles.them { padding: 0; gap: 8px; margin-left: auto; align-items: center; }
.duel-piles .pile { flex: none; height: auto; }
.duel-piles.them .pile { width: 30px; } .duel-piles.them .pile-label { display: none; } .duel-piles.them .pile-count { min-width: 20px; height: 20px; font-size: 0.65rem; right: -9px; bottom: -6px; }
.duel-piles.them .pile-top .dc-inner > :not(.dc-thumb) { display: none; } .duel-piles.them .pile-top .dc-thumb { margin: 2px; height: calc(100% - 4px); aspect-ratio: auto; }
.fx-cardback { position: absolute; width: 60px; aspect-ratio: 5 / 7; border-radius: 8px; background: url(/extreme-demon.png) center / 55% no-repeat, radial-gradient(circle at 50% 40%, #4c1d95, #1e1036 70%); border: 2px solid #a78bfa; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); }
/* a card (or card back) in flight between two places: sized to where it starts, moved with transforms only */
.fx-ghost { position: absolute; margin: 0; transform-origin: 50% 50%; will-change: transform; z-index: 2; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.6)); }
.fx-ghost.dcard { --dw: 100%; pointer-events: none; }
.dcard.unseen { visibility: hidden; } /* a drawn card's spot, held until its draw lands there */
.fx-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(var(--vc), 0.55) 100%); }
.fx-banner { position: absolute; padding: 10px 0; text-align: center; font: 900 clamp(1.3rem, 4.2vw, 2.4rem)/1 var(--display); color: #fff; letter-spacing: 0.04em;
  background: linear-gradient(90deg, transparent, rgba(15, 12, 30, 0.88) 18%, rgba(15, 12, 30, 0.88) 82%, transparent); text-shadow: 0 2px 0 #000, 0 0 18px rgba(167, 139, 250, 0.7); border-block: 1px solid rgba(167, 139, 250, 0.45); }
/* a unit's ability going off: a band of light in the ability's colour (--sc) sweeping across the card */
.fx-sweep { position: absolute; overflow: hidden; pointer-events: none; }
.fx-sweep i { position: absolute; top: -10%; bottom: -10%; left: 0; width: 45%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35) 45%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0.35) 55%, transparent);
  mix-blend-mode: plus-lighter; opacity: 0.8; transform: translateX(-120%); }
.fx-sweep i { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--sc) 55%, transparent) 40%, rgba(255, 255, 255, 0.6) 50%, color-mix(in srgb, var(--sc) 55%, transparent) 60%, transparent); }
.fx-banner.mine { text-shadow: 0 2px 0 #000, 0 0 18px rgba(251, 191, 36, 0.75); border-color: rgba(251, 191, 36, 0.55); }
@media (max-width: 640px) { .pile { width: 50px; } .duel-piles { gap: 10px; } .duel-hand-row { gap: 4px; } }
/* end screen: the site's own dialog, a result tag, a plain table */
.duel-end { z-index: 900; }
.duel-end-card { --rc: var(--muted); position: relative; overflow: hidden; isolation: isolate; width: min(440px, 100%); text-align: center;
  background: radial-gradient(100% 45% at 50% -5%, color-mix(in srgb, var(--rc) 16%, transparent), transparent 70%), var(--panel-solid); }
.duel-end-card.res-won { --rc: var(--ok); } .duel-end-card.res-lost { --rc: var(--danger); }
.end-rays { position: absolute; z-index: -1; left: 50%; top: 70px; width: 480px; height: 480px; margin: -240px 0 0 -240px; pointer-events: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--rc) 14%, transparent) 0 8deg, transparent 8deg 20deg); mask-image: radial-gradient(circle, #000 5%, transparent 55%); animation: spin 18s linear infinite; }
.end-title { margin: 12px 0 6px; font-size: clamp(1.8rem, 7vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; color: #fff; text-shadow: 0 0 20px color-mix(in srgb, var(--rc) 55%, transparent); }
.end-sub { margin: 0; font-size: 0.92rem; }
.end-score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.end-score .stat span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-stats { display: grid; gap: 10px; margin-top: 16px; text-align: left; font-size: 0.88rem; }
.end-stat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .end-stat-head b { color: #fff; } .end-stat-head .lead { color: var(--rc); }
.end-bar { height: 4px; margin-top: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.end-bar i { display: block; height: 100%; border-radius: inherit; background: var(--rc); animation: endbar 0.7s 0.2s ease-out both; transform-origin: left; }
@keyframes endbar { from { transform: scaleX(0); } }
.duel-end-actions { gap: 8px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
/* Duels v8: the duel card, laid out like the collection card (cost and type on top, art, name, ability, stats) */
.dc-face { padding: 3px; gap: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 30%, #111) 0%, #0b0b14 60%); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px color-mix(in srgb, var(--tc) 55%, transparent); }
.dcard.spell .dc-face { background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 30%, #111) 0%, #0b0b14 60%); }
.dc-inner { height: 100%; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; container-type: inline-size;
  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); }
.dcard.spell .dc-inner { background: radial-gradient(120% 70% at 50% 110%, rgba(167, 139, 250, 0.22), transparent 70%), linear-gradient(180deg, #17142a, #0b0a14); }
.dc-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 6px 8px 5px; }
.dc-cost { display: inline-flex; align-items: center; gap: 2px; padding: 0; border-radius: 0; background: none; font-weight: 800; font-size: clamp(0.95rem, 13.5cqi, 1.6rem); line-height: 1; letter-spacing: -0.03em; color: #fff; }
.dc-cost svg { width: 0.9em; height: 0.9em; color: #60a5fa; }
.dc-top .tier-badge { font-size: clamp(0.45rem, 5cqi, 0.65rem); }
.dcard.spell .dc-top .tier-badge { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.55); background: rgba(167, 139, 250, 0.18); }
.dc-thumb { margin: 0 8px; flex: none; }
.dc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 7px; }
.dc-name { font-size: clamp(0.62rem, 8cqi, 1rem); -webkit-line-clamp: 1; padding: 0; }
.dc-ab { flex: none; padding: 0; border: 0; background: none; text-align: left; color: #fde68a; font-weight: 700; font-size: clamp(0.5rem, 6.5cqi, 0.8rem); line-height: 1.25; }
.dc-ab b { font-weight: 700; }
.dcard.spell .dc-ab small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-weight: 500; margin-top: 1px; }
.dc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.dc-foot .dc-stat { all: unset; display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: clamp(0.9rem, 13.5cqi, 1.55rem); line-height: 1; letter-spacing: -0.02em; }
.dc-foot .dc-stat svg { width: 0.9em; height: 0.9em; flex: none; }
.dc-foot .dc-atk { color: #fed7aa; } .dc-foot .dc-atk svg { color: #fb923c; }
.dc-foot .dc-hp { color: #fecaca; } .dc-foot .dc-hp svg { color: #f87171; }
.dc-foot .dc-stat small { font-size: 0.62em; color: var(--muted); font-weight: 700; margin-left: 1px; }
.dc-foot .dc-atk.up { color: #fde68a; }
.dc-foot .dc-hp.hurt { color: #f87171; }
.dc-status { top: clamp(26px, 30cqi, 40px); right: 12px; }
/* Duels on phones: board, hand and piles in one screen, the action panel pinned to the bottom */
@media (max-width: 640px) {
  .duel-head { flex-wrap: nowrap; gap: 8px; }
  .duel-head h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .duel-head > .row { flex-wrap: nowrap; flex: none; }
  .duel-head .btn.sm { padding: 5px 9px; min-height: 30px; font-size: 0.75rem; }
  .duel-table { padding: 6px; margin-top: 8px; border-radius: 14px; }
  .duel-player { padding: 4px 8px; gap: 4px 10px; font-size: 0.82rem; min-height: 36px; }
  .duel-player .attempts { font-size: 0.95rem; }
  .duel-player .energy { gap: 2px; } .duel-player .energy i { width: 11px; height: 11px; border-width: 1px; } .duel-player .energy small { margin-left: 5px; font-size: 0.88rem; } .duel-player .en-word { display: none; } /* one line, as before */
  .turn-chip { padding: 2px 8px; font-size: 0.7rem; }
  .duel-board { gap: 5px; margin: 6px auto; width: 88%; } /* a bit narrower: shorter rows, so the hand fits on screen */
  .duel-mid { padding: 3px 2px; font-size: 0.8rem; } .duel-banner { min-height: 1.2em; }
  .duel-hand-row { align-items: center; gap: 0; }
  .duel-hand { --dw: 86px; gap: 8px; padding: 10px 4px 10px 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .duel-piles.you { flex-direction: column; gap: 16px; padding: 8px 10px 8px 6px; }
  .duel-piles.you .pile { width: 36px; } .duel-piles.you .pile-label { display: none; }
  .duel-piles.you .pile-count { min-width: 20px; height: 20px; font-size: 0.65rem; right: -9px; bottom: -6px; }
  .duel-piles.you .pile-top .dc-inner > :not(.dc-thumb) { display: none; } .duel-piles.you .pile-top .dc-thumb { margin: 2px; height: calc(100% - 4px); aspect-ratio: auto; }
  .duel-actions { margin-top: 8px; padding: 8px 10px; gap: 6px; }
  .duel-act-main { flex-basis: 100%; } .duel-act-main > .small { font-size: 0.75rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .duel-info { font-size: 0.85rem; } .duel-info .small { font-size: 0.78rem; }
  .duel-act-side { width: 100%; justify-content: space-between; } .duel-act-side .btn { min-height: 36px; padding: 6px 14px; }
  .dc-top { padding: 4px 5px 3px; } .dc-thumb { margin: 0 5px; } .dc-body { padding: 4px 5px 5px; gap: 1px; }
  .dcard.spell .dc-ab small { display: none; } /* too small to read here: tap the card, the panel shows it */
  .dc-foot { padding-top: 3px; }
  /* small board cards: cost, art, name and the two stats; the ability is a tap away (the panel shows it) */
  .slot .dc-ab, .slot .dc-top .tier-badge { display: none; }
  .slot .dc-top { padding: 3px 4px 2px; } .slot .dc-thumb { margin: 0 3px; } .slot .dc-body { padding: 3px 4px 4px; }
  .slot .dc-name { font-size: clamp(0.55rem, 12cqi, 0.8rem); }
  .slot .dc-foot .dc-stat { font-size: clamp(0.7rem, 15cqi, 1rem); gap: 1px; } .slot .dc-foot .dc-stat svg { width: 0.75em; height: 0.75em; }
  .slot .dc-foot .dc-stat small { font-size: 0.6em; margin-left: 0; }
  .slot .dc-status { top: 18px; right: 3px; }
}
/* Duels v9: the ability text is always there, sized by fitDuelText to the biggest font that fits */
.dc-body .dc-ab { flex: 1 1 auto; min-height: calc(1.25em + 2px); display: flex; flex-direction: column; overflow: hidden; }
.dc-body .dc-ab b { flex: none; line-height: 1.25; padding-bottom: 1px; }
.dc-body .dc-name { flex: none; } /* the name keeps its line; only the ability text gives way */
.dc-body .dc-ab small, .dcard.spell .dc-body .dc-ab small { display: block !important; flex: 1 1 auto; min-height: 0; overflow: hidden; margin-top: 1px; color: #e5e7eb; font-weight: 500; line-height: 1.2; -webkit-line-clamp: unset; }
.dc-foot { flex: none; }
@media (max-width: 640px) {
  /* small board cards: the space goes to the ability text (the card's name and the ability's name are a tap away) */
  .slot .dc-ab { display: flex !important; } .slot .dc-name, .slot .dc-ab b { display: none; }
  .slot .dc-thumb { aspect-ratio: 2.4 / 1; }
  .dcard.spell .dc-ab small { display: block !important; }
}
/* Narrow cards (under ~90px): every part scales with the card, since the parts' rem minimums overflowed a 5:7 card that small.
   Board slots keep their own sizes (.slot rules are more specific). */
@container (max-width: 90px) {
  .dc-top { padding: 3cqi 5cqi 2cqi; }
  .dc-cost { font-size: 17cqi; }
  .dc-top .tier-badge { font-size: 7.5cqi; }
  .dc-thumb { margin: 2cqi 5cqi 0; }
  .dc-body { padding: 3cqi 5cqi 4cqi; gap: 0; }
  .dc-name { font-size: 12cqi; }
  .dc-ab { font-size: 10cqi; }
  .dc-foot { padding-top: 2cqi; }
  .dc-foot .dc-stat { font-size: 16cqi; }
}
/* the coin flip */
/* the coin flip: the site's dialog with a flat coin (gold for you, grey for them) */
.duel-coin { z-index: 950; }
.duel-coin-card { width: min(320px, 100%); text-align: center; perspective: 900px; }
.duel-coin-card h2 { margin: 0 0 16px; }
.coin { position: relative; width: 112px; height: 112px; margin: 0 auto; transform-style: preserve-3d; }
.coin-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; border-radius: 50%; backface-visibility: hidden; font-weight: 700; font-size: 1rem; line-height: 1.15; overflow-wrap: anywhere;
  background: var(--panel-solid); border: 3px solid var(--gold); color: var(--gold); box-shadow: inset 0 0 0 5px rgba(251, 191, 36, 0.1); }
.coin-face.back { transform: rotateY(180deg); border-color: var(--muted); color: var(--text); box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.05); }
.duel-coin-text { margin: 16px 0 0; min-height: 1.4em; color: var(--muted); }
.duel-coin-text b { color: var(--text); }
/* the Duels page: play box and deck side by side, then matches */
.duel-lobby { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-top: 12px; }
.duel-find { display: flex; flex-direction: column; gap: 14px; }
.duel-find h2, .duel-deckbox h2 { margin: 0; }
.duel-find-main { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.duel-find-main p { margin: 0; }
.btn.lg { font-size: 1.1rem; padding: 14px 30px; min-height: 52px; border-radius: 12px; }
.duel-searching { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.duel-searching b { font-variant-numeric: tabular-nums; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.duel-find-alt { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.duel-deckbox { display: flex; flex-direction: column; gap: 12px; }
.duel-deckbox p { margin: 0; }
/* your saved decks: ‹ name · 2 of 5 › (the one shown is the one matches use) */
.deck-switch { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.deck-switch .btn { flex: none; min-width: 36px; font-size: 1.1rem; line-height: 1; }
.deck-switch-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.deck-switch-name b { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-slots { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.deck-slots .field { min-width: 0; } .deck-slots select { max-width: 100%; }
.deck-slots .deck-name { flex: 1 1 180px; } .deck-slots .deck-name input { width: 100%; }
.deck-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
/* the whole duel cards, 4 a row (12 = 3 rows); the deck box has the room */
.deck-mini { --dw: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.duel-when { margin-left: 4px; }
@media (max-width: 760px) { .duel-lobby { grid-template-columns: 1fr; } .deck-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } }
@media (prefers-reduced-motion: reduce) { html:not(.motion-on) .spinner { animation-duration: 2s; } }
.beta-chip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; color: var(--gold); background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.5); line-height: 1.5; }
.beta-chip.lg { font-size: 0.75rem; padding: 2px 8px; vertical-align: 0.35em; }
.queue-count { font-size: 0.85rem; color: var(--muted); }
.queue-count::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); vertical-align: 0.05em; }
/* a bold first letter (T, W…) sticks out a pixel; give the clipped boxes that pixel so it isn't cut */
.dc-body .dc-name, .dc-body .dc-ab b, .dc-body .dc-ab small { padding-inline: 1px; }
/* attacking the player when their board is empty: their whole half is the target */
.duel-table { position: relative; }
.their-half-zone { position: absolute; left: 0; right: 0; top: 0; z-index: 2; pointer-events: none; display: grid; place-items: center; border: 2px solid rgba(248, 113, 113, 0.55); border-radius: 18px 18px 6px 6px; background: rgba(248, 113, 113, 0.07); transition: background 0.15s, border-color 0.15s; }
.their-half-zone span { padding: 6px 14px; border-radius: 999px; background: rgba(8, 8, 14, 0.8); border: 1px solid rgba(248, 113, 113, 0.6); color: #fca5a5; font-weight: 700; opacity: 0.85; }
.duel-table.their-half-hot .their-half-zone { background: rgba(248, 113, 113, 0.2); border-color: #f87171; }
.duel-table.their-half-hot .their-half-zone span { opacity: 1; color: #fff; }
.duel-table.their-half-open .duel-player.them.target { box-shadow: none; } /* the zone says it all */
/* status effects: flat labelled chips on the card (like its UNIT tag), explained in a plain panel beside it */
.dc-status { gap: 3px; align-items: flex-end; }
@media (max-width: 640px) { .slot .dc-status i em { display: none; } .slot .dc-status i { padding: 0.2em 0.25em; } }
/* A unit's states. One hue per state (--c), shared by the chip on the card, the note beside it and the line in the panel. */
.s-ready { --c: #4ade80; } .s-fresh { --c: #a1a1aa; } .s-safe { --c: #60a5fa; } .s-zeroed { --c: #f472b6; } .s-frozen { --c: #67e8f9; } .s-silenced { --c: #f87171; }
.s-stolen { --c: #c084fc; } .s-doom { --c: #fb923c; } .s-lust { --c: #f43f5e; } .s-poison { --c: #a3e635; } .s-boost { --c: #facc15; } .s-learned { --c: #34d399; }
.dc-status i { display: inline-flex; align-items: center; gap: 0.3em; width: auto; height: auto; padding: 0.2em 0.5em; border-radius: 4px; font-style: normal; font-size: clamp(0.5rem, 7.5cqi, 0.8rem); line-height: 1;
  color: var(--c); background: #0d0d14; background: color-mix(in srgb, var(--c) 22%, #0d0d14); border: 1px solid rgba(255, 255, 255, 0.25); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); } /* the card's UNIT tag, in the state's colour */
.dc-status i > span { flex: none; display: grid; place-items: center; }
.dc-status i > span svg { width: 1.05em; height: 1.05em; }
.dc-status i em { font-style: normal; font-weight: 700; letter-spacing: 0.02em; color: inherit; }
.note-ic { flex: none; display: grid; place-items: center; color: var(--c, #a1a1aa); }
.note-ic svg { width: 15px; height: 15px; }
.status-note .note-state { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; align-items: center; }
.status-note .note-state .note-ic { grid-row: span 2; align-self: start; margin-top: 2px; }
.status-note .note-state b { font-size: 0.85rem; line-height: 1.25; color: var(--c); }
.status-note .note-tip { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.status-line { display: inline-flex; align-items: center; gap: 5px; margin-right: 14px; } .status-line .note-ic svg { width: 13px; height: 13px; } .status-line b { color: var(--c); }
.status-note { position: absolute; z-index: 4; max-width: 260px; margin: 0; padding: 10px 12px; list-style: none; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); font-size: 0.82rem; line-height: 1.35; display: grid; gap: 9px; pointer-events: none; animation: previewIn 0.12s ease-out; }
/* the opponent's spell, shown big for a moment */
.spell-reveal { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); width: min(230px, 55vw); display: grid; gap: 8px; justify-items: center; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.75)); }
.spell-reveal .dcard { --dw: 100%; width: 100%; }
.spell-reveal-label { padding: 4px 12px; border-radius: 999px; background: var(--panel-solid); border: 1px solid rgba(196, 181, 253, 0.6); color: #ddd6fe; font-weight: 700; font-size: 0.9rem; }
/* the duel page: the game, with the match chat beside it */
.duel-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.duel-main { min-width: 0; }
.duel-chat { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - 96px); margin-top: 12px; padding: 14px; }
.duel-chat h2 { margin: 0; font-size: 1rem; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 120px; flex: 1; display: grid; align-content: start; gap: 6px; font-size: 0.88rem; overflow-wrap: anywhere; }
.chat-list li b { margin-right: 4px; } .chat-player { color: var(--gold); } .chat-watcher { color: #93c5fd; }
.chat-body { display: block; color: var(--text); }
.chat-form { display: flex; gap: 6px; } .chat-form input { flex: 1; min-width: 0; }
@media (max-width: 1100px) { .duel-layout { grid-template-columns: 1fr; } .duel-chat { position: static; max-height: 360px; } }
.duel-search-results { display: grid; gap: 6px; margin-top: 10px; }
.duel-search-results p { margin: 4px 0 0; }
/* Duels: hand limit, casting from the board, touch */
.hand-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hand-count.full { color: #fbbf24; font-weight: 700; } .hand-count.full b { padding: 0 5px; border-radius: 999px; background: rgba(251, 191, 36, 0.18); font-size: 0.7rem; text-transform: uppercase; }
.duel-mid { position: relative; }
/* laid over the middle line, not in it: showing or hiding it never resizes the field */
.cast-mid { position: absolute; left: 4px; top: 50%; translate: 0 -50%; z-index: 3; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: castglow 1.2s ease-in-out infinite alternate; }
@keyframes castglow { from { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.3); } to { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.35), 0 0 22px rgba(251, 191, 36, 0.55); } }
@media (max-width: 640px) {

  .hand-count { font-size: 0.72rem; }
  .cast-mid { min-height: 34px; padding: 4px 14px; }
}
/* the one 8-energy card (Ragequit): a still black-and-crimson frame, unlike any tier's */
.dcard.top-cost .dc-face { padding: 3px; background: linear-gradient(160deg, #991b1b, #0a0a0a 40%, #0a0a0a 60%, #991b1b); }
/* its shadow at the lowest priority, so the ready / guarded / selected / target glows win */
:where(.dcard.top-cost) .dc-face { box-shadow: 0 0 0 1px #000, 0 6px 20px rgba(0, 0, 0, 0.6); }
.dcard.top-cost .dc-inner { background: linear-gradient(180deg, #1a0a0a, #080606); box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35); }
.dcard.top-cost .dc-top .dc-cost { color: #fca5a5; } .dcard.top-cost .dc-cost svg { color: #ef4444; }
.status-note.with-token { max-width: none; padding: 0; background: none; border: 0; box-shadow: none; }
.status-note.with-token > li:not(.note-token) { justify-self: start; max-width: 260px; padding: 10px 12px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); }
.status-note .note-token { display: grid; gap: 4px; }
.status-note .note-token > span { justify-self: start; padding: 2px 10px; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.status-note .note-token .dcard { filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.55)); }
.status-note .note-token .dcard { --dw: 100%; width: 100%; }
.status-note .note-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }

/* ---------- duel cosmetics (src/cosmetics.js) ---------- */

/* Board themes (Supporters): a layer behind each half of the table, split at the middle line (--mid, set by the page). */
.duel-table { isolation: isolate; }
/* the board is for tapping, not reading: no text selection or blinking text cursor (caret browsing) when you click a slot */
.duel-table { -webkit-user-select: none; user-select: none; caret-color: transparent; }
.duel-table :is(input, textarea) { -webkit-user-select: text; user-select: text; caret-color: auto; }
.arena-half { position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; opacity: 0.75; filter: brightness(0.8); overflow: hidden; }
.style-opt .board-swatch .arena-half { opacity: 1; filter: none; top: 0; bottom: 0; -webkit-mask: none; mask: none; }
.style-opt .board-swatch .arena-half::after { display: none; } /* no edge vignette at preview size */ /* the picker shows them at full strength */
/* on a themed half the empty slots get a dark fill and a brighter outline, so they stand out from the pattern */
.duel-table:has(.arena-half.you) .slot.yours, .duel-table:has(.arena-half.them) .slot.theirs { background: rgba(6, 6, 12, 0.62); border-color: rgba(255, 255, 255, 0.24); }
/* each half runs a little past the middle line and fades out there, so the two blend instead of meeting at a hard edge */
.arena-half.them { top: 0; height: calc(var(--mid, 45%) + 30px); border-radius: 18px 18px 0 0; -webkit-mask: linear-gradient(#000 calc(100% - 90px), transparent); mask: linear-gradient(#000 calc(100% - 90px), transparent); }
.arena-half.you { top: calc(var(--mid, 45%) - 30px); bottom: 0; border-radius: 0 0 18px 18px; -webkit-mask: linear-gradient(transparent, #000 90px); mask: linear-gradient(transparent, #000 90px); }
/* a mirrored half (scaleY(-1)) flips its mask too: give it the other one */
.arena-half.them:is(.board-blocks, .board-neon, .board-lava) { -webkit-mask: linear-gradient(transparent, #000 90px); mask: linear-gradient(transparent, #000 90px); }
@media (prefers-reduced-motion: reduce) { .arena-half, .sleeve::after, .sleeve { animation: none !important; } }

/* Board and sleeve pickers (deck page) */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.style-opt { display: grid; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: inherit; font: inherit; cursor: pointer; text-align: center; }
.style-opt[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35); }
.style-opt:disabled { cursor: not-allowed; opacity: 0.55; }
.style-opt .board-swatch { height: 64px; border-radius: 8px; position: relative; overflow: hidden; background: #0e0e14; isolation: isolate; }
.style-opt .sleeve-swatch { display: grid; place-items: center; padding: 6px 0; }
.style-opt .sleeve-swatch .sleeve { position: relative; width: 62px; aspect-ratio: 5 / 7; }

/* Quick emotes: a button in your bar opens them; a bubble pops by the sender's bar */
.emote-ctl { margin-left: auto; } /* the popover is placed on your bar (.duel-player is relative), so it stays on screen */
.emote-toggle { width: 34px; height: 34px; padding: 0; line-height: 1; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; }
.emote-toggle:hover, .emote-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, 0.14); }
.emote-pop { position: absolute; right: 8px; bottom: calc(100% + 8px); z-index: 6; display: grid; grid-template-columns: repeat(3, auto); gap: 6px; padding: 8px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6); animation: previewIn 0.12s ease-out; }
.emote-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap; }
.emote-btn span { font-size: 1.1rem; }
.emote-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.emote-btn.sup { border-color: rgba(244, 114, 182, 0.55); background: linear-gradient(90deg, rgba(244, 114, 182, 0.15), rgba(129, 140, 248, 0.15)); }
.emote-btn:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 640px) { .emote-pop { left: 6px; right: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); } .emote-btn { justify-content: center; padding: 5px 4px; font-size: 0.74rem; } }
.emote-bubble { position: absolute; z-index: 45; padding: 8px 14px; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--line); font-weight: 800; font-size: 1.05rem; white-space: nowrap; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); animation: emoteIn 2.6s ease-out forwards; }
.emote-bubble .ei { font-size: 1.6rem; vertical-align: middle; margin-right: 6px; display: inline-block; }
.emote-bubble.sup { border: 2px solid transparent; background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box, conic-gradient(from var(--ang), #f472b6, #818cf8, #22d3ee, #fbbf24, #f472b6) border-box; animation: emoteIn 2.6s ease-out forwards, frameSpin 4s linear infinite; }
.emote-bubble.sup .ei { animation: emoteBounce 1.1s ease-in-out infinite alternate; }
@keyframes emoteIn { 0% { opacity: 0; transform: translateY(8px) scale(0.6); } 10% { opacity: 1; transform: translateY(0) scale(1.08); } 18% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes emoteBounce { to { transform: translateY(-4px) rotate(-8deg) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .emote-bubble, .emote-bubble.sup, .emote-bubble.sup .ei { animation: none; } }

/* Chat: as tall as the table on wide screens (--field-h from the page), the list scrolls inside */
@media (min-width: 1101px) { .duel-chat { position: static; height: var(--field-h, 640px); max-height: none; } }
.chat-list { min-height: 0; overscroll-behavior: contain; }

/* A hand you can't see: card backs fanned out (--k: -n/2 .. n/2) */
.hand-fan { display: inline-flex; align-items: flex-end; height: 96px; padding: 0 14px; margin-inline: auto; }
.hand-fan .sleeve { position: relative; width: 62px; aspect-ratio: 5 / 7; margin-left: -26px; transform-origin: 50% 140%; transform: rotate(calc(var(--k) * 6deg)) translateY(calc(var(--k) * var(--k) * 1.4px)); backface-visibility: hidden; will-change: transform; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55); transition: transform 0.25s; }
.hand-fan .sleeve:first-child { margin-left: 0; }
.duel-hand .hand-fan { height: 96px; } .duel-hand .hand-fan .sleeve { width: 58px; margin-left: -24px; }
@media (max-width: 640px) { .hand-fan { height: 54px; } .hand-fan .sleeve { width: 34px; margin-left: -15px; } }


/* ---- Board themes ----
   A gradient mesh in one palette, one signature detail (::before) and a vignette (::after) keeping the slots readable. */
.arena-half::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 90% at 50% 50%, transparent 55%, oklch(8% 0.02 280 / 0.75)); }
/* Synthwave (Neon Grid): magenta horizon glow, a cyan grid fading into the distance */
.board-neon { background: radial-gradient(ellipse 70% 45% at 50% 100%, oklch(62% 0.25 340 / 0.85), transparent 70%), radial-gradient(ellipse 50% 50% at 12% 15%, oklch(42% 0.2 300 / 0.8), transparent 70%),
  radial-gradient(ellipse 45% 45% at 90% 25%, oklch(38% 0.17 265 / 0.8), transparent 70%), oklch(15% 0.06 300); }
.board-neon::before { content: ''; position: absolute; left: -60%; right: -60%; top: 45%; height: 110%; transform-origin: top; transform: perspective(180px) rotateX(60deg);
  background: linear-gradient(90deg, oklch(82% 0.13 200 / 0.55) 1px, transparent 1px) 0 0 / 38px 100%, linear-gradient(oklch(82% 0.13 200 / 0.55) 1px, transparent 1px) 0 0 / 100% 38px;
  -webkit-mask: linear-gradient(transparent, #000 45%); mask: linear-gradient(transparent, #000 45%); animation: neonRun 6s linear infinite; }
/* Molten Core: basalt, a low glow of lava from below, a few slow embers */
.board-lava { background: radial-gradient(ellipse 65% 60% at 22% 100%, oklch(72% 0.19 55 / 0.95), transparent 70%), radial-gradient(ellipse 70% 60% at 82% 100%, oklch(56% 0.22 28 / 0.95), transparent 72%),
  radial-gradient(ellipse 70% 50% at 50% 0%, oklch(24% 0.05 30), transparent 80%), oklch(13% 0.025 30); background-size: 130% 130%; animation: meshDrift 26s ease-in-out infinite alternate; }
.board-lava::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, oklch(85% 0.14 70) 0 1px, transparent 1.6px) 0 0 / 61px 53px, radial-gradient(circle, oklch(75% 0.17 50 / 0.8) 0 0.8px, transparent 1.4px) 30px 20px / 47px 59px;
  -webkit-mask: linear-gradient(transparent 20%, #000 85%); mask: linear-gradient(transparent 20%, #000 85%); animation: embersUp 16s linear infinite; }
/* Aurora (Frostbite): teal and violet ribbons over a midnight sky */
.board-frost { background: radial-gradient(ellipse 60% 40% at 50% 120%, oklch(30% 0.06 230), transparent 70%), oklch(16% 0.045 250); }
.board-frost::before { content: ''; position: absolute; inset: -20% -10%; filter: blur(14px);
  background: radial-gradient(ellipse 50% 22% at 30% 38%, oklch(80% 0.15 175 / 0.95), transparent 70%), radial-gradient(ellipse 45% 20% at 66% 48%, oklch(66% 0.18 290 / 0.85), transparent 70%), radial-gradient(ellipse 40% 16% at 82% 32%, oklch(82% 0.14 150 / 0.7), transparent 70%);
  animation: auroraSway 18s ease-in-out infinite alternate; }
/* Starfield: indigo depth, a soft milky band, still stars and a few that slowly twinkle */
.board-stars { background: radial-gradient(circle, oklch(97% 0.01 280) 0 0.8px, transparent 1.4px) 0 0 / 53px 47px, radial-gradient(circle, oklch(85% 0.08 290) 0 0.8px, transparent 1.4px) 25px 30px / 71px 61px,
  linear-gradient(155deg, transparent 30%, oklch(55% 0.14 300 / 0.35) 46%, oklch(60% 0.15 350 / 0.22) 54%, transparent 68%), radial-gradient(ellipse 80% 70% at 75% 15%, oklch(30% 0.12 280), oklch(11% 0.04 280) 75%); }
.board-stars::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, #fff 0 1.4px, oklch(90% 0.06 280 / 0.35) 2.4px, transparent 3.6px) 14px 22px / 150px 120px; animation: twinkle 6s ease-in-out infinite alternate; }
/* Royal (Royal Gold): crimson velvet, a fine gold lattice that fades toward the edges */
.board-royal { background: radial-gradient(ellipse 70% 70% at 50% 45%, oklch(38% 0.15 18), oklch(20% 0.08 15) 60%, oklch(12% 0.03 15)); }
.board-royal::before { content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle, transparent 0 5px, oklch(80% 0.13 85 / 0.55) 5.5px 6.2px, transparent 6.8px) 0 0 / 40px 40px,
  linear-gradient(45deg, transparent calc(50% - 0.5px), oklch(80% 0.13 85 / 0.28) 50%, transparent calc(50% + 0.5px)) 0 0 / 40px 40px, linear-gradient(-45deg, transparent calc(50% - 0.5px), oklch(80% 0.13 85 / 0.28) 50%, transparent calc(50% + 0.5px)) 0 0 / 40px 40px;
  -webkit-mask: radial-gradient(ellipse at center, #000 30%, transparent 75%); mask: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
/* Geometry: the familiar blue backdrop, faint blocks, a checkered ground with a bright edge */
.board-blocks { background: linear-gradient(oklch(100% 0 0 / 0.06) 1.5px, transparent 1.5px) 0 0 / 46px 46px, linear-gradient(90deg, oklch(100% 0 0 / 0.06) 1.5px, transparent 1.5px) 0 0 / 46px 46px,
  linear-gradient(oklch(52% 0.2 262), oklch(30% 0.14 265) 70%); }
.board-blocks::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 20%; background: linear-gradient(oklch(98% 0.01 260), oklch(98% 0.01 260)) top / 100% 2px no-repeat,
  repeating-conic-gradient(oklch(34% 0.15 265) 0 25%, oklch(28% 0.13 265) 0 50%) 0 0 / 46px 46px; box-shadow: 0 -10px 24px oklch(70% 0.15 230 / 0.3); animation: groundRun 6s linear infinite; }
.arena-half.them:is(.board-blocks, .board-neon, .board-lava) { transform: scaleY(-1); } /* horizon, ground and lava on the outer edge for both players */
@keyframes neonRun { to { background-position: 0 0, 0 38px; } }
@keyframes embersUp { to { background-position: 0 -53px, 30px -98px; } }
@keyframes meshDrift { to { background-position: 100% 100%; } }
@keyframes auroraSway { from { transform: translateX(-4%) skewX(-4deg); } to { transform: translateX(4%) skewX(4deg); } }
@keyframes twinkle { from { opacity: 0.3; } to { opacity: 1; } }
@keyframes groundRun { to { background-position: top, -46px 0; } }

/* ---- Card sleeves ----
   Vector art in /sleeves/<key>.svg. Images are cached for a day: bump ?v= when a sleeve changes. */
.sleeve { border-radius: 9px; overflow: hidden; border: 0; background: url(/sleeves/default.svg?v=2) center / 100% 100% no-repeat; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.45); }
.sleeve::before { content: ''; position: absolute; inset: 0; background: url(/extreme-demon.png) center / 38% no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.sleeve-prism { background-image: url(/sleeves/prism.svg?v=2); } .sleeve-ember { background-image: url(/sleeves/ember.svg?v=2); } .sleeve-nebula { background-image: url(/sleeves/nebula.svg?v=2); }
.sleeve-frost { background-image: url(/sleeves/frost.svg?v=2); } .sleeve-deco { background-image: url(/sleeves/deco.svg?v=2); }
.sleeve-neon { background-image: url(/sleeves/neon.svg?v=2); box-shadow: 0 0 12px rgba(34, 211, 238, 0.35), 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.45); }
.sleeve-prism::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, transparent 66%) 0 0 / 260% 100%; animation: foilSweep 9s ease-in-out infinite; }
@keyframes foilSweep { 0%, 100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }
@media (prefers-reduced-motion: reduce) { .arena-half, .arena-half::before, .sleeve::after { animation: none !important; } }


/* Browsing a pile: the piles are buttons, the popup lists the cards */
.pile.browsable { cursor: pointer; } .pile.browsable:hover .pile-back, .pile.browsable:hover .pile-top { filter: brightness(1.15); }
.pile.browsable:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 10px; }
.modal.pile-modal { width: min(920px, 94vw); max-width: none; }
.modal.prefs-modal { width: min(400px, 100%); }
.modal.zoom-modal { width: min(340px, 100%); padding-top: 34px; }
.card-zoom { --dw: min(240px, 70vw); display: flex; justify-content: center; }
.card-zoom-made { --dw: min(120px, 36vw); display: flex; justify-content: center; gap: 10px; }
.pile-modal .pile-list { --dw: 122px; flex-wrap: wrap; justify-content: center; max-height: 65vh; overflow-y: auto; padding: 14px 6px; }

/* Customize button (deck page) and its panel */
.customize-btn { border-color: rgba(244, 114, 182, 0.6); background: linear-gradient(90deg, rgba(244, 114, 182, 0.18), rgba(129, 140, 248, 0.18)); font-weight: 700; }
.customize-btn:hover { background: linear-gradient(90deg, rgba(244, 114, 182, 0.3), rgba(129, 140, 248, 0.3)); }
.customize-btn { gap: 7px; } .customize-btn svg { flex: none; color: #f9a8d4; } /* the sparkles, in the button's pink */
.modal.look-modal { width: min(1000px, 94vw); max-width: none; }

/* Duel balance table (mod panel) */
.duel-stats td, .duel-stats th { white-space: nowrap; }
.th-sort { all: unset; cursor: pointer; font-weight: 700; } .th-sort:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.stat .stat-list { font-size: 0.95rem; line-height: 1.5; }
.wr-hi { color: var(--ok); font-weight: 700; } .wr-lo { color: #f87171; font-weight: 700; }

/* ---------- Admin: alt accounts ---------- */
.c-hi { color: #f87171; } .c-mid { color: #fbbf24; } .c-lo { color: var(--muted); }
.dot-count.quiet { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.status.tag { font-size: 0.62rem; padding: 1px 6px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
kbd { font-family: var(--body); font-size: 0.7em; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.linkish { all: unset; cursor: pointer; color: var(--gold); font-weight: 600; } .linkish:hover { text-decoration: underline; } .linkish:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.alt-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.alt-tabs { margin: 0; }
.alt-scan { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.alt-scan .spinner { width: 14px; height: 14px; border-width: 2px; }
.alt-how { flex-basis: 100%; } .alt-how summary { cursor: pointer; color: var(--muted); } .alt-how p { margin: 8px 0 0; max-width: 80ch; }
/* filters: search, sort and the Filters toggle on one line; the rest folds out (always shown on wide screens) */
.alt-filter { margin-top: 12px; display: grid; gap: 12px; }
.alt-filter-main { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.alt-filter-main .alt-q { flex: 1 1 220px; }
.alt-more { align-self: flex-end; margin-bottom: 2px; }
.alt-filter-more { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
@media (max-width: 900px) { .alt-filter:not(.more-open) .alt-filter-more { display: none; } }
@media (min-width: 901px) {
  .alt-more { display: none; }
  /* wide screens: every select on the search row, the signal chips under it */
  .alt-filter { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
  .alt-filter-main, .alt-filter-more { display: contents; }
  .alt-filter .field select { min-width: 0; }
}
.alt-filter .field { font-size: 0.8rem; }
.alt-sigfilter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 auto; order: 10; }
#altClear { order: 11; }
.chip-toggle { font: inherit; font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--text); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.chip-toggle:hover { border-color: var(--muted); }
.chip-toggle[aria-pressed='true'] { color: #fecaca; background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.6); }
/* list on the left, the account being investigated on the right (a full-screen sheet on phones) */
.alt-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); gap: 16px; align-items: start; margin-top: 12px; }
.alt-results { margin: 0 0 8px; } .alt-keys { white-space: nowrap; }
.alt-cl { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.alt-cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid var(--line); }
.alt-cl-name { all: unset; cursor: pointer; display: flex; align-items: baseline; gap: 6px; min-width: 0; border-radius: 6px; padding: 2px 4px; }
.alt-cl-name b { font-size: 1.02rem; color: var(--gold); overflow-wrap: anywhere; }
.alt-cl-name:hover b { text-decoration: underline; } .alt-cl-name.active { background: rgba(251, 191, 36, 0.12); } .alt-cl-name:focus-visible { outline: 2px solid var(--gold); }
.alt-cl-meta { color: var(--muted); } .alt-cl-meta b { color: var(--text); }
.alt-cl-actions { display: flex; gap: 6px; margin-left: auto; }
.alt-cl-actions .btn { padding: 3px 9px; font-size: 0.75rem; }
.alt-rows { list-style: none; margin: 0; padding: 0; }
.alt-row { display: flex; align-items: center; border-top: 1px solid var(--line); }
.alt-row:first-child { border-top: 0; }
.alt-row.active { background: rgba(251, 191, 36, 0.09); box-shadow: inset 3px 0 var(--gold); }
.alt-check { display: grid; place-items: center; padding: 0 4px 0 12px; align-self: stretch; cursor: pointer; }
.alt-check input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.alt-row-main { all: unset; box-sizing: border-box; flex: 1; min-width: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 12px 7px 6px; cursor: pointer; }
.alt-row-main:hover { background: rgba(255, 255, 255, 0.03); } .alt-row-main:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.alt-row-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.alt-row-name { display: flex; align-items: center; min-width: 0; } .alt-row-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alt-note-dot { margin-left: 6px; color: var(--gold); font-size: 0.8rem; }
.alt-row-who .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alt-showmore { all: unset; display: block; width: 100%; box-sizing: border-box; text-align: center; padding: 7px; font-size: 0.8rem; color: var(--gold); cursor: pointer; border-top: 1px solid var(--line); }
.alt-showmore:hover { background: rgba(255, 255, 255, 0.03); }
.conf { position: relative; display: block; height: 22px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); overflow: hidden; text-align: center; }
.conf i { position: absolute; inset: 0 auto 0 0; opacity: 0.28; background: currentColor; }
.conf b { position: relative; line-height: 22px; font-size: 0.8rem; }
.conf.big { width: 76px; height: 32px; flex: none; } .conf.big b { line-height: 32px; font-size: 1.05rem; }
.conf.mini { display: inline-block; height: 16px; padding: 0 5px; vertical-align: middle; } .conf.mini b { line-height: 16px; font-size: 0.68rem; } .conf.mini i { display: none; }
.alt-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 240px; }
.alt-chip { font-size: 0.66rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(248, 113, 113, 0.12); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.3); white-space: nowrap; }
/* the investigation panel */
.alt-detail { position: sticky; top: 72px; max-height: calc(100dvh - 88px); overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; }
.alt-d-empty { text-align: center; padding: 40px 10px; } .alt-d-empty p { margin: 8px 0 0; }
.alt-d-head { display: flex; align-items: center; gap: 12px; }
.alt-d-title { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; flex: 1; }
.alt-d-title h2 { margin: 0; font-size: 1.35rem; overflow-wrap: anywhere; }
.alt-d-close { display: none; }
.alt-d-facts { margin: 6px 0 0; } .alt-d-flow { margin: 8px 0 0; }
.alt-d-actions { gap: 6px; margin-top: 12px; } .alt-d-actions kbd { margin-left: 4px; }
.alt-d-nav { gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); align-items: center; } .alt-d-nav .check { margin-left: auto; }
.alt-note { margin-top: 12px; } .alt-note .row { gap: 6px; align-items: stretch; margin-top: 4px; } .alt-note textarea { flex: 1; min-width: 0; resize: vertical; }
.alt-d-graph { margin: 12px auto 0; max-width: 300px; }
.alt-detail h4 { margin: 16px 0 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.alt-graph { width: 100%; height: auto; display: block; }
.alt-graph .edge { stroke-linecap: round; opacity: 0.55; stroke: var(--muted); }
.alt-graph .edge.c-hi { stroke: #f87171; } .alt-graph .edge.c-mid { stroke: #fbbf24; }
.alt-graph .node { cursor: pointer; } .alt-graph .node:focus { outline: none; }
.alt-graph .node circle { fill: #3f3f46; stroke: #0b0b12; stroke-width: 2; }
.alt-graph .node.c-hi circle { fill: #ef4444; } .alt-graph .node.c-mid circle { fill: #f59e0b; } .alt-graph .node.c-lo circle { fill: #71717a; }
.alt-graph .node.root circle { fill: #0b0b12; stroke: var(--gold); stroke-width: 3; }
.alt-graph .node circle.ring { fill: none; stroke: #fff; stroke-width: 2.5; stroke-dasharray: 4 3; }
.alt-graph .node:is(:hover, :focus-visible) circle:not(.ring) { stroke: #fff; }
.alt-graph text { fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: #0b0b12; stroke-width: 3px; }
.alt-graph .node.root text, .alt-graph .node.focus text { font-weight: 800; fill: var(--gold); }
.alt-sigs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.alt-sig { position: relative; display: flex; gap: 10px; align-items: baseline; padding: 4px 8px; border-radius: 6px; font-size: 0.85rem; overflow: hidden; }
.alt-sig-bar { position: absolute; inset: 0 auto 0 0; width: var(--w); background: rgba(248, 113, 113, 0.14); }
.alt-sig.neg .alt-sig-bar { background: rgba(74, 222, 128, 0.14); }
.alt-sig > span:not(.alt-sig-bar) { position: relative; }
.alt-sig-w { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: #fca5a5; } .alt-sig.neg .alt-sig-w { color: var(--ok); }
.alt-table { width: 100%; font-size: 0.82rem; } .alt-table td, .alt-table th { padding: 4px 6px; } .alt-table td:not(:first-child), .alt-table th:not(:first-child) { text-align: right; }
.alt-trades td:nth-child(2) { text-align: left; } .alt-trades th:nth-child(2) { text-align: left; }
.alt-table tr.to-main td { background: rgba(248, 113, 113, 0.08); }
.alt-bulk { position: sticky; bottom: 12px; z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: fit-content; max-width: 100%; margin: 12px auto 0; padding: 10px 14px;
  border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
.alt-bulk[hidden] { display: none; }
.modal.trade-quick { width: min(760px, 100%); }
@media (max-width: 1100px) { .alt-work { grid-template-columns: minmax(0, 1fr) minmax(340px, 46%); } .alt-chips { display: none; } }
@media (max-width: 860px) {
  .alt-work { grid-template-columns: 1fr; }
  .alt-detail { display: none; }
  .alt-work.detail-open .alt-detail { display: block; position: fixed; inset: 0; z-index: 140; top: 0; max-height: none; border-radius: 0; border: 0; padding-top: 14px; background: var(--panel-solid); }
  .alt-d-close { display: inline-flex; } .alt-keys { display: none; } .alt-d-actions kbd, .alt-d-nav kbd { display: none; }
  .alt-cl-actions { margin-left: 0; } .alt-scan { margin-left: 0; }
}
.ok-text { color: var(--ok); }
/* duel chat: report someone's message (shows on hover; always on touch screens) */
.chat-list li { position: relative; }
.chat-report { position: absolute; top: 2px; right: 2px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; padding: 2px 5px; border-radius: 4px; opacity: 0; }
.chat-list li:hover .chat-report, .chat-report:focus-visible { opacity: 1; } .chat-report:hover { color: #f87171; background: rgba(248, 113, 113, 0.12); }
@media (hover: none) { .chat-report { opacity: 0.7; } }
/* punishments: the duration presets in a grid, and what's on a player at the top of their profile */
.punish-hours { grid-template-columns: repeat(3, 1fr); }
.punish-hours .report-option { justify-content: center; padding: 10px 8px; }
.punish-box .list-row { border-color: rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.07); justify-content: space-between; }
/* admin panel: the sections in two labelled groups, side by side when there's room */
.admin-nav { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.admin-nav-group { display: flex; flex-direction: column; gap: 6px; }
.admin-nav-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.admin-nav .admin-tabs { margin-bottom: 0; }
.stat-hot { border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.07); }
.stat-hot b { color: #fbbf24; }
/* Punishments tab: one row per player, one chip per punishment on them */
.punished-row { flex-wrap: wrap; align-items: flex-start; }
.punished-list { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.punish-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.07); max-width: 420px; }
/* the announced update's countdown: like the announcement banner, but it stays */
.update-notice { background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(168, 85, 247, 0.22)); border-bottom-color: rgba(168, 85, 247, 0.5); font-variant-numeric: tabular-nums; }
.punish-chip .btn, .punish-box .btn { white-space: nowrap; }

/* ---------- printed look: duel cards ----------
   The collection card's printed look for the duel card's own markup (.dc-face / .dc-inner), last so it wins. */
.dc-face { padding: 3.6%; border-radius: 4.6% / 3.3%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 78%, #3a3430), color-mix(in srgb, var(--tc) 58%, #1d1a18));
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.35), 0 10px 18px -6px rgba(0, 0, 0, 0.5); }
.dcard.spell .dc-face { background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 78%, #3a3430), color-mix(in srgb, var(--tc) 58%, #1d1a18)); } /* spells: the rarity frame too */
.dcard.top-cost .dc-face { padding: 3.6%; background: linear-gradient(160deg, #8a1c18, #2a0d0b 45%, #1a0807 60%, #7a1915); }
.dc-thumb { margin-top: 3px; } /* the picture's 2px ring sits outside its box, and the row above is 1px shorter at the bottom */
.dc-face::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: var(--paper); }
.dc-inner { position: relative; border-radius: 3% / 2.2%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 0 2px color-mix(in srgb, var(--tc) 40%, rgba(255, 255, 255, 0.25));
  background: radial-gradient(120% 60% at 50% 115%, color-mix(in srgb, var(--tc) 16%, transparent), transparent 70%), linear-gradient(180deg, #23212a, #17161c); }
.dcard.spell .dc-inner { background: radial-gradient(120% 60% at 50% 115%, rgba(167, 139, 250, 0.16), transparent 70%), linear-gradient(180deg, #25212e, #18161e); }
.dcard.top-cost .dc-inner { background: linear-gradient(180deg, #24100f, #150a09); }
.dc-inner::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, 0.022)); }
.dc-name, .dc-cost { color: #efe9dd; } /* the stats keep their own colors (attack, HP, buffed, hurt) */
.dcard .dc-name, .dcard .dc-cost, .dcard .dc-foot .dc-stat, .dcard .dc-ab { text-shadow: 0 0 0.6px currentColor; }

/* Holiday quests (#/holiday) */
.hq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hq-quest h3 { margin: 0; }
.hq-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.hq-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.hq-ready { margin: 0; color: var(--ok); font-weight: 600; }
.hq-quest .bar { margin: 10px 0; }
.hq-bar i { background: linear-gradient(90deg, #dc2626, #16a34a); } /* the snow strip goes on .hq-bar once it's drawn */
.hq-done { border-color: rgba(34, 197, 94, 0.5); }
.hq-locked { opacity: 0.6; }
.hq-home { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; text-decoration: none; color: inherit;
  border-color: rgba(220, 38, 38, 0.5); background: linear-gradient(90deg, rgba(220, 38, 38, 0.12), rgba(22, 163, 74, 0.12)); }
.hq-home-title { font-weight: 700; }

/* Christmas lights hanging under the top bar (xmasLights in app.js); the bar is sticky, so they stay in view */
.xmas-lights { position: absolute; top: 100%; left: 0; right: 0; pointer-events: none; z-index: -1; }

/* Winter theme (html.winter, Dec 1 until the holiday quests close; set in app.js): deep blue instead of black, icy blue
   accents instead of red-to-gold, so the red and green of the lights and quest bars stand out. Rarity colors, medals and
   other colors that mean something stay as they are. Remove the class (or this block) to go back. */
html.winter {
  --bg: #070c18; --bg2: #0b1324; --panel: rgba(14, 24, 44, 0.78); --panel-solid: #0f1a2f; --line: rgba(147, 197, 253, 0.12);
  --text: #e8f0ff; --muted: #9fb0cf; --cyan: #7dd3fc;
  --ice: linear-gradient(90deg, #60a5fa, #a5f3fc);
}
/* the design team's winter painting (blurred in the file, so no CSS blur to redraw), darkened so text stays readable */
html.winter .backdrop { background: linear-gradient(rgba(5, 10, 22, 0.5), rgba(5, 10, 22, 0.62)), url('/winter-bg.webp') center 56px / cover no-repeat, var(--bg); } /* top-aligned under the top bar: the moon and the horizon show */
html.winter header.top { background: rgba(5, 10, 22, 0.94); }
html.winter .logo b, html.winter .auth-logo b { background: var(--ice); -webkit-background-clip: text; background-clip: text; }
html.winter .btn.primary, html.winter .dm-btn, html.winter .pick-badge, html.winter .role-badge.owner, html.winter .dm-msg.mine p { background: var(--ice); color: #04121f; }
html.winter .btn.primary { box-shadow: 0 6px 20px rgba(96, 165, 250, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
html.winter .btn.primary:hover:not(:disabled) { background: linear-gradient(90deg, #93c5fd, #cffafe); box-shadow: 0 8px 26px rgba(125, 211, 252, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
html.winter .bar i, html.winter .badge-bar i { background: var(--ice); }
html.winter .hq-bar i { background: linear-gradient(90deg, #dc2626, #16a34a); } /* the quest bars keep their Christmas colors */
html.winter input[type='checkbox'] { accent-color: #60a5fa; }
html.winter input[type='range']::-moz-range-progress { background: #60a5fa; }
html.winter input[type='range']::-webkit-slider-runnable-track { background: linear-gradient(90deg, #60a5fa var(--val), rgba(255, 255, 255, 0.12) var(--val)); }
html.winter #ringgrad stop:first-child { stop-color: #60a5fa; } html.winter #ringgrad stop:last-child { stop-color: #a5f3fc; }
html.winter .invite-card { border-color: rgba(125, 211, 252, 0.4); background: rgba(56, 189, 248, 0.06); }
html.winter .invite-card .btn { border-color: rgba(125, 211, 252, 0.6); color: var(--cyan); }
html.winter .invite-card .btn:hover { background: rgba(125, 211, 252, 0.15); }
/* Snow on top of the holiday quest cards and the small stat boxes (collection progress, profiles): the design team's left end, middle (repeats) and right end, as one
   pseudo-element. Its padding is the two ends' width, so the middle (clipped to the content box) runs between them. */
html.winter .hq-quest, html.winter .stat { position: relative; }
html.winter .hq-quest::before, html.winter .stat::before { content: ''; position: absolute; z-index: 1; pointer-events: none; left: -6px; right: -6px; top: -22px; height: 40px;
  padding: 0 52px 0 44px; box-sizing: border-box; /* 1px under each end piece: no hairline at the joins */
  background: url('/snow-left.png') left top / auto 40px no-repeat border-box, url('/snow-right.png') right top / auto 40px no-repeat border-box,
    url('/snow-mid.png') 0 top / auto 40px round no-repeat content-box;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); }
.hq-grid { padding-top: 14px; row-gap: 30px; }
/* each quest card's snow a little different: mirrored on every other card, sitting a bit higher or lower on others */
html.winter .hq-quest:nth-child(2n)::before, html.winter .stat:nth-child(2n)::before { transform: scaleX(-1); }
html.winter .hq-quest:nth-child(3n+1)::before, html.winter .stat:nth-child(3n+1)::before { top: -25px; }
html.winter .hq-quest:nth-child(3n+2)::before, html.winter .stat:nth-child(3n+2)::before { top: -19px; }
html.winter .stats { padding-top: 12px; row-gap: 26px; }
/* the ??? page's countdown */
.soon-count { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.soon-count div { min-width: 74px; padding: 12px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); text-align: center; }
.soon-count b { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }
.soon-count span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.soon-panel { margin-top: 24px; }
/* the holiday present (checkGift in app.js): Grom's reindeer carrying a gift, near the bottom of the screen until clicked */
.gift-sprite { position: fixed; bottom: 90px; left: calc(8px + var(--spot, 0.5) * (100% - 124px)); z-index: 35; padding: 6px; line-height: 0; border: 0; cursor: pointer;
  background: radial-gradient(closest-side, rgba(251, 191, 36, 0.12), transparent); transition: transform 0.15s; animation: giftin 0.5s ease-out backwards; }
.gift-sprite svg { display: block; width: 96px; height: 80px; }
.gift-sprite:hover { transform: translateY(-3px); }
.gift-sprite:active { transform: scale(0.94); }
.gift-sprite:disabled { cursor: progress; opacity: 0.6; transform: none; }
.gift-sprite.opened { opacity: 1; animation: giftout 0.8s ease-in forwards; }
.gift-sprite.opened .deer-gift { transform-origin: 48px 30px; animation: giftpop 0.55s ease-out forwards; }
body:has(.duel-actions) .gift-sprite, body:has(.trade-tray) .gift-sprite { display: none; }
.deer-body, .deer-gift, .deer-head, .deer-ear, .deer-tail { animation: 5s ease-in-out infinite; }
.deer-body { animation-name: deerhop; }
.deer-gift { animation-name: deergift; }
.deer-head { transform-origin: 77px 56px; animation-name: deernod; }
.deer-ear { transform-origin: 89px 25px; animation-name: deerear; }
.deer-tail { transform-origin: 29px 50px; animation-name: deerwag; }
@keyframes giftout { 0%, 60% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(8px); } }
@keyframes giftpop { 40% { transform: translateY(-14px) scale(1.15); opacity: 1; } 100% { transform: translateY(-28px) scale(0.6); opacity: 0; } }
@keyframes giftin { from { opacity: 0; transform: translateY(24px); } }
@keyframes deerhop { 0% { transform: none; animation-timing-function: ease-out; } 7% { transform: translateY(-8px); animation-timing-function: ease-in; } 13%, 100% { transform: none; } }
@keyframes deergift { 0%, 13%, 23%, 100% { transform: none; } 17% { transform: translateY(-3px); } }
@keyframes deernod { 0%, 34%, 56%, 100% { transform: none; } 45% { transform: rotate(9deg); } }
@keyframes deerear { 0%, 28%, 34%, 100% { transform: none; } 31% { transform: rotate(-16deg); } }
@keyframes deerwag { 0%, 64%, 84%, 100% { transform: none; } 69% { transform: rotate(-18deg); } 74% { transform: rotate(14deg); } 79% { transform: rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .gift-sprite, .gift-sprite * { animation: none !important; } }
/* Santa hat on the pack's demon in the winter season (the span is in packBag, hidden otherwise) */
.xmas-hat { display: none; }
html.winter .xmas-hat { display: block; position: absolute; left: 50%; top: 0; width: 42%; aspect-ratio: 869 / 720; translate: -64% -24%; rotate: 0deg; /* the brim centred on the face (the pompom hangs off the left) */
  background: url('/santa-hat.png') center / contain no-repeat; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4)); }
/* the Christmas card back (the design team's, with its own frame), in the winter season */
html.winter .card-back { background: url('/card-back-xmas.webp') center / 100% 100% no-repeat, #2a0b0a; }
html.winter .card-back::before { box-shadow: none; }
/* the winter loading screen (#splash in index.html), gone once the app has loaded */
#splash { display: none; }
html.winter #splash { display: block; position: fixed; inset: 0; z-index: 2000; background: #3b1c12 url('/fireplace.webp') center bottom / cover no-repeat; transition: opacity 0.35s ease-in; }
#splash.gone { opacity: 0; pointer-events: none; }
.stockings { list-style: none; margin: 0 auto; padding: 3vh 4vw 0; display: flex; flex-wrap: wrap; justify-content: center; row-gap: 1.5vh; max-width: 1250px; --per: 11; } /* 21 stockings: rows of 11 and 10 */
.stockings li { min-width: 0; flex: 0 0 calc(100% / var(--per)); display: grid; justify-items: center; transform-origin: 50% 0; animation: sway 3.2s ease-in-out var(--d) infinite alternate; }
.stockings li:nth-child(3n) { margin-top: 2vh; }
.stockings .st { position: relative; width: min(66%, 84px); container-type: inline-size; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35)); }
.stockings .st img { display: block; width: 100%; height: auto; }
/* the name stitched on the white cuff (where the cuff sits differs a little between the two stockings) */
.stockings .st span { position: absolute; left: 60%; top: 16.5%; translate: -50% -50%; text-align: center; line-height: 1; max-width: 74%; font-weight: 800; font-size: 11.5cqi; letter-spacing: -0.02em; color: #8b1a12; white-space: nowrap; text-shadow: 0 0 1px #fff; }
.stockings .st.green span { left: 55.6%; top: 22.5%; color: #1d5e33; }
.splash-load { position: absolute; left: 0; right: 0; bottom: 3vh; margin: 0; text-align: center; color: #fff7ea; font-weight: 700; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
@media (max-width: 700px) { .stockings { --per: 6; padding: 2vh 2vw 0; row-gap: 1vh; } .stockings .st { width: 60%; } .stockings { row-gap: 0.4vh; } .stockings li:nth-child(3n) { margin-top: 0; } .stockings li:nth-child(even) { margin-top: 1.2vh; } }
@keyframes sway { from { rotate: -3deg; } to { rotate: 3deg; } }
@media (prefers-reduced-motion: reduce) { .stockings li { animation: none; } }
html.winter #splash { view-transition-name: splash; } /* stays on top if a page transition runs */
