/* ==========================================================================
   Binderly — global styles. Themes are CSS variable sets on .theme-*.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #0b0819; }
body {
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1:focus { outline: none; }
a { color: inherit; }
button { font: inherit; }
code { font-family: ui-monospace, Consolas, monospace; }

select, textarea, input[type=text], input[type=number], input[type=email], input[type=password], input:not([type]) {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    padding: 7px 10px;
    font: inherit;
}
select option { background: var(--surface-3); color: var(--text); }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Themes ---------- */
.theme-midnight {
    --bg: #0b0819;
    --bg-glow: radial-gradient(1100px 600px at 75% -10%, rgba(124, 58, 237, .28), transparent 60%),
               radial-gradient(900px 600px at -10% 110%, rgba(219, 39, 119, .14), transparent 60%);
    --topbar: rgba(11, 8, 25, .8);
    --sidebar: rgba(14, 10, 32, .55);
    --surface: rgba(23, 17, 48, .9);
    --surface-2: rgba(36, 27, 72, .9);
    --surface-3: #2d2358;
    --glass: rgba(18, 13, 40, .62);
    --input-bg: rgba(255, 255, 255, .04);
    --border: rgba(167, 139, 250, .16);
    --border-strong: rgba(167, 139, 250, .38);
    --text: #efeaff;
    --muted: #a49bc9;
    --accent: #8b5cf6;
    --accent-text: #c4b5fd;
    --accent-soft: rgba(139, 92, 246, .16);
    --accent-glow: rgba(124, 58, 237, .35);
    --btn-bg: linear-gradient(135deg, #7c3aed, #a855f7);
    --btn-text: #ffffff;
    --pill-hot: #ec4899;
    --gold: #fbbf24;
    --good: #34d399;
    --meter: linear-gradient(90deg, #7c3aed, #c084fc);
    --meter-track: rgba(255, 255, 255, .07);
    --shadow: 0 10px 30px rgba(3, 1, 12, .45);
    --hero-shade: rgba(11, 8, 25, .92);
    --hero-shade-mid: rgba(11, 8, 25, .5);
    --bn-sky-1: #1e1050; --bn-sky-2: #6d28d9; --bn-sky-3: #f472b6; --bn-sun: #fda4af;
    --bn-mtn-back: #3b2477; --bn-mtn: #1f1547; --bn-snow: #d8ccff; --bn-pagoda: #140c30;
    --bn-branch: #22123f; --bn-blossom: #f472b6; --bn-blossom-light: #fbcfe8; --bn-petal: #f9a8d4;
}

.theme-sakura {
    --bg: #170c13;
    --bg-glow: radial-gradient(1100px 600px at 75% -10%, rgba(244, 114, 182, .24), transparent 60%),
               radial-gradient(900px 600px at -10% 110%, rgba(251, 207, 232, .08), transparent 60%);
    --topbar: rgba(23, 12, 19, .8);
    --sidebar: rgba(30, 15, 24, .55);
    --surface: rgba(43, 22, 35, .9);
    --surface-2: rgba(60, 31, 48, .9);
    --surface-3: #4b2639;
    --glass: rgba(35, 17, 28, .6);
    --input-bg: rgba(255, 255, 255, .05);
    --border: rgba(249, 168, 212, .18);
    --border-strong: rgba(249, 168, 212, .42);
    --text: #fff1f7;
    --muted: #d7a9bf;
    --accent: #f472b6;
    --accent-text: #f9a8d4;
    --accent-soft: rgba(244, 114, 182, .15);
    --accent-glow: rgba(244, 114, 182, .3);
    --btn-bg: linear-gradient(135deg, #fbcfe8, #f472b6);
    --btn-text: #3d0b25;
    --pill-hot: #f43f5e;
    --gold: #fcd34d;
    --good: #6ee7b7;
    --meter: linear-gradient(90deg, #f472b6, #fbcfe8);
    --meter-track: rgba(255, 255, 255, .08);
    --shadow: 0 10px 30px rgba(10, 2, 6, .45);
    --hero-shade: rgba(23, 12, 19, .9);
    --hero-shade-mid: rgba(23, 12, 19, .4);
    --bn-sky-1: #8b5cf6; --bn-sky-2: #f0abfc; --bn-sky-3: #fecdd3; --bn-sun: #fff1f2;
    --bn-mtn-back: #c084fc; --bn-mtn: #86307a; --bn-snow: #fdf4ff; --bn-pagoda: #3b0f2a;
    --bn-branch: #4a1d33; --bn-blossom: #f472b6; --bn-blossom-light: #fce7f3; --bn-petal: #fbcfe8;
}

/* ---------- Shell ---------- */
.app {
    min-height: 100vh;
    color: var(--text);
    background: var(--bg-glow), var(--bg);
    background-attachment: fixed;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
    grid-template-areas: "top top" "side main";
}

.topbar {
    grid-area: top;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    background: var(--topbar);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 196px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--btn-bg); color: var(--btn-text);
    box-shadow: 0 0 18px var(--accent-glow);
}
.brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.theme-sakura .brand-name { font-family: "Segoe Script", "Brush Script MT", cursive; font-weight: 700; color: #fbcfe8; }

.topnav { display: flex; gap: 4px; }
.topnav-link {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-weight: 600;
    transition: background .15s, color .15s;
}
.topnav-link:hover { color: var(--text); background: var(--accent-soft); }
.topnav-link.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border-strong); }
.topnav-link.is-soon { opacity: .45; cursor: not-allowed; }
.topnav-link.is-soon:hover { background: none; color: var(--muted); }

.search {
    flex: 1; max-width: 420px; margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 12px;
    border-radius: 12px; background: var(--input-bg);
    border: 1px solid var(--border); color: var(--muted);
}
.search input { flex: 1; min-width: 0; padding: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; }
.search input:focus { outline: 0; }
.search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-page { max-width: 640px; margin: 0 0 18px; height: 44px; }

.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--pill-hot); box-shadow: 0 0 0 2px var(--bg); }
.me-link { display: block; border-radius: 50%; text-decoration: none; }

.sidebar {
    grid-area: side;
    position: sticky; top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 18px 12px 24px;
    border-right: 1px solid var(--border);
    background: var(--sidebar);
    display: flex; flex-direction: column; gap: 18px;
}
.side-section h3 { font-size: .95rem; font-weight: 700; margin: 0 10px 8px; }
.side-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.side-link:hover { background: var(--accent-soft); color: var(--text); }
.side-link.active, .side-link.active-game { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.side-link em {
    margin-left: auto; font-style: normal; font-size: .68rem; font-weight: 700;
    padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted);
}
.side-link.is-soon { cursor: default; opacity: .6; }
.side-link.is-soon:hover { background: none; color: var(--muted); }

.pro-card {
    margin-top: auto; padding: 16px; border-radius: var(--radius, 14px);
    border: 1px solid var(--border-strong);
    background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface);
}
.pro-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; }
.pro-card p { color: var(--muted); margin: 6px 0 12px; font-size: .85rem; }

.content { grid-area: main; padding: 20px 22px 48px; min-width: 0; }

/* ---------- Primitives ---------- */
.icon { flex: none; display: inline-block; vertical-align: middle; }
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; }
.panel-head h2 .icon { color: var(--accent-text); }
.link-more { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; text-decoration: none; white-space: nowrap; }
.link-more:hover { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.gold { color: var(--gold) !important; }
.good { color: var(--good) !important; }
.section-gap { margin-top: 18px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 10px; border: 0;
    background: var(--btn-bg); color: var(--btn-text);
    font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
    box-shadow: 0 6px 18px var(--accent-glow);
    transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; transform: none; filter: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 9px; }
.btn-block { display: flex; width: 100%; }

.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 999px;
    font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.pill-hot { background: var(--pill-hot); color: #fff; }
.pill-pro { background: var(--btn-bg); color: var(--btn-text); font-size: .72rem; }
.pill-gold { background: rgba(251, 191, 36, .16); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .4); }
.pill-good { background: rgba(52, 211, 153, .14); color: var(--good); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .4); }
.pill-muted { background: var(--surface-3); color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .72rem; }
.pill-restock { background: rgba(52, 211, 153, .16); color: var(--good); }
.pill-shelf { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
.pill-release { background: rgba(217, 70, 239, .18); color: #f0abfc; }

.meter { height: 12px; border-radius: 999px; background: var(--meter-track); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.meter.thin { height: 6px; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--meter); box-shadow: 0 0 12px var(--accent-glow); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

.avatar {
    flex: none; display: grid; place-items: center;
    border-radius: 50%; font-weight: 800; color: #fff; letter-spacing: -.02em;
    background: radial-gradient(circle at 30% 25%, hsl(var(--ah) 90% 72%), hsl(var(--ah) 70% 45%) 55%, hsl(calc(var(--ah) + 40) 60% 25%));
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--border-strong);
    text-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.avatar-square { border-radius: 22%; }
.avatar-photo { display: block; object-fit: cover; background: var(--surface-3); }

.skeleton {
    height: 60px; border-radius: 10px;
    background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton.tall { height: 140px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h1, .empty-state h2 { font-size: 1.4rem; margin-bottom: 8px; }
.empty-state .btn { margin-top: 10px; }
.empty-inline { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.notice { padding: 10px 12px; border-radius: 10px; background: rgba(52, 211, 153, .12); color: var(--good); margin-bottom: 12px; font-size: .85rem; }
.alert { padding: 10px 12px; border-radius: 10px; background: rgba(244, 63, 94, .14); color: #fda4af; margin-bottom: 14px; }

/* ---------- Card art (original placeholder art until licensed images exist) ---------- */
.tcg-card {
    position: relative; flex: none;
    width: var(--w, 100%); aspect-ratio: 63 / 88;
    border-radius: 6% / 4.3%; overflow: hidden;
    container-type: inline-size;
    background: linear-gradient(155deg, hsl(var(--h) 85% 68%), hsl(var(--h) 72% 46%) 48%, hsl(calc(var(--h) + 35) 70% 28%));
    box-shadow: 0 6px 16px rgba(0, 0, 0, .45), inset 0 0 0 1.5px rgba(255, 255, 255, .35);
    transition: transform .2s, box-shadow .2s;
}
.tcg-card:hover {
    transform: translateY(-2px) rotate(-.6deg);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .55), 0 0 18px hsl(var(--h) 90% 60% / .45), inset 0 0 0 1.5px rgba(255, 255, 255, .5);
}
.size-xs { --w: 40px; }
.size-sm { --w: 64px; }
.size-md { --w: 96px; }
.size-lg { --w: 136px; }
.size-fill { --w: 100%; }
.tcg-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcg-frame {
    position: absolute; inset: 4.5%;
    display: flex; flex-direction: column; gap: 3cqw; padding: 3.5cqw;
    border-radius: 4%;
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .04) 40%, rgba(0, 0, 0, .25));
}
.tcg-top { display: flex; justify-content: space-between; align-items: center; min-width: 0; }
.tcg-name { font-size: 9cqw; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg-art {
    flex: 1; border-radius: 3cqw;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 38%, hsl(var(--h) 100% 88%), hsl(var(--h) 75% 52%) 45%, hsl(calc(var(--h) + 200) 45% 18%));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 -10cqw 18cqw rgba(0, 0, 0, .35);
}
.tcg-art svg { width: 58%; height: auto; fill: rgba(255, 255, 255, .92); filter: drop-shadow(0 2cqw 3cqw hsl(var(--h) 80% 20% / .7)); }
.tcg-bottom { display: flex; justify-content: space-between; font-size: 7cqw; font-weight: 700; color: rgba(255, 255, 255, .85); white-space: nowrap; }
.tcg-rarity { color: #fde68a; letter-spacing: -.05em; }
.size-xs .tcg-top, .size-xs .tcg-bottom { display: none; }
.tcg-holo {
    position: absolute; inset: 0; pointer-events: none;
    mix-blend-mode: color-dodge; opacity: .35;
    background: linear-gradient(115deg, transparent 18%, rgba(255, 255, 255, .55) 32%, rgba(255, 120, 220, .35) 42%, rgba(120, 220, 255, .35) 54%, transparent 68%);
    background-size: 260% 260%;
    animation: holo 7s ease-in-out infinite;
}
.rarity-altart .tcg-holo, .rarity-secretrare .tcg-holo { opacity: .55; }
.rarity-secretrare { box-shadow: 0 6px 16px rgba(0, 0, 0, .45), inset 0 0 0 2px #fcd34d; }
@keyframes holo { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }

/* ---------- Slabs & trophies ---------- */
.slab {
    width: 100%; max-width: 116px; margin: 0 auto;
    padding: 6px 6px 8px; border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .06));
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: inset 0 0 14px rgba(255, 255, 255, .12), 0 10px 24px rgba(0, 0, 0, .45);
}
.slab-label {
    display: flex; justify-content: space-between; align-items: center; gap: 4px;
    padding: 3px 6px; margin-bottom: 6px; border-radius: 4px;
    background: linear-gradient(180deg, #fff, #e5e7eb); border: 2px solid #dc2626;
    color: #b91c1c; font-size: .66rem; font-weight: 900; letter-spacing: .02em;
}
.slab-label.grader-bgs { border-color: #6b7280; color: #111827; background: linear-gradient(180deg, #f3f4f6, #9ca3af); }
.slab-label.grader-cgc { border-color: #2563eb; color: #1e3a8a; }
.slab-window { padding: 5px; border-radius: 5px; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.trophy-shelf {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px;
    padding: 16px 14px 12px; border-radius: 12px;
    background: radial-gradient(ellipse 70% 60% at 50% 100%, rgba(251, 191, 36, .22), transparent 70%), var(--surface-2);
    box-shadow: inset 0 -3px 0 rgba(251, 191, 36, .35);
}
.trophy { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.trophy-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
    background: var(--glass); border: 1px solid var(--border-strong);
}
.tag-grail { color: var(--gold); }
.tag-slab { color: #7dd3fc; }
.tag-hit { color: #fb7185; }

/* ---------- Binder page ---------- */
.page-with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.page-main { min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }

.hero { position: relative; overflow: hidden; min-height: 236px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-shade {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--hero-shade) 0%, var(--hero-shade-mid) 50%, transparent 80%),
                linear-gradient(0deg, var(--hero-shade) 0%, transparent 60%);
}
.hero-body { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 22px; min-height: 236px; padding: 24px; }
.hero-avatar { position: relative; flex: none; }
.level-chip {
    position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    color: var(--gold); font-weight: 800; font-size: .78rem; white-space: nowrap;
}
.hero-id { flex: 1 1 260px; min-width: 0; }
.hero-id h1 { display: flex; align-items: center; gap: 10px; font-size: 2rem; font-weight: 800; letter-spacing: -.02em; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; color: var(--muted); font-size: .85rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-roles { margin-top: 8px; font-weight: 600; color: var(--accent-text); }
.hero-tagline { margin-top: 2px; opacity: .92; }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.stat-strip {
    display: flex; align-items: stretch;
    background: var(--glass); backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong); border-radius: 14px;
}
.stat-strip > div { padding: 10px 18px; display: flex; flex-direction: column; justify-content: center; }
.stat-strip > div + div { border-left: 1px solid var(--border); }
.stat-strip small { display: block; color: var(--muted); font-size: .75rem; }
.stat-rank { flex-direction: row !important; align-items: center; gap: 10px; color: var(--accent-text); }
.stat-rank strong { color: var(--gold); font-size: 1.05rem; }
.stat strong { font-size: 1.25rem; font-weight: 800; }

.tabs {
    display: flex; gap: 4px; margin: 14px 0; padding: 5px;
    width: fit-content; max-width: 100%; overflow-x: auto;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
}
.tab { padding: 8px 16px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--btn-bg); color: var(--btn-text); }

.overview { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.overview-left { display: flex; flex-direction: column; gap: 16px; }
.overview-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 180px;
    grid-template-areas:
        "chaser chaser squad"
        "top9 trophies trophies"
        "top9 badges badges"
        "chases chases chases"
        "activity activity activity";
    gap: 16px;
    align-items: start;
}
.chaser { grid-area: chaser; }
.squad { grid-area: squad; align-self: stretch; }
.top9 { grid-area: top9; }
.trophies { grid-area: trophies; }
.badges { grid-area: badges; }
.chase-list { grid-area: chases; }
.activity { grid-area: activity; }

.trainer-stage {
    position: relative; height: 210px; margin-bottom: 10px;
    display: grid; place-items: center; border-radius: 12px; overflow: hidden;
    background: radial-gradient(circle at 50% 42%, var(--accent-soft), transparent 65%),
                repeating-linear-gradient(135deg, rgba(255, 255, 255, .03) 0 10px, transparent 10px 20px),
                var(--surface-2);
}
.trainer-held { position: absolute; right: 26px; bottom: 20px; transform: rotate(10deg); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .5)); }
.theme-picker { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.theme-picker > span { display: inline-flex; align-items: center; gap: 6px; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-swatch { padding: 8px; border-radius: 10px; border: 1px solid var(--border); color: #fff; font-weight: 700; cursor: pointer; }
.swatch-midnight { background: linear-gradient(135deg, #1e1050, #7c3aed); }
.swatch-sakura { background: linear-gradient(135deg, #fbcfe8, #a78bfa); color: #3d0b25; }
.theme-swatch.active { box-shadow: 0 0 0 2px var(--text); }

.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }

.chaser-body { display: flex; gap: 18px; align-items: flex-start; }
.chaser-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.chaser-info h3 { font-size: 1.35rem; font-weight: 800; }
.meter-box { margin-top: 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.meter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.meter-head span { display: inline-flex; align-items: center; gap: 6px; }
.meter-head strong { font-size: 1.1rem; }
.meter-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meter-stats > div { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 0 10px; color: var(--muted); }
.meter-stats > div:first-child { padding-left: 0; }
.meter-stats > div + div { border-left: 1px solid var(--border); }
.meter-stats .icon { grid-row: span 2; color: var(--accent-text); }
.meter-stats strong { color: var(--text); font-size: 1.15rem; line-height: 1.1; }
.meter-stats small { font-size: .72rem; }
.meter-note { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }

.squad-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.squad-body strong { margin-top: 6px; }

.binder-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.binder-pocket { aspect-ratio: 63 / 88; border-radius: 7px; background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); display: grid; place-items: center; }
.pocket-empty { color: var(--muted); opacity: .6; }

.badge-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.badge-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--accent-text); }
.badge.earned .badge-icon { background: linear-gradient(145deg, var(--accent-soft), rgba(251, 191, 36, .12)); color: var(--gold); box-shadow: 0 0 16px var(--accent-glow); }
.badge.locked .badge-icon, .badge.locked .badge-name { opacity: .55; }
.badge-name { font-size: .75rem; font-weight: 600; }
.badge .meter { width: 70%; }

.mini-chases { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mini-chase { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.mini-chase-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mini-chase-top { display: flex; justify-content: space-between; gap: 6px; }

.post { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.post:first-of-type { border-top: 0; padding-top: 0; }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; gap: 8px; align-items: baseline; }
.post p { margin: 2px 0 4px; }

/* ---------- Rail ---------- */
.rail-panel .panel-head { margin-bottom: 10px; }
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rail-item { display: flex; gap: 10px; align-items: center; }
.rail-thumb {
    width: 44px; height: 44px; flex: none; border-radius: 10px;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(145deg, hsl(var(--h, 280) 80% 60%), hsl(calc(var(--h, 280) + 40) 70% 35%));
}
.rail-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.rail-text small { overflow: hidden; text-overflow: ellipsis; }
.rail-meta { font-size: .75rem; color: var(--muted); white-space: nowrap; align-self: flex-start; }

.countdown { display: flex; gap: 4px; flex: none; }
.countdown > div { min-width: 38px; padding: 4px 4px 3px; border-radius: 8px; text-align: center; background: var(--surface-2); border: 1px solid var(--border-strong); }
.countdown strong { display: block; font-size: 1rem; line-height: 1.1; }
.countdown small { font-size: .58rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.swap-preview { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 14px; }
.swap-side { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.swap-side small { color: var(--muted); font-size: .75rem; }
.swap-side strong { font-size: .82rem; }
.swap-icon { color: var(--accent-text); }

/* ---------- Pages ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 10px; font-size: 1.7rem; font-weight: 800; }
.page-head p { margin: 6px 0 0; max-width: 680px; }
.radius-picker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }

.chase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; margin-bottom: 18px; }
.chase-card { display: flex; gap: 16px; }
.chase-card.is-one { border-color: rgba(251, 191, 36, .45); box-shadow: var(--shadow), 0 0 24px rgba(251, 191, 36, .1); }
.chase-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.chase-card-title { display: flex; align-items: center; gap: 8px; }
.chase-card-title h3 { font-size: 1.15rem; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .8rem; }
.mini-stats span { display: inline-flex; align-items: center; gap: 5px; }
.chase-actions, .log-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.confirm-row { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.log-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.log-form label { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; color: var(--muted); }
.log-form input[type=number] { width: 80px; }
.log-form .grow { flex: 1; min-width: 160px; }
.log-form .grow input { width: 100%; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-tile { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.stat-tile small { display: block; color: var(--muted); font-size: .72rem; }
.stat-tile strong { font-size: 1.2rem; }
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .num { text-align: right; }
.done-list { display: flex; flex-direction: column; gap: 10px; }
.done-item { display: flex; gap: 10px; align-items: center; }

.celebrate {
    position: relative; overflow: hidden;
    display: flex; gap: 18px; align-items: center; margin-bottom: 18px;
    border-color: rgba(251, 191, 36, .5);
    background: radial-gradient(circle at 15% 50%, rgba(251, 191, 36, .2), transparent 60%), var(--surface);
}
.celebrate h2 { font-size: 1.4rem; color: var(--gold); }
.celebrate-text { flex: 1; position: relative; }
.celebrate-text p { margin: 6px 0 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
    position: absolute; top: -14px; left: calc(var(--i) * 4.2%);
    width: 8px; height: 14px; border-radius: 2px;
    background: hsl(calc(var(--i) * 47) 90% 65%);
    animation: confetti 2.6s ease-in calc(var(--i) * -0.11s) infinite;
}
@keyframes confetti { to { transform: translateY(220px) rotate(540deg); opacity: 0; } }

.match-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.match-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.match-who { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.match-who small { display: block; }
.match-body { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.match-side { padding: 12px; border-radius: 12px; background: var(--surface-2); }
.match-side > small { display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: .7rem; }
.card-row { display: flex; flex-wrap: wrap; gap: 12px; }
.card-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 96px; font-size: .8rem; font-weight: 600; text-align: center; }
.match-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 12px; }
.sighting { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.sighting:first-of-type { border-top: 0; }

.drops-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.drops-side { display: flex; flex-direction: column; gap: 16px; }
.drop-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.drop-row:first-of-type { border-top: 0; padding-top: 0; }
.drop-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.drop-actions { align-self: center; }
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.form-grid select, .form-grid input { width: 100%; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.result-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; border-radius: 12px; background: var(--surface-2); }
.people { display: flex; flex-wrap: wrap; gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--surface-2); text-decoration: none; }

.validation-message { color: #fda4af; font-size: .8rem; }
.validation-errors { color: #fda4af; font-size: .8rem; margin: 4px 0 0; padding-left: 18px; width: 100%; }
.invalid { outline: 1px solid #f43f5e; }

/* ---------- Accounts: top-bar menu, sign-in pages, settings ---------- */
.auth-actions { display: flex; gap: 8px; align-items: center; }
.me-menu { position: relative; }
.me-menu > summary { display: block; list-style: none; cursor: pointer; border-radius: 50%; }
.me-menu > summary::-webkit-details-marker { display: none; }
.me-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-menu[open] > summary { box-shadow: 0 0 0 2px var(--border-strong); }
.me-menu-list {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
    min-width: 220px; padding: 8px; border-radius: 14px;
    background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 2px;
}
.me-menu-head { display: flex; flex-direction: column; padding: 6px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.me-menu-list a, .me-menu-list button {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 10px; border-radius: 9px; border: 0; background: none;
    color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.me-menu-list a:hover, .me-menu-list button:hover { background: var(--accent-soft); }
.me-menu-list form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); }

.auth-shell {
    min-height: 100vh; padding: 48px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 22px;
    color: var(--text); background: var(--bg-glow), var(--bg); background-attachment: fixed;
}
.auth-shell .brand { min-width: 0; }
.auth-card { width: 100%; max-width: 420px; padding: 26px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 10px; }
.auth-card > p { margin: 0 0 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0 0; }
.auth-links a, .panel p a, .page-head p a, .getting-started a { color: var(--accent-text); }
.auth-foot { max-width: 420px; margin: 0; text-align: center; }

.form-grid label small { color: var(--muted); font-size: .75rem; }
/* A field whose control can't sit inside its <label> (the town picker's suggestion list would join the label text). */
.form-grid .field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.form-grid .field small { color: var(--muted); font-size: .75rem; }

/* ---------- Town picker (TownPicker.razor + town-picker.js) ---------- */
.town-picker { position: relative; }
.town-options {
    position: absolute;
    z-index: 25;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 264px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.town-options[hidden] { display: none; }
.town-options [role="option"] { padding: 7px 10px; border-radius: 7px; color: var(--text); font-size: .9rem; cursor: pointer; }
.town-options [role="option"]:hover, .town-options [role="option"][aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border-strong); }
label.check, .form-grid label.check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); cursor: pointer; }
input[type=checkbox] { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid input[type=checkbox] { width: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.checks legend { padding: 0 6px; font-size: .8rem; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.inline-form { margin-top: 12px; }
.btn-danger { background: #e11d48; color: #fff; box-shadow: none; }
.danger-zone { box-shadow: inset 0 0 0 1px rgba(244, 63, 94, .45); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.photo-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.photo-actions { flex: 1 1 200px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-actions small { flex-basis: 100%; }
.file-button { position: relative; }
.file-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.kv dd .pill { margin-left: 6px; }

/* ---------- Landing and first-run ---------- */
.landing-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 44px 32px; }
.landing-hero h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.landing-hero p { max-width: 560px; margin: 0; font-size: 1.05rem; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 18px; }
.landing-grid h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 1.05rem; }
.landing-grid p { margin: 0 0 10px; }
.getting-started { margin-bottom: 18px; }
.getting-started ol { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding-left: 20px; }

/* ---------- Collection ---------- */
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.coll-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.coll-list { display: flex; flex-direction: column; gap: 10px; }
.coll-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 14px; }
.coll-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; }
.slot { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.coll-confirm { display: inline-flex; gap: 6px; }
/* ---------- Responsive ---------- */
/* ---------- Social: follows, friends, messages ---------- */
.count-badge {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--pill-hot); color: #fff; font-size: .68rem; font-weight: 800; line-height: 1;
}
.top-icons { display: flex; align-items: center; gap: 2px; }
.icon-btn { text-decoration: none; }
button.icon-btn { background: none; border: 0; cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--accent-soft); }
.icon-btn .count-badge { position: absolute; top: 1px; right: -2px; box-shadow: 0 0 0 2px var(--bg); }
.side-link .count-badge { margin-left: auto; }
.side-following { display: flex; flex-direction: column; gap: 1px; margin: 4px 0 0 6px; padding-left: 8px; border-left: 1px solid var(--border); }
.side-person { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .84rem; min-width: 0; }
.side-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-person:hover { background: var(--accent-soft); color: var(--text); }
.side-more { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; color: var(--muted); font-size: .75rem; text-decoration: none; }
.side-more:hover { color: var(--text); }

.hero-social { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.hero-social a { color: var(--muted); text-decoration: none; }
.hero-social a:hover { color: var(--text); }
.hero-social strong { color: var(--text); }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.profile-notes { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; max-width: 420px; text-align: right; }
.empty-state .profile-actions { justify-content: center; margin-top: 12px; }
.confirm-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.locked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.locked p { margin: 0; }
.locked a { color: var(--accent-text); }
.post-who { color: var(--text); text-decoration: none; }
.post-who:hover { text-decoration: underline; }
.post-card { flex: none; }
.tab-count { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .72rem; }
.tab.active .tab-count { background: rgba(255, 255, 255, .22); color: inherit; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.person-list { display: flex; flex-direction: column; }
.person-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.person-row:first-child { border-top: 0; padding-top: 0; }
.person-row-who { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: 0; }
.person-row-who:hover strong { text-decoration: underline; }
.person-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.coll-tile {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; text-align: center;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
}
.coll-tile strong { font-size: .88rem; }
.coll-tile small { font-size: .74rem; }
.coll-tile-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 20px; }

.choices { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: 10px; }
.choices legend { padding: 0 6px; font-size: .8rem; color: var(--muted); }
.choices small { color: var(--muted); font-size: .75rem; }
.choices input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.messages-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100vh - 210px); min-height: 440px; }
.convo-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.convo-list > p { padding: 8px; }
.convo { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.convo:hover { background: var(--accent-soft); }
.convo.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border-strong); }
.convo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.convo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.convo-top small { flex: none; font-size: .72rem; }
.convo-preview { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.unread .convo-preview { color: var(--text); font-weight: 600; }
.thread { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.thread-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; line-height: 1.25; }
.thread-back { display: none; }
.flip { transform: scaleX(-1); }
/* column-reverse keeps the newest message in view without script. */
.thread-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column-reverse; padding: 16px; }
.thread-messages { display: flex; flex-direction: column; gap: 10px; }
.bubble-row { display: flex; flex-direction: column; gap: 3px; }
.bubble-row.mine { align-items: flex-end; }
.bubble-row.theirs { align-items: flex-start; }
.bubble { max-width: min(72%, 560px); padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.mine .bubble { background: var(--btn-bg); color: var(--btn-text); border-bottom-right-radius: 5px; }
.theirs .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble-time { font-size: .7rem; padding: 0 4px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 160px; font: inherit; }
.thread .alert { margin: 0 16px 12px; }
.composer-locked { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.thread-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px; text-align: center; }

@media (max-width: 1000px) {
    .profile-actions, .profile-notes { justify-content: flex-start; text-align: left; }
    .messages-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 190px); }
    .messages-layout.show-list .thread, .messages-layout.show-thread .convo-list { display: none; }
    .thread-back { display: inline-flex; }
}

/* ---------- Shared bits for the community pages ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rule { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }
.section-title .icon { color: var(--accent-text); }
.desk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.picker-search { margin: 0; max-width: none; height: 40px; }
.money-input { width: 110px; }

/* ---------- Marketplace ---------- */
.market-safety {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 10px 14px;
    border-radius: 12px; background: rgba(251, 191, 36, .08); color: var(--text); font-size: .85rem;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .28);
}
.market-safety .icon { color: var(--gold); flex: none; margin-top: 1px; }
.market-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.market-filters .picker-search { flex: 1 1 240px; }
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.listing { display: flex; gap: 14px; align-items: flex-start; }
.listing.is-chase { box-shadow: var(--shadow), inset 0 0 0 1px var(--accent); }
.listing-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.listing-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.listing-title strong { font-size: 1rem; }
.listing-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.listing-price { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.listing-price-sm { font-weight: 800; }
.listing-seller { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: .85rem; flex-wrap: wrap; }
.listing-seller:hover span { text-decoration: underline; }
.listing-note { font-style: italic; }
.listing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.offer-form { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.offer-form .desk-actions { margin-top: 0; }
.desk-row { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.desk-row:first-of-type { border-top: 0; padding-top: 0; }
.desk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.desk-body p { margin: 4px 0 0; }
.desk-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.offer-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.offer-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.offer-row.is-closed { opacity: .6; }

/* ---------- Pull posts ---------- */
.theme-banner {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 4px; border-radius: 14px;
    background: linear-gradient(120deg, rgba(251, 191, 36, .14), var(--accent-soft)); border: 1px solid var(--border);
}
.theme-banner > div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.theme-banner strong { font-size: 1.05rem; }
.pull-feed { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.theme-rank { font-weight: 800; color: var(--gold); margin-bottom: -8px; }
.pull-post { display: flex; flex-direction: column; gap: 10px; }
.pull-head { display: flex; align-items: center; gap: 10px; }
.pull-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pull-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pull-caption { margin: 0; font-size: .95rem; white-space: pre-line; }
.card-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; text-decoration: none; }
.strip-card { flex: none; border-radius: 6px; }
.strip-card.is-hit .tcg-card, .reveal-card.is-hit .tcg-card { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(251, 191, 36, .45); }
.strip-more { flex: none; align-self: center; padding: 0 10px; color: var(--muted); font-weight: 700; }
.pull-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction {
    display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--surface-2); color: var(--text); font-size: .8rem; box-shadow: inset 0 0 0 1px var(--border);
}
.reaction:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.reaction.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.reaction.is-static { cursor: default; }
.reaction strong { font-size: .78rem; }
.composer-panel .alert { margin-bottom: 12px; }
.pull-composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; }
.pull-composer textarea { width: 100%; resize: vertical; font: inherit; }
.card-picker { display: flex; flex-direction: column; gap: 8px; }
.picker-results { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.picker-result {
    display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; border: 0; cursor: pointer;
    background: var(--surface-2); color: var(--text); text-align: left;
}
.picker-result:hover, .picker-result:focus-visible { background: var(--accent-soft); outline: 0; box-shadow: inset 0 0 0 1px var(--border-strong); }
.picker-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picker-add { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-size: .78rem; font-weight: 700; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; }
.picked-card { position: relative; padding: 0; border: 0; background: none; cursor: pointer; }
.picked-x {
    position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 2px var(--bg);
}
.picked-card:hover .picked-x { background: #e11d48; }

/* ---------- Pull Party ---------- */
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #f43f5e; box-shadow: 0 0 0 0 rgba(244, 63, 94, .6); animation: live-pulse 1.6s infinite; flex: none; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, .6); } 70% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); } }
.live-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    background: rgba(244, 63, 94, .16); color: #fda4af; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.live-badge.sm { padding: 1px 7px; font-size: .62rem; }
.side-link .live-badge.sm { margin-left: auto; }
.page-head h1 .live-badge { font-size: .8rem; }
.live-line { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: .85rem; }
.pull-stage { display: flex; flex-direction: column; gap: 14px; }
.reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.reveal-card { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .82rem; perspective: 800px; }
.flip-in .tcg-card { animation: card-flip .7s cubic-bezier(.2, .8, .2, 1); }
@keyframes card-flip {
    0% { transform: rotateY(90deg) scale(.9); filter: brightness(2); }
    60% { transform: rotateY(-8deg) scale(1.04); }
    100% { transform: rotateY(0) scale(1); filter: none; }
}
.card-back {
    width: 136px; aspect-ratio: 63 / 88; border-radius: 6% / 4.3%; display: grid; place-items: center; color: rgba(255, 255, 255, .7);
    background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 8px, transparent 8px 16px), linear-gradient(145deg, var(--accent), #312e81);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .12);
}
.card-back.is-waiting { opacity: .55; animation: waiting 1.8s ease-in-out infinite; }
@keyframes waiting { 50% { opacity: .9; } }
.replay-actions { justify-content: center; }
.host-panel .card-picker { margin: 10px 0 4px; }
.best-pull { display: flex; gap: 12px; align-items: flex-start; }
.party-list { display: flex; flex-direction: column; gap: 8px; }
.party-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--surface-2); text-decoration: none; }
.party-row:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.party-row .rail-text strong { display: flex; align-items: center; gap: 8px; }
.party-peek { display: flex; gap: 4px; }

/* ---------- Chase Squads ---------- */
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.squad-tile { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); text-decoration: none; }
.squad-tile:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.squad-tile.is-mine { box-shadow: inset 0 0 0 1px var(--accent); }
.squad-tile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.squad-counts { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8rem; color: var(--muted); }
.squad-counts span { display: inline-flex; align-items: center; gap: 4px; }
.squad-counts.big { font-size: .92rem; color: var(--text); margin: 6px 0; }
.squad-latest { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.squad-hero { display: flex; gap: 20px; align-items: center; margin-top: 10px; }
.squad-hero-body { flex: 1; min-width: 0; }
.squad-hero-body h1 { font-size: 1.6rem; font-weight: 800; }
.squad-hero-body p { margin: 4px 0 0; }
.squad-composer { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.squad-composer textarea { width: 100%; resize: vertical; font: inherit; }
.kind-picker { display: flex; gap: 6px; }
.kind { padding: 5px 12px; border-radius: 999px; border: 0; cursor: pointer; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .8rem; }
.kind.on { background: var(--btn-bg); color: var(--btn-text); }
.squad-text { white-space: pre-line; }

/* ---------- Events ---------- */
.event-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.event-row:first-of-type { border-top: 0; padding-top: 0; }
.event-row .rail-text a { text-decoration: none; }
.event-row .rail-text a:hover strong { text-decoration: underline; }
.date-block {
    flex: none; width: 54px; padding: 6px 0; border-radius: 12px; text-align: center; text-decoration: none;
    display: flex; flex-direction: column; line-height: 1.1;
    background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); box-shadow: inset 0 0 0 1px var(--border-strong);
}
.date-block small { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.date-block strong { font-size: 1.35rem; font-weight: 800; }
.date-block.big { width: 76px; padding: 10px 0; }
.date-block.big strong { font-size: 2rem; }
.event-hero { display: flex; gap: 18px; align-items: flex-start; }
.event-title { font-size: 1.6rem; font-weight: 800; margin: 6px 0 4px; }
.event-hero p { margin: 4px 0 0; }
.event-description { white-space: pre-line; font-size: .95rem; margin: 16px 0 8px; }

/* ---------- Games ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.game-tile {
    display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; text-decoration: none;
    background: linear-gradient(150deg, hsl(var(--gh, 262) 70% 45% / .32), var(--surface) 60%);
    border: 1px solid hsl(var(--gh, 262) 70% 65% / .35); box-shadow: var(--shadow);
}
.game-tile:hover { border-color: hsl(var(--gh, 262) 80% 70% / .7); }
.game-tile.is-upcoming { background: linear-gradient(150deg, hsl(var(--gh, 262) 50% 40% / .18), var(--surface) 60%); }
.game-tile .btn { align-self: flex-start; }
.game-art {
    display: grid; place-items: center; width: 58px; height: 58px; border-radius: 14px; color: #fff;
    background: linear-gradient(145deg, hsl(var(--gh, 262) 80% 58%), hsl(calc(var(--gh, 262) + 40) 70% 32%));
}
.game-art.big { width: 84px; height: 84px; border-radius: 18px; flex: none; }
.game-body { display: flex; flex-direction: column; gap: 4px; }
.game-body strong { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.game-body small { color: var(--muted); }
.game-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); }
.game-stats span { display: inline-flex; align-items: center; gap: 4px; }
.game-hero {
    display: flex; gap: 18px; align-items: center; margin-top: 10px; padding: 20px; border-radius: 14px;
    background: linear-gradient(120deg, hsl(var(--gh, 262) 70% 45% / .35), var(--surface) 70%); border: 1px solid var(--border);
}
.game-hero h1 { font-size: 1.7rem; font-weight: 800; }
.game-hero p { margin: 4px 0 8px; color: var(--muted); }

@media (max-width: 1200px) {
    .pull-composer { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
    .listing-grid { grid-template-columns: minmax(0, 1fr); }
    .squad-hero, .event-hero { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    .live-dot, .card-back.is-waiting, .flip-in .tcg-card { animation: none; }
}

@media (max-width: 1500px) {
    .page-with-rail { grid-template-columns: minmax(0, 1fr); }
    .rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 1200px) {
    .overview { grid-template-columns: minmax(0, 1fr); }
    .overview-left { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
    .two-col, .drops-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
    .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
    .sidebar, .topnav { display: none; }
    .brand { min-width: 0; }
    .overview-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chaser" "squad" "top9" "trophies" "badges" "chases" "activity"; }
    .hero-body { flex-wrap: wrap; }
    .hero-side { align-items: flex-start; }
    .chase-grid { grid-template-columns: minmax(0, 1fr); }
    .match-body { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .tcg-holo, .confetti i, .skeleton { animation: none; }
    .tcg-card, .btn, .meter-fill { transition: none; }
}

/* ---------- Banner art (theme colors via CSS) ---------- */
.bn-sky-1 { stop-color: var(--bn-sky-1); }
.bn-sky-2 { stop-color: var(--bn-sky-2); }
.bn-sky-3 { stop-color: var(--bn-sky-3); }
.bn-sun { stop-color: var(--bn-sun); }
.bn-sun-disc { fill: var(--bn-sun); opacity: .9; }
.bn-mtn-back { fill: var(--bn-mtn-back); opacity: .85; }
.bn-mtn { fill: var(--bn-mtn); }
.bn-snow { fill: var(--bn-snow); opacity: .9; }
.bn-pagoda { fill: var(--bn-pagoda); }
.bn-branch { fill: none; stroke: var(--bn-branch); stroke-width: 6; stroke-linecap: round; }
.bn-blossom { fill: var(--bn-blossom); opacity: .9; }
.bn-blossom-light { fill: var(--bn-blossom-light); }
.bn-petal { fill: var(--bn-petal); opacity: .75; }

/* ---------- Blazor plumbing ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #111;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { padding: 1rem; color: white; background: #b32121; border-radius: 10px; }
.blazor-error-boundary::after { content: "An error has occurred."; }
