:root {
    color-scheme: dark;
    --bg: #0f1315;
    --panel: #151b1e;
    --panel-soft: #1d2529;
    --line: rgba(239, 203, 128, 0.22);
    --text: #f6f0e5;
    --muted: rgba(246, 240, 229, 0.68);
    --gold: #e8b84f;
    --green: #76d17b;
    --blue: #63a7ff;
    --violet: #ba85ff;
    --red: #ff7474;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: end;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--gold);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(32px, 6vw, 62px);
    line-height: 0.95;
}

.topbar p:last-child {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.nav a,
.button-link {
    border: 1px solid rgba(246, 240, 229, 0.16);
    border-radius: 6px;
    padding: 8px 11px;
    background: rgba(21, 27, 30, 0.92);
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.nav a.active,
.nav a:hover,
.button-link:hover {
    border-color: var(--gold);
    color: var(--text);
}

.nav a.disabled,
.button-link.disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.primary-link {
    border-color: var(--gold);
    background: var(--gold);
    color: #11171b;
    font-weight: 800;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0;
}

.stat,
.panel,
.user-card,
.card,
.opening {
    border: 1px solid rgba(246, 240, 229, 0.12);
    border-radius: 8px;
    background: var(--panel);
}

.stat {
    padding: 14px;
}

.stat strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.stat span,
.muted {
    color: var(--muted);
}

.stat span {
    display: block;
    margin-top: 8px;
    font-size: 13px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    align-items: start;
}

.hero-panel,
.stream-panel,
.message-panel {
    margin-top: 18px;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    border: 1px solid rgba(246, 240, 229, 0.12);
    border-radius: 8px;
    padding: 22px;
    background: linear-gradient(135deg, rgba(29, 37, 41, 0.92), rgba(21, 27, 30, 0.92));
}

.hero-panel h2 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(26px, 4vw, 44px);
    line-height: 1.04;
}

.hero-panel p:last-child {
    max-width: 680px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.stream-panel {
    overflow: hidden;
    border: 1px solid rgba(246, 240, 229, 0.12);
    border-radius: 8px;
    background: #050707;
}

.stream-panel iframe {
    display: block;
    border: 0;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 340px;
}

.panel h2 {
    margin: 0;
    border-bottom: 1px solid rgba(246, 240, 229, 0.10);
    padding: 16px 18px;
    font-size: 18px;
}

.users,
.openings,
.cards {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.users {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.user-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    text-decoration: none;
}

.user-card strong {
    font-size: 18px;
}

.cards {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.collection-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 160px));
    gap: 10px;
    padding: 14px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
}

.profile-card,
.set-progress {
    border: 1px solid rgba(246, 240, 229, 0.12);
    border-radius: 8px;
    background: var(--panel-soft);
}

.profile-card {
    display: grid;
    gap: 8px;
    padding: 14px;
}

.profile-card strong {
    font-size: 30px;
    line-height: 1;
}

.profile-card span {
    color: var(--muted);
    font-size: 13px;
}

.progress {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: rgba(246, 240, 229, 0.10);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
}

.collection-section {
    border-top: 1px solid rgba(246, 240, 229, 0.10);
    padding: 16px 14px;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-heading h3 {
    margin: 0;
    font-size: 18px;
}

.set-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.set-progress {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 12px;
}

.set-progress.complete {
    border-color: rgba(232, 184, 79, 0.62);
}

.set-progress-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
}

.set-progress-head span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.set-slots {
    display: flex;
    gap: 7px;
    min-height: 62px;
}

.set-slot {
    display: grid;
    place-items: center;
    width: 42px;
    height: 62px;
    overflow: hidden;
    border: 1px solid rgba(246, 240, 229, 0.14);
    border-radius: 5px;
    background: #0c1012;
}

.set-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.set-slot.missing::after {
    content: "?";
    color: rgba(246, 240, 229, 0.38);
    font-weight: 800;
}

.rarity-progress {
    display: grid;
    gap: 9px;
}

.rarity-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) 58px;
    gap: 10px;
    align-items: center;
}

.rarity-row span {
    color: var(--muted);
}

.rarity-row strong {
    text-align: right;
}

.collection-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.collection-filters label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
}

.collection-filters select,
.collection-filters button {
    min-height: 38px;
    border: 1px solid rgba(246, 240, 229, 0.16);
    border-radius: 6px;
    padding: 7px 10px;
    background: #0f1315;
    color: var(--text);
}

.collection-filters button {
    border-color: var(--gold);
    background: var(--gold);
    color: #11171b;
    font-weight: 800;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding-top: 12px;
}

.card {
    position: relative;
    overflow: hidden;
    border-color: rgba(232, 184, 79, 0.24);
}

.card.rarity-uncommon { border-color: rgba(118, 209, 123, 0.58); }
.card.rarity-rare { border-color: rgba(99, 167, 255, 0.68); }
.card.rarity-epic { border-color: rgba(186, 133, 255, 0.72); }
.card.rarity-legendary { border-color: rgba(232, 184, 79, 0.95); }
.card.rarity-special { border-color: rgba(255, 116, 116, 0.88); }

.art {
    display: grid;
    place-items: center;
    aspect-ratio: 2 / 3;
    background: var(--panel-soft);
    color: rgba(246, 240, 229, 0.38);
    font-size: 42px;
    font-weight: 800;
}

.art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-body {
    display: grid;
    gap: 8px;
    padding: 11px;
}

.card h3,
.opening strong {
    margin: 0;
    font-size: 16px;
    line-height: 1.22;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    border: 1px solid rgba(246, 240, 229, 0.14);
    border-radius: 999px;
    padding: 4px 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
}

.quantity {
    position: absolute;
    top: 8px;
    right: 8px;
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(15, 19, 21, 0.88);
    color: var(--gold);
    font-weight: 800;
    font-size: 13px;
}

.desc {
    margin: 0;
    color: rgba(246, 240, 229, 0.78);
    font-size: 13px;
    line-height: 1.38;
}

.opening {
    display: grid;
    gap: 7px;
    padding: 12px;
}

.empty {
    padding: 24px;
    color: var(--muted);
}

@media (max-width: 860px) {
    .topbar,
    .layout,
    .stats,
    .hero-panel,
    .profile-grid,
    .collection-filters {
        grid-template-columns: 1fr;
    }

    .nav {
        justify-content: flex-start;
    }

    .hero-actions {
        justify-content: flex-start;
    }
}
