* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root, [data-theme="dark"] {
    /* Dark mode (default) — neutral surfaces, Master Ball purple accent */
    --bg-primary: #0e0e10;
    --bg-secondary: #18181b;
    --bg-tertiary: #232327;
    --bg-hover: #2f2f35;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.14);
    --text-primary: #f5f5f3;
    --text-secondary: #a3a29e;
    --text-muted: #6f6e69;
    --accent: #9d5cff;
    --accent-hover: #b07fff;
    --accent-subtle: rgba(157, 92, 255, 0.13);
    --accent-glow: rgba(157, 92, 255, 0.18);
    --success: #69db7c;
    --danger: #ff6b6b;
    --warning: #ffd43b;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --card-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.75), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* overshoots a little: the bouncy feel */
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: var(--font-body); /* Plus Jakarta Sans everywhere (2026-10-15) */
    --binder-color: #1e3a5f;
    --card-back-primary: #1a237e;
    --card-back-secondary: #3949ab;
}

[data-theme="light"] {
    --bg-primary: #f6f5f2;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eeede9;
    --bg-hover: #e5e3de;
    --border-color: rgba(30, 28, 25, 0.1);
    --border-light: rgba(30, 28, 25, 0.16);
    --text-primary: #1e1c19;
    --text-secondary: #605d57;
    --text-muted: #97948c;
    --accent: #6d33d6;
    --accent-hover: #5b28b8;
    --accent-subtle: rgba(109, 51, 214, 0.09);
    --accent-glow: rgba(109, 51, 214, 0.15);
    --success: #1f9d4d;
    --danger: #dc3b30;
    --warning: #f59e0b;
    --shadow-sm: 0 2px 8px rgba(25, 23, 20, 0.06);
    --shadow: 0 4px 20px rgba(25, 23, 20, 0.1);
    --shadow-lg: 0 8px 40px rgba(25, 23, 20, 0.14);
    --card-shadow: 0 10px 20px -12px rgba(25, 23, 20, 0.45), 0 2px 6px -2px rgba(25, 23, 20, 0.2);
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

/* Header */
/* Solid, no backdrop blur: a blurred sticky bar re-renders on every scroll frame
   over the tilting hero cards and binder preview, and flickers */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* User Menu & Popover */
.user-menu-wrapper {
    position: relative;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.user-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.user-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent);
}

.user-btn.logged-in {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.user-popover {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 0.25rem;
    z-index: 200;
}

.user-popover.open {
    display: block;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.popover-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.popover-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* woahpoke account block at the top of the account popover */
.popover-user {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.75rem 0.4rem;
}

.popover-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.popover-item[hidden],
.popover-user[hidden] { display: none; }

a.popover-item { text-decoration: none; }

.popover-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Login Modal */
.login-modal-body {
    padding: 2.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.login-header {
    text-align: center;
}

.login-logo {
    height: 32px;
    width: auto;
    margin-bottom: 0.75rem;
}

[data-theme="light"] .login-logo {
    filter: invert(1);
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.login-option-btn.google {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.login-option-btn.google:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-divider span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-email-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition);
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.login-submit-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.login-submit-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.login-footer {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* Dark mode (default): show sun icon (to switch to light), hide moon */
[data-theme="dark"] .theme-icon.moon,
:root:not([data-theme="light"]) .theme-icon.moon { display: none; }
[data-theme="dark"] .theme-icon.sun,
:root:not([data-theme="light"]) .theme-icon.sun { display: block; }

/* Light mode: show moon icon (to switch to dark), hide sun */
[data-theme="light"] .theme-icon.moon { display: block; }
[data-theme="light"] .theme-icon.sun { display: none; }

.header-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.logo {
    height: 24px;
    width: auto;
}

.beta-tag {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 9999px;
    padding: 0.1rem 0.4rem;
    line-height: 1.3;
}

[data-theme="light"] .logo,
[data-theme="light"] .home-logo {
    filter: invert(1);
}

nav {
    display: flex;
    gap: 0.25rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-btn:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent);
    color: #fff;
}

.badge {
    background: var(--accent-subtle);
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
}

.nav-btn.active .badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ==========================================
   Home Section
   ========================================== */
.home-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh; /* the footer starts below the fold, so rows loading in never push it around */
}

.home-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Hero */
.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 2rem;
    padding: 2.5rem 0 1.5rem;
}

.home-sub {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.5;
    margin-top: 0.875rem;
    max-width: 34ch;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 1.5rem;
}

.hero-btn {
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.7rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.hero-btn:hover { border-color: var(--text-secondary); }

.hero-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.hero-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Fan of three featured cards */
.home-hero-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    padding: 1rem 0;
}

.hero-card {
    width: 38%;
    max-width: 210px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.hero-card:nth-child(1) { transform: rotate(-9deg) translateY(14px); margin-right: -9%; }
.hero-card:nth-child(2) { z-index: 2; transform: translateY(-8px) scale(1.08); }
.hero-card:nth-child(3) { transform: rotate(9deg) translateY(14px); margin-left: -9%; }
.hero-card:hover { z-index: 3; }
.hero-card:nth-child(1):hover { transform: rotate(-5deg) translateY(0); }
.hero-card:nth-child(2):hover { transform: translateY(-16px) scale(1.1); }
.hero-card:nth-child(3):hover { transform: rotate(5deg) translateY(0); }

/* Latest set row */
.home-eyebrow {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

/* A small grey label over a Home section's title, in plain words ("Binder planner", "Out Nov 6") */
.home-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    margin-bottom: 0.5rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
}
.home-pill[hidden] { display: none; }
.home-chart-header > div > .home-pill { display: flex; }
.home-chart-header > div > .home-pill[hidden] { display: none; }
.home-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }

.home-latest .home-chart-header h3 { font-size: 1.375rem; }

.home-see-all-set {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
}

.home-see-all-set:hover { text-decoration: underline; }

.home-latest-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 168px;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.75rem 0.25rem 1rem;
    margin: 0 -0.25rem;
    scrollbar-width: thin;
}

.home-logo {
    height: 48px;
    width: auto;
    max-width: 300px;
    display: block;
    margin: 0 auto 0.75rem;
}

.home-tagline {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: clamp(2rem, 4.2vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    text-wrap: balance;
}

/* Quick Actions */
.home-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.quick-action-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.quick-action-card:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 0.25rem;
    transition: all var(--transition);
}

.quick-action-card:hover .quick-action-icon {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.quick-action-label {
    font-weight: 700;
    font-size: 0.9rem;
}

.quick-action-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Stats Bar */
.home-stats-bar {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem 2rem 1.25rem;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.home-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.25rem;
}

.home-stats-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.home-stats-period {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.home-stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.home-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0.25rem 1rem;
    border-radius: var(--radius);
}

.home-stat:hover {
    background: var(--bg-tertiary);
}

.home-stat-number {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.home-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.home-stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border-color);
}

/* Charts Preview Grid */
.home-charts-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.home-chart-block {
    padding: 0;
}

.home-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.home-chart-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.home-see-all {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.home-see-all:hover {
    background: var(--accent-subtle);
}

.home-chart-row {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.home-chart-row::-webkit-scrollbar {
    height: 4px;
}

.home-chart-row::-webkit-scrollbar-track {
    background: transparent;
}

.home-chart-row::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.home-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.home-chart-empty {
    width: 100%;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Home Card Item */
.home-card-item {
    flex: 0 0 auto;
    width: 130px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.home-card-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.home-card-item img {
    width: 100%;
    aspect-ratio: 5/7;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.home-card-rank {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-card-rank.gold { background: linear-gradient(135deg, #f59e0b, #d97706); }
.home-card-rank.silver { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.home-card-rank.bronze { background: linear-gradient(135deg, #d97706, #92400e); }

.home-card-score {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 700;
}

.home-card-name {
    margin-top: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Responsive for Home */
@media (max-width: 768px) {
    .home-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .home-stats-bar {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .home-stats-row {
        gap: 1rem;
    }

    .home-stat-number {
        font-size: 1.35rem;
    }

    .home-hero {
        padding: 1.5rem 1rem 0.5rem;
    }

    .home-tagline {
        font-size: 1.125rem;
    }

    .home-logo {
        height: 36px;
    }

    .home-card-item {
        width: 110px;
    }
}

@media (max-width: 480px) {
    .home-quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .quick-action-card {
        padding: 1rem 0.75rem;
    }

    .quick-action-icon {
        width: 44px;
        height: 44px;
    }

    .quick-action-icon svg {
        width: 22px;
        height: 22px;
    }

    .home-stats-bar {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .home-stats-row {
        gap: 0.75rem;
    }

    .home-stat-number {
        font-size: 1.2rem;
    }

    .home-stat {
        padding: 0.25rem 0.5rem;
    }

    .home-card-item {
        width: 100px;
    }
}

/* Search Section */
.search-section {
    margin-bottom: 1rem;
}

.browse-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.browse-row-top {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.browse-row-filters {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
    max-width: 440px;
}

#search-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    min-width: 0;
    transition: all var(--transition);
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-btn {
    padding: 0.625rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

#search-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.filters, .browse-row-filters {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.filters select, .browse-row-filters select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.filters select:focus, .browse-row-filters select:focus {
    border-color: var(--accent);
}

.price-timestamp {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.6;
    white-space: nowrap;
}

.art-chip {
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.art-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.art-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Cards Grid */
.cards-section {
    min-height: 400px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.75rem 1.25rem;
}

.card {
    cursor: pointer;
    position: relative;
    min-width: 0;
}

.card-image {
    width: 100%;
    aspect-ratio: 600 / 825;
    border-radius: 4.55% / 3.5%;
    background: var(--bg-tertiary);
    position: relative;
    transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-image:has(img.loaded) {
    background: transparent;
}

/* Grid tiles: a little pop under the pointer, like the Connecting cards widget.
   No foil or glare here; the opened card has the full holo effect. */
.card .card-image {
    /* Always its own GPU layer (rest and hover are both 3D transforms), so
       starting or stopping the lift doesn't re-rasterise the card: no flicker */
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
    transition: transform 320ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
/* Shadow on a pseudo-element, fading its opacity: cheaper than animating box-shadow */
.card .card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: none;
    z-index: -1;
}
@media (hover: hover) {
    .card:hover .card-image { transform: translate3d(0, -6px, 0) scale(1.02); }
    .card:hover .card-image::after { opacity: 1; }
}
.card:active .card-image { transform: translate3d(0, 0, 0) scale(0.97); }

.card-image.holo .holo-rotator {
    box-shadow: var(--card-shadow);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.card-image img.loaded {
    opacity: 1;
}

/* Shimmer loading effect */
.card-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: inherit;
}

.card-image:has(img.loaded)::before {
    display: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.card-info {
    padding: 0.625rem 0.125rem 0;
}

.card-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-name {
    font-weight: 600;
    font-size: 0.8125rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-price {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--success);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.card-set {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.card:hover .card-actions {
    opacity: 1;
}

.card-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all var(--transition);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: white;
}

.card-action-btn.wishlist { color: #f87171; }
.card-action-btn.wishlist.active { background: #ef4444; color: white; }
.card-action-btn.collection { color: #4ade80; }
.card-action-btn.collection.active { background: #22c55e; color: white; }

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 1.5rem;
}

#load-more-btn {
    padding: 0.625rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

#load-more-btn:hover {
    background: var(--bg-hover);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.125rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 10;
}

.modal-close:hover { background: var(--bg-hover); }

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    padding: 1.5rem;
}

.modal-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-details p {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.modal-details strong { color: var(--text-primary); }

.modal-prices {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius);
}

.modal-prices h3 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
}

.price-item {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.price-label { color: var(--text-muted); }
.price-value { font-weight: 600; color: var(--success); }

/* Tags Section */
.modal-tags {
    margin-top: 0.5rem;
}

.tags-header {
    margin-bottom: 0.375rem;
}

.tags-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    min-height: 1.5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.tag-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.tag-chip.user-tagged {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.tag-chip .tag-count {
    font-size: 0.55rem;
    opacity: 0.7;
    font-weight: 500;
}

.tags-input-row {
    display: flex;
    gap: 0.375rem;
}

.tags-input {
    flex: 1;
    padding: 0.35rem 0.625rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.tags-input:focus {
    border-color: var(--accent);
}

.tags-input::placeholder {
    color: var(--text-muted);
}

.tags-add-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-family: inherit;
}

.tags-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.action-btn {
    flex: 1;
    padding: 0.625rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.wishlist-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.wishlist-btn:hover, .wishlist-btn.active { background: #ef4444; color: white; border-color: #ef4444; }

.collection-btn {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.collection-btn:hover, .collection-btn.active { background: #22c55e; color: white; border-color: #22c55e; }

/* Toasts (from the Michi tool) */
.toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    z-index: 2000;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}
.toast {
    pointer-events: auto;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(12px) scale(0.92);
    transition: opacity 200ms, transform 380ms var(--spring);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }
.toast-warn { background: var(--warning); color: #1e1c19; }
.toast-success::before { content: '✓'; color: var(--success); }
.toast-action {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
}
[data-theme="light"] .toast-action { color: #c9a7ff; }
.toast-error .toast-action, .toast-warn .toast-action { color: inherit; }

/* ==================== BINDER STYLES ==================== */

/* Binder color: Michi tool swatches + custom hex picker (binder-color.js) */
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 26px)); gap: 6px; }
.swatches > * {
    position: relative;
    display: block;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sw);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.swatches > *:hover { transform: scale(1.1); }
.swatches > *:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Selected: white ring drawn inside the swatch, so it never touches its neighbours. */
.swatches > .active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}
.swatch-custom { background: none; }
.swatch-custom::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff6b6b, #ffd43b, #69db7c, #4dabf7, #9d5cff, #ff6b6b);
    pointer-events: none;
}
/* A custom colour shows as the colour itself, inside the rainbow ring */
.swatch-custom.active::before { background: var(--sw); }

.hex-picker {
    margin-top: 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.hex-picker[hidden] { display: none; }
.hex-picker-sv {
    position: relative;
    height: 120px;
    border-radius: 6px;
    background:
        linear-gradient(to top, #000, transparent),
        linear-gradient(to right, #fff, var(--hue));
    cursor: crosshair;
    touch-action: none;
}
.hex-picker-thumb {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: var(--picked);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.hex-picker-hue {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    margin: 0;
    border-radius: 999px;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
    cursor: pointer;
}
.hex-picker-hue::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--hue);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.4);
}
.hex-picker-hue::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: var(--hue);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.4);
}
.hex-picker-field {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}
.hex-picker-field:focus-within { border-color: var(--accent); }
.hex-picker-preview { width: 18px; height: 18px; border-radius: 4px; background: var(--picked); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); flex: none; }
.hex-picker-label { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; color: var(--text-muted); }
.hex-picker-hash { color: var(--text-muted); margin-right: -4px; }
.hex-picker-field input {
    flex: 1;
    width: 0;
    min-width: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-transform: uppercase;
    outline: none;
    padding: 2px 0;
}

.binder-section { padding: 0; }

.binder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 1.5rem;
}

/* Card Source Panel - Below Binder */
.binder-card-source {
    margin-top: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.card-source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-source-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.source-header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
}

.card-source-header .search-box {
    flex: 1;
    max-width: 300px;
}

.fade-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.fade-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.source-filter-select {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.binder-highlight-toggle {
    padding: 0.25rem 0;
}

/* Binder page: grey out unowned cards */
.binder-slot.binder-unowned {
    opacity: 0.35;
    filter: grayscale(0.5);
    transition: opacity 0.2s, filter 0.2s;
}
.binder-slot.binder-unowned:hover {
    opacity: 0.7;
    filter: none;
}

.binder-card-source .source-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.binder-card-source .source-group {
    flex-shrink: 0;
}

.binder-card-source .source-group h5 {
    position: static;
    background: transparent;
}

.binder-card-source .source-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 345px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.binder-card-source .source-cards.expanded {
    max-height: none;
}

.source-see-more {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.source-see-more:hover { background: var(--accent-subtle); }

/* Owned/wishlist badge on source cards */
.source-card { position: relative; }
.source-card-badge {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
}
.source-card-badge.badge-wishlist {
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
}
.source-card-badge.badge-collection {
    background: rgba(34, 197, 94, 0.85);
    color: #fff;
}

/* Fade wishlisted cards toggle */
.source-card.faded-unowned {
    opacity: 0.35;
    filter: grayscale(0.5);
}
.source-card.faded-unowned:hover {
    opacity: 0.7;
    filter: none;
}

.binder-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0; /* let the pockets size to the space, not the other way round */
}

/* Binder Spread */
.binder-spread {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.binder-page {
    position: relative; /* holds the drop preview */
    display: grid;
    gap: 8px;
    padding: 16px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    background: linear-gradient(145deg,
        color-mix(in srgb, var(--binder-color) 95%, #888) 0%,
        color-mix(in srgb, var(--binder-color) 70%, #555) 100%
    );
    border-radius: var(--radius) 0 0 var(--radius);
}

.binder-page.right-page { border-radius: 0 var(--radius) var(--radius) 0; }

.binder-spine {
    width: 16px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--binder-color) 30%, #333),
        color-mix(in srgb, var(--binder-color) 50%, #444),
        color-mix(in srgb, var(--binder-color) 30%, #333)
    );
}

/* Grid layouts - scaled up */
.binder-page.grid-2x2 { grid-template-columns: repeat(2, 120px); grid-template-rows: repeat(2, 168px); }
.binder-page.grid-3x3 { grid-template-columns: repeat(3, 100px); grid-template-rows: repeat(3, 140px); }
.binder-page.grid-4x3 { grid-template-columns: repeat(4, 85px); grid-template-rows: repeat(3, 119px); }
.binder-page.grid-4x4 { grid-template-columns: repeat(4, 80px); grid-template-rows: repeat(4, 112px); }

.binder-slot {
    background: color-mix(in srgb, var(--binder-color) 80%, rgba(128,128,128,0.3));
    border: 1.5px dashed color-mix(in srgb, var(--binder-color) 40%, #999);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.binder-slot:hover {
    border-color: color-mix(in srgb, var(--binder-color) 30%, #777);
    background: color-mix(in srgb, var(--binder-color) 70%, rgba(128,128,128,0.3));
}

.binder-slot.filled { border: none; background: transparent; cursor: grab; }
.binder-slot.filled:active { cursor: grabbing; }
.binder-slot.filled img { pointer-events: none; }
/* Tap an empty pocket to select it; the next tapped card goes there (Michi tool) */
.binder-slot.empty { cursor: pointer; }
.binder-slot.selected { border: 2px solid var(--accent); background: var(--accent-subtle); }
.binder-slot.selected::after {
    content: 'Tap a card below';
    position: absolute;
    inset: auto 0 8px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}
.compact .binder-slot.selected::after { display: none; }
/* The pop when a card lands */
.binder-slot.just-added { animation: binder-pop 320ms ease-out; }
@keyframes binder-pop { 0% { transform: scale(0.88); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.binder-nav-divider { width: 1px; height: 20px; background: var(--border-color); margin: 0 4px; }
.nav-arrow:disabled { opacity: 0.35; cursor: default; }
.source-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.binder-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
}

.binder-slot .remove-card {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.binder-slot:hover .remove-card { opacity: 1; }

/* Michi blocks (binder-michi.js; styles from the Michi tool) */
.binder-slot.merged-occupied {
    grid-column: span var(--merge-cols, 2);
    grid-row: span var(--merge-rows, 2);
    border: none;
    background: none;
    box-shadow: none;
    overflow: visible;
}
.michi-block { position: relative; border-radius: 4px; }
.michi-tiles {
    display: grid;
    grid-template-columns: repeat(var(--bw), 1fr);
    grid-template-rows: repeat(var(--bh), 1fr);
    gap: 8px; /* the page's pocket gap, so slices sit where they'll print */
    width: 100%;
    height: 100%;
}
.michi-tile {
    position: relative;
    border-radius: 4px;
    background-color: var(--accent-subtle);
    border: 1.5px solid var(--accent);
    background-repeat: no-repeat;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.michi-tile[style*="background-image"] { border: none; }
.michi-tile[style*="background-image"]::after {
    /* soft sleeve glare */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.04) 28%, transparent 42%, transparent 70%, rgba(255,255,255,0.06) 100%);
    pointer-events: none;
    border-radius: inherit;
}
.michi-block.file-over .michi-tile { outline: 3px solid var(--accent); }
.michi-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.michi-empty-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 150ms, transform 240ms var(--spring);
}
.michi-empty-pick:hover { background: var(--accent-subtle); }
.michi-empty-pick:active { transform: scale(0.95); }
.michi-empty-pick svg { width: 28px; height: 28px; }
.michi-empty-pick small { font-weight: 500; font-size: 11px; color: var(--text-secondary); }
.michi-empty-link {
    border: 0;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.michi-empty-link:hover { color: var(--accent); }
/* 1×1 block (a photo card): one pocket, so less padding */
.michi-single .michi-empty { gap: 2px; padding: 4px; }
.michi-single .michi-empty-pick { padding: 6px 8px; }
.michi-single .michi-empty-pick svg { width: 22px; height: 22px; }
.michi-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 2;
}
.michi-block:hover .michi-actions, .michi-actions:focus-within { opacity: 1; }
.michi-block:not(:has(.michi-tile[style*="background-image"])) .michi-actions { opacity: 1; } /* × always there on an empty block */
@media (hover: none) { .michi-actions { opacity: 1; } }
.michi-actions button {
    height: 26px;
    min-width: 26px;
    padding: 0 9px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.michi-actions button:hover { background: var(--accent); }
.michi-actions button[data-act="remove"] { font-size: 16px; padding: 0; }
.michi-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    pointer-events: none;
}

/* Michi mode (the Michi tool's look): banner, outlined pages, "+" pockets */
.binder-main { position: relative; }
.michi-banner {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: joy-chip-in 360ms var(--spring);
}
.michi-banner[hidden] { display: none; }
.michi-banner-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); }
.michi-banner > button {
    border: 0;
    border-radius: 999px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font: inherit;
    cursor: pointer;
    transition: background-color 150ms, transform 240ms var(--spring);
}
.michi-banner > button:hover { background: rgba(255, 255, 255, 0.3); }
.michi-banner > button:active { transform: scale(0.94); }
.binder-spread.michi-on .binder-page { outline: 2px solid var(--accent); outline-offset: 2px; }
.binder-slot.michi-target {
    border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    background: transparent;
    cursor: crosshair;
    touch-action: none;
}
.binder-slot.michi-target:hover { border-color: var(--accent); background: var(--accent-subtle); }
.binder-spread.michi-on .binder-slot.filled { opacity: 0.45; }
.pocket-plus { color: var(--accent); font-size: 22px; opacity: 0.55; pointer-events: none; }
.binder-select-rect {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border: 2px solid var(--accent);
}
.binder-select-rect::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
}
.binder-select-rect.bad { background: rgba(255, 107, 107, 0.18); border-color: var(--danger); }
.binder-select-rect.bad::after { background: var(--danger); content: 'Not empty'; }
.michi-steps { padding-left: 18px; font-size: 0.8125rem; color: var(--text-secondary); display: grid; gap: 4px; }
.michi-steps b { color: var(--text-primary); }

/* Michi crop + link dialogs */
.michi-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.65);
}
.michi-modal[hidden] { display: none; }
.michi-modal-card {
    width: min(760px, 100%);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: joy-chip-in 300ms var(--spring);
}
.michi-modal-small { width: min(440px, 100%); }
.michi-modal-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.michi-modal-sub { font-size: 0.8rem; color: var(--text-muted); }
.michi-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.michi-primary {
    padding: 0.55rem 1.1rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 240ms var(--spring), background-color 150ms;
}
.michi-primary:hover { background: var(--accent-hover); }
.michi-primary:active { transform: scale(0.94); }
.michi-primary:disabled { opacity: 0.6; }
.michi-link-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font: inherit;
}
.michi-link-input:focus { outline: none; border-color: var(--accent); }
.crop-wrap { height: min(60vh, 520px); background: #000; border-radius: var(--radius); overflow: hidden; }
.crop-wrap img { display: block; max-width: 100%; }
.crop-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); margin-left: auto; cursor: pointer; }
.crop-pockets { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--w), 1fr); grid-template-rows: repeat(var(--h), 1fr); pointer-events: none; }
.crop-pockets span { border: 1px dashed rgba(255, 255, 255, 0.7); }
.crop-pockets[hidden] { display: none; }
.cropper-view-box { outline-color: var(--accent); }
.cropper-point, .cropper-line { background-color: var(--accent); }
body.modal-open { overflow: hidden; }

/* Binder Navigation */
.binder-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.nav-arrow {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.nav-arrow:hover:not(:disabled) { background: var(--bg-hover); }
.nav-arrow:disabled { opacity: 0.3; cursor: not-allowed; }

#page-indicator {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    min-width: 70px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.add-page-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-left: 0.5rem;
}

.add-page-btn:hover { background: var(--accent-hover); }

/* Binder Sidebar */
.binder-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-section h4 {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Binder Selector */
.binder-selector {
    display: flex;
    gap: 0.375rem;
}

.binder-selector select {
    flex: 1;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8125rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.binder-selector select:focus { border-color: var(--accent); }

.binder-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.binder-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.binder-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

/* Card Source Panel */
.source-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.source-group h5 {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 0.25rem 0;
}

.source-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source-card {
    width: 92px;
    height: 129px;
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y; /* swipes scroll; press and hold to drag */
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.source-card {
    transition: transform 260ms var(--spring), border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.source-card:hover {
    transform: translateY(-4px) rotate(-1.5deg) scale(1.04);
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.source-card:active { transform: scale(0.96); }


/* Binder drag and drop (binder-drag.js, ported from the Michi tool) */
.binder-drop-rect {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    border: 2px solid var(--accent);
    background: var(--accent-subtle);
    border-radius: 4px;
}
.binder-drop-rect.swap { border-style: dashed; }
.binder-drop-rect.bad { background: rgba(255, 107, 107, 0.18); border-color: var(--danger); }
.drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    pointer-events: none;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    opacity: 0.95;
}
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.drag-source { opacity: 0.35; }
.binder-card-source { transition: background var(--transition); }
.binder-card-source.remove-hover { background: rgba(255, 107, 107, 0.12); }
.binder-card-source.remove-hover .card-source-header h4::before {
    content: 'Drop here to remove from binder · ';
    color: var(--danger);
    font-weight: 600;
}
.source-card img { width: 100%; height: 100%; object-fit: cover; }

.source-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.75rem;
}

/* Grid Options */
.grid-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

.grid-btn {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.grid-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.grid-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Toggle */
.toggle-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.toggle-label span:first-child {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.toggle-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.toggle {
    position: relative;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: white; }

/* Michi Controls */
.michi-controls { padding-top: 0.5rem; border-top: 1px solid var(--border-color); }

.michi-size-select {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

.michi-size-btn {
    padding: 0.375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all var(--transition);
}

.michi-size-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.michi-size-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.michi-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin: 0.5rem 0;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }

/* Stats */
.stats-section {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.stat-row span:first-child { color: var(--text-muted); }
.stat-row span:last-child { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

.stat-row + .stat-row { margin-top: 0.375rem; }

/* Sidebar Actions */
.sidebar-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn-small {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all var(--transition);
}

.action-btn-small:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-btn-small.danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: var(--danger); }

.save-cloud-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: auto;
}

.save-cloud-btn:hover { background: var(--accent-hover); }

/* Share binder button + menu */
.binder-share-wrap { position: relative; margin-top: 0.5rem; }

.share-binder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.share-binder-btn:hover { border-color: var(--accent); color: var(--accent); }

.share-binder-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 50;
}

.share-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.share-menu-item:hover { background: var(--bg-hover); color: var(--accent); }

/* ==========================================
   Shared binder viewer (read-only)
   ========================================== */
.shared-binder-container { max-width: 1100px; margin: 0 auto; }

.shared-binder-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.shared-binder-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.shared-binder-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0.25rem 0 0.15rem;
}

.shared-binder-meta { font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.shared-binder-cta {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius);
    transition: background var(--transition);
    white-space: nowrap;
}

.shared-binder-cta:hover { background: var(--accent-hover); }

.shared-binder-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.shared-binder-spread {
    display: flex;
    background: color-mix(in srgb, var(--binder-color) 82%, #000);
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.shared-binder-spread .binder-page.shared { pointer-events: auto; }

.shared-binder-spread .binder-slot.clickable { cursor: pointer; }
.shared-binder-spread .binder-slot.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.shared-binder-spread .binder-slot img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }

.shared-michi-placeholder {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.25rem;
}

.shared-binder-pageind {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-variant-numeric: tabular-nums;
}

.shared-binder-error {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 0.95rem;
}

/* ==================== SWIPE MODE STYLES ==================== */

.swipe-section {
    padding: 1rem;
}

/* Swipe (swipe.js): a deck of cards. The top card follows the pointer; the
   next two peek out behind and spring forward when it's thrown. */
.swipe-container {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
}

.swipe-progress {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.swipe-progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--accent);
    transition: width 400ms var(--spring);
}

.swipe-deck {
    position: relative;
    width: min(100%, 340px);
    aspect-ratio: 63 / 88;
    margin-bottom: 24px; /* room for the cards peeking out below */
    user-select: none;
    -webkit-user-select: none;
}
.swipe-deck.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4.5% / 3.2%;
    background: var(--bg-tertiary);
    animation: swipe-shimmer 1.2s ease-in-out infinite;
}
@keyframes swipe-shimmer { 50% { opacity: 0.5; } }

.swipe-card {
    --depth: 0;
    position: absolute;
    inset: 0;
    border-radius: 4.5% / 3.2%;
    overflow: hidden;
    cursor: grab;
    touch-action: none;           /* the card handles its own drag */
    -webkit-touch-callout: none;  /* no "save image" menu mid-swipe */
    transform-origin: 50% 100%;
    transform: translateY(calc(var(--depth) * 12px)) scale(calc(1 - var(--depth) * 0.05));
    filter: brightness(calc(1 - var(--depth) * 0.18));
    opacity: calc(1 - var(--depth) * 0.12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, calc(0.45 - var(--depth) * 0.12));
    transition: transform 520ms var(--spring), filter 300ms, opacity 300ms;
    will-change: transform;
}
.swipe-card:not(.is-top) { pointer-events: none; }
.swipe-card.is-dragging { cursor: grabbing; transition: none; }
.swipe-card.is-loading { background: var(--bg-tertiary); animation: swipe-shimmer 1.2s ease-in-out infinite; }
.swipe-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

/* Stamps fade in as you drag towards a decision */
.swipe-stamp {
    position: absolute;
    top: 9%;
    padding: 6px 14px;
    border: 3px solid currentColor;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: rgba(14, 14, 16, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    pointer-events: none;
    opacity: 0;
}
.stamp-want { left: 8%; color: #ff6bcb; transform: rotate(-14deg) scale(calc(0.8 + var(--want, 0) * 0.2)); opacity: var(--want, 0); }
.stamp-skip { right: 8%; color: #d4d4d8; transform: rotate(14deg) scale(calc(0.8 + var(--skip, 0) * 0.2)); opacity: var(--skip, 0); }
.stamp-got { left: 50%; top: auto; bottom: 12%; color: #69db7c; transform: translateX(-50%) rotate(-4deg) scale(calc(0.8 + var(--got, 0) * 0.2)); opacity: var(--got, 0); }
.swipe-card.thrown-wishlist .stamp-want, .swipe-card.thrown-skip .stamp-skip, .swipe-card.thrown-collection .stamp-got { opacity: 1; }

.swipe-card .bracket-winner-badge {
    font-size: 0.65rem;
    padding: 3px 9px 3px 7px;
    bottom: 10px;
    left: 10px;
}

.swipe-card-info {
    text-align: center;
    min-height: 3rem;
}
.swipe-card-info h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    color: var(--text-primary);
}
.swipe-card-info p { font-size: 0.875rem; color: var(--text-muted); }
.swipe-count { opacity: 0.7; }
.swipe-count:not(:empty)::before { content: '· '; }

/* Buttons: round, coloured, and the one you're dragging towards grows */
.swipe-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
}
.swipe-btn {
    --c: var(--text-secondary);
    --intent: 0;
    position: relative;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--c) 35%, transparent);
    background: color-mix(in srgb, var(--c) calc(8% + var(--intent) * 22%), var(--bg-secondary));
    color: var(--c);
    cursor: pointer;
    transform: scale(calc(1 + var(--intent) * 0.18));
    box-shadow: 0 0 0 calc(var(--intent) * 8px) color-mix(in srgb, var(--c) 18%, transparent);
    transition: transform 260ms var(--spring), background-color 150ms, border-color 150ms, box-shadow 150ms;
}
.swipe-btn:hover { border-color: var(--c); transform: scale(1.08); }
.swipe-btn:active:not(:disabled) { transform: scale(0.9); }
.swipe-btn.skip { --c: #a1a1aa; --intent: var(--intent-skip, 0); }
.swipe-btn.collection { --c: #69db7c; --intent: var(--intent-collection, 0); width: 56px; height: 56px; }
.swipe-btn.wishlist { --c: #ff6bcb; --intent: var(--intent-wishlist, 0); }
.swipe-btn.undo { --c: #ffd43b; width: 44px; height: 44px; }
.swipe-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.swipe-icon-svg { width: 26px; height: 26px; }
.swipe-btn.undo .swipe-icon-svg { width: 20px; height: 20px; }
.swipe-btn.collection .swipe-icon-svg { width: 24px; height: 24px; }
.swipe-label {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.swipe-hint {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.swipe-hint b { color: var(--text-secondary); }
@media (hover: none) { .swipe-hint { display: none; } }

.swipe-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.swipe-filters select {
    padding: 0.5rem 1.75rem 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}
.swipe-filters select:focus { border-color: var(--accent); }

.swipe-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 4.5% / 3.2%;
}
.swipe-empty[hidden] { display: none; }
.swipe-empty strong { color: var(--text-primary); display: block; margin-bottom: 0.25rem; }
.swipe-empty-emoji { font-size: 2.5rem; animation: joy-pop 600ms var(--spring); }
.swipe-empty button {
    padding: 0.7rem 1.4rem;
    background: var(--accent);
    border: none;
    border-radius: 999px;
    color: white;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 240ms var(--spring), background-color 150ms;
}
.swipe-empty button:hover { background: var(--accent-hover); transform: translateY(-2px); }
.swipe-empty button:active { transform: scale(0.94); }

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 101;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Responsive */
@media (max-width: 1100px) {
    .binder-layout { grid-template-columns: minmax(0, 1fr); }
    .binder-sidebar { max-height: none; }
}

/* Phones and tablets (an iPad's 820px doesn't fit the full menu): the menu button */
@media (max-width: 1023px) {
    /* Mobile header ordering: logo (1) | theme (2) | user (3) | hamburger (4) | nav dropdown (5) */
    .theme-toggle {
        order: 2;
        margin-left: auto;
        margin-right: 0.375rem;
    }

    /* Account and menu buttons sit together on the right */
    .user-menu-wrapper {
        order: 3;
        margin-left: auto;
        margin-right: 0.5rem;
    }

    .hamburger {
        display: flex;
        order: 4;
    }

    /* Mobile nav dropdown */
    nav#main-nav {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.25rem;
        display: none;
        box-shadow: var(--shadow-lg);
        order: 5;
    }

    nav#main-nav.open {
        display: flex;
    }

    nav#main-nav .nav-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    header { padding: 0 1rem; }
    main { padding: 1rem; }

    /* Search and filters stacked on mobile */
    .search-row, .browse-row-top {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        width: 100%;
        max-width: none;
    }

    .browse-row-top .art-chip {
        align-self: flex-start;
    }

    .filters, .browse-row-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .filters select, .browse-row-filters select {
        width: 100%;
    }

    /* Cards grid */
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    /* Modal */
    .modal-body { grid-template-columns: 1fr; }
    .modal-content { margin: 0.5rem; max-height: calc(100vh - 1rem); }

    /* Binder */
    .binder-spread { flex-direction: column; padding: 1rem; }
    .binder-page { border-radius: var(--radius); }
    .binder-spine { width: 100%; height: 8px; }

    /* Binder grid sizes on mobile */
    .binder-page.grid-2x2 { grid-template-columns: repeat(2, 100px); grid-template-rows: repeat(2, 140px); }
    .binder-page.grid-3x3 { grid-template-columns: repeat(3, 80px); grid-template-rows: repeat(3, 112px); }
    .binder-page.grid-4x3 { grid-template-columns: repeat(4, 65px); grid-template-rows: repeat(3, 91px); }
    .binder-page.grid-4x4 { grid-template-columns: repeat(4, 60px); grid-template-rows: repeat(4, 84px); }

    /* Swipe */
    .swipe-deck { width: min(100%, 300px); }

    /* Card source */
    .card-source-header { flex-direction: column; align-items: stretch; }
    .card-source-header .search-box { max-width: none; }
    .source-card { width: 76px; height: 106px; }
}

@media (max-width: 480px) {
    main { padding: 0.75rem; }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .swipe-deck { width: min(100%, 270px); }

    /* Binder even smaller on very small screens */
    .binder-page.grid-2x2 { grid-template-columns: repeat(2, 80px); grid-template-rows: repeat(2, 112px); }
    .binder-page.grid-3x3 { grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(3, 84px); }
    .binder-page.grid-4x3 { grid-template-columns: repeat(4, 50px); grid-template-rows: repeat(3, 70px); }
    .binder-page.grid-4x4 { grid-template-columns: repeat(4, 45px); grid-template-rows: repeat(4, 63px); }

    .filters, .browse-row-filters {
        grid-template-columns: 1fr;
    }
}

/* ==================== PACKS (packs.js) ==================== */
.pack-section { padding: 1rem 0 2rem; }
.pk { max-width: 980px; margin: 0 auto; }
.pk [hidden] { display: none !important; }

/* 1. Pick */
.pk-head { text-align: center; margin-bottom: 1.75rem; }
.pk-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.4rem; }
.pk-head p { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 0.95rem; }
.pk-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem 1rem;
    justify-items: center;
}
.pk-loading { grid-column: 1 / -1; color: var(--text-muted); animation: swipe-shimmer 1.2s ease-in-out infinite; }
.pk-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: 0;
    padding: 0;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    animation: pk-deal-in 520ms var(--spring) backwards;
    animation-delay: calc(var(--i) * 50ms);
}
.pk-tile .pk-pack { transition: transform 320ms var(--spring), box-shadow 200ms; }
.pk-tile:hover .pk-pack { box-shadow: 0 22px 40px rgba(0, 0, 0, 0.5); }
.pk-tile:active .pk-pack { transform: scale(0.95); }
.pk-tile:focus-visible { outline: none; }
.pk-tile:focus-visible .pk-pack { outline: 3px solid var(--accent); outline-offset: 4px; }
.pk-tile-name { font-size: 0.8125rem; font-weight: 700; text-align: center; max-width: 150px; }
@keyframes pk-deal-in { from { opacity: 0; transform: translateY(24px) rotate(4deg); } }

.pk-find {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 360px;
    margin: 0 auto 1.75rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.pk-find:focus-within { border-color: var(--accent); }
.pk-find input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text-primary); font: inherit; font-size: 0.9rem; }
.pk-none { text-align: center; color: var(--text-muted); margin-top: 1rem; }
.pk-tile[hidden] { display: none; }

/* The booster pack itself: foil, crimped ends, set logo */
.pk-pack {
    --h: 260;
    position: relative;
    width: 132px;
    aspect-ratio: 0.6;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(120% 70% at 50% 35%, hsl(var(--h) 85% 62% / 0.55), transparent 70%),
        linear-gradient(160deg, hsl(var(--h) 70% 48%), hsl(calc(var(--h) + 40) 75% 30%) 55%, hsl(calc(var(--h) - 30) 70% 22%));
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    user-select: none;
}
.pk-pack-big { width: min(250px, 62vw); border-radius: 12px; }
.pk-crimp {
    position: absolute;
    left: 0;
    right: 0;
    height: 9%;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 2px, rgba(0, 0, 0, 0.12) 2px 5px),
        linear-gradient(hsl(var(--h) 40% 75%), hsl(var(--h) 35% 55%));
}
.pk-crimp-top { top: 0; }
.pk-crimp-bottom { bottom: 0; }
.pk-sheen {
    position: absolute;
    inset: -40%;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.3) 48%, rgba(255, 255, 255, 0.05) 52%, transparent 60%);
    transform: translateX(var(--sx, -18%));
    transition: transform 600ms cubic-bezier(0.2, 0.8, 0.3, 1);
    pointer-events: none;
}
/* Foil: a soft iridescent sheen drifting slowly across the wrapper, each pack at its
   own pace and starting point (packs.js sets --gd / --gdelay), so the shelf shimmers
   rather than ticking. The pointer-led shine (.pk-sheen) takes over on hover. */
.pk-pack::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 18%,
        hsl(185 95% 72% / 0.22) 32%,
        hsl(285 90% 78% / 0.2) 44%,
        hsl(330 90% 80% / 0.16) 52%,
        hsl(48 100% 74% / 0.2) 62%,
        transparent 78%);
    background-size: 260% 260%;
    background-position: 0% 50%;
    mix-blend-mode: overlay;
    animation: pk-foil var(--gd, 16s) ease-in-out var(--gdelay, 0s) infinite alternate;
    pointer-events: none;
    z-index: 2;
}
@keyframes pk-foil {
    0% { background-position: 0% 30%; opacity: 0.55; }
    50% { opacity: 1; }
    100% { background-position: 100% 70%; opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) { .pk-pack::after { animation: none; background-position: 40% 50%; } }
/* Hover: the shine follows the pointer and the pack tilts toward it */
.pk-tile .pk-pack { transform-style: preserve-3d; }
.pk-tile.is-hovered .pk-pack {
    transform: translateY(-8px) perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(1.04);
    transition: transform 140ms ease-out, box-shadow 200ms;
}
.pk-tile.is-hovered .pk-sheen { transition: transform 120ms ease-out; }
.pk-tile.is-hovered:active .pk-pack { transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(0.96); }
.pk-tile.is-hovered .pk-pack::after { animation-play-state: paused; opacity: 0; }
.pk-pack-logo { position: relative; width: 82%; display: grid; place-items: center; min-height: 30%; margin-bottom: 16%; } /* sits optically centred above the label */
.pk-pack-logo img { max-width: 100%; max-height: 90px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45)); }
.pk-pack-big .pk-pack-logo img { max-height: 150px; }
.pk-pack-logo b { color: #fff; font-weight: 800; text-align: center; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.pk-pack-label {
    position: absolute;
    bottom: 13%;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}
.pk-pack-big .pk-pack-label { font-size: 0.7rem; }

/* Chase-card art on the pack: the card's art fills the body, logo on top */
.pk-art {
    position: absolute;
    inset: 9% 0;
    background-size: 175% auto;
    background-position: 50% 16%;
    background-repeat: no-repeat;
}
.pk-pack.has-art .pk-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, hsl(var(--h) 60% 12% / 0.7) 0%, transparent 34%, transparent 52%, hsl(var(--h) 70% 12% / 0.92) 76%, hsl(var(--h) 70% 10%) 100%),
        radial-gradient(130% 90% at 50% 45%, transparent 55%, hsl(var(--h) 70% 20% / 0.75) 100%);
}
.pk-pack.has-art { justify-content: flex-start; }
.pk-pack.has-art .pk-pack-logo { position: absolute; top: 11%; margin: 0; min-height: 0; }
.pk-pack.has-art .pk-pack-logo img { max-height: 46px; }
.pk-pack-big.has-art .pk-pack-logo img { max-height: 82px; }
.pk-pack.has-art .pk-sheen { z-index: 1; }

/* 2. Stage */
.pk-stage { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pk-stage-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pk-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.8rem 0.45rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 240ms var(--spring), color 150ms;
}
.pk-back:hover { color: var(--text-primary); }
.pk-back:active { transform: scale(0.94); }
.pk-stage-set { font-size: 0.8125rem; font-weight: 700; color: var(--text-muted); }
.pk-arena {
    position: relative;
    width: 100%;
    min-height: min(470px, 120vw);
    display: grid;
    place-items: center;
}

.pk-sealed {
    position: relative;
    cursor: grab;
    touch-action: none;
    animation: pk-float 3s ease-in-out infinite;
    transition: transform 200ms;
}
@keyframes pk-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.pk-sealed:active { cursor: grabbing; }
/* The tear line follows your finger across the top */
.pk-tear {
    --p: 0;
    position: absolute;
    top: 9%;
    height: 3px;
    width: calc(var(--p) * 80%);
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 12px #fff, 0 0 24px hsl(50 100% 70%);
    pointer-events: none;
}
.pk-sealed.ripped { animation: pk-shake 260ms ease-in-out; pointer-events: none; }
.pk-sealed.ripped .pk-crimp-top { animation: pk-flyoff 700ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.pk-sealed.ripped .pk-pack { animation: pk-drop 700ms 200ms cubic-bezier(0.5, 0, 0.75, 0) forwards; }
.pk-sealed.ripped .pk-tear { opacity: 0; }
@keyframes pk-shake { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes pk-flyoff { to { transform: translate(60px, -160px) rotate(-35deg); opacity: 0; } }
@keyframes pk-drop { to { transform: translateY(70vh) rotate(8deg); opacity: 0; } }

/* 3. Reveal: the stack */
.pk-stack {
    position: relative;
    width: min(300px, 72vw);
    aspect-ratio: 63 / 88;
    perspective: 1200px;
}
.pk-card {
    --depth: 0;
    position: absolute;
    inset: 0;
    transform: translateY(calc(var(--depth) * -6px)) scale(calc(1 - var(--depth) * 0.03));
    transition: transform 420ms var(--spring), opacity 420ms;
    animation: pk-rise 600ms cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards;
    animation-delay: calc(var(--deal) * 30ms);
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}
@keyframes pk-rise { from { transform: translateY(45vh) scale(0.8); opacity: 0; } }
.pk-card:not(.top) { pointer-events: none; }
.pk-card.top { cursor: grab; }
.pk-card.dragging { transition: none; cursor: grabbing; }
.pk-card.gone { transition: transform 450ms cubic-bezier(0.2, 0.7, 0.3, 1), opacity 450ms ease-in; }
.pk-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 520ms cubic-bezier(0.3, 1.4, 0.5, 1);
}
.pk-card.face-down .pk-card-inner { transform: rotateY(180deg); }
.pk-face {
    position: absolute;
    inset: 0;
    border-radius: 4.5% / 3.2%;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.pk-front img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
/* Some scans (30th Celebration) have a thin dark line at the edge: trim a hair off
   and scale up by the same amount, so the picture still fills the card (no gap) */
.pk-front img, .pk-best img, .pk-sum-card img { clip-path: inset(0.6% round 4.5% / 3.2%); scale: 1.013; }
/* Card back: our own design (not Pokémon's), with a glow that hints at the rarity */
.pk-cardback {
    transform: rotateY(180deg);
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 50%, #3b82c4 0 22%, transparent 23%),
        repeating-conic-gradient(from 0deg, #1d3f7a 0 10deg, #234a8c 10deg 20deg);
    border: 8px solid #1a2f5c;
}
.pk-back-ball {
    width: 34%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(#f2f2f2 0 46%, #1a1a1a 46% 54%, #e8e8e8 54%);
    box-shadow: 0 0 0 4px #1a1a1a, inset 0 0 0 999px rgba(157, 92, 255, 0.0);
}
.pk-back-tap {
    position: absolute;
    bottom: 10%;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    animation: swipe-shimmer 1.4s ease-in-out infinite;
}
.pk-card.face-down.top { animation: pk-rise 600ms cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards, pk-wobble 2.4s 700ms ease-in-out infinite; }
@keyframes pk-wobble { 0%, 100% { rotate: 0deg; } 20% { rotate: -1.5deg; } 40% { rotate: 1.5deg; } 60% { rotate: 0deg; } }
/* The rare slot glows by how good it is, as a soft aura behind the card (not a box around
   it): a calm silver-blue for a rare, a breathing purple-pink haze for a hit, a slowly
   shifting rainbow for a chase card */
.pk-card.face-down::before {
    content: '';
    position: absolute;
    inset: -14% -26%;
    z-index: -1;
    border-radius: 50%;
    filter: blur(16px);
    pointer-events: none;
}
.pk-card.face-down.tier-2::before { background: radial-gradient(closest-side, rgba(180, 205, 255, 0.75), rgba(150, 185, 255, 0.3) 60%, transparent); }
.pk-card.face-down.tier-3::before {
    background: radial-gradient(closest-side, rgba(190, 140, 255, 1), rgba(157, 92, 255, 0.85) 45%, rgba(236, 72, 153, 0.55) 72%, transparent);
    animation: pk-aura-breathe 2.4s ease-in-out infinite;
}
.pk-card.face-down.tier-4::before {
    background: conic-gradient(from 0deg, #ff6bcb, #9d5cff, #4dabf7, #5eead4, #ffd43b, #ff6bcb);
    -webkit-mask: radial-gradient(closest-side, #000 55%, transparent 100%);
    mask: radial-gradient(closest-side, #000 55%, transparent 100%);
    animation: pk-aura-breathe 2s ease-in-out infinite, pk-aura-hue 4s linear infinite;
}
@keyframes pk-aura-breathe { 50% { transform: scale(1.07); opacity: 0.85; } }
@keyframes pk-aura-hue { to { filter: blur(16px) hue-rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pk-card.face-down::before { animation: none; } }
/* Cards wait face-down in the stack and flip over as they reach the top */
.pk-card:not(.top):not(.gone) .pk-card-inner { transform: rotateY(180deg); }
/* Hover: the top card tilts toward the pointer, with a soft glare */
.pk-card.top:not(.face-down) .pk-card-inner { transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); }
/* No flip as a card reaches the top: it's simply face-up. Only the rare slot flips (tap to reveal). */
.pk-card:not(.flipping) .pk-card-inner { transition: none; }
.pk-card.hovering .pk-card-inner { transition: transform 120ms ease-out; }
.pk-card.flipping.top .pk-card-inner { transform: rotateY(0deg) scale(1.06); }
.pk-glare {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.4), transparent 55%);
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity 200ms;
    pointer-events: none;
}
.pk-card.hovering .pk-glare { opacity: 1; }
.pk-card.tier-3:not(.face-down) .pk-front { box-shadow: 0 0 34px 6px rgba(255, 200, 60, 0.55), 0 16px 36px rgba(0, 0, 0, 0.45); }
.pk-card.tier-4:not(.face-down) .pk-front { box-shadow: 0 0 44px 10px rgba(255, 107, 203, 0.55), 0 16px 36px rgba(0, 0, 0, 0.45); }
/* Reverse holo: a moving rainbow sheen over the card */
.pk-reverse-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 107, 203, 0.22) 35%, rgba(77, 171, 247, 0.22) 50%, rgba(255, 212, 59, 0.22) 65%, transparent 80%);
    background-size: 250% 100%;
    mix-blend-mode: color-dodge;
    animation: pk-holo 3s linear infinite;
    pointer-events: none;
}
@keyframes pk-holo { from { background-position: 100% 0; } to { background-position: -150% 0; } }
body.pk-flash::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    z-index: 2500;
    animation: pk-flash 500ms ease-out forwards;
}
@keyframes pk-flash { from { opacity: 1; } to { opacity: 0; } }

.pk-info { text-align: center; min-height: 3.4rem; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.pk-info.pop { animation: joy-chip-in 360ms var(--spring); }
.pk-name { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.pk-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.pk-rarity {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.pk-rarity.tier-2 { color: #e4e4e7; border-color: #a1a1aa; }
.pk-rarity.tier-3 { color: #ffd43b; border-color: #ffd43b; background: rgba(255, 212, 59, 0.12); }
.pk-rarity.tier-4 { /* deep jewel tones; border-box so the gradient doesn't repeat at the edges */
    color: #fff; border-color: transparent; text-shadow: 0 1px 2px rgba(40, 0, 60, 0.45);
    background: linear-gradient(100deg, #4c1d95 0%, #7c3aed 38%, #a21caf 72%, #db2777 100%) border-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 14px rgba(124, 58, 237, 0.35);
}
.pk-rarity.reverse { color: #c4b5fd; border-color: #7c5cff; }

.pk-actions { display: flex; gap: 0.75rem; }
.pk-act {
    --c: #a1a1aa;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 2px solid color-mix(in srgb, var(--c) 40%, transparent);
    background: color-mix(in srgb, var(--c) 8%, var(--bg-secondary));
    color: var(--c);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 240ms var(--spring), background-color 150ms, border-color 150ms;
}
.pk-act svg { width: 16px; height: 16px; }
.pk-act.want { --c: #ff6bcb; }
.pk-act.got { --c: #69db7c; }
.pk-act.on { background: var(--c); border-color: var(--c); color: #111; }
.pk-act:active { transform: scale(0.92); }
.pk-hint { font-size: 0.8125rem; color: var(--text-muted); min-height: 1.2em; }
.pk-hint.pulse { animation: swipe-shimmer 1.4s ease-in-out infinite; color: var(--text-secondary); font-weight: 600; }

.pk-tray { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pk-slot {
    width: 34px;
    aspect-ratio: 63 / 88;
    border-radius: 3px;
    border: 1px dashed var(--border-color);
    overflow: hidden;
}
.pk-slot.filled { border: 0; animation: joy-pop 420ms var(--spring); }
.pk-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk-slot.tier-3 { box-shadow: 0 0 0 2px #ffd43b; }
.pk-slot.tier-4 { box-shadow: 0 0 0 2px #ff6bcb; }

/* 4. Summary */
.pk-summary { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.pk-sum-head { text-align: center; }
.pk-sum-head h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; animation: joy-pop 600ms var(--spring); }
.pk-sum-head p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.pk-sum-body { display: flex; gap: 2rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.pk-best {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 0;
    padding: 0;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}
.pk-best img {
    width: min(240px, 60vw);
    border-radius: 4.5% / 3.2%;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    transition: transform 320ms var(--spring);
    animation: pk-deal-in 600ms var(--spring);
}
.pk-best:hover img { transform: translateY(-6px) rotate(-1.5deg); }
.pk-best.tier-3 img { box-shadow: 0 0 34px 6px rgba(255, 200, 60, 0.5), 0 18px 40px rgba(0, 0, 0, 0.5); }
.pk-best.tier-4 img { box-shadow: 0 0 44px 10px rgba(255, 107, 203, 0.5), 0 18px 40px rgba(0, 0, 0, 0.5); }
.pk-best-label { font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.pk-best-name { font-weight: 800; }
.pk-sum-grid { display: grid; grid-template-columns: repeat(5, 72px); gap: 10px; }
.pk-sum-card {
    padding: 0;
    border: 0;
    background: none;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 63 / 88;
    animation: pk-deal-in 480ms var(--spring) backwards;
    animation-delay: calc(var(--i) * 45ms);
    transition: transform 260ms var(--spring);
}
.pk-sum-card { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); } /* no rarity rings: the art speaks for itself */
.pk-sum-card:hover { transform: translateY(-4px) scale(1.06); }
.pk-sum-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pk-sum-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.pk-primary, .pk-secondary {
    padding: 0.8rem 1.4rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 240ms var(--spring), background-color 150ms;
}
.pk-primary { background: var(--accent); color: #fff; border: 0; }
.pk-secondary svg { vertical-align: -2px; margin-right: 0.4rem; }
.pk-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
.pk-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); }
.pk-secondary:hover { background: var(--bg-hover); }
.pk-primary:active, .pk-secondary:active { transform: scale(0.94); }
.pk-sum-hint { font-size: 0.8125rem; color: var(--text-muted); }

@media (max-width: 600px) {
    .pk-shelf { grid-template-columns: repeat(2, 1fr); }
    .pk-sum-grid { grid-template-columns: repeat(5, 1fr); width: 100%; }
}

/* ==================== CHARTS ==================== */
.charts-section {
    padding: 1rem 0;
}

.charts-container {
    max-width: 800px;
    margin: 0 auto;
}

.charts-header {
    margin-bottom: 1.5rem;
}

.charts-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.charts-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.chart-category-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 2px;
}

.chart-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: all var(--transition);
}

.chart-tab:hover {
    color: var(--text-primary);
}

.chart-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

#chart-time-filter {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

/* Charts List */
.charts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.chart-entry:hover {
    border-color: var(--border-light);
    background: var(--bg-tertiary);
}

.chart-rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.chart-rank.top-3 {
    color: var(--accent);
}

.chart-thumb {
    display: block;
    width: 64px;
    height: 88px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.chart-info {
    flex: 1;
    min-width: 0;
}

.chart-change {
    font-weight: 700;
    color: #22c55e;
    font-variant-numeric: tabular-nums;
}
.chart-price {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: 0.5rem;
    min-width: 4.5rem;
    text-align: right;
}
.chart-votes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chart-card-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-card-set {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-vote-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chart-vote-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    position: relative;
}

.chart-vote-btn.upvote:hover {
    color: #22c55e;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.chart-vote-btn.upvote.active {
    color: #22c55e;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.35);
}

.chart-vote-btn.downvote:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.chart-vote-btn.downvote.active {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}

/* Reuse the burst animation from modal vote buttons */
.chart-vote-btn.vote-burst {
    animation: vote-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-vote-score {
    font-weight: 700;
    font-size: 0.875rem;
    min-width: 2.5rem;
    text-align: center;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    transition: all 0.2s ease;
}

.chart-vote-score.score-bump {
    animation: score-bump 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-vote-score.positive { color: #22c55e; }
.chart-vote-score.negative { color: #ef4444; }

.charts-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--text-muted);
}

.charts-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==================== VOTING (Modal) ==================== */
.modal-voting {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius);
}

.vote-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.vote-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    position: relative;
    overflow: visible;
}

.vote-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.vote-btn.upvote::after {
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.6), 0 0 32px rgba(34, 197, 94, 0.3);
}

.vote-btn.downvote::after {
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.6), 0 0 32px rgba(239, 68, 68, 0.3);
}

.vote-btn.upvote:hover {
    color: #22c55e;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.vote-btn.upvote.active {
    color: #22c55e;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.vote-btn.upvote.active::after {
    opacity: 1;
    animation: vote-glow-pulse 1.5s ease-in-out infinite;
}

.vote-btn.downvote:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.vote-btn.downvote.active {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.vote-btn.downvote.active::after {
    opacity: 1;
    animation: vote-glow-pulse 1.5s ease-in-out infinite;
}

/* Click burst animation */
.vote-btn.vote-burst {
    animation: vote-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes vote-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes vote-glow-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.vote-score {
    font-weight: 700;
    font-size: 1.25rem;
    min-width: 3rem;
    text-align: center;
    transition: all 0.2s ease;
}

.vote-score.score-bump {
    animation: score-bump 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes score-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--accent); }
    100% { transform: scale(1); }
}

/* Charts Responsive */
@media (max-width: 768px) {
    .charts-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-tab {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .chart-entry {
        gap: 0.75rem;
        padding: 0.625rem;
    }

    .chart-rank {
        font-size: 1rem;
        min-width: 1.5rem;
    }

    .chart-card-thumb {
        width: 40px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .chart-card-name {
        font-size: 0.8125rem;
    }

    .chart-vote-btn {
        width: 28px;
        height: 28px;
    }

    .chart-vote-score {
        min-width: 2rem;
        font-size: 0.8125rem;
    }
}

/* ==========================================
   Collection / Wishlist Toolbar
   ========================================== */
.collection-toolbar {
    margin-bottom: 1rem;
}

.collection-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.collection-toolbar-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.import-csv-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.import-csv-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

/* ==========================================
   CSV Import Modal
   ========================================== */
.import-modal-content {
    max-width: 540px;
    padding: 2rem;
}

.import-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.import-step h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.import-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.import-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Dropzone */
.import-dropzone {
    width: 100%;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted);
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.import-dropzone p {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.import-dropzone span {
    font-size: 0.8125rem;
}

/* Progress */
.import-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.import-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.import-progress-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.import-match-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    padding: 0.25rem;
}

.import-match-preview img {
    width: 48px;
    height: auto;
    border-radius: 4px;
    opacity: 0;
    animation: fadeInCard 0.3s ease forwards;
}

@keyframes fadeInCard {
    to { opacity: 1; }
}

/* Summary */
.import-summary {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.import-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    min-width: 100px;
}

.import-summary-stat .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.import-summary-stat .stat-number.matched {
    color: var(--success);
}

.import-summary-stat .stat-number.unmatched {
    color: var(--danger);
}

.import-summary-stat .stat-number.collection-num {
    color: var(--accent);
}

.import-summary-stat .stat-number.wishlist-num {
    color: #f87171;
}

.import-summary-stat .stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Results Tabs */
.import-results-tabs {
    display: flex;
    gap: 0.25rem;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.import-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.import-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.import-tab:hover {
    color: var(--text-primary);
}

/* Results List */
.import-results-list {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}

.import-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    font-size: 0.8125rem;
}

.import-result-row img {
    width: 32px;
    height: auto;
    border-radius: 3px;
    flex-shrink: 0;
}

.import-result-row .result-info {
    flex: 1;
    min-width: 0;
}

.import-result-row .result-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-result-row .result-set {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.import-result-row .result-dest {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.import-result-row .result-dest.to-collection {
    background: var(--accent-subtle);
    color: var(--accent);
}

.import-result-row .result-dest.to-wishlist {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.import-result-row.unmatched {
    opacity: 0.7;
}

.import-result-row.unmatched .result-name {
    color: var(--text-secondary);
}

.import-search-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.import-search-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.result-qty {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 0.25rem;
}

.import-search-results {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin: 0.25rem 0;
}

.import-search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.import-search-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.import-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.import-search-card {
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: border-color 0.15s ease;
    text-align: center;
}

.import-search-card:hover {
    border-color: var(--accent);
}

.import-search-card img {
    width: 100%;
    border-radius: 3px;
}

.search-card-label {
    font-size: 0.55rem;
    color: var(--text-secondary);
    line-height: 1.2;
    margin-top: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-card-label span {
    color: var(--text-muted);
    font-size: 0.5rem;
}

/* Actions */
.import-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.5rem;
}

.import-confirm-btn {
    background: var(--accent) !important;
    color: white !important;
    border: none !important;
    font-weight: 600;
}

.import-confirm-btn:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Done */
.import-done-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(105, 219, 124, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .import-modal-content {
        padding: 1.5rem 1rem;
    }

    .import-summary {
        gap: 0.5rem;
    }

    .import-summary-stat {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }

    .collection-toolbar-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ==========================================
   Bracket Winner Badge (shows on all card views)
   ========================================== */
.bracket-winner-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 2px 7px 2px 5px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bracket-winner-star {
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Badge in chart entry thumbnail */
.chart-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.chart-thumb-wrap .bracket-winner-badge {
    font-size: 0.45rem;
    padding: 1px 5px 1px 3px;
    bottom: 2px;
    left: 2px;
}

/* Badge in modal */
.modal-image {
    position: relative;
}

.modal-image .bracket-winner-badge {
    font-size: 0.7rem;
    padding: 4px 10px 4px 8px;
    bottom: 10px;
    left: 10px;
}

/* ==========================================
   Poll of the Week Bracket
   ========================================== */
/* Bracket of the Week */
.home-bracket-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.bracket-header {
    margin-bottom: 1.25rem;
}

.bracket-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.bracket-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.bracket-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bracket-round-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 9999px;
    background: var(--accent);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bracket-timer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Bracket Layout — vertical rounds */
.bracket-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bracket-round-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.125rem;
}

/* 2-column grid for matchups */
.bracket-matchups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* Center the Final matchup */
.bracket-round[data-round="3"] .bracket-matchups-grid {
    grid-template-columns: 1fr;
    max-width: 560px;
    margin: 0 auto;
}

/* Matchup — side-by-side cards */
.bracket-matchup {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    transition: all var(--transition);
    overflow: hidden;
}

.bracket-matchup.active {
    border-color: var(--border-light);
}

.bracket-matchup.completed {
    opacity: 0.7;
}

/* Bracket Card — row layout: image left, info+vote right */
.bracket-card {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    position: relative;
}

.bracket-card:hover {
    background: var(--bg-hover);
}

.bracket-card.voted {
    background: var(--accent-subtle);
    border-radius: var(--radius-sm);
}

.bracket-card.eliminated {
    opacity: 0.35;
    filter: grayscale(0.8);
}

.bracket-card.eliminated .bracket-vote-btn {
    pointer-events: none;
}

.bracket-card.winner-highlight {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
}

.bracket-card-img {
    width: 72px;
    height: auto;
    border-radius: 4px;
    background: var(--bg-primary);
    aspect-ratio: 5/7;
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.bracket-card:hover .bracket-card-img {
    transform: scale(1.03);
}

/* TBD mystery card placeholder */
.bracket-card.tbd {
    cursor: default;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    gap: 0.4rem;
}

.bracket-card.tbd:hover {
    background: transparent;
}

.bracket-card.tbd .bracket-card-info {
    align-items: center;
}

.bracket-tbd-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    background-size: 300% 300%;
    animation: bracketMystery 3s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 0 12px rgba(255,255,255,0.1);
    position: relative;
}

.bracket-tbd-placeholder::before {
    content: '?';
    font-size: 1.75rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 12px rgba(255,255,255,0.5);
    animation: bracketPulse 2s ease-in-out infinite;
}

@keyframes bracketMystery {
    0%, 100% { background-position: 0% 50%; box-shadow: 0 0 20px var(--accent-glow), inset 0 0 12px rgba(255,255,255,0.1); }
    50% { background-position: 100% 50%; box-shadow: 0 0 30px var(--accent-glow), inset 0 0 16px rgba(255,255,255,0.15); }
}

@keyframes bracketPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.bracket-card.tbd .bracket-card-name {
    color: var(--text-secondary);
    font-style: normal;
    font-weight: 600;
    font-size: 0.65rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.4;
}

.bracket-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    flex: 1;
}

.bracket-card-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-card-subtitle {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-card-votes {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Vote button — small upvote arrow */
.bracket-vote-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bracket-vote-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
    transform: scale(1.1);
}

.bracket-card.voted .bracket-vote-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.bracket-card.eliminated .bracket-vote-btn {
    opacity: 0.3;
}

.bracket-matchup:not(.active) .bracket-vote-btn {
    display: none;
}

.bracket-vs {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 0.125rem;
}

/* Winner Display */
.bracket-winner-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    margin-top: 1rem;
    border: 2px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.04));
}

.bracket-winner-crown {
    font-size: 2rem;
}

.bracket-winner-img {
    width: 140px;
    height: auto;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
    border: 2px solid rgba(245, 158, 11, 0.4);
}

.bracket-winner-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bracket-winner-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive — single column gets bigger images since more room */
@media (max-width: 768px) {
    .bracket-matchups-grid {
        grid-template-columns: 1fr;
    }

    .bracket-card-img {
        width: 80px;
    }

    .bracket-tbd-placeholder {
        width: 80px;
    }

    .bracket-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .home-bracket-block {
        padding: 1rem;
    }

    .bracket-matchup {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .bracket-card {
        gap: 0.375rem;
    }

    .bracket-card-img {
        width: 56px;
    }

    .bracket-tbd-placeholder {
        width: 56px;
    }

    .bracket-card-name {
        font-size: 0.65rem;
    }

    .bracket-vote-btn {
        width: 26px;
        height: 26px;
        border-radius: 6px;
    }

    .bracket-vote-btn svg {
        width: 11px;
        height: 11px;
    }

    .bracket-winner-img {
        width: 100px;
    }
}

/* ==========================================
   Card Detail — tabbed modal
   ========================================== */
.card-detail-content {
    max-width: 980px;
}

.card-detail-body {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
}

.card-detail-body .modal-image {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: sticky;
    top: 1rem;
}

.card-detail-body .modal-image img {
    width: 100%;
    max-width: 340px;
    height: auto;
    max-height: none;
    object-fit: contain;
}

.modal-image .card-flavor {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    margin-top: 0.75rem;
    text-align: left;
}

.card-detail-info {
    gap: 0.875rem;
    min-width: 0;
}

.detail-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.detail-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.set-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.3rem 0.75rem 0.3rem 0.4rem;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.set-chip:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.set-chip-symbol {
    width: 20px;
    height: 20px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
}

.detail-number {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Tabs */
.detail-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

.detail-tabs::-webkit-scrollbar { display: none; }

.detail-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition);
    white-space: nowrap;
    margin-bottom: -1px;
}

.detail-tab:hover { color: var(--text-primary); }

.detail-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.detail-panel { display: none; }
.detail-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Variant price table */
.variant-table {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.variant-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
}

.variant-name {
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 0;
}

.variant-sub {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.variant-name a {
    color: inherit;
    text-decoration: none;
}

.variant-name a:hover { color: var(--accent); }

.variant-price {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--success);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.variant-price.na { color: var(--text-muted); font-weight: 500; }

.qty-stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-btn:disabled { opacity: 0.35; cursor: default; }
.qty-btn:disabled:hover { border-color: var(--border-color); color: var(--text-secondary); }

.qty-value {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.qty-value.owned { color: var(--accent); }

.price-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.price-meta a {
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
    transition: all var(--transition);
}

.price-meta a:hover { color: var(--accent); border-color: var(--accent); }

/* Attacks */
.attacks-block {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.attack-row .attack-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.attack-cost { display: flex; gap: 3px; }

.energy-pip {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 800;
    color: rgba(0,0,0,0.75);
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.energy-Grass { background: #7ac74c; }
.energy-Fire { background: #ee8130; }
.energy-Water { background: #6390f0; }
.energy-Lightning { background: #f7d02c; }
.energy-Psychic { background: #c069c9; }
.energy-Fighting { background: #c22e28; }
.energy-Darkness { background: #4a4458; color: #fff; }
.energy-Metal { background: #b7b7ce; }
.energy-Fairy { background: #ee99ac; }
.energy-Dragon { background: #b8a038; }
.energy-Colorless { background: #e8e6e3; }

.attack-name {
    font-weight: 700;
    font-size: 0.9375rem;
}

.ability-badge {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 9999px;
    padding: 0.15rem 0.5rem;
}

.attack-damage {
    margin-left: auto;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.attack-damage-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 0.375rem;
}

.attack-effect {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: 0.375rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.875rem;
}

.stat-cell { min-width: 0; }

.stat-cell-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-cell-value {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
}

button.stat-chip { cursor: pointer; transition: all var(--transition); }
button.stat-chip:hover { border-color: var(--accent); color: var(--accent); }

.stat-plain { color: var(--text-secondary); font-weight: 500; }

/* TCG legality */
.legal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1.5rem;
}

.legal-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.legal-value { font-weight: 700; font-size: 0.9375rem; }
.legal-value.legal { color: var(--success); }
.legal-value.not-legal { color: var(--text-secondary); }

/* Notes */
.notes-wrap { position: relative; }

.card-notes-input {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.6;
    padding: 0.75rem;
    outline: none;
    transition: border-color var(--transition);
}

.card-notes-input:focus { border-color: var(--accent); }

.notes-status {
    position: absolute;
    right: 0.625rem;
    bottom: 0.625rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Graded */
.graded-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.graded-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
}

.graded-slab {
    font-weight: 800;
    font-size: 0.8125rem;
    background: var(--warning);
    color: #1a1a1a;
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
}

.graded-cert { font-size: 0.75rem; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.graded-value { font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }

.graded-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    display: flex;
}

.graded-remove:hover { color: var(--danger); background: var(--bg-secondary); }

.graded-form {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.graded-form select,
.graded-form input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 0.5rem 0.625rem;
    outline: none;
    min-width: 0;
}

.graded-form select:focus,
.graded-form input:focus { border-color: var(--accent); }

.graded-add-btn {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.5rem 0.875rem;
    cursor: pointer;
    transition: background var(--transition);
}

.graded-add-btn:hover { background: var(--accent-hover); }

.graded-hint { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

/* Price tab */
.price-range-tabs {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
    align-self: flex-start;
}

.price-range-tab {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.price-range-tab.active {
    background: var(--accent);
    color: #fff;
}

.price-chart-wrap {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.price-chart-wrap svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.price-chart-wrap { position: relative; }

/* Hover readout: the day's price for each printing */
.price-tip {
    position: absolute;
    top: 0.75rem;
    pointer-events: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 0.45rem 0.6rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 2;
}
.price-tip[hidden] { display: none; }
.price-tip-date { color: var(--text-muted); font-size: 0.6875rem; margin-bottom: 0.2rem; }
.price-tip-row { display: flex; align-items: center; gap: 0.4rem; color: var(--text-secondary); }
.price-tip-row .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.price-tip-row b { margin-left: auto; padding-left: 0.75rem; color: var(--text-primary); font-weight: 700; }

.price-chart-empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
    padding: 1.5rem 1rem;
    text-align: center;
}

.price-chart-note {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 0.5rem 0.25rem 0;
    font-style: italic;
}

.price-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    justify-content: flex-end;
    padding: 0 0.25rem;
}

.price-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 0.375rem;
}

.price-stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.price-stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.price-stat-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.price-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.price-stat-value.up { color: var(--success); }
.price-stat-value.down { color: var(--danger); }

.price-variant-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* ==========================================
   Lists
   ========================================== */
.lists-container { max-width: 1000px; margin: 0 auto; }

.lists-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.lists-title { font-size: 1.5rem; font-weight: 700; }

.lists-tabs {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}

.lists-tab {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.lists-tab:hover { color: var(--text-primary); }

.lists-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Visibility toggle (private/public) */
.visibility-toggle {
    display: inline-flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
}

.visibility-opt {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    transition: all var(--transition);
}

.visibility-opt:hover { color: var(--text-primary); }

.visibility-opt.active {
    background: var(--accent);
    color: #fff;
}

/* Discover list vote count on cards */
.list-card-vote {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.list-card-vote svg { color: var(--accent); }

.list-card-author {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.list-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--accent-subtle);
    border-radius: 9999px;
    padding: 0.1rem 0.45rem;
}

/* List vote widget in detail header */
.list-vote-widget {
    display: inline-flex;
    align-items: center;
    gap: 0;
    height: 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0 0.25rem;
}

.list-vote-widget .vote-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
}

.list-vote-widget .vote-score {
    min-width: 2rem;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.discover-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.new-list-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
}

.new-list-btn:hover { background: var(--accent-hover); }

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.list-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: inherit;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.list-card-name { font-weight: 700; font-size: 1rem; }

.list-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-card-value { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }

.list-card-previews { display: flex; gap: 0.375rem; margin-top: 0.25rem; }

.list-card-previews img {
    width: 42px;
    height: 58px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.list-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
}

.list-back-btn:hover { color: var(--accent); }

.list-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.list-name-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    margin-right: auto;
}

.list-detail-name { font-size: 1.5rem; font-weight: 700; }

.list-emoji-btn {
    font-size: 1.5rem;
    line-height: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.list-emoji-btn:hover { border-color: var(--accent); transform: scale(1.05); }

.emoji-picker {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    width: min(340px, calc(100vw - 32px));
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}
.emoji-search {
    width: 100%;
    margin-bottom: 0.4rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
}
.emoji-search:focus { outline: none; border-color: var(--accent); }
.emoji-scroll { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.emoji-group { margin: 0.5rem 0.25rem 0.25rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.emoji-group:first-child { margin-top: 0.15rem; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-note { margin: 0.75rem 0.25rem; font-size: 0.8125rem; color: var(--text-muted); text-align: center; }
.emoji-picker button {
    font-size: 1.15rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.emoji-picker button:hover { background: var(--bg-hover); }

.list-card-emoji {
    font-size: 1.15rem;
    line-height: 1;
    margin-right: 0.4rem;
}

.list-detail-meta {
    display: flex;
    gap: 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.list-detail-meta .meta-value { color: var(--text-primary); font-weight: 700; }
.list-detail-meta .meta-value.money { color: var(--success); }

.list-detail-actions { display: flex; gap: 0.375rem; }

.list-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    transition: all var(--transition);
}

.list-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.list-action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.list-action-btn.voted-up { border-color: #22c55e; color: #22c55e; background: rgba(34,197,94,0.12); }
.list-action-btn.voted-down { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.12); }

/* List picker popover (in card modal) */
.list-picker {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.list-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.45rem 0.625rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.list-picker-item:hover { background: var(--bg-hover); }
.list-picker-item .in-list { color: var(--accent); font-weight: 700; }
.list-picker-item.create-new { color: var(--accent); font-weight: 600; }

/* Collection value in toolbar */
.collection-value {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: 0.75rem;
}

.collection-value strong { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Compact action bar under the card name (wishlist/collection/list + votes) */
.detail-action-bar {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-action-bar .modal-actions {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.detail-action-bar .action-btn {
    /* 2px more below than above: Plus Jakarta Sans leaves extra room over its
       letters, so words without descenders (Wishlist, List) looked low when centered */
    padding: 0 0.875rem 2px;
    font-size: 0.8125rem;
    white-space: nowrap;
    height: 38px;
}

.detail-action-bar .list-btn { flex: 0 0 auto; }

/* Vote widget becomes a compact horizontal pill, same height as buttons.
   Reset the base .modal-voting box so only the .vote-controls pill shows. */
.detail-action-bar .modal-voting {
    flex-shrink: 0;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
}

.detail-action-bar .vote-controls {
    height: 38px;
    gap: 0.125rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0 4px; /* the arrows sit inside the pill, with the same gap all round */
}

/* Arrows: a small rounded square inset in the pill. No outer glow here; it spilled past the pill */
.detail-action-bar .vote-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
}
.detail-action-bar .vote-btn::after { display: none; }

.detail-action-bar .vote-btn:hover { background: var(--bg-hover); }
.detail-action-bar .vote-btn.upvote.active { background: rgba(34, 197, 94, 0.14); box-shadow: none; }
.detail-action-bar .vote-btn.downvote.active { background: rgba(239, 68, 68, 0.14); box-shadow: none; }

.detail-action-bar .vote-score {
    min-width: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 700;
    /* Plain figures: the font's fixed-width 1 has a foot and flag, like a typewriter */
}

@media (max-width: 700px) {
    .card-detail-body { grid-template-columns: 1fr; }
    .modal-image img { max-height: 300px; }
    .stats-grid { grid-template-columns: 1fr; }
    .graded-form { grid-template-columns: 1fr 1fr; }
    .price-stat-cards { grid-template-columns: 1fr; }
}

/* ==========================================
   Active filter chip (browse) — e.g. "Pokédex: Pikachu"
   ========================================== */
.active-filter-row {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 9999px;
    padding: 0.3rem 0.4rem 0.3rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.active-filter-chip button {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.35rem;
    border-radius: 50%;
}

.active-filter-chip button:hover { background: var(--accent); color: #fff; }

/* ==========================================
   Pokédex
   ========================================== */
.pokedex-container, .sets-container { max-width: 1100px; margin: 0 auto; }

.pokedex-header { margin-bottom: 1.5rem; }

.pokedex-title { font-size: 1.75rem; font-weight: 700; }

.pokedex-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

.pokedex-search {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 420px;
}

.pokedex-search svg {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
}

.pokedex-search input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition);
}

.pokedex-search input:focus { border-color: var(--accent); }

.pokedex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.pokedex-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.75rem 0.5rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-primary);
    position: relative;
}

.pokedex-cell:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: var(--accent-subtle);
}

.pokedex-cell img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    image-rendering: pixelated;
}

.pokedex-num {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pokedex-name {
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.pokedex-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ==========================================
   Sets browser
   ========================================== */
.sets-series { margin-bottom: 1.75rem; }

.sets-series-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.set-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-primary);
    text-align: left;
}

.set-cell:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.set-cell-logo {
    width: 56px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.set-cell-info { min-width: 0; flex: 1; }

.set-cell-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.set-cell-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}


/* Card detail: content that loads in must not shift the scroll position */
.modal-content { overflow-anchor: none; }

@media (max-width: 768px) {
    .home-hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 1.25rem 0 0.5rem;
        gap: 0.5rem;
    }
    .home-tagline { font-size: 2rem; }
    .home-hero-cards { min-height: 0; order: -1; padding: 0.5rem 0 1.25rem; }
    .hero-card { width: 34%; }
    .home-latest-row { grid-auto-columns: 140px; }
    .cards-grid { gap: 1.25rem 0.875rem; }
    .beta-tag { font-size: 0.5625rem; }
}

/* ==========================================
   Nav: Browse group
   ========================================== */
.nav-group { position: relative; display: flex; }

.nav-group-btn svg { opacity: 0.7; transition: transform var(--transition); }
.nav-group.open .nav-group-btn svg { transform: rotate(180deg); }
/* Hovering opens the menu too, so the arrow turns the same way (hover devices only) */
@media (hover: hover) and (min-width: 1024px) {
    .nav-group:hover:not(.dismissed) .nav-group-btn svg { transform: rotate(180deg); }
}

.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    min-width: 168px;
    margin-top: 6px;
    padding: 0.25rem;
    flex-direction: column;
    gap: 1px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Bridges the gap so the pointer can travel from button to menu */
.nav-menu::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
}

.nav-group.open .nav-menu { display: flex; }

@media (hover: hover) and (min-width: 1024px) {
    .nav-group:hover:not(.dismissed) .nav-menu { display: flex; }
}

.nav-menu a.nav-btn { text-decoration: none; }
.nav-menu .nav-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
}

.nav-menu .nav-btn.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

@media (max-width: 1023px) {
    /* Explore is a row that opens in place: closed by default, open when you're on one of its pages */
    .nav-group { flex-direction: column; width: 100%; }
    nav#main-nav .nav-group-btn { justify-content: space-between; }
    nav#main-nav .nav-group-btn.active { background: none; color: var(--text-primary); }
    .nav-group-btn svg { width: 14px; height: 14px; }
    .nav-menu {
        position: static;
        margin: 0 0 0 1rem;
        padding: 0 0 0 0.25rem;
        border: none;
        border-left: 1px solid var(--border-color);
        border-radius: 0;
        box-shadow: none;
        background: none;
        min-width: 0;
    }
    .nav-menu::before { display: none; }
    nav#main-nav .nav-menu .nav-btn { padding: 0.625rem 1rem; }
}

/* ==========================================
   Home: pillars under the hero
   ========================================== */
.home-pillars {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.home-pillar {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.home-pillar-title {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color var(--transition);
}

.home-pillar:hover .home-pillar-title { color: var(--accent); }

.home-pillar-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 36ch;
}

@media (max-width: 768px) {
    .home-pillars { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* ==========================================
   Card page: sections, eBay button, tags
   ========================================== */
.detail-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin: 0;
}

.detail-section-title {
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-section .stats-grid,
.detail-section .attacks-block {
    border-top: none;
    padding-top: 0;
}

.detail-section .attacks-block:empty,
.detail-section .stats-grid:empty { display: none; }

.stat-cell[hidden] { display: none; }

.ebay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    max-width: 340px;
    margin-top: 1rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.ebay-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Add to list: quiet neutral next to the coloured Wishlist/Collection */
.list-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.list-btn:hover, .list-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.modal-tags { margin-top: 0; }

.modal-tags .tags-list { margin-bottom: 0; min-height: 0; gap: 0.375rem; }

.tag-chip {
    padding: 0;
    gap: 0;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: default;
}

.tag-chip-name,
.tag-chip-vote {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0.3rem 0.5rem 0.3rem 0.65rem;
}

.tag-chip-vote {
    padding: 0.3rem 0.6rem 0.3rem 0.45rem;
    border-left: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.tag-chip.user-tagged .tag-chip-vote { border-left-color: var(--accent); }
.tag-chip-name:hover, .tag-chip-vote:hover { color: var(--text-primary); background: var(--bg-hover); }

.tags-empty { font-size: 0.8125rem; color: var(--text-muted); }
.tags-empty-block { grid-column: 1 / -1; padding: 2rem 0; }

.tags-toggle {
    align-self: flex-start;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition);
}

.tags-toggle:hover { border-color: var(--text-secondary); }

.tags-picker { display: flex; flex-direction: column; gap: 0.75rem; }
.tags-picker[hidden] { display: none; }

#modal-tags-suggestions { display: flex; flex-direction: column; gap: 0.625rem; }

.tag-suggest-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.tag-suggest-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.tag-suggest,
.tag-index-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 9999px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

a.tag-index-chip, a.pokedex-cell, a.grid-btn { text-decoration: none; }
a.pokedex-cell { color: inherit; }
a.grid-btn { display: inline-flex; align-items: center; justify-content: center; }

/* Under a tag's cards: the other tags in its group, as links */
.tags-related { margin-top: 2rem; }
.tags-related[hidden] { display: none; }
.tags-related h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.6rem; }
.tags-related-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag-suggest:hover,
.tag-index-chip:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.tag-suggest.selected {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.tags-picker .tags-input { margin-top: 0; }

.tags-picker .tags-add-btn {
    width: auto;
    height: auto;
    padding: 0 0.8rem;
    font-size: 0.8125rem;
}

/* ==========================================
   Tags page
   ========================================== */
.tags-group { margin-bottom: 1.75rem; }

.tags-group-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag-index-chip {
    font-size: 0.875rem;
    padding: 0.4rem 0.85rem;
    color: var(--text-primary);
    border-color: var(--border-light);
}

.tag-index-chip.empty { color: var(--text-muted); border-color: var(--border-color); }

.tag-index-chip .tag-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
}

.tags-results-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tags-results-header :is(h1, h3) {
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.tags-results-intro {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    max-width: 60ch;
    margin: -0.5rem 0 1.25rem;
}
.tags-results-intro[hidden] { display: none; }

.tags-back {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
}

.tags-back:hover { color: var(--accent); }

/* ==========================================
   Sets: logo fallbacks
   ========================================== */
.set-cell-logo.is-symbol { padding: 6px 12px; }

.set-cell-code {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    overflow: hidden;
}

/* Tags: approval flow */
.tag-chip-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.35rem 0.3rem 0.65rem;
}

.tag-chip-label em {
    font-style: normal;
    font-size: 0.625rem;
    font-weight: 600;
    opacity: 0.75;
}

.tag-chip.pending {
    border-style: dashed;
    background: transparent;
    color: var(--text-secondary);
}

.tag-chip-x,
.tag-chip-ok {
    border: none;
    border-left: 1px solid var(--border-color);
    background: none;
    color: inherit;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
}

.tag-chip-x:hover { background: var(--bg-hover); color: var(--text-primary); }
.tag-chip-ok { color: var(--success); }
.tag-chip-ok:hover { background: var(--bg-hover); }

.tags-note { font-size: 0.75rem; color: var(--text-muted); }
.tags-note a { color: var(--accent); }

.tag-suggest.settled,
.tag-suggest:disabled {
    opacity: 0.45;
    cursor: default;
    text-decoration: line-through;
}

.tags-review { margin-bottom: 2.25rem; }
.tags-review-admin { margin-left: 0.75rem; font-size: 0.8rem; font-weight: 500; text-transform: none; letter-spacing: normal; color: var(--accent); }

.tags-review-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-color);
}

.tags-review-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 240px;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.tags-review-card img { width: 36px; border-radius: 3px; flex-shrink: 0; }
.tags-review-card span { display: flex; flex-direction: column; min-width: 0; }
.tags-review-card strong { font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags-review-card small { font-size: 0.75rem; color: var(--text-muted); }
.tags-review-row .tags-list { margin: 0; min-height: 0; }

@media (max-width: 768px) {
    .tags-review-row { flex-direction: column; align-items: flex-start; }
    .tags-review-card { flex-basis: auto; }
}

/* Hero cards keep their fanned pose: foil and glare only, no pointer tilt */
.hero-card .holo .holo-rotator { transform: none; }

.tags-results-header { align-items: center; flex-wrap: wrap; }
.tags-results-tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* Card page: "every card of this Pokémon" chip */
.stat-cell-wide { grid-column: 1 / -1; }

.stat-chip-pokemon {
    gap: 0.5rem;
    padding: 0.3rem 0.85rem 0.3rem 0.5rem; /* room around the sprite, so it doesn't touch the edge */
}

.stat-chip-pokemon img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
}

.stat-chip-sub { color: var(--text-muted); font-weight: 500; font-size: 0.75rem; }

/* Set chip: when the symbol is missing we show the (wide) set logo instead */
.set-chip-symbol.is-logo {
    width: auto;
    max-width: 84px;
    height: 22px;
    background: none;
    border-radius: 0;
    padding: 0;
}

/* ==========================================
   Cameos
   ========================================== */
.cameo-chip .tag-chip-name {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.65rem 0.1rem 0.25rem;
}

.cameo-chip .tag-chip-name img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
}

/* "Edge" cameos in the source data: partial, silhouette or debatable */
.cameo-chip.edge { border-style: dashed; }

.cameo-admin { display: flex; flex-direction: column; gap: 0.5rem; }
.cameo-admin .tags-input { margin-top: 0; }
.cameo-admin .tags-add-btn { width: auto; height: auto; padding: 0 0.8rem; font-size: 0.8125rem; }

.cameo-pins-toggle {
    width: 100%;
    max-width: 340px;
    margin-top: 0.75rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.cameo-pins-toggle:hover { color: var(--text-primary); border-color: var(--border-light); }
.cameo-pins-toggle + .ebay-btn { margin-top: 0.5rem; }

#cameos-results .tags-results-header { justify-content: space-between; }

/* Heart icon: sized by the surrounding text, sits on the baseline row */
.heart-icon { display: block; flex-shrink: 0; }
.card-action-btn .heart-icon { width: 15px; height: 15px; }
.action-btn .icon { display: inline-flex; align-items: center; }

/* Parked for V1 (FEATURES in js/init.js) */
.no-charts .nav-btn[data-view="charts"],
.no-charts .home-charts-grid,
.no-brackets .home-bracket-block,
.no-brackets .bracket-winner-badge { display: none !important; }

/* Tags: combining several */
.tags-refine { display: flex; flex-direction: column; gap: 0.625rem; margin-bottom: 1.5rem; }
.tags-refine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.tags-refine-row .tag-chip { font-size: 0.8125rem; }
.tags-plus { color: var(--text-muted); font-size: 0.875rem; padding: 0 0.125rem; }
.tags-refine-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-right: 0.25rem;
}
.tag-suggest .tag-count { font-size: 0.625rem; font-weight: 600; color: var(--accent); }

.check-icon { display: block; flex-shrink: 0; }
.card-action-btn .check-icon { width: 15px; height: 15px; }
.tag-chip-ok .check-icon, .in-list .check-icon, .source-card-badge .check-icon { width: 12px; height: 12px; }

/* Tag picker: search first, create only when nothing matches */
.tags-picker .tags-input-row { margin: 0; }
.tags-picker .tags-input { width: 100%; }
.tag-create {
    align-self: flex-start;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px dashed var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}
.tag-create[hidden] { display: none; }
.tags-picker .tags-input { font-size: 0.8125rem; padding: 0.5rem 0.7rem; }

/* ==========================================
   Home: tags preview
   ========================================== */
.tag-emoji { font-size: 1em; line-height: 1; }

.home-tags-chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 0.25rem;
    margin: 0 -0.25rem;
    scrollbar-width: none;
}
.home-tags-chips::-webkit-scrollbar { display: none; }

.home-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    padding: 0.45rem 0.9rem 0.45rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: none; /* tags are lowercase everywhere */
    cursor: pointer;
    transition: all var(--transition);
}

.home-tag-chip:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.home-tag-chip.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Last cell of the preview row: jump to the full tag page */
.home-tag-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    aspect-ratio: 600 / 825;
    align-self: start;
    border-radius: 4.55% / 3.5%;
    border: 1px dashed var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    padding: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.home-tag-more:hover { border-color: var(--accent); color: var(--text-primary); }
.home-tag-more-emoji { font-size: 2rem; line-height: 1; }
.tag-index-chip .tag-emoji { margin-right: -0.1rem; }

/* Trainers */
.trainer-sprite { image-rendering: pixelated; object-fit: contain; }
.trainer-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 700;
}
.trainer-cell .trainer-sprite, .trainer-cell .trainer-initial { width: 64px; height: 64px; }
.trainer-cell .trainer-initial { font-size: 1.25rem; }
.cameo-chip .trainer-initial { width: 22px; height: 22px; margin: 3px; font-size: 0.6875rem; }
.pokedex-grid .trainer-region { grid-column: 1 / -1; margin: 1rem 0 0; }
.pokedex-grid .trainer-region:first-child { margin-top: 0; }

/* Browse nav button: the chevron carries its own whitespace, so trim the right side */
.nav-group-btn { padding-right: 0.6rem; gap: 0.3rem; }

/* Scope toggle: all / own cards / cameos only */
.scope-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 2px;
    gap: 2px;
}
.scope-toggle:empty { display: none; }
.scope-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all var(--transition);
}
.scope-btn:hover { color: var(--text-primary); }
.scope-btn.active { background: var(--bg-hover); color: var(--text-primary); font-weight: 600; }
.active-filter-row { gap: 0.625rem; flex-wrap: wrap; }
#cameos-results .tags-results-header { justify-content: flex-start; }
#cameos-results .tags-results-tools { margin-left: auto; }

.cameo-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 5;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    background: rgba(16, 16, 20, 0.85);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    pointer-events: none;
}
.results-sentinel { grid-column: 1 / -1; height: 1px; }

/* ==========================================
   Connecting cards (card page)
   ========================================== */
.connection + .connection { margin-top: 1rem; }
.connection-name { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* Cards sit edge to edge so the joined-up art reads as one picture */
.connection-strip { display: flex; gap: 3px; flex-wrap: wrap; }
/* Vertical connections stack top to bottom; full page ones form a grid (connections.js) */
.connection-strip.layout-column { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; }
.connection-strip.layout-column .connection-card { flex: none; width: 108px; }
.connection-strip.layout-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 108px)); }
.connection-strip.layout-grid .connection-card { min-width: 0; }
.connection-pages { display: flex; flex-direction: column; gap: 0.75rem; } /* 18 cards: two binder pages, one above the other */

.connection-card {
    flex: 0 1 108px;
    min-width: 72px;
    padding: 0;
    border: none;
    background: none;
    border-radius: 4.55% / 3.5%;
    cursor: pointer;
    position: relative;
    transition: transform var(--transition), opacity var(--transition);
}
.connection-card img { display: block; width: 100%; aspect-ratio: 600 / 825; object-fit: cover; border-radius: 4.55% / 3.5%; }
.connection-card:not(.current):hover { transform: translateY(-3px); }
.connection-card.current { cursor: default; }
.connection-card.current::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4.55% / 3.5%;
    box-shadow: inset 0 0 0 2px var(--accent);
    pointer-events: none;
}
.connection-noscan {
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 600 / 825;
    border: 1px dashed var(--border-light);
    border-radius: 4.55% / 3.5%;
    font-size: 0.6875rem; color: var(--text-muted); text-align: center; padding: 0.25rem;
}

/* Connecting cards: home widget and browse page */
.connection-block { display: flex; flex-direction: column; gap: 0.625rem; min-width: 0; }
.connection-caption { display: flex; flex-direction: column; gap: 0.125rem; }
.connection-caption strong { font-size: 0.9375rem; font-weight: 600; }
.connection-caption small { font-size: 0.75rem; color: var(--text-muted); }

.home-connections-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 2rem;
    overflow-x: auto;
    padding: 0.75rem 0.25rem 1rem;
    margin: 0 -0.25rem;
    scrollbar-width: thin;
}
.home-connections-row .connection-strip { flex-wrap: nowrap; }
.home-connections-row .connection-card { flex: 0 0 132px; }

.connections-kind-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 2.25rem 2rem; }
.connections-kind-list.layout-column { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } /* stacked ones are narrow */
.connections-list .connection-card { flex: 1 1 0; min-width: 0; max-width: 168px; }
.connections-list .connection-strip { flex-wrap: nowrap; }
.connections-list .connection-strip.layout-column .connection-card { flex: none; width: 120px; }

@media (max-width: 768px) {
    .home-connections-row .connection-card { flex-basis: 104px; }
}

/* Import: how-to notes and why a row didn't match */
.import-help { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
.import-help p { font-size: 0.8125rem; line-height: 1.5; color: var(--text-secondary); }
.import-help strong { color: var(--text-primary); font-weight: 600; }
.import-help em { font-style: normal; color: var(--text-primary); }
.result-reason { font-size: 0.6875rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ==========================================
   Tags page: grid layout (TAGS_INDEX_LAYOUT = 'grid' in tags.js)
   ========================================== */
.tags-index-grid .tags-group { margin-bottom: 2rem; }
.tags-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.tags-see-all {
    border: none; background: none; padding: 0; cursor: pointer;
    font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--accent);
}
.tags-see-all[hidden] { display: none; }
.tags-see-all:hover { text-decoration: underline; }
/* One row per group that scrolls sideways (swipe on a phone); "See all" wraps it into a grid */
.tags-index-grid .tags-group-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 168px;
    gap: 0.875rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    /* A scrolling row clips whatever leaves it: room above for the lift, around for its shadow */
    padding: 12px 8px 24px;
    margin: -12px -8px -20px;
    scroll-padding-inline: 8px;
}
.tags-index-grid .tags-group-row::-webkit-scrollbar { display: none; }
.tags-index-grid .tags-group-row > * { scroll-snap-align: start; }
.tags-index-grid .tags-group.expanded .tags-group-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    overflow: visible;
}

.tag-index-chip.tag-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    text-align: left;
    min-width: 0;
}

/* A window onto the card's artwork: zoomed past the frame and name bar */
.tag-tile-art {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background-color: var(--bg-tertiary);
    /* Zoomed past the name bar and attack text: just the art (covers are mostly full art) */
    background-size: 140%;
    background-position: var(--tile-framing, 50% 30%); /* the admin's drag, else the default */
    background-repeat: no-repeat;
    margin-bottom: 0.35rem;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
    transition: transform 320ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
/* A gentle lift: up a little, a touch bigger, a soft shadow underneath */
.tag-tile-art::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: none;
    z-index: -1;
}
@media (hover: hover) {
    .tag-tile:hover .tag-tile-art { transform: translate3d(0, -3px, 0) scale(1.015); }
    .tag-tile:hover .tag-tile-art::after { opacity: 1; }
}
.tag-tile:active .tag-tile-art { transform: translate3d(0, 0, 0) scale(0.97); }
.tag-index-chip.tag-tile:hover { border-color: transparent; }

/* The emoji sits by the name, where it's easy to spot */
.tag-tile-name .tag-emoji { margin-right: 0.3rem; font-size: 0.95rem; }
.tag-tile-art .tag-emoji { font-size: 1.75rem; }
/* No card yet: the emoji stands in for the art */
.tag-tile.empty .tag-tile-art { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-color); }
.tag-tile.empty .tag-tile-art .tag-emoji { opacity: 0.55; }

/* TAG_TILE_STYLE 'full': the whole card, smaller tiles */
.tags-index-full .tags-group-row { grid-auto-columns: 128px; }
.tags-index-full .tags-group.expanded .tags-group-row { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.tags-index-full .tag-tile-art { aspect-ratio: 600 / 825; background-size: cover; background-position: center; border-radius: 6px; }

.tag-tile-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); text-transform: capitalize; }
.tag-tile.empty .tag-tile-name { color: var(--text-secondary); }
.tag-tile .tag-count { font-size: 0.6875rem; font-weight: 500; color: var(--text-muted); }

@media (max-width: 768px) {
    .tags-index-grid .tags-group-row { grid-auto-columns: 132px; }
    .tags-index-grid .tags-group.expanded .tags-group-row { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

.tags-index-grid .tags-unused-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.875rem; }
.tags-index-grid .tags-unused-row .tag-index-chip { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

/* ==========================================
   Site footer
   ========================================== */
.site-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding: 1.75rem 1.5rem 2.5rem;
}
.site-footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.site-footer p { font-size: 0.75rem; line-height: 1.6; color: var(--text-muted); max-width: 90ch; }
.site-footer p:first-child { color: var(--text-secondary); }
.site-footer a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--accent); }

/* ==========================================
   Tags page: emoji tiles (TAGS_INDEX_LAYOUT = 'emoji')
   ========================================== */
.tags-index-emoji .tags-group-row { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.875rem 0.625rem; }

.tag-tile-emoji { align-items: center !important; text-align: center !important; }
.tag-tile-emoji .tag-tile-art {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: none;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
}
.tag-tile-emoji .tag-tile-art .tag-emoji {
    position: static;
    background: none;
    padding: 0;
    font-size: 2.25rem;
    opacity: 1;
    transition: transform var(--transition);
}
.tag-tile-emoji:hover .tag-tile-art { border-color: var(--accent); background-color: var(--accent-subtle); }
.tag-tile-emoji:hover .tag-tile-art .tag-emoji { transform: scale(1.12); }

/* Unused tags stay in the grid but step back */
.tag-tile-emoji.empty .tag-tile-art { border-style: solid; background-color: transparent; }
.tag-tile-emoji.empty .tag-tile-art .tag-emoji { font-size: 2.25rem; opacity: 0.4; filter: grayscale(0.6); }
.tag-tile-emoji.empty .tag-count { opacity: 0.7; }
.tag-tile-emoji:not(.empty) .tag-count { color: var(--accent); font-weight: 600; }

/* Tags page pills: a size up from the originals (0.875rem / 0.4rem 0.85rem) */
#tags-index:not(.tags-index-grid) .tags-group-row { gap: 0.625rem; }
#tags-index:not(.tags-index-grid) .tag-index-chip {
    font-size: 1rem;
    padding: 0.55rem 1.05rem 0.55rem 0.9rem;
    gap: 0.5rem;
}
#tags-index:not(.tags-index-grid) .tag-index-chip .tag-emoji { font-size: 1.1em; }
#tags-index:not(.tags-index-grid) .tag-index-chip .tag-count { font-size: 0.75rem; }
#tags-index:not(.tags-index-grid) .tags-group { margin-bottom: 2rem; }


/* ==================== Binder size slider ==================== */
.binder-size {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 0.25rem;
    color: var(--text-muted);
    cursor: pointer;
}
.binder-size input {
    -webkit-appearance: none;
    appearance: none;
    width: 96px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-color);
    cursor: pointer;
}
.binder-size input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    transition: transform 220ms var(--spring);
}
.binder-size input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.binder-size input:active::-webkit-slider-thumb { transform: scale(1.25); }
@media (max-width: 768px) {
    .binder-nav { flex-wrap: wrap; }
    .binder-size { flex-basis: 100%; justify-content: center; }
    .binder-size input { width: 160px; }
}

/* ==================== Tag search chips (tag-search.js) ==================== */
.tag-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0.5rem 0 0.75rem;
}
.tag-search-row[hidden] { display: none; }
.tag-suggest-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 2px;
}
.tag-suggest-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px 5px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    animation: joy-chip-in 360ms var(--spring) backwards;
    animation-delay: calc(var(--i, 0) * 35ms);
}
.tag-suggest-chip:hover { border-color: var(--accent); background: var(--accent-subtle); transform: translateY(-2px); }
.tag-suggest-chip .tag-count { font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; }
@keyframes joy-chip-in { from { opacity: 0; transform: translateY(6px) scale(0.85); } }

.source-showcase-note { margin: 0 0 0.625rem; font-size: 0.8125rem; color: var(--text-muted); }
.source-tag-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.source-tag-head strong { color: var(--text-primary); }
.source-tag-head .tag-count { font-size: 0.75rem; color: var(--text-muted); }
.source-tag-clear {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

/* ==================== Joy: bouncy, squishy, celebratory (joy.js) ==================== */
/* Buttons squish when pressed and spring back */
.nav-arrow, .add-page-btn, .binder-action-btn, .grid-btn, .michi-size-btn, #search-btn, .art-chip,
.tag-index-chip, .tag-suggest-chip, .tag-suggest, .card-action-btn, .action-btn, .source-tag-clear,
.toast-action, .binder-selector button {
    transition: transform 240ms var(--spring), background-color 150ms, border-color 150ms, color 150ms, box-shadow 150ms, opacity 150ms;
}
.nav-arrow:active:not(:disabled), .add-page-btn:active, .binder-action-btn:active, .grid-btn:active,
.michi-size-btn:active, #search-btn:active, .art-chip:active, .tag-index-chip:active, .tag-suggest-chip:active,
.card-action-btn:active, .action-btn:active, .source-tag-clear:active, .binder-selector button:active {
    transform: scale(0.92);
}
.tag-index-chip:hover { transform: translateY(-2px); }

/* Cards in the binder lift a little under the pointer */
.binder-slot { transition: transform 240ms var(--spring), box-shadow 200ms, border-color 150ms, background-color 150ms; }
.binder-slot.filled:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35); z-index: 1; }
.binder-slot.empty:hover { transform: scale(1.02); }

/* Counters bump when they change */
.joy-pop { animation: joy-pop 420ms var(--spring); }
span.joy-pop { display: inline-block; }
@keyframes joy-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* Sparkle / confetti bursts */
.joy-burst { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 3000; }
.joy-bit {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--size);
    height: calc(var(--size) * 0.6);
    border-radius: 2px;
    animation: joy-fly 900ms cubic-bezier(0.15, 0.8, 0.3, 1) forwards;
}
.joy-bit-round { height: var(--size); border-radius: 50%; }
@keyframes joy-fly {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
    70% { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) rotate(var(--rot)) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== Dropdowns ==================== */
/* One chevron for every dropdown, with room from the edge (the browser's own
   arrow sits tight against the border). */
select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.8rem center !important;
    background-size: 12px 12px !important;
    padding-right: 2.25rem !important;
}

.site-footer-links a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.site-footer-links a:hover { color: var(--text-primary); }

/* Search = a tag: its cards in a row above the results (tag-search.js) */
.search-tag-strip { margin-bottom: 1.5rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-secondary); animation: joy-chip-in 360ms var(--spring); }
.search-tag-strip[hidden] { display: none; }
.search-tag-strip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 0.75rem; }
.search-tag-strip-head strong { font-size: 1rem; }
.search-tag-strip-head .tag-count { color: var(--text-muted); font-size: 0.8125rem; }
.search-tag-strip-all { margin-left: auto; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; font-size: 0.8125rem; cursor: pointer; }
.search-tag-strip-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; }
.search-tag-strip-card { flex: 0 0 96px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 4.55% / 3.5%; animation: joy-chip-in 400ms var(--spring) backwards; animation-delay: calc(var(--i) * 30ms); transition: transform 280ms var(--spring); }
.search-tag-strip-card:hover { transform: translateY(-5px) scale(1.03); }
.search-tag-strip-card img { display: block; width: 100%; aspect-ratio: 600 / 825; object-fit: cover; border-radius: 4.55% / 3.5%; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }

/* ==================== Card view on phones: an app-style sheet ====================
   Full screen, slides up, swipe down to close (card-modal.js). The ✕ always
   stays on screen, the card scrolls with the page (on desktop it stays pinned
   beside the info), tabs stick to the top and Want / Collection / List stay
   at the bottom within thumb reach. */
@media (max-width: 700px) {
    #card-modal { padding: 0; align-items: flex-end; backdrop-filter: none; background: rgba(0, 0, 0, 0.85); }
    #card-modal .card-detail-content {
        margin: 0;
        width: 100%;
        max-width: none;
        height: calc(100dvh - env(safe-area-inset-top) - 8px);
        max-height: none;
        border: 0;
        border-radius: 20px 20px 0 0;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        animation: card-sheet-up 340ms cubic-bezier(0.2, 0.9, 0.3, 1);
        transition: transform 280ms cubic-bezier(0.2, 0.9, 0.3, 1);
    }
    #card-modal .card-detail-content.dragging { transition: none; }
    @keyframes card-sheet-up { from { transform: translateY(100%); } }
    /* Grab handle */
    #card-modal .card-detail-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        margin: 8px auto 0;
        border-radius: 999px;
        background: var(--border-light);
    }
    /* ✕ stays on screen while the sheet scrolls */
    #card-modal .modal-close {
        position: sticky;
        top: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        margin: 0 10px -34px auto;
        border-radius: 50%;
        background: rgba(20, 20, 24, 0.7);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        color: #fff;
        font-size: 1.35rem;
        z-index: 20;
    }
    #card-modal .card-detail-body { grid-template-columns: 1fr; gap: 1rem; padding: 0.5rem 1rem 0; }
    /* The card scrolls with the page instead of staying pinned over the info */
    #card-modal .card-detail-body .modal-image { position: static; padding-top: 0.25rem; }
    #card-modal .card-detail-body .modal-image img { max-width: min(72vw, 300px); max-height: none; }
    #card-modal .modal-card-holo { width: min(72vw, 300px); }
    #card-modal .ebay-btn { margin-top: 0.75rem; }
    #card-modal .detail-header { align-items: center; text-align: center; }
    #card-modal .detail-header h2 { font-size: 1.5rem; }
    /* Tabs stick to the top of the sheet (clear of the ✕) */
    #card-modal .detail-tabs {
        position: sticky;
        top: 0;
        z-index: 15;
        margin: 0 -1rem;
        padding: 0.5rem 50px 0 0.75rem;
        background: var(--bg-secondary);
    }
    #card-modal .detail-tab { padding: 0.6rem 0.55rem; font-size: 0.875rem; }
    /* Want / Collection / List + votes pinned at the bottom */
    #card-modal .detail-action-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 25;
        flex-wrap: nowrap;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border-top: 1px solid var(--border-color);
    }
    #card-modal .detail-action-bar .action-btn { flex: 1 1 0; min-width: 0; height: 44px; padding: 0 0.5rem; font-size: 0.875rem; justify-content: center; }
    #card-modal .detail-action-bar .list-btn { flex: 0 0 auto; padding: 0 0.85rem; }
    #card-modal .detail-action-bar .vote-controls { height: 44px; padding: 0 6px; }
    #card-modal .detail-action-bar .vote-btn { width: 32px; height: 32px; }
    /* Phones: four buttons in one row, so labels sit a bit tighter */
    #card-modal .detail-action-bar { gap: 0.4rem; }
    #card-modal .detail-action-bar .modal-actions { gap: 0.4rem; }
    #card-modal .detail-action-bar .action-btn { gap: 0.3rem; padding: 0 0.35rem 2px; font-size: 0.8125rem; }
    #card-modal .card-detail-info { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
    #card-modal .stats-grid { grid-template-columns: 1fr 1fr; }
    #card-modal .list-picker { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 26; max-height: 50dvh; overflow: auto; }
}

/* Other cards that lift on hover: keep each on its own GPU layer so the
   start and end of the movement don't flicker. */
.source-card,
.binder-slot.filled,
.search-tag-strip-card,
.pk-tile .pk-pack {
    backface-visibility: hidden;
    will-change: transform;
}

/* Michi block with no image yet: the prompt sits on a solid card so the pocket
   lines behind it don't run through the text */
.michi-empty { pointer-events: none; }
.michi-empty > * { pointer-events: auto; }
.michi-empty-pick,
.michi-empty-link {
    background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.michi-empty-pick { padding: 12px 18px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.michi-empty-pick:hover { background: color-mix(in srgb, var(--bg-secondary) 80%, var(--accent)); }
.michi-empty-link { padding: 4px 10px; border-radius: 999px; }
.compact .michi-empty-link { display: none; }

/* Michi print & cut panel (binder-print.js) */
.michi-print { display: flex; flex-direction: column; gap: 8px; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-color); }
.michi-print-head { display: flex; align-items: center; justify-content: space-between; }
.michi-print-head h4 { margin: 0; }
.michi-print-label, .print-field > span { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.unit-toggle, .seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bg-tertiary); border: 1px solid var(--border-color); }
.unit-toggle button, .seg button { flex: 1; border: 0; border-radius: 999px; padding: 4px 10px; background: none; color: var(--text-secondary); font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: background-color 150ms, color 150ms; }
.unit-toggle button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--text-primary); color: var(--bg-primary); }
.print-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.print-field { display: flex; flex-direction: column; gap: 4px; }
.print-field input, .print-field select { width: 100%; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-tertiary); color: var(--text-primary); font: inherit; font-size: 0.8125rem; }
.print-field input:focus, .print-field select:focus { outline: none; border-color: var(--accent); }
.pocket-size[hidden] { display: none; }
.print-more summary { cursor: pointer; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); padding: 4px 0; }
.print-more[open] { display: flex; flex-direction: column; gap: 6px; }
.print-check { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-primary); cursor: pointer; }
.print-check input { accent-color: var(--accent); }
.print-summary { font-size: 0.8125rem; color: var(--text-secondary); margin: 2px 0 0; }
.print-pdf-btn { width: 100%; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.michi-actions button { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.michi-actions button[data-act="remove"] { width: 26px; padding: 0; }
.michi-actions button svg { display: block; }
.seg button { white-space: nowrap; padding: 5px 8px; }

/* Card popup: no blurred backdrop. A backdrop-filter behind a card that is
   re-tilting in 3D every frame makes Chromium (and the Claude app) flicker. */
#card-modal { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(8, 8, 10, 0.86); }
#card-modal .modal-card-holo .holo-rotator { will-change: transform; }
#card-modal .modal-card-holo { isolation: isolate; }

.detail-local-name { margin: -0.25rem 0 0; color: var(--text-secondary); font-size: 0.95rem; }
.michi-block { cursor: grab; }
.michi-block.drag-source { opacity: 0.35; }

/* Binder panel: picked tags (stack them) + Narrow by */
.source-tag-head { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.source-tag-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.source-tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent-subtle); border: 1px solid var(--accent); color: var(--text-primary); font-size: 0.8125rem; font-weight: 600; animation: joy-chip-in 300ms var(--spring); }
.source-tag-remove { width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.25); color: inherit; cursor: pointer; line-height: 1; display: inline-grid; place-items: center; }
.source-tag-remove:hover { background: var(--accent); color: #fff; }
.source-tag-narrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tags-plus { color: var(--text-muted); font-weight: 700; }

/* ==================== A card's own page (/cards/{id}) ====================
   A shared card link opens the app on that card (card-modal.js openCardPage):
   the same card view as the popup, laid out as a page under the app's header,
   with "All cards" in place of the ✕. */
.card-page-back { display: none; }
body.card-page main { display: none; }
body.card-page #card-modal {
    position: static;
    display: block;
    padding: 1.5rem 1.5rem 3rem;
    background: none;
    z-index: auto;
    min-height: calc(100dvh - 56px);
}
body.card-page #card-modal .card-detail-content {
    margin: 0 auto;
    max-width: 1080px;
    max-height: none;
    overflow: visible;
    animation: none;
    transform: none;
}
body.card-page #card-modal .modal-close { display: none; }
body.card-page .card-page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 1rem 0 0 1.25rem;
    padding: 0.4rem 0.75rem 0.4rem 0.5rem;
    border-radius: 999px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
body.card-page .card-page-back:hover { background: var(--bg-tertiary); color: var(--text-primary); }
body.card-page #card-modal .card-detail-body .modal-image { top: calc(56px + 1rem); }
@media (max-width: 700px) {
    body.card-page #card-modal { padding: 0; min-height: 0; }
    body.card-page #card-modal .card-detail-content {
        height: auto;
        border-radius: 0;
        overflow: visible;
    }
    body.card-page #card-modal .card-detail-content::before { display: none; }
    body.card-page .card-page-back { margin: 0.75rem 0 0 0.75rem; }
}

/* "Try again" under the Cards message when the card database didn't answer (showCardsMessage) */
.empty-state-retry {
    margin-top: 1rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}
.empty-state-retry:hover { background: var(--bg-hover); }

/* Cameo picker suggestions (cameos.js): a short list under the box, not the browser's tall datalist */
.cameo-input-row { position: relative; }
.cameo-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: min(240px, 38vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.cameo-suggest[hidden] { display: none; }
.cameo-suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}
.cameo-suggest-item:hover, .cameo-suggest-item.active { background: var(--bg-tertiary); }
.cameo-suggest-dex { color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

/* Collectr import: skipped rows, the starred → wishlist option, the editable card search */
.import-summary-stat .stat-number.skipped-num { color: var(--text-secondary); }
.import-result-row .result-dest.to-skip { background: var(--bg-hover); color: var(--text-muted); }
.import-option { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--text-secondary); cursor: pointer; }
.import-option[hidden] { display: none; }
.import-option input { accent-color: var(--accent); width: 16px; height: 16px; }
.import-option small { color: var(--text-muted); }
.import-tab-note { margin: 0.25rem 0 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
.import-search-results-header small { color: var(--text-muted); margin-left: 0.35rem; }
.import-search-form { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.import-search-input { flex: 1; min-width: 0; padding: 0.45rem 0.7rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-primary); font: inherit; font-size: 0.8125rem; }
.import-search-input:focus { outline: none; border-color: var(--accent); }
.import-search-go { padding: 0.45rem 0.9rem; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: #fff; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.import-search-note { grid-column: 1 / -1; margin: 0.5rem 0; font-size: 0.75rem; color: var(--text-muted); text-align: center; }
button.import-search-card { padding: 0; background: none; font: inherit; color: inherit; }
.import-search-grid { max-height: 280px; }
.pk-head h2 .pk-beta { font-size: 0.6875rem; vertical-align: middle; margin-left: 0.4rem; position: relative; top: -0.15em; }
.cameo-suggest-note { margin: 0.4rem 0.6rem; font-size: 0.8125rem; color: var(--text-muted); }

/* Binder card panel: which cards to search (binders.js setBinderSource) */
.source-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-tertiary); flex-wrap: wrap; }
.source-tab { padding: 0.35rem 0.8rem; border: 0; border-radius: 999px; background: none; color: var(--text-secondary); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--transition), color var(--transition); }
.source-tab:hover { color: var(--text-primary); }
.source-tab.active { background: var(--accent); color: #fff; }
.source-switch { margin-left: 0.25rem; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* Under "See card on eBay": the affiliate disclosure, close to the link but quiet */
.ebay-note { margin: 0.45rem 0 0; font-size: 0.6875rem; line-height: 1.35; color: var(--text-muted); text-align: center; }

/* ==================== Binder builder layout (design pass) ====================
   Toolbar on top (which binder · how it looks · share), the binder on the left
   and the cards to add docked beside it with their own scroll, so a drag is a
   short move. Under 1100px the card panel sits under the binder. */
.binder-section { --bt-h: 52px; }
.binder-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.5rem 0.6rem 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}
.bt-group { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.bt-binder { flex: 1 1 auto; }
.bt-share { margin-left: auto; gap: 0.75rem; }
.bt-missing[hidden] { display: none; }
.bt-binder-pick { display: flex; flex-direction: column; min-width: 0; margin-right: 0.25rem; }
.bt-binder-pick select {
    max-width: 240px;
    padding: 0.1rem 1.6rem 0.1rem 0;
    border: 0;
    background-color: transparent;
    background-position: right 0.15rem center;
    color: var(--text-primary);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-overflow: ellipsis;
}
.bt-binder-pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.bt-meta { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bt-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.bt-icon:hover, .bt-icon[aria-expanded="true"] { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-hover); }
.bt-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-tertiary); }
.bt-seg .grid-btn { padding: 0.3rem 0.65rem; border: 0; border-radius: 999px; background: none; color: var(--text-secondary); font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bt-seg .grid-btn:hover { color: var(--text-primary); background: none; }
.bt-seg .grid-btn.active { background: var(--accent); color: #fff; }
.bt-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 34px;
    padding: 0 0.8rem 0 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}
.bt-pill:hover, .bt-pill[aria-expanded="true"] { border-color: var(--border-light); background: var(--bg-hover); }
.bt-color-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--sw, #18181b); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 0 2px var(--bg-tertiary); }
.bt-switch { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; user-select: none; white-space: nowrap; }
.bt-switch:hover { color: var(--text-primary); }
.bt-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bt-switch-track { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--bg-hover); border: 1px solid var(--border-light); transition: background 180ms, border-color 180ms; }
.bt-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-secondary); transition: transform 220ms var(--spring, cubic-bezier(0.3, 1.4, 0.5, 1)), background 180ms; }
.bt-switch input:checked + .bt-switch-track { background: var(--accent); border-color: var(--accent); }
.bt-switch input:checked + .bt-switch-track::after { transform: translateX(12px); background: #fff; }
.bt-switch input:checked ~ * { color: var(--text-primary); }
.bt-switch:has(input:checked) { color: var(--text-primary); }
.bt-switch input:focus-visible + .bt-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Menus and popovers hanging off the toolbar */
.bt-menu-wrap { position: relative; }
.bt-menu, .bt-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: bt-pop-in 160ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.bt-menu[hidden], .bt-pop[hidden] { display: none; }
@keyframes bt-pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.bt-menu { min-width: 220px; padding: 0.3rem; display: flex; flex-direction: column; }
.bt-menu > button, .bt-menu > label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
}
.bt-menu > button svg, .bt-menu > label svg { color: var(--text-muted); flex-shrink: 0; }
.bt-menu > button:hover, .bt-menu > label:hover { background: var(--bg-hover); }
.bt-menu > .danger { color: var(--danger); }
.bt-menu > .danger svg { color: currentColor; }
.bt-menu hr { margin: 0.3rem 0.4rem; border: 0; border-top: 1px solid var(--border-color); }
.bt-pop { padding: 0.75rem; width: max-content; }
.bt-pop .swatches { grid-template-columns: repeat(8, 26px); }
.bt-pop .hex-picker { margin-top: 0.75rem; width: 248px; }

/* Save status + Share */
.binder-save-status { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 0.3rem; }
.binder-save-status a { color: var(--accent); }
.binder-save-status.saved::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.bt-share .binder-share-wrap { margin-top: 0; }
.bt-share .share-binder-btn { width: auto; height: 34px; padding: 0 0.95rem; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; }
.bt-share .share-binder-btn:hover { filter: brightness(1.08); color: #fff; }
.bt-share .share-binder-menu { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; min-width: 200px; }

/* Binder + docked card panel */
.binder-layout { grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 380px); gap: 1rem; align-items: start; }
.binder-main .binder-spread { padding: clamp(0.75rem, 1.6vw, 1.5rem); }
.binder-nav { padding: 0.5rem 0.75rem; gap: 0.6rem; }
.binder-main .michi-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1.25rem 2rem;
    padding: 1rem 1.1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    border-top: 1px solid var(--border-color);
}
.binder-main .michi-controls[style*="none"] { display: none !important; }
.binder-main .michi-controls > .michi-print { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
.binder-card-source {
    position: sticky;
    top: 72px;
    margin-top: 0;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: calc(100vh - 88px);
    min-height: 420px;
}
.binder-card-source .card-source-header { margin: 0; }
.binder-card-source .card-source-header h4 { font-size: 0.9375rem; font-weight: 700; }
.binder-card-source .source-tabs { display: flex; width: 100%; }
.binder-card-source .source-tab { flex: 1; padding: 0.35rem 0.4rem; }
.binder-card-source .search-box { max-width: none; }
.binder-card-source .source-cards-container { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -0.35rem; padding: 0 0.35rem 0.25rem; }
.binder-card-source .source-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0.5rem; max-height: none; overflow: visible; }
.binder-card-source .source-card { width: auto; }
.binder-card-source .source-card img { width: 100%; height: auto; aspect-ratio: 63.5 / 88.9; object-fit: cover; }
.binder-card-source .source-see-more { display: none; }
.source-more-btn { display: block; width: 100%; margin-top: 0.6rem; padding: 0.5rem; border: 1px dashed var(--border-light); border-radius: var(--radius); background: none; color: var(--text-secondary); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.source-more-btn:hover { color: var(--text-primary); border-color: var(--accent); }

/* Below big desktops the card panel is a tray docked to the bottom of the screen:
   the binder keeps the full width, one row of cards scrolls sideways (drag them up
   into the pockets), and "Show more" opens it into a grid (binder-toolbar.js). */
.source-tray-toggle { display: none; }
@media (max-width: 1439px) {
    .binder-layout { grid-template-columns: minmax(0, 1fr); }
    .binder-card-source {
        position: sticky;
        top: auto;
        bottom: 0;
        z-index: 40;
        min-height: 0;
        max-height: none;
        gap: 0.5rem;
        padding: 0.6rem 0.85rem 0.75rem;
        border-radius: 18px 18px 0 0;
        border-bottom: 0;
        background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.45);
    }
    .binder-card-source { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(200px, 320px); align-items: center; column-gap: 0.75rem; }
    .binder-card-source .card-source-header { grid-column: 1; grid-row: 1; gap: 0.5rem; }
    .binder-card-source .source-tabs { grid-column: 2; grid-row: 1; width: auto; justify-self: start; }
    .binder-card-source .source-tab { flex: 0 0 auto; padding: 0.35rem 0.75rem; }
    .binder-card-source .search-box { grid-column: 3; grid-row: 1; }
    .binder-card-source .tag-search-row, .binder-card-source .source-cards-container { grid-column: 1 / -1; }
    .source-tray-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.3rem 0.6rem;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        font: inherit;
        font-size: 0.75rem;
        font-weight: 600;
        cursor: pointer;
    }
    .source-tray-toggle:hover { color: var(--text-primary); }
    .source-tray-toggle svg { transition: transform 220ms; }
    .binder-card-source.tray-open .source-tray-toggle svg { transform: rotate(180deg); }
    /* Collapsed: one sideways row */
    .binder-card-source:not(.tray-open) .source-cards-container { max-height: none; overflow: visible; margin: 0; padding: 0; }
    .binder-card-source:not(.tray-open) .source-cards {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 72px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .binder-card-source:not(.tray-open) .source-card { scroll-snap-align: start; }
    .binder-card-source:not(.tray-open) .source-more-btn { display: none; }
    .binder-card-source:not(.tray-open) .source-tag-head { display: none; }
    /* Open: a grid you can scroll */
    .binder-card-source.tray-open .source-cards-container { max-height: 52vh; }
    .binder-main .michi-controls { grid-template-columns: minmax(0, 1fr); }
    .binder-main .michi-controls > .michi-print { grid-column: auto; grid-row: auto; }
}
@media (max-width: 860px) {
    .binder-card-source { grid-template-columns: minmax(0, 1fr); row-gap: 0.5rem; }
    .binder-card-source .card-source-header, .binder-card-source .source-tabs, .binder-card-source .search-box { grid-column: 1; grid-row: auto; }
    .binder-card-source .card-source-header { justify-content: space-between; }
    .binder-card-source .source-tabs { width: 100%; }
    .binder-card-source .source-tab { flex: 1; padding: 0.35rem 0.3rem; }
    .binder-card-source:not(.tray-open) .source-cards { grid-auto-columns: 64px; }
    .binder-card-source { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) {
    .binder-toolbar { gap: 0.6rem; padding: 0.6rem; }
    .bt-binder { flex-basis: 100%; }
    .bt-binder-pick { flex: 1; }
    .bt-look { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
    .bt-share { margin-left: 0; flex-basis: 100%; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
    .bt-share .binder-save-status { flex-basis: 100%; }
    .bt-pop { left: auto; right: auto; }
}
.pokemon-chip img { width: 22px; height: 22px; margin: -4px 0 -4px -6px; image-rendering: pixelated; }
.source-tag-chip img { width: 22px; height: 22px; margin: -4px 2px -4px -4px; image-rendering: pixelated; vertical-align: middle; }

/* Cards grid: wishlist / collection as round badges (the binder's Add cards look),
   stacked in the top-right corner and shown on hover (always on touch screens) */
.card .card-actions {
    top: 6px;
    right: 6px;
    bottom: auto;
    flex-direction: column;
    gap: 4px;
    z-index: 4;
}
.card .card-action-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(15, 15, 18, 0.82);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: background 160ms, transform 220ms var(--spring, ease);
}
.card .card-action-btn .heart-icon, .card .card-action-btn .check-icon { width: 13px; height: 13px; }
.card .card-action-btn.wishlist { color: #fca5a5; }
.card .card-action-btn.collection { color: #86efac; font-size: 1rem; }
.card .card-action-btn.wishlist.active { background: rgba(239, 68, 68, 0.92); color: #fff; }
.card .card-action-btn.collection.active { background: rgba(34, 197, 94, 0.92); color: #fff; }
@media (hover: hover) {
    .card .card-actions { opacity: 0; }
    .card:hover .card-actions { opacity: 1; }
    .card .card-action-btn:not(.active):hover { background: rgba(15, 15, 18, 0.95); transform: scale(1.08); }
}
@media (hover: none) { .card .card-actions { opacity: 1; } }

/* Add cards: each card is exactly card-shaped, so its badge sits on the card */
.binder-card-source .source-card { height: auto; aspect-ratio: 63.5 / 88.9; }
.binder-card-source .source-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.source-card-badge { width: 20px; height: 20px; bottom: 4px; right: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.source-tray-toggle .tray-icon-close { display: none; }
.binder-card-source.tray-open .source-tray-toggle .tray-icon-open { display: none; }
.binder-card-source.tray-open .source-tray-toggle .tray-icon-close { display: inline; }
.binder-card-source.tray-open .source-tray-toggle svg { transform: none; }

/* Michi bar: one row over the binder while Michi is on, replacing the floating pill
   and the settings box under the binder. Print settings open as a popover. */
.binder-main .michi-banner {
    position: static;
    transform: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.5rem 0.5rem 0.9rem;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--accent) 16%, var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--text-primary);
    font-weight: 500;
    white-space: normal;
    box-shadow: none;
    animation: bt-pop-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.binder-main .michi-banner[hidden] { display: none; }
.binder-main .michi-banner-dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.michi-bar-hint { margin: 0; flex: 1 1 260px; font-size: 0.8125rem; color: var(--text-secondary); }
.michi-bar-hint b { color: var(--text-primary); font-weight: 600; }
.michi-banner .michi-size-select { display: flex; flex-wrap: wrap; gap: 3px; }
.michi-banner .michi-size-btn { padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--bg-tertiary); }
.binder-main .michi-banner button.michi-size-btn { color: var(--text-secondary); }
.binder-main .michi-banner button.michi-size-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.binder-main .michi-banner .michi-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.85rem;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}
.binder-main .michi-banner .michi-bar-btn:hover, .binder-main .michi-banner .michi-bar-btn[aria-expanded="true"] { background: var(--bg-hover); }
.binder-main .michi-banner .michi-done { background: var(--accent); border-color: var(--accent); color: #fff; }
.michi-print-pop { left: auto; right: 0; width: min(340px, calc(100vw - 32px)); max-height: min(70vh, 640px); overflow-y: auto; overscroll-behavior: contain; padding: 1rem; }
.michi-print-pop .michi-print { margin: 0; padding: 0; border: 0; }

/* No frosted glass over the binder: backdrop blur re-renders unevenly over the
   moving, 3D-transformed cards and pockets in Chromium (flicker) */
@media (max-width: 1439px) {
    .binder-card-source { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg-secondary); }
}

/* Keep the scrollbar's space reserved: otherwise resizing the binder pockets can
   add or remove the page scrollbar, which changes the width, which resizes the
   pockets again (a flicker loop) */
html { scrollbar-gutter: stable; }
/* The Michi bar's print popover opens over the card tray */
.binder-main .michi-banner { position: relative; left: auto; top: auto; z-index: 45; }

/* Binder: buying what's missing (binder-toolbar.js, binders.js) */
.bt-missing { color: var(--text-primary); }
.bt-missing svg { color: var(--success); }
.binder-missing-pop { left: auto; right: 0; width: min(380px, calc(100vw - 32px)); padding: 0.85rem; }
.bm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.bm-head strong { font-size: 0.9375rem; }
.bm-total { font-size: 0.875rem; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.bm-sub { margin: 0.15rem 0 0.6rem; font-size: 0.75rem; color: var(--text-muted); }
.bm-list { display: flex; flex-direction: column; gap: 2px; max-height: min(50vh, 420px); overflow-y: auto; overscroll-behavior: contain; margin: 0 -0.35rem; padding: 0 0.35rem; }
.bm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 0.5rem; padding: 0.3rem; border-radius: var(--radius-sm); }
.bm-row:hover { background: var(--bg-hover); }
.bm-card { display: flex; align-items: center; gap: 0.55rem; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bm-card img { width: 32px; aspect-ratio: 63.5 / 88.9; object-fit: cover; border-radius: 3px; flex-shrink: 0; background: var(--bg-tertiary); }
.bm-card span { display: flex; flex-direction: column; min-width: 0; }
.bm-card strong { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-card small { font-size: 0.6875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-price { font-size: 0.8125rem; font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }
.bm-buy, .bm-got { padding: 0.3rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer; }
.bm-buy { background: var(--accent); color: #fff; }
.bm-buy:hover { filter: brightness(1.08); }
.bm-got { border: 1px solid var(--border-light); background: none; color: var(--text-secondary); font: inherit; font-size: 0.75rem; font-weight: 600; }
.bm-got:hover { color: var(--success); border-color: var(--success); }
.binder-missing-pop .ebay-note { margin-top: 0.6rem; }


/* Card view: hide the picture while the next card's image loads (card-modal.js) */
#modal-card-image { transition: opacity 160ms ease; }
#modal-card-image.is-swapping { opacity: 0; transition: none; }
/* "To get" sort: a quiet line of text, so the purple stays with the eBay buttons */
.bm-sort { display: flex; align-items: baseline; gap: 0.15rem; margin: -0.2rem 0 0.5rem; font-size: 0.75rem; }
.bm-sort-label { color: var(--text-muted); margin-right: 0.3rem; }
.bm-sort button { padding: 0.15rem 0.35rem; border: 0; border-radius: 4px; background: none; color: var(--text-muted); font: inherit; font-weight: 500; cursor: pointer; }
.bm-sort button + button::before { content: '·'; margin: 0 0.4rem 0 -0.15rem; color: var(--text-muted); pointer-events: none; }
.bm-sort button:hover { color: var(--text-secondary); }
.bm-sort button[aria-pressed="true"] { color: var(--text-primary); font-weight: 600; }
a.brand { text-decoration: none; color: inherit; border-radius: 6px; }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Binder: one page at a time (binders.js setBinderSinglePage) */
.binder-spread.single .right-page, .binder-spread.single .binder-spine { display: none; }
.bt-view button { display: inline-flex; align-items: center; justify-content: center; padding: 0.3rem 0.55rem; border: 0; border-radius: 999px; background: none; color: var(--text-secondary); cursor: pointer; }
.bt-view button:hover { color: var(--text-primary); }
.bt-view button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Quick tooltips: data-tip="…" on a button shows a small label above it on hover
   or keyboard focus, straight away (the browser's own title tooltip lags) */
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 3px);
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    background: #0b0b0d;
    border: 1px solid var(--border-light);
    color: #f4f4f5;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms, transform 160ms;
    z-index: 70;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
@media (hover: hover) { [data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 150ms; } }
[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.bt-view button { padding: 0.25rem 0.5rem; }

/* Home hero search: one box for names, artists and what's in the art */
.home-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 1.5rem;
    max-width: 30rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.home-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-subtle); }
.home-search-icon { position: absolute; left: 1.1rem; color: var(--text-muted); pointer-events: none; }
.home-search input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: none;
    border: none;
    outline: none;
    padding: 0.95rem 0 0.95rem 3rem;
}
.home-search input::-webkit-search-cancel-button { display: none; }
.home-search-ghost {
    position: absolute;
    left: 3rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    white-space: nowrap;
}
.home-search-ghost:not(:empty)::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-left: 1px;
    vertical-align: -0.2em;
    background: var(--accent);
    animation: home-caret 1s steps(1) infinite;
}
@keyframes home-caret { 50% { opacity: 0; } }
.home-search-go {
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 9999px;
    padding: 0.65rem 1.15rem;
    margin: 0.3rem;
    cursor: pointer;
    transition: background var(--transition);
}
.home-search-go:hover { background: var(--accent-hover); }
.home-search-suggest { max-width: 30rem; margin-top: 0.6rem; }
/* One line, its height kept while the tags load, so nothing below jumps */
.home-search-try {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    margin-top: 0.85rem;
    overflow: hidden;
    font-size: 0.8125rem;
    color: var(--text-muted);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    transition: opacity 0.3s ease;
}
.home-search-try[hidden] { display: flex; visibility: hidden; opacity: 0; }
.home-search-suggest:not([hidden]) + .home-search-try { display: none; }
.home-search-chip { flex: none; }
.home-search-try > span { margin-right: 0.15rem; }
.home-search-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.home-search-chip:hover { color: var(--text-primary); border-color: var(--text-secondary); transform: translateY(-1px); }

/* Home binder planner preview: a spread that fills itself on scroll */
.home-binder {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 2.5rem;
    margin: 1rem 0 2.5rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
}
.home-binder[hidden] { display: none; }
.home-binder h3 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-wrap: balance;
}
.home-binder p { color: var(--text-secondary); line-height: 1.5; margin: 0.75rem 0 1.25rem; max-width: 36ch; }
.home-binder-spread {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
    background: #141416;
    border-radius: 14px;
    box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    transform: perspective(1400px) rotateX(8deg);
    transform-origin: 50% 100%;
}
.hb-page {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}
.hb-pocket {
    position: relative;
    aspect-ratio: 63 / 88;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.hb-pocket img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: translateY(-14px) scale(1.06);
}
.home-binder-spread.filling .hb-pocket img {
    animation: hb-drop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--d) * 90ms + 150ms);
}
.home-binder-spread.filling .hb-pocket.to-get img { animation-name: hb-drop-ghost; }
@keyframes hb-drop { to { opacity: 1; transform: none; } }
@keyframes hb-drop-ghost { to { opacity: 0.28; transform: none; } }
.hb-pocket.to-get img { filter: grayscale(1); }
.hb-get {
    position: absolute;
    left: 50%;
    bottom: 8%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 700;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    padding: 0.15rem 0.45rem;
    opacity: 0;
}
.home-binder-spread.filling .hb-get { animation: hb-fade 0.3s ease forwards; animation-delay: calc(var(--d) * 90ms + 500ms); }
@keyframes hb-fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .hb-pocket img { opacity: 1; transform: none; }
    .hb-pocket.to-get img { opacity: 0.28; }
    .hb-get { opacity: 1; }
}
@media (max-width: 900px) {
    .home-binder { grid-template-columns: 1fr; padding: 1.25rem; gap: 1.5rem; }
    .home-binder-spread { transform: none; padding: 8px; gap: 4px; }
    .hb-page { padding: 4px; gap: 4px; }
}

/* The tags row is the first thing below the fold line on most screens: it keeps
   its height from the start so later rows load in without shoving anything. */
#home-tags { min-height: 423px; }

/* Hero fan: hidden until its pictures are ready, then dealt in one after another */
.home-hero-cards .hero-card > .card-image { opacity: 0; translate: 0 18px; scale: 0.94; }
.home-hero-cards.ready .hero-card > .card-image {
    animation: hero-deal 0.6s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
.home-hero-cards.ready .hero-card:nth-child(1) > .card-image { animation-delay: 0.08s; }
.home-hero-cards.ready .hero-card:nth-child(2) > .card-image { animation-delay: 0s; }
.home-hero-cards.ready .hero-card:nth-child(3) > .card-image { animation-delay: 0.16s; }
/* translate/scale rather than transform, which the tilt sets inline */
@keyframes hero-deal { to { opacity: 1; translate: none; scale: 1; } }
@media (prefers-reduced-motion: reduce) {
    .home-hero-cards.ready .hero-card > .card-image { animation: none; opacity: 1; translate: none; scale: 1; }
}

/* Tag page: "All tags" sits on its own line above the title */
.tags-back-above { display: inline-block; margin-bottom: 0.4rem; font-size: 0.875rem; }

/* Picked tags on a tag page: label and × centred in the pill */
.tags-refine-row .tag-chip.user-tagged { display: inline-flex; align-items: stretch; line-height: 1; padding: 0; }
.tags-refine-row .tag-chip.user-tagged .tag-chip-label { display: flex; align-items: center; padding: 0.45rem 0.55rem 0.45rem 0.8rem; line-height: 1; }
.tags-refine-row .tag-chip.user-tagged .tag-chip-x { display: flex; align-items: center; justify-content: center; padding: 0 0.6rem 0 0.55rem; border-radius: 0 9999px 9999px 0; }
.tags-refine-row .tag-chip.user-tagged .tag-chip-x svg { display: block; }

/* Suggestion rows: the group label sits on the chips' center line */
.tag-search-row .tag-suggest-label { margin: 0 2px 0 0; line-height: 1; }
.tag-search-row .tag-suggest-label:not(:first-child) { margin-left: 6px; }
.trainer-suggest .trainer-sprite { width: 22px; height: 22px; margin: -4px 0 -4px -6px; object-fit: contain; image-rendering: pixelated; }
.trainer-suggest .trainer-initial { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.625rem; background: var(--bg-hover); }

/* Tags page: a row of card art under each group's pills */
.tags-peek {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 112px;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    margin: 0.9rem -0.25rem 0;
    padding: 0.25rem 0.25rem 0.5rem;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.tags-peek::-webkit-scrollbar { display: none; }
.tags-index.filtering .tags-peek, #tags-index.filtering .tags-peek { display: none; }
.tags-peek-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    animation: tags-peek-in 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
    animation-delay: calc(var(--i) * 28ms);
}
.tags-peek-card img {
    width: 100%;
    aspect-ratio: 600 / 825;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg-tertiary);
    transition: transform 0.2s ease;
}
.tags-peek-card:hover img { transform: translateY(-3px); }
.tags-peek-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tags-peek.one-tag .tags-peek-label { visibility: hidden; } /* keeps the row height, so nothing below moves */
@keyframes tags-peek-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .tags-peek-card { animation: none; } }
@media (max-width: 600px) { .tags-peek { grid-auto-columns: 92px; gap: 0.6rem; } }
.source-tag-note { flex-basis: 100%; font-size: 0.75rem; color: var(--text-muted); }

/* Tag pages: the tag's emoji leads its title */
.tags-title-emoji { margin-right: 0.4rem; text-transform: none; }

/* Card page tags: emoji + name centered in the pill, × on the same line */
#modal-tags-list .tag-chip { display: inline-flex; align-items: stretch; line-height: 1; }
#modal-tags-list .tag-chip-name,
#modal-tags-list .tag-chip-label { display: inline-flex; align-items: center; gap: 0.35rem; line-height: 1; padding-top: 0.45rem; padding-bottom: 0.45rem; }
#modal-tags-list .tag-chip-x,
#modal-tags-list .tag-chip-ok { display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding: 0 0.6rem 0 0.5rem; }
#modal-tags-list .tag-chip-x svg { display: block; }
#modal-tags-list .tag-emoji { font-size: 0.95em; }

/* Tags page: a tag with tags inside it (home → rooms) folds them behind a "+ 7" button */
.tag-family { display: inline-flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; }
.tag-family-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 9999px;
    padding: 0 0.65rem;
    margin-left: -0.3rem;
    cursor: pointer;
}
.tag-family-toggle svg { display: block; flex: none; }
.tag-family-toggle.open { padding: 0 0.75rem; }
.tag-family-toggle.open span, .tag-family-toggle.open .tag-family-plus { display: none; }
.tag-family-toggle:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.tag-family-kids { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding-left: 0.6rem; border-left: 2px solid var(--border-color); }
.tag-family-kids[hidden] { display: none; }
.tag-family-kids .tag-index-chip { font-size: 0.9em; }
.tags-inside-row { margin-bottom: 0.4rem; }

/* Tag pills: one line box, so emoji, name and count share a center line */
.tag-index-chip, .tag-suggest, .tag-suggest-chip, .home-search-chip { line-height: 1; }
.tag-index-chip .tag-emoji, .tag-suggest .tag-emoji, .tag-suggest-chip .tag-emoji { line-height: 1; display: inline-flex; }
.tag-index-chip { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Binder: fill the empty pockets on screen from the Add cards list */
.source-fill-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin: 0 0 0.6rem;
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-light);
    border-radius: 9999px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.source-fill-btn:hover { border-color: var(--accent); background: var(--accent-subtle); }
.binder-card-source .source-fill-btn { grid-column: 1 / -1; }

/* Pokémon sprites cropped to the same size (spriteHtml in core.js) */
.dex-sprite-box { position: relative; display: inline-block; flex: none; overflow: hidden; vertical-align: middle; }
.dex-sprite-box img { position: absolute; max-width: none; margin: 0; image-rendering: pixelated; }
.pokemon-chip .dex-sprite-box { margin: -4px 0 -4px -6px; }
.source-tag-chip .dex-sprite-box { margin: -4px 2px -4px -4px; }

/* Trainer chip on a Trainer card's page, sized like the Pokémon chip beside it */
.stat-chip-trainer .trainer-sprite { width: 28px; height: 28px; }
.stat-chip-trainer .trainer-initial { width: 24px; height: 24px; margin: 4px; font-size: 0.75rem; }

/* English search: "12 Japanese cards also match" (search.js hintOtherLanguages) */
.search-other-lang { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: 0 0 1rem; padding: 0.625rem 0.875rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-secondary); color: var(--text-secondary); font-size: 0.875rem; }
.search-other-lang[hidden] { display: none; }
.search-other-lang .btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Rip Packs: pull-rate slider and reveal switch (packs.js), centred under the search */
.pk-controls { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; margin: -0.75rem auto 2rem; }
.pk-luck { --p: 0; --bubble: 40px; width: min(100%, 440px); }
.pk-luck-track { position: relative; height: 48px; display: flex; align-items: center; }
.pk-luck input[type="range"] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 10px; margin: 0; border-radius: 999px; cursor: pointer; outline: none;
    background: linear-gradient(90deg, #9d5cff, #ff6bcb 60%, #ffd43b) 0 0 / calc(var(--bubble) / 2 + (100% - var(--bubble)) * var(--p)) 100% no-repeat, rgba(127, 127, 127, 0.2);
    transition: background-size 0.3s cubic-bezier(.34, 1.56, .64, 1);
}
.pk-luck input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--bubble); height: var(--bubble); border-radius: 50%; background: transparent; border: 0; }
.pk-luck input[type="range"]::-moz-range-thumb { width: var(--bubble); height: var(--bubble); border-radius: 50%; background: transparent; border: 0; }
.pk-luck input[type="range"]:focus-visible + .pk-luck-ticks + .pk-luck-bubble { outline: 2px solid var(--accent); outline-offset: 3px; }
.pk-luck-ticks { position: absolute; inset: 0 calc(var(--bubble) / 2); pointer-events: none; }
.pk-luck-ticks i { position: absolute; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(127, 127, 127, 0.45); transition: background 0.2s, transform 0.2s; }
.pk-luck-ticks i.on { background: rgba(255, 255, 255, 0.85); }
.pk-luck-ticks i.gold { box-shadow: 0 0 0 2px rgba(255, 212, 59, 0.45); }
.pk-luck-bubble {
    position: absolute; top: 50%; left: calc(var(--bubble) / 2 + (100% - var(--bubble)) * var(--p)); width: var(--bubble); height: var(--bubble);
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem; line-height: 1; border-radius: 50%; pointer-events: none;
    background: var(--bg-card, #1c1c22); border: 2px solid #9d5cff; transform: translate(-50%, -50%);
    box-shadow: 0 0 0 4px rgba(157, 92, 255, 0.18), 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: left 0.3s cubic-bezier(.34, 1.56, .64, 1), border-color 0.2s, box-shadow 0.2s;
}
.pk-luck-bubble.pop { animation: pk-luck-pop 0.38s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pk-luck-pop { 0% { transform: translate(-50%, -50%) scale(1); } 45% { transform: translate(-50%, -50%) scale(1.32) rotate(-8deg); } 100% { transform: translate(-50%, -50%) scale(1); } }
.pk-luck[data-level="3"] .pk-luck-bubble { border-color: #ff6bcb; box-shadow: 0 0 0 5px rgba(255, 107, 203, 0.22), 0 0 22px rgba(255, 107, 203, 0.45); }
.pk-luck[data-level="4"] .pk-luck-bubble, .pk-luck[data-level="5"] .pk-luck-bubble { border-color: #ffd43b; box-shadow: 0 0 0 5px rgba(255, 212, 59, 0.22), 0 0 24px rgba(255, 212, 59, 0.5); }
.pk-luck[data-level="6"] .pk-luck-bubble { border-color: transparent; background: linear-gradient(var(--bg-card, #1c1c22), var(--bg-card, #1c1c22)) padding-box, conic-gradient(from var(--pk-spin, 0deg), #8a6a2f, #f3d98b, #fff4d6, #c99a3e, #8a6a2f) border-box; animation: pk-luck-spin 3.2s linear infinite; box-shadow: 0 0 0 5px rgba(232, 196, 110, 0.16), 0 0 26px rgba(232, 196, 110, 0.38); }
.pk-luck[data-level="6"] .pk-luck-bubble.pop { animation: pk-luck-pop 0.38s cubic-bezier(.34, 1.56, .64, 1), pk-luck-spin 3.2s linear infinite; }
/* God pack: gold foil rather than a rainbow, with a slow light sweep */
.pk-luck[data-level="6"] input[type="range"] { background: linear-gradient(100deg, #7c3aed 0%, #b07ce8 30%, #c99a3e 55%, #fff1c9 64%, #d9ac52 72%, #9a7433 100%) 0 0 / 220% 100%, rgba(127, 127, 127, 0.2); animation: pk-luck-shimmer 4s ease-in-out infinite alternate; }
@property --pk-spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes pk-luck-spin { to { --pk-spin: 360deg; } }
@keyframes pk-luck-shimmer { from { background-position: 0 0, 0 0; } to { background-position: 100% 0, 0 0; } }
.pk-luck-text { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; margin: 0.35rem 0 0; text-align: center; }
.pk-luck-text strong { font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text-primary); transition: color 0.2s; }
.pk-luck-text span { font-size: 0.8125rem; color: var(--text-muted); max-width: 380px; }
.pk-luck[data-level="3"] .pk-luck-text strong { color: #ff6bcb; }
.pk-luck[data-level="4"] .pk-luck-text strong, .pk-luck[data-level="5"] .pk-luck-text strong { color: #ffd43b; }
.pk-luck[data-level="6"] .pk-luck-text strong { background: linear-gradient(100deg, #b8893a 0%, #e9c977 35%, #fff6dc 50%, #e9c977 65%, #b8893a 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 0.01em; animation: pk-luck-foil 3.5s ease-in-out infinite; }
@keyframes pk-luck-foil { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.pk-luck-text strong.pop { animation: pk-luck-text-pop 0.35s ease-out; }
@keyframes pk-luck-text-pop { 0% { transform: translateY(4px) scale(0.96); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
.pk-reveal { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--border-color); background: var(--bg-secondary); }
.pk-reveal button { font: inherit; font-size: 0.8125rem; font-weight: 600; padding: 0.4rem 0.9rem; border: 0; border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; transition: background 0.2s, color 0.2s; }
.pk-reveal button[aria-pressed="true"] { background: var(--bg-hover, rgba(255, 255, 255, 0.08)); color: var(--text-primary); }
@media (prefers-reduced-motion: reduce) {
    .pk-luck-bubble, .pk-luck input[type="range"] { transition: none; }
    .pk-luck-bubble.pop, .pk-luck-text strong.pop, .pk-luck[data-level="6"] .pk-luck-bubble, .pk-luck[data-level="6"] input[type="range"], .pk-luck[data-level="6"] .pk-luck-text strong { animation: none; }
}

/* Opening straight into a view (app.blade.php sets data-boot-view; main.js clears it once the view is up) */
html[data-boot-view] #home-section { display: none !important; }
html[data-boot-view="packs"] #pack-section { display: block !important; }
.pk-shared-loading { display: none; }
html[data-boot-pack] .pk-shared-loading { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 6rem 1rem; color: var(--text-muted); }
html[data-boot-pack] #pk-pick { display: none; }


/* God pack selected: a quiet note under the sets that really have god packs */
.pk-god-badge { display: none; margin-top: -0.35rem; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #d4b06a; }
.pk-shelf.god-mode .pk-god-badge { display: block; }

/* Explore → Connecting cards: kinds in order, or one kind (connections.js) */
.connections-filter { margin: 0 0 1.5rem; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.connections-filter::-webkit-scrollbar { display: none; }
.connections-filter .grid-btn { flex: none; white-space: nowrap; }
.connections-kind + .connections-kind { margin-top: 2.5rem; }
.connections-kind-title { font-size: 1.125rem; font-weight: 800; margin: 0 0 0.2rem; }
.connections-kind-title span { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); margin-left: 0.35rem; }
.connections-kind-about { color: var(--text-muted); font-size: 0.875rem; margin: 0 0 1rem; }

/* A card's other-language version: one quiet row under the price chart (prices.js) */
.modal-version:empty { display: none; }
.modal-version .price-version { margin: 0.75rem 0 0; } /* under Wishlist / Collection / List */
.price-version { display: flex; align-items: center; gap: 0.75rem; width: 100%; margin: 0 0 1rem; padding: 0.75rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-secondary); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s; }
.price-version:hover { border-color: var(--accent); }
.price-version-name { font-weight: 600; font-size: 0.875rem; }
.price-version-price { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-version.cheaper .price-version-name { color: #4ade80; }
.price-version.cheaper { border-color: rgba(74, 222, 128, 0.35); }
.price-version-go { display: inline-block; margin-left: 0.15rem; font-size: 1.1rem; line-height: 1; transition: transform 0.15s; } /* right after the words: it reads as a link */
.price-version:hover .price-version-go { transform: translateX(2px); }
.card-load-error { padding: 1.25rem 0; color: var(--text-secondary); font-size: 0.875rem; }
.card-load-error button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Tags: the era switch shows only when a tag has both modern and vintage cards */
#tags-era[hidden] { display: none; }

/* Cards filtered to one set: its chase cards page */
.set-chase-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--transition), color var(--transition);
}
.set-chase-link:hover { border-color: var(--accent); color: var(--accent); }
.set-chase-link[hidden] { display: none; }
a.pk-chase-link { text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }

/* ==========================================
   Profiles (profile.js): pictures, /user/name, the profile dialog
   ========================================== */
.avatar {
    --avatar: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--avatar);
    color: #fff;
    font-weight: 800;
    line-height: 1;
    user-select: none;
}
.avatar-xs { width: 18px; height: 18px; font-size: 0.65rem; }
.avatar-sm { width: 22px; height: 22px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 2.4rem; }

.list-card-by {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    align-self: flex-start;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
}
.list-card-by:hover { color: var(--text-primary); }

.profile-dialog {
    margin: auto; /* centered (the reset sets margin: 0) */
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.profile-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.profile-form { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; }
.profile-form h2 { margin: 0; font-size: 1.25rem; }
.profile-form-preview { display: flex; align-items: center; gap: 0.9rem; }
.profile-form-url { color: var(--text-secondary); font-size: 0.85rem; overflow-wrap: anywhere; }
.profile-field { display: flex; flex-direction: column; gap: 0.4rem; border: 0; margin: 0; padding: 0; font-weight: 600; font-size: 0.9rem; }
.profile-field legend { padding: 0; margin-bottom: 0.4rem; }
.profile-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    padding: 0 0.75rem;
}
.profile-input-wrap:focus-within { border-color: var(--accent); }
.profile-at { color: var(--text-secondary); }
.profile-input-wrap input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-weight: 500;
    padding: 0.6rem 0.15rem;
    outline: none;
}
.profile-input-wrap input:disabled { color: var(--text-secondary); }
.profile-hint { font-weight: 400; font-size: 0.8rem; color: var(--text-secondary); }
.profile-hint[data-state="error"] { color: #ef4444; }
.profile-hint[data-state="ok"] { color: #22c55e; }
.profile-colors { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.profile-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--avatar);
    box-shadow: inset 0 0 0 2px var(--bg-secondary);
    cursor: pointer;
}
.profile-color.active { border-color: var(--text-primary); }
.profile-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.profile-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.profile-note { margin: -0.4rem 0 0; color: var(--text-secondary); font-size: 0.8rem; }
.profile-form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.25rem; }
.profile-cancel, .profile-save {
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: none;
    color: var(--text-primary);
}
.profile-save { background: var(--accent); border-color: var(--accent); color: #fff; }
.profile-save:disabled { opacity: 0.6; cursor: default; }
.profile-edit-btn[hidden] { display: none; }

/* ==========================================
   Chase cards (chase.js): a set's most valuable cards
   ========================================== */
.chase-container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.chase-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.chase-back:hover { color: var(--text-primary); }
.chase-title { font-size: 2rem; font-weight: 800; margin: 0 0 0.35rem; }
.chase-intro { color: var(--text-secondary); margin: 0 0 1.75rem; }
.chase-tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem 1rem;
}
.chase-tile { position: relative; display: flex; flex-direction: column; gap: 0.2rem; color: inherit; text-decoration: none; }
.chase-tile-art { display: block; border-radius: 10px; overflow: hidden; background: var(--bg-tertiary); aspect-ratio: 245 / 337; transition: transform 320ms cubic-bezier(0.3, 1.3, 0.5, 1), box-shadow 220ms ease; }
.chase-tile-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
    .chase-tile:hover .chase-tile-art { transform: translate3d(0, -3px, 0) scale(1.015); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }
}
.chase-tile-rank {
    position: absolute;
    top: -8px;
    left: -8px;
    z-index: 1;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
}
.chase-tile-name { margin-top: 0.45rem; font-weight: 600; }
.chase-tile-meta { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--text-secondary); font-size: 0.85rem; }
.chase-tile-price { color: #22c55e; font-weight: 600; }
.chase-others { margin-top: 3rem; }
.chase-others h2 { font-size: 1.15rem; margin: 0 0 0.9rem; }
.chase-others-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 600px) {
    .chase-title { font-size: 1.5rem; }
    .chase-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 0.75rem; }
}

/* Cards' first view: only the best art (search.js, isFeaturedBrowse) */
.cards-featured-note { margin: 0 0 1rem; color: var(--text-secondary); font-size: 0.9rem; }
.cards-featured-note[hidden] { display: none; }
.cards-featured-note button {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
}
.cards-featured-note button:hover { text-decoration: underline; }

/* About this card: each fact only as wide as it needs, side by side (wraps when a name is long) */
#modal-about { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; }
#modal-about .stat-cell[hidden] { display: none; }
#modal-about .stat-cell-wide { flex-basis: 100%; }

/* The vote buttons' tips sit on a wrapper (the buttons' ::after is their glow) */
.vote-tip { display: inline-flex; }
/* Tips near the right edge open leftwards, so they aren't cut off */
[data-tip][data-tip-end]::after { left: auto; right: 0; transform: translate(0, 3px); }
@media (hover: hover) { [data-tip][data-tip-end]:hover::after { transform: translate(0, 0); } }
[data-tip][data-tip-end]:focus-visible::after { transform: translate(0, 0); }

/* Home binder preview: chips under the pages to fill them from a tag, a Pokémon, a trainer or an artist */
.home-binder-visual { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; min-width: 0; }
.home-binder-visual .home-binder-spread { width: 100%; transition: opacity 200ms; }
.home-binder-spread.loading { opacity: 0.55; }
.home-binder-sources { display: flex; flex-wrap: nowrap; justify-content: safe center; align-items: center; gap: 0.35rem; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.home-binder-sources::-webkit-scrollbar { display: none; }
@media (max-width: 600px) { .home-binder-sources { justify-content: flex-start; } }
.home-binder-sources[hidden] { display: none; }
.hb-sources-label { color: var(--text-muted); font-size: 0.8rem; margin-right: 0.15rem; }
.hb-source {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}
.hb-source:hover { border-color: var(--accent); color: var(--text-primary); }
.hb-source[aria-pressed="true"] { border-color: var(--accent); color: var(--text-primary); background: var(--accent-subtle, rgba(157, 92, 255, 0.15)); }
.hb-source-icon { display: inline-flex; align-items: center; }
.hb-source-sprite { width: 22px; height: 22px; margin: -4px -2px; image-rendering: pixelated; object-fit: contain; }

/* Under "Latest set: …": when it came out */
.home-latest-date { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; color: var(--text-secondary); font-size: 0.85rem; }
.home-latest-date[hidden] { display: none; }

/* An empty collection or wishlist: ways to add cards */
.mycards-empty { max-width: 720px; margin: 2.5rem auto; text-align: center; }
.mycards-empty[hidden] { display: none; }
.mycards-empty h2 { font-size: 1.4rem; font-weight: 800; margin: 0 0 0.4rem; }
.mycards-empty > p { color: var(--text-secondary); margin: 0 0 1.5rem; }
.mycards-empty-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; text-align: left; }
.mycards-empty-action {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition);
}
.mycards-empty-action:hover { border-color: var(--accent); transform: translateY(-2px); }
.mycards-empty-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.mycards-empty-action strong { display: block; font-size: 0.95rem; }
.mycards-empty-action small { display: block; color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.15rem; }
@media (max-width: 600px) { .mycards-empty-actions { grid-template-columns: 1fr; } }

/* Binder planner: a set's logo on its suggestion chip and the chip over its cards */
.set-chip-logo { height: 16px; width: auto; max-width: 48px; object-fit: contain; flex-shrink: 0; }

/* The card tile's round + and ♡ buttons, inline in text ("Tap + on any card you own") */
.inline-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin: 0 0.15rem;
    border-radius: 50%;
    background: rgba(15, 15, 18, 0.82);
    border: 1px solid var(--border-color);
    vertical-align: middle;
    position: relative;
    top: -2px;
}
.inline-card-btn.collection { color: #86efac; font-size: 0.85rem; }
.inline-card-btn.wishlist { color: #fca5a5; }
.inline-card-btn .heart-icon { width: 11px; height: 11px; }

/* A real booster pack photo (packs.js, public/images/packs): the photo is the pack */
.pk-pack.pk-photo {
    aspect-ratio: auto;
    background: none;
    box-shadow: none;
    border-radius: 4px;
    overflow: hidden;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.5));
}
.pk-pack.pk-photo::after { display: none; }
/* One height for every pack, so the names line up; a narrower pack stays centered */
.pk-pack.pk-photo { height: 241px; width: 132px; display: flex; justify-content: center; border-radius: 0; overflow: visible; }
.pk-pack.pk-photo.pk-pack-big { height: auto; width: min(250px, 62vw); }
.pk-pack.pk-photo img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; border-radius: 4px; user-select: none; }
.pk-pack.pk-photo.pk-pack-big img { width: 100%; height: auto; }
.pk-photo-frame { position: relative; display: block; height: 100%; border-radius: 4px; overflow: hidden; }
.pk-pack.pk-photo.pk-pack-big .pk-photo-frame { height: auto; width: 100%; }
.pk-tile:hover .pk-pack.pk-photo { box-shadow: none; filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.6)); }

/* Pack reveal: "Next card", and a little hop on the top card when nothing has happened for a moment */
.pk-act.next { background: var(--accent); border-color: var(--accent); color: #fff; }
.pk-act.next svg { width: 15px; height: 15px; }
.pk-act.next:hover { filter: brightness(1.08); }
@keyframes pk-nudge {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    30% { translate: 10px -6px; rotate: 2.5deg; }
    55% { translate: -3px 0; rotate: -0.8deg; }
}
.pk-card.top.nudge { animation: pk-nudge 700ms cubic-bezier(0.3, 1.3, 0.5, 1) 2; }
@media (prefers-reduced-motion: reduce) { .pk-card.top.nudge { animation: none; } }

/* The real card back */
.pk-cardback {
    background: #1a2f5c url('/images/card-back.webp') center / cover no-repeat;
    border: 0;
}
.pk-cardback .pk-back-ball { display: none; }
.pk-cardback .pk-back-tap { display: none; } /* the hint under the card says it */

/* About this card: every value the same height, so the Pokémon chip (with its sprite)
   lines up with the artist and rarity chips and the plain date */
#modal-about { gap: 0.75rem 1.5rem; }
#modal-about .stat-cell-value { min-height: 32px; }
#modal-about .stat-chip { height: 32px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
#modal-about .stat-chip-pokemon { padding-left: 0.4rem; }
#modal-about .stat-chip-pokemon img, #modal-about .stat-chip-trainer .trainer-sprite { width: 26px; height: 26px; margin: 0; }
#modal-about .stat-plain { line-height: 32px; }
#modal-about #stat-trainer-cell { flex-basis: auto; } /* inline with the rest, like the Pokémon chip */
.swipe-filter-pills { flex-basis: 100%; display: flex; justify-content: center; gap: 0.5rem; } /* Rare and up, Full Art: their own line above the dropdowns */
.swipe-filters select { flex: 1 1 0; min-width: 0; } /* the three dropdowns share one row */

/* Home, Browse by what's in the art: the art, name, set and number, no price */
#home-tags-row .card-price { display: none; }

/* Binder Share menu: the public switches */
.share-menu-divider { height: 1px; background: var(--border-color); margin: 0.25rem 0; }
.share-public { display: flex; align-items: center; gap: 0.5rem; }
.share-public-check {
    width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
    border: 1.5px solid var(--text-muted);
}
.share-public[aria-pressed="true"] .share-public-check {
    border-color: #22c55e;
    background: #22c55e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.share-public[aria-pressed="true"] { color: var(--text-primary); }

/* Profile: public binders and pages, as a small page each */
.profile-binders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.25rem 1rem; }
.profile-binder { display: flex; flex-direction: column; gap: 0.3rem; color: inherit; text-decoration: none; }
.profile-binder-page {
    display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 4px;
    padding: 8px; border-radius: 10px; background: #141416; border: 1px solid var(--border-color);
    transition: transform 320ms cubic-bezier(0.3, 1.3, 0.5, 1), border-color var(--transition);
}
.profile-binder:hover .profile-binder-page { transform: translateY(-3px); border-color: var(--accent); }
.profile-binder-page img, .profile-binder-page i { display: block; width: 100%; aspect-ratio: 63 / 88; border-radius: 3px; object-fit: cover; }
.profile-binder-page i { background: rgba(255, 255, 255, 0.04); }
.profile-binder-name { font-weight: 600; margin-top: 0.35rem; }
.profile-binder-meta { color: var(--text-secondary); font-size: 0.85rem; }
.shared-binder-eyebrow a { display: inline-flex; align-items: center; gap: 0.3rem; color: inherit; font-weight: 600; text-decoration: none; }
.shared-binder-eyebrow a:hover { color: var(--accent); }
/* "Binder by @nick": plain words, not an all-caps label */
.shared-binder-eyebrow { text-transform: none; letter-spacing: 0; color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; }

/* Profile binder preview: the pockets placed on the grid, custom images spanning theirs */
.profile-binder-page { grid-auto-rows: auto; }
.profile-binder-page .profile-binder-michi { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; border-radius: 3px; }

/* ---- Profile page: cover band in their color, picture overlapping it, bio, Top 3, tabs with counts ---- */
.profile-container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.profile-header {
    /* Not the site header (the global header rule) */
    position: static; display: block; height: auto; padding: 0; background: none; border: 0; backdrop-filter: none;
    margin-bottom: 1.75rem;
}
.profile-cover {
    height: 132px;
    border-radius: var(--radius-lg);
    background-color: color-mix(in srgb, var(--avatar, var(--accent)) 30%, var(--bg-secondary));
    background-image: radial-gradient(color-mix(in srgb, var(--avatar, var(--accent)) 45%, transparent) 1.2px, transparent 1.3px);
    background-size: 18px 18px;
}
.profile-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 0 1.25rem; margin-top: -48px; }
.profile-head .avatar-xl { width: 104px; height: 104px; font-size: 2.8rem; box-shadow: 0 0 0 5px var(--bg-primary); flex-shrink: 0; }
.profile-actions { display: flex; gap: 0.5rem; flex-shrink: 0; padding-bottom: 0.25rem; }
.profile-titles { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.85rem 1.25rem 0; min-width: 0; }
.profile-name { font-size: 1.75rem; font-weight: 800; margin: 0; overflow-wrap: anywhere; line-height: 1.15; }
.profile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }
.profile-dot { opacity: 0.6; }
.profile-fav { display: inline-flex; align-items: center; gap: 0.3rem; color: inherit; text-decoration: none; }
.profile-fav:hover { color: var(--text-primary); }
.profile-fav .dex-sprite-box, .profile-fav .dex-sprite { margin: -6px 0; }
.profile-edit-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary);
    font: inherit; font-weight: 600; cursor: pointer;
    transition: border-color var(--transition), transform 220ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
.profile-edit-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.profile-edit-btn[hidden] { display: none; }

/* Top 3 */
.profile-showcase { margin: 0 0 2rem; padding: 0 1.25rem; }
.profile-showcase[hidden] { display: none; }
.profile-showcase-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.profile-showcase-head h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.profile-showcase-edit { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0.25rem; }
.profile-showcase-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 1rem; }
.profile-showcase-card {
    aspect-ratio: 63 / 88; padding: 0; border: 0; border-radius: 10px; background: var(--bg-secondary);
    overflow: hidden; cursor: pointer;
    transition: transform 320ms cubic-bezier(0.3, 1.3, 0.5, 1), box-shadow 320ms ease;
}
.profile-showcase-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-showcase-card:not(.empty):hover { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45); }
.profile-showcase-card.empty {
    display: grid; place-items: center; background: none; border: 2px dashed var(--border-color);
    color: var(--text-muted); font-size: 2rem; font-weight: 300;
}
.profile-showcase-card.empty:hover { border-color: var(--accent); color: var(--accent); }

/* Tabs: the counts are the tabs */
.profile-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-color); margin: 0 0 1.5rem; overflow-x: auto; scrollbar-width: none; }
.profile-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
    padding: 0.6rem 1.1rem 0.75rem; margin-bottom: -1px;
    background: none; border: 0; border-bottom: 2px solid transparent;
    color: var(--text-secondary); font: inherit; cursor: pointer; white-space: nowrap;
}
.profile-tab strong { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.profile-tab span { font-size: 0.85rem; font-weight: 600; }
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active { border-bottom-color: var(--accent); color: var(--text-primary); }
.profile-empty { color: var(--text-secondary); margin: 0; }
.profile-private-note { margin: 0 0 1rem; color: var(--text-secondary); font-size: 0.85rem; }
.profile-more { color: var(--text-secondary); font-size: 0.85rem; margin: 1.25rem 0 0; }
.profile-lists .list-card { text-decoration: none; }

@media (max-width: 600px) {
    .profile-cover { height: 96px; }
    .profile-head { padding: 0 0.75rem; margin-top: -36px; }
    .profile-head .avatar-xl { width: 76px; height: 76px; font-size: 2rem; box-shadow: 0 0 0 4px var(--bg-primary); }
    .profile-edit-btn { padding: 0.45rem 0.8rem; font-size: 0.85rem; }
    .profile-titles, .profile-showcase { padding-left: 0.75rem; padding-right: 0.75rem; }
    .profile-name { font-size: 1.4rem; }
    .profile-showcase-cards { gap: 0.6rem; }
    .profile-tab { padding: 0.5rem 0.8rem 0.65rem; }
}

/* Edit profile: a preview of the header up top */
.profile-form-preview { padding: 0.9rem; border-radius: var(--radius); background: var(--bg-primary); border: 1px solid var(--border-color); }
.profile-form-who { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.profile-form-who strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.profile-form-bio { font-size: 0.85rem; color: var(--text-secondary); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.profile-form-bio:empty { display: none; }
.profile-field-row { display: flex; justify-content: space-between; align-items: baseline; }
.profile-counter { font-weight: 400; font-size: 0.8rem; color: var(--text-muted); }
.profile-textarea {
    resize: none; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-primary);
    color: var(--text-primary); font: inherit; font-weight: 500; padding: 0.6rem 0.75rem; line-height: 1.45;
}
.profile-textarea:focus { outline: none; border-color: var(--accent); }
.profile-hint[hidden] { display: none; }
.profile-fav-sprite { display: inline-flex; width: 0; transition: width 160ms ease; }
.profile-fav-sprite:not(:empty) { width: 28px; }
.profile-dialog { max-height: calc(100vh - 32px); overflow-y: auto; }

/* Top 3 picker */
.showcase-dialog { width: min(640px, calc(100vw - 32px)); }
.showcase-note { margin: -0.4rem 0 0; }
.showcase-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem; max-height: 55vh; overflow-y: auto; padding: 4px; }
.showcase-choice { position: relative; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.showcase-choice img { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: cover; border-radius: 6px; transition: opacity 160ms ease; }
.showcase-choice[aria-pressed="true"] img { outline: 3px solid var(--accent); outline-offset: 2px; }
.showcase-badge {
    position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 0.8rem;
    transform: scale(0); transition: transform 260ms cubic-bezier(0.3, 1.5, 0.5, 1);
}
.showcase-choice[aria-pressed="true"] .showcase-badge { transform: scale(1); }
#profile-body { padding: 0 1.25rem; }
@media (max-width: 600px) { #profile-body { padding: 0 0.75rem; } }

/* Profile picks: trainer sprite and set logo beside the name */
.profile-meta { row-gap: 0.35rem; }
.profile-trainer-sprite { width: 30px; height: 30px; object-fit: contain; margin: -6px 0; image-rendering: pixelated; }
.profile-set-logo-img { height: 20px; max-width: 64px; object-fit: contain; }
.profile-fav-sprite img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.profile-set-logo:not(:empty) { width: 52px; margin-right: 0.35rem; }
.profile-set-logo img { width: 52px; height: 22px; image-rendering: auto; }

/* Profile picks as the card page's chips */
.profile-meta { gap: 0.45rem; margin-top: 0.15rem; }
.profile-meta .stat-chip { text-decoration: none; }
a.stat-chip:hover { border-color: var(--accent); color: var(--accent); }
.profile-meta .stat-chip-pokemon img, .profile-meta .stat-chip-trainer .trainer-sprite { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.profile-meta .stat-chip-pokemon { padding-left: 0.4rem; }
.profile-joined { color: var(--text-secondary); font-size: 0.875rem; margin-left: 0.25rem; }
.profile-meta .stat-chip { min-height: 38px; }

/* Profile picks: equal tiles (label over the pick), sprites in the same square */
.profile-meta { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.profile-picks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.profile-pick {
    display: inline-flex; align-items: center; gap: 0.6rem;
    height: 52px; padding: 0 1rem 0 0.5rem; min-width: 150px;
    border: 1px solid var(--border-color); border-radius: var(--radius);
    background: var(--bg-secondary); color: var(--text-primary);
    font: inherit; text-align: left; text-decoration: none; cursor: pointer;
    transition: border-color var(--transition), transform 220ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
.profile-pick.no-icon { padding-left: 1rem; }
.profile-pick:hover { border-color: var(--accent); transform: translateY(-2px); }
.profile-pick-icon {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 8px; background: var(--bg-tertiary);
    display: grid; place-items: center; overflow: hidden; font-weight: 800; color: var(--text-secondary);
}
.profile-pick-icon > img { max-width: 34px; max-height: 34px; object-fit: contain; image-rendering: pixelated; }
.profile-pick-icon .dex-sprite-box { position: relative; }
.profile-pick-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.profile-pick-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.profile-pick-value { font-size: 0.92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-joined { margin-left: 0; font-size: 0.85rem; }
@media (max-width: 600px) {
    .profile-picks { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .profile-pick { min-width: 0; }
}

/* A pick tinted with its sprite's color (SpriteColor): very subtle */
.profile-pick.tinted {
    background: color-mix(in srgb, var(--pick) 18%, var(--bg-secondary));
    border-color: color-mix(in srgb, var(--pick) 32%, var(--border-color));
}
.profile-pick.tinted .profile-pick-icon { background: color-mix(in srgb, var(--pick) 22%, var(--bg-tertiary)); }
.profile-pick.tinted:hover { border-color: color-mix(in srgb, var(--pick) 70%, var(--border-color)); }

/* Profile: Currently hunting and badges, under the picks */
.profile-hunting { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.profile-row-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.profile-hunt-row, .profile-hunt-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.hunt-chip { min-height: 34px; text-decoration: none; }
.hunt-chip .dex-sprite-box { margin: -4px -2px -4px -4px; }
.hunt-chip .hunt-trainer { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; margin: -4px -2px; }
.hunt-chip-x { margin: 0 -0.25rem 0 0.15rem; background: none; border: 0; color: var(--text-muted); font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
.hunt-chip-x:hover { color: var(--text-primary); }
.profile-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.profile-badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.3rem 0.7rem 0.3rem 0.45rem; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border-color));
    font-size: 0.8rem; font-weight: 600; color: var(--text-primary); cursor: default;
}
.profile-badge-emoji { font-size: 0.95rem; line-height: 1; }
.profile-badge.locked { background: none; border-style: dashed; border-color: var(--border-color); color: var(--text-muted); }
.profile-badge.locked .profile-badge-emoji { filter: grayscale(1); opacity: 0.55; }

/* Top 3: the grail */
.profile-showcase-slot { position: relative; }
.profile-showcase-slot .profile-showcase-card { width: 100%; }
.profile-showcase-card.is-grail { box-shadow: 0 0 0 2px #e8c260, 0 10px 28px rgba(232, 194, 96, 0.18); }
.grail-pill {
    position: absolute; top: -11px; left: 50%; translate: -50% 0; z-index: 2;
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.22rem 0.65rem 0.22rem 0.5rem; border-radius: 999px;
    background: #1d1a12; border: 1px solid #e8c260; color: #f3d98b;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.grail-pill svg { width: 12px; height: 12px; fill: #e8c260; }
.showcase-grail {
    position: absolute; bottom: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); cursor: pointer;
}
.showcase-grail svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2; }
.showcase-choice.is-grail .showcase-grail { background: #1d1a12; box-shadow: 0 0 0 1.5px #e8c260; }
.showcase-choice.is-grail .showcase-grail svg { fill: #e8c260; stroke: #e8c260; }
.showcase-choice.is-grail img { outline-color: #e8c260; }

/* Edit profile: the picks two across, a wider dialog */
#profile-dialog { width: min(600px, calc(100vw - 32px)); }
.profile-picks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem 0.75rem; }
.profile-select {
    border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-primary);
    color: var(--text-primary); font: inherit; font-weight: 500; padding: 0.6rem 0.65rem; height: 42px;
}
.profile-select:focus { outline: none; border-color: var(--accent); }
.profile-input-wrap input { min-height: 40px; }
@media (max-width: 520px) { .profile-picks-grid { grid-template-columns: 1fr; } }
.profile-joined { order: 0; }

/* Profile tiles: all the same (label over the pick); sprites inline before the name */
.profile-pick, .profile-pick.no-icon { padding: 0 1rem; height: 54px; }
.profile-pick-value { display: flex; align-items: center; gap: 0.35rem; }
.profile-pick-sprite { display: inline-flex; width: 24px; height: 24px; flex-shrink: 0; align-items: center; justify-content: center; margin: -4px 0; }
.profile-pick-sprite > img { max-width: 24px; max-height: 24px; object-fit: contain; image-rendering: pixelated; }

/* Currently hunting: round pills, so they read as things to browse, not facts */
.hunt-pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    height: 34px; padding: 0 0.9rem 0 0.6rem; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-secondary);
    color: var(--text-primary); font: inherit; font-size: 0.82rem; font-weight: 600;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: border-color var(--transition), transform 220ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
a.hunt-pill:hover, button.hunt-pill:hover { border-color: var(--accent); transform: translateY(-1px); }
.hunt-pill .dex-sprite-box { margin: -4px -2px -4px -4px; }
.hunt-pill .hunt-trainer { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; margin: -4px -2px; }
span.hunt-pill { cursor: default; padding-right: 0.45rem; }

/* Badges: their own section under the Top 3 */
.profile-badges-section .profile-badges { margin-top: 0; gap: 0.5rem; }
.profile-badges-section .profile-badge { padding: 0.4rem 0.85rem 0.4rem 0.55rem; font-size: 0.85rem; }
.profile-badges-section .profile-count { font-weight: 500; }

/* Picks: no tinted tiles; the sprite's color glows softly behind it instead */
.profile-pick.tinted, .profile-pick.has-color { background: var(--bg-secondary); border-color: var(--border-color); }
.profile-pick.has-color .profile-pick-sprite {
    border-radius: 50%; width: 28px; height: 28px; margin: -6px 0 -6px -2px;
    background: radial-gradient(circle, color-mix(in srgb, var(--pick) 55%, transparent) 0%, color-mix(in srgb, var(--pick) 18%, transparent) 60%, transparent 72%);
}
.profile-pick.has-color:hover { border-color: color-mix(in srgb, var(--pick) 70%, var(--border-color)); }

/* Picks: the sprite's color as a thin stripe down the tile's left edge (works for any sprite shape) */
.profile-pick.has-color .profile-pick-sprite { background: none; width: 24px; height: 24px; margin: -4px 0; border-radius: 0; }
.profile-pick.has-color { position: relative; overflow: hidden; }
.profile-pick.has-color::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: color-mix(in srgb, var(--pick) 85%, white);
}

/* Badge tooltip: what you did, or how to earn it (hover, keyboard focus, or tap on phones) */
.profile-badge { position: relative; cursor: help; outline: none; }
.profile-badge:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.badge-tip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 20;
    display: flex; flex-direction: column; gap: 0.15rem;
    width: max-content; max-width: 220px; padding: 0.55rem 0.75rem;
    border-radius: var(--radius); background: var(--bg-tertiary); border: 1px solid var(--border-light, var(--border-color));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    color: var(--text-primary); font-size: 0.8rem; font-weight: 500; line-height: 1.35; text-align: left; white-space: normal;
    opacity: 0; translate: -50% 4px; pointer-events: none;
    transition: opacity 140ms ease, translate 180ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
.badge-tip strong { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); }
.profile-badge:not(.locked) .badge-tip strong { color: var(--accent); }
.badge-tip::after {
    content: ''; position: absolute; top: 100%; left: 50%; translate: -50% 0;
    border: 6px solid transparent; border-top-color: var(--bg-tertiary);
}
.profile-badge:hover .badge-tip, .profile-badge:focus .badge-tip { opacity: 1; translate: -50% 0; }
.profile-badge.locked .badge-tip { color: var(--text-primary); }

/* The grail keeps its gold ring while it lifts on hover */
.profile-showcase-card.is-grail:hover { box-shadow: 0 0 0 2px #e8c260, 0 18px 30px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(232, 194, 96, 0.22); }

/* A picture that's a sprite: the Pokémon or trainer on their color */
.avatar.has-sprite { overflow: hidden; }
.avatar-sprite { width: 125%; height: 125%; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.avatar-sprite.is-trainer { width: 150%; height: 150%; object-position: 50% 20%; translate: 0 18%; }
.avatar-xs .avatar-sprite, .avatar-sm .avatar-sprite { image-rendering: auto; }

/* Edit profile: the three picture choices */
.profile-styles { display: flex; gap: 0.6rem; }
.profile-style {
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem; flex: 1;
    padding: 0.6rem 0.4rem; border-radius: var(--radius); border: 1px solid var(--border-color);
    background: var(--bg-primary); color: var(--text-secondary); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.profile-style[aria-checked="true"] { border-color: var(--accent); color: var(--text-primary); box-shadow: 0 0 0 1px var(--accent); }
.profile-style.missing .avatar { opacity: 0.45; }

.avatar.has-sprite { position: relative; }

/* Edit profile: our own suggestions under a field */
.profile-input-wrap { position: relative; }
.profile-suggest {
    position: absolute; top: calc(100% + 4px); left: -1px; right: -1px; z-index: 30;
    max-height: 264px; overflow-y: auto; padding: 4px;
    border: 1px solid var(--border-light, var(--border-color)); border-radius: var(--radius);
    background: var(--bg-secondary); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
}
.profile-suggest[hidden] { display: none; }
.profile-suggest-item {
    display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 38px;
    padding: 0.35rem 0.6rem; border: 0; border-radius: var(--radius-sm); background: none;
    color: var(--text-primary); font: inherit; font-size: 0.88rem; font-weight: 500; text-align: left; cursor: pointer;
}
.profile-suggest-item.active, .profile-suggest-item:hover { background: var(--bg-tertiary); }
.profile-suggest-kind { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.profile-suggest-empty { margin: 0; padding: 0.5rem 0.6rem; color: var(--text-muted); font-size: 0.85rem; }
.suggest-trainer { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.suggest-emoji { width: 26px; text-align: center; }
.profile-dialog { overflow: visible; }
.profile-form { max-height: calc(100vh - 32px); overflow-y: auto; }

/* Initials: dark on light colors (avatarInk) */
.avatar { color: var(--avatar-ink, #fff); }
/* The color picker swatch: a rainbow ring until a color is picked */
.profile-color-custom { position: relative; display: grid; place-items: center; overflow: hidden;
    background: conic-gradient(#f3c4d3, #f2e5a6, #c3e6cb, #bcd6f0, #d5c8f2, #f3c4d3); color: #1c1b22; font-weight: 700; font-size: 1rem; }
.profile-color-custom.picked { background: var(--avatar); }
.profile-color-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

/* Staff pill by the name */
.profile-name-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.staff-pill {
    display: inline-flex; align-items: center; height: 22px; padding: 0 0.6rem; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 18%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    color: color-mix(in srgb, var(--accent) 60%, white); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
}
.staff-pill[hidden] { display: none; }

/* Follow */
.profile-follow-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.profile-follow-btn:hover { filter: brightness(1.08); border-color: var(--accent); }
.profile-follow-btn.is-following { background: var(--bg-secondary); border-color: var(--border-color); color: var(--text-primary); }
.profile-follow-btn[hidden] { display: none; }
.profile-count-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.profile-count-link strong { color: var(--text-primary); font-weight: 700; }
.profile-count-link:hover strong { text-decoration: underline; }

/* Followers / following list */
.people-dialog { width: min(420px, calc(100vw - 32px)); }
.people-head { display: flex; align-items: center; justify-content: space-between; }
.people-close { background: none; border: 0; color: var(--text-secondary); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.people-list { display: flex; flex-direction: column; gap: 0.25rem; max-height: 60vh; overflow-y: auto; }
.people-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: var(--radius); color: var(--text-primary); font-weight: 600; text-decoration: none; }
.people-row:hover { background: var(--bg-tertiary); }
.people-row .avatar-lg { width: 40px; height: 40px; font-size: 1.1rem; }

/* Notifications */
.notif-list { display: flex; flex-direction: column; max-width: 680px; }
.notif-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 0.5rem; border-bottom: 1px solid var(--border-color); }
.notif-row.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: var(--radius); }
.notif-row .avatar-lg { width: 42px; height: 42px; font-size: 1.1rem; flex-shrink: 0; }
.notif-anon { --avatar: var(--bg-tertiary); color: var(--text-secondary); font-size: 0.9rem; }
.notif-text { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; font-size: 0.92rem; }
.notif-text a { color: var(--text-primary); font-weight: 700; text-decoration: none; }
.notif-text a:hover { text-decoration: underline; }
.notif-time { color: var(--text-muted); font-size: 0.8rem; }
.notif-action { padding: 0.35rem 0.85rem; font-size: 0.85rem; text-decoration: none; }

/* Something new: a dot on the account button, a count in its menu */
.user-btn { position: relative; }
.user-btn.has-dot::after {
    content: ''; position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%;
    background: #ef6b6b; box-shadow: 0 0 0 2px var(--bg-primary);
}
.popover-new { margin-left: 0.35rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: #ef6b6b; color: #fff; font-size: 0.7rem; font-weight: 700; }
/* Staff pill: lined up with the middle of the lowercase letters (the line box sits higher, for capitals) */
.profile-name-row .staff-pill { position: relative; top: 3px; }
/* Edit profile: the two "show my…" boxes and their note, together */
.profile-toggles { display: flex; flex-direction: column; gap: 0.55rem; }
.profile-toggles .profile-note { margin: 0.1rem 0 0; }

/* Notifications panel (from the account menu) */
.notif-dialog { width: min(460px, calc(100vw - 32px)); }
.notif-panel { max-height: 65vh; overflow-y: auto; }
.notif-panel .notif-list { max-width: none; }
.notif-panel .profile-empty { padding: 0.5rem 0 0.25rem; }
#popover-notifications-btn .popover-new { margin-left: auto; }

/* Notifications panel: the upvotes switch, and Mute per list */
.notif-setting { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.5rem 0.9rem; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.notif-switch {
    appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--bg-tertiary); border: 1px solid var(--border-color);
    position: relative; cursor: pointer; transition: background var(--transition); flex-shrink: 0; margin: 0;
}
.notif-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
    transition: translate 220ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
.notif-switch:checked { background: var(--accent); border-color: var(--accent); }
.notif-switch:checked::after { translate: 16px 0; }
.notif-mute { background: none; border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-secondary); font: inherit; font-size: 0.78rem; font-weight: 600; padding: 0.25rem 0.7rem; cursor: pointer; flex-shrink: 0; }
.notif-mute:hover { color: var(--text-primary); border-color: var(--border-light, var(--border-color)); }
.notif-mute[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* Vote pill: the card page's (arrow inset in a rounded box, a soft tint when voted, no glow).
   Lists and binders are upvote-only: ↑ and the count. */
.vote-pill {
    display: inline-flex; align-items: center; gap: 0.125rem; height: 38px; padding: 0 0.55rem 0 4px;
    background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius);
}
.vote-pill .vote-btn {
    width: 30px; height: 30px; border: none; border-radius: calc(var(--radius) - 4px); background: transparent; box-shadow: none;
}
.vote-pill .vote-btn::after { display: none; }
.vote-pill .vote-btn:focus { outline: none; }
.vote-pill .vote-btn:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.vote-pill .vote-btn:hover { background: var(--bg-hover); border: none; }
.vote-pill .vote-btn.upvote.active { background: rgba(34, 197, 94, 0.14); box-shadow: none; color: #22c55e; }
.vote-pill .vote-btn:disabled { opacity: 0.45; cursor: default; background: transparent; }
.vote-pill .vote-score { min-width: 1.25rem; text-align: center; font-size: 0.875rem; font-weight: 700; }
.vote-pill-sm { height: 32px; }
.vote-pill-sm .vote-btn { width: 26px; height: 26px; }
.list-card-foot { display: flex; justify-content: flex-start; margin-top: 0.35rem; }

/* Vote pill: fully round, with a round arrow inside (matching curves) */
.vote-pill { border-radius: 999px; padding: 0 0.7rem 0 3px; }
.vote-pill .vote-btn { border-radius: 50%; }
.vote-pill-sm { height: 30px; }
.vote-pill-sm .vote-btn { width: 24px; height: 24px; }
/* On a Discover list card it sits top right */
.list-card { position: relative; }
.list-card-foot { position: absolute; top: 0.75rem; right: 0.75rem; margin: 0; }
.list-card .list-card-name { padding-right: 4.5rem; }

/* The account button with your picture */
.user-btn.has-avatar { padding: 0; border: 0; background: none; overflow: visible; }
.user-btn.has-avatar:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }
.avatar-btn { width: 36px; height: 36px; font-size: 1rem; transition: box-shadow var(--transition); }

/* A slab on a profile: the grader and grade on the card, and a thin silver edge */
.card.is-slab .card-image { box-shadow: 0 0 0 2px #c9ced6, 0 6px 18px rgba(0, 0, 0, 0.35); border-radius: 10px; }
.slab-pill {
    position: absolute; top: 8px; left: 8px; z-index: 3;
    display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.55rem; border-radius: 999px;
    background: rgba(20, 20, 24, 0.82); border: 1px solid #c9ced6; color: #f1f3f6;
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em; backdrop-filter: blur(4px); pointer-events: none;
}
.slab-more { color: #a9b0bb; font-weight: 700; }

/* Profile, for visitors: make your own */
.profile-invite {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    margin: 0 1.25rem 2rem; padding: 1rem 1.25rem; border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--accent) 9%, var(--bg-secondary)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border-color));
}
.profile-invite[hidden] { display: none; }
.profile-invite .avatar-lg { flex-shrink: 0; }
.profile-invite-text { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 220px; }
.profile-invite-text strong { font-size: 1rem; }
.profile-invite-text span { color: var(--text-secondary); font-size: 0.88rem; }
.profile-invite-btn {
    padding: 0.6rem 1.15rem; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap;
    transition: transform 220ms cubic-bezier(0.3, 1.3, 0.5, 1), filter var(--transition);
}
.profile-invite-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.profile-invite-link { color: var(--text-secondary); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.profile-invite-link:hover { color: var(--text-primary); }
@media (max-width: 600px) { .profile-invite { margin: 0 0.75rem 1.5rem; } }

/* Profile sections, one under the other (the counts at the top jump to them) */
#profile-body .profile-block { margin-bottom: 2.75rem; scroll-margin-top: 80px; }
#profile-body .profile-block h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 1rem; }

.profile-show-all { margin-top: 1.25rem; }

/* Rearrange binder pages: wiggling thumbnails you drag into order */
.rearrange-dialog { width: min(760px, calc(100vw - 32px)); }
.rearrange-dialog .people-head { gap: 1rem; }
.rearrange-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 1rem 0.85rem; max-height: 62vh; overflow-y: auto; padding: 8px 4px; }
.rearrange-page { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; cursor: grab; user-select: none; touch-action: none; }
.rearrange-pocket-grid {
    display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 3px; width: 100%; padding: 6px;
    border-radius: 8px; background: var(--binder-color, #18181b); border: 1px solid var(--border-color);
    animation: rearrange-wiggle 0.32s ease-in-out infinite alternate; animation-delay: var(--wiggle-delay, 0s);
}
.rearrange-pocket-grid img, .rearrange-pocket-grid i { display: block; width: 100%; aspect-ratio: 63 / 88; border-radius: 2px; object-fit: cover; }
.rearrange-pocket-grid i { background: rgba(255, 255, 255, 0.05); }
.rearrange-num { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
@keyframes rearrange-wiggle { from { rotate: -1.1deg; } to { rotate: 1.1deg; } }
.rearrange-chosen .rearrange-pocket-grid { animation: none; box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(0, 0, 0, 0.5); scale: 1.04; }
.rearrange-ghost { opacity: 0.35; }
.rearrange-ghost .rearrange-pocket-grid { animation: none; border-style: dashed; }
@media (prefers-reduced-motion: reduce) { .rearrange-pocket-grid { animation: none; } }

/* Profile: placeholder cards while the real ones load (a soft shimmer) */
html[data-boot-view="profile"] #profile-section { display: block !important; }
.profile-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1.25rem; }
.profile-skeleton i {
    display: block; aspect-ratio: 63 / 88; border-radius: 10px;
    background: linear-gradient(100deg, var(--bg-secondary) 40%, var(--bg-tertiary) 50%, var(--bg-secondary) 60%) 0 0 / 300% 100%;
    animation: profile-shimmer 1.4s ease-in-out infinite;
}
@keyframes profile-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .profile-skeleton i { animation: none; } }

/* Collected / Wishlist on a profile: one row until Show all, so binders and lists aren't buried */
.profile-cards.one-row { grid-template-rows: auto; grid-auto-rows: 0; row-gap: 0; overflow: hidden; }
.profile-cards.one-row > .card:nth-child(n) { margin-bottom: 0; }

/* Opening a page other than Home directly (data-boot-view): Home isn't lit up in the menu while it loads */
html[data-boot-view]:not([data-boot-view="home"]) .nav-btn.active[data-view="home"] { background: transparent; color: var(--text-secondary); }

/* Menu badges: hidden until their number is known (never a "0" that then jumps) */
#wishlist-count:empty, #collection-count:empty { display: none; }

/* Share a page: pick which of the two, name it, link and/or profile */
.share-page-dialog { width: min(480px, calc(100vw - 32px)); }
.share-page-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.share-page-choices[hidden] { display: none; }
.share-page-choice { padding: 6px; border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; color: inherit; font: inherit; }
.share-page-choice .rearrange-pocket-grid { animation: none; }
.share-page-choice[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.share-page-choice[aria-pressed="true"] .rearrange-num { color: var(--text-primary); }
.share-page-toggle { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0.7rem 0.85rem; }

/* Profile pictures (Top 3, binder and list previews): a soft placeholder until each loads,
   never the browser's broken-image "?" */
img.pv-img { opacity: 0; transition: opacity 200ms ease-in; background: var(--bg-tertiary); }
img.pv-img.loaded { opacity: 1; }
.profile-showcase-card, .profile-binder-page img, .list-card-previews img { background-color: var(--bg-tertiary); }

/* Binder: Matches (binder-match.js) — cards that look good in an empty pocket */
.source-tab-match span { color: var(--accent); transition: color var(--transition); }
.source-tab-match.active span { color: #fff; }
.match-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem; margin-bottom: 0.85rem; }
.match-where { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.95rem; flex: 1 1 auto; }
.match-spark { color: var(--accent); }
.match-scope { display: inline-flex; padding: 2px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--bg-tertiary); }
.match-scope button { padding: 0.25rem 0.7rem; border: 0; border-radius: 999px; background: none; color: var(--text-secondary); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.match-scope button[aria-pressed="true"] { background: var(--bg-primary); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.match-scope button:disabled { opacity: 0.45; cursor: default; }
.match-palette { display: flex; gap: 3px; width: 100%; height: 10px; }
.match-palette:empty { display: none; }
.match-swatch { flex: 1 1 0; min-width: 10px; border-radius: 999px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.match-intro { display: flex; gap: 0.6rem; padding: 1rem; border: 1px dashed var(--border-color); border-radius: 12px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }
.match-intro b { color: var(--text-primary); }
.match-intro .match-spark { font-size: 1.1rem; line-height: 1.3; }
.match-pending { margin: 0 0 0.6rem; color: var(--text-secondary); font-size: 0.8rem; }
.match-list { display: flex; flex-direction: column; gap: 0.5rem; }
.match-row {
    display: grid; grid-template-columns: 64px 1fr; gap: 0.75rem; align-items: start;
    padding: 0.6rem; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-secondary);
    cursor: pointer; text-align: left;
    animation: match-in 420ms cubic-bezier(0.3, 1.3, 0.5, 1) both; animation-delay: calc(var(--i) * 35ms);
    transition: border-color var(--transition), transform 240ms cubic-bezier(0.3, 1.3, 0.5, 1);
}
.match-row:hover, .match-row:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
@keyframes match-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .match-row { animation: none; } }
.match-row img { width: 64px; aspect-ratio: 63 / 88; border-radius: 4px; object-fit: cover; display: block; }
.match-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.match-title { display: flex; align-items: flex-start; gap: 0.5rem; }
.match-name { flex: 1; font-weight: 700; font-size: 0.9rem; line-height: 1.25; }
.match-score {
    flex-shrink: 0; min-width: 2.2rem; padding: 0.1rem 0.45rem; border-radius: 999px; text-align: center;
    border: 1.5px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 0.78rem; font-variant-numeric: tabular-nums;
}
.match-set { color: var(--text-secondary); font-size: 0.75rem; }
.match-reasons { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.match-reason { padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-secondary); font-size: 0.72rem; line-height: 1.4; }
.match-reason-connects, .match-reason-flow { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text-primary); }
.match-reason-artist, .match-reason-tag { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text-primary); }
.match-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.15rem; }
.match-put { padding: 0.3rem 0.8rem; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.match-put:hover { filter: brightness(1.08); }
.match-owned { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--text-secondary); font-size: 0.75rem; }
.match-owned svg { width: 12px; height: 12px; }
.match-ebay { color: var(--text-secondary); font-size: 0.75rem; text-decoration: underline; text-underline-offset: 2px; }
.match-ebay:hover { color: var(--accent); }
/* The hovered match, see-through in its pocket */
.binder-slot.match-ghosting { position: relative; }
.match-ghost {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
    opacity: 0.7; outline: 2px dashed var(--accent); outline-offset: -2px; pointer-events: none;
    animation: match-ghost-in 220ms ease-out;
}
@keyframes match-ghost-in { from { opacity: 0; transform: scale(0.96); } }

/* Tags review queue: the woahpoke helper's suggestions (ArtTagSuggester) */
.tags-review-import { border: 0; background: none; font: inherit; cursor: pointer; padding: 0; margin-right: 0.75rem; }
.tag-chip.from-helper { border-style: dashed; }
.helper-spark { color: var(--accent); margin-right: 0.25rem; }
.tags-review-all {
    padding: 0.2rem 0.65rem; border: 1px solid var(--accent); border-radius: 999px; background: none;
    color: var(--accent); font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer;
}
.tags-review-all:hover { background: var(--accent); color: #fff; }
.tags-review-row:has(.tags-review-why) { flex-wrap: wrap; }
.tags-review-why { flex-basis: 100%; margin: 0.35rem 0 0; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.45; }
.tags-review-why b { color: var(--text-primary); font-weight: 600; }

.match-trial { width: 100%; margin: 0; color: var(--text-secondary); font-size: 0.78rem; }

/* Profile: "12 others" hunting the same thing */
.hunt-with-others { display: inline-flex; align-items: center; gap: 0.3rem; }
.hunt-others {
    padding: 0.2rem 0.55rem; border: 1px solid var(--border-color); border-radius: 999px; background: none;
    color: var(--text-secondary); font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}
.hunt-others:hover { color: var(--accent); border-color: var(--accent); }

/* Home: Following feed (feed.js) */
.home-feed .feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.feed-item {
    padding: 0.8rem 0.9rem; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-secondary);
    animation: match-in 420ms cubic-bezier(0.3, 1.3, 0.5, 1) both; animation-delay: calc(var(--i) * 40ms);
}
@media (prefers-reduced-motion: reduce) { .feed-item { animation: none; } }
.feed-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.45rem; font-size: 0.92rem; }
.feed-who { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-primary); text-decoration: none; }
.feed-who:hover b { color: var(--accent); }
.feed-what { color: var(--text-secondary); }
.feed-what a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.feed-what a:hover { color: var(--accent); }
.feed-line time { margin-left: auto; color: var(--text-muted); font-size: 0.78rem; }
.feed-cards { display: flex; gap: 0.45rem; margin-top: 0.65rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.feed-cards::-webkit-scrollbar { display: none; }
.feed-card { flex: 0 0 auto; width: 74px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 5px; transition: transform 240ms cubic-bezier(0.3, 1.3, 0.5, 1); }
.feed-card:hover { transform: translateY(-3px); }
.feed-card i, .feed-card img { display: block; width: 100%; aspect-ratio: 63 / 88; border-radius: 5px; background: var(--bg-tertiary); object-fit: cover; }
.feed-card-more { flex: 0 0 auto; align-self: center; padding: 0 0.6rem; color: var(--text-secondary); font-weight: 700; font-size: 0.85rem; }
.feed-binder { display: block; max-width: 220px; margin-top: 0.65rem; color: inherit; }
.feed-binder:hover .profile-binder-page { border-color: var(--accent); }
.feed-empty { color: var(--text-secondary); font-size: 0.9rem; }
.feed-more { margin-top: 0.75rem; padding: 0.45rem 1rem; border: 1px solid var(--border-color); border-radius: 999px; background: none; color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; }
.feed-more:hover { border-color: var(--accent); color: var(--accent); }
.home-feed { margin-bottom: 2rem; }
