:root {
    color-scheme: dark;
    --guild: #1e1f22;
    --channels: #2b2d31;
    --content: #313338;
    --panel: #2b2d31;
    --panel-2: #232428;
    --card: #1e1f22;
    --hover: #35373c;
    --line: #3f4147;
    --text: #f2f3f5;
    --muted: #b5bac1;
    --subtle: #80848e;
    --brand: #5865f2;
    --green: #23a55a;
    --yellow: #f0b232;
    --pink: #eb459e;
    --danger: #f23f42;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.discord-shell {
    display: grid;
    grid-template-columns: 72px 250px minmax(0, 1fr);
    height: 100vh;
}

.guild-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    background: var(--guild);
}

.guild-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 0;
    border-radius: 16px;
    color: var(--text);
    background: var(--content);
    font-weight: 800;
    transition: border-radius .12s ease, background .12s ease;
}

.guild-icon:hover,
.guild-icon.active {
    border-radius: 14px;
    background: var(--brand);
}

.home-icon {
    background: var(--brand);
}

.rail-line {
    width: 32px;
    height: 2px;
    background: var(--line);
}

.channel-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    background: var(--channels);
}

.panel-header {
    display: grid;
    gap: 2px;
    padding: 14px 16px;
    border-bottom: 1px solid rgb(0 0 0 / 28%);
}

.panel-header span,
.source-card span,
.topbar p,
.stats-strip span,
.collectible-info p,
.category-body p,
.quest-body p,
.preview-header span,
.meta-line span,
.profile-body p {
    color: var(--muted);
}

.channel-list {
    display: grid;
    gap: 2px;
    padding: 10px 8px;
}

.channel {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    text-align: left;
    background: transparent;
}

.channel:hover {
    color: var(--text);
    background: var(--hover);
}

.channel.active {
    color: var(--text);
    background: #404249;
}

.channel span {
    color: var(--subtle);
    font-size: 20px;
    line-height: 1;
}

.source-card {
    display: grid;
    gap: 8px;
    margin: auto 10px 12px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--panel-2);
}

.source-card strong {
    font-size: 13px;
}

.source-card button,
.import-actions button,
.open-detail {
    min-height: 34px;
    border: 0;
    border-radius: 4px;
    color: var(--text);
    background: var(--brand);
}

.content {
    min-width: 0;
    overflow: auto;
    background: var(--content);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 12px 20px;
    border-bottom: 1px solid rgb(0 0 0 / 30%);
    background: rgb(49 51 56 / 96%);
    backdrop-filter: blur(10px);
}

.topbar h1 {
    margin: 0 0 2px;
    font-size: 18px;
    letter-spacing: 0;
}

.topbar p {
    margin: 0;
    font-size: 13px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.toolbar-actions input,
.toolbar-actions select {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    background: #1e1f22;
}

.toolbar-actions input {
    width: min(34vw, 360px);
    padding: 0 10px;
}

.toolbar-actions select {
    padding: 0 8px;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 20px 0;
}

.stats-strip div {
    padding: 12px;
    border-radius: var(--radius);
    background: var(--panel);
}

.stats-strip span,
.stats-strip strong {
    display: block;
}

.stats-strip strong {
    margin-top: 3px;
    font-size: 22px;
}

.shop-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    padding: 16px 20px 24px;
}

.shop-main {
    min-width: 0;
}

.hero-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(340px, 520px);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.hero-card {
    position: relative;
    min-height: 190px;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius);
    color: var(--text);
    background: var(--card);
    text-align: left;
}

.hero-card img,
.hero-card video {
    width: 100%;
    height: 100%;
    min-height: 190px;
    object-fit: cover;
    display: block;
}

.hero-card span {
    position: absolute;
    inset: auto 0 0;
    display: grid;
    gap: 3px;
    padding: 50px 16px 14px;
    background: linear-gradient(180deg, transparent, rgb(0 0 0 / 82%));
}

.hero-card small {
    color: var(--muted);
}

.product-grid,
.category-grid,
.quest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.collectible-card,
.category-card,
.quest-card {
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--panel);
}

.collectible-card.selected {
    border-color: var(--brand);
}

.collectible-button,
.category-button,
.quest-button {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
}

.collectible-button:hover,
.category-button:hover,
.quest-button:hover {
    background: var(--hover);
}

.collectible-media,
.category-media,
.quest-media {
    display: grid;
    min-height: 184px;
    place-items: center;
    background:
        linear-gradient(135deg, rgb(88 101 242 / 20%), transparent),
        radial-gradient(circle at 72% 24%, rgb(235 69 158 / 18%), transparent 35%),
        #1e1f22;
}

.collectible-media img,
.collectible-media video,
.category-media img,
.category-media video,
.quest-media img,
.quest-media video {
    width: 100%;
    max-height: 204px;
    object-fit: contain;
    display: block;
}

.collectible-info,
.category-body,
.quest-body {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.collectible-info h3,
.category-body h3,
.quest-body h3 {
    margin: 0 0 4px;
    overflow: hidden;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.collectible-info p,
.category-body p,
.quest-body p {
    min-height: 36px;
    margin: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 13px;
}

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

.pill {
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--muted);
    background: #232428;
    font-size: 12px;
}

.price {
    color: #b9f6c7;
    background: rgb(35 165 90 / 20%);
}

.owned {
    color: #ffe8a3;
    background: rgb(240 178 50 / 20%);
}

.preview-panel {
    position: sticky;
    top: 80px;
    align-self: start;
    display: grid;
    gap: 12px;
}

.preview-header {
    display: grid;
    gap: 3px;
}

.preview-header strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.profile-preview {
    min-height: 470px;
}

.profile-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #111214;
    box-shadow: 0 12px 40px rgb(0 0 0 / 32%);
}

.profile-banner {
    position: relative;
    height: 132px;
    overflow: hidden;
    background:
        linear-gradient(135deg, #5865f2 0%, #2b2d31 48%, #eb459e 100%);
}

.effect-layer {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .9;
}

.avatar-wrap {
    position: relative;
    width: 112px;
    height: 112px;
    margin: -52px 0 0 18px;
}

.avatar-core {
    position: absolute;
    inset: 18px;
    display: grid;
    place-items: center;
    border: 7px solid #111214;
    border-radius: 50%;
    background: linear-gradient(135deg, #5865f2, #23a55a);
    font-weight: 800;
    overflow: hidden;
}

.avatar-core img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-decoration {
    position: absolute;
    inset: -10px;
    width: 132px;
    height: 132px;
    object-fit: contain;
    pointer-events: none;
}

.status-dot {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 23px;
    height: 23px;
    border: 5px solid #111214;
    border-radius: 50%;
    background: var(--green);
}

.profile-body {
    display: grid;
    gap: 8px;
    padding: 8px 18px 18px;
}

.profile-body h2,
.profile-body p {
    margin: 0;
}

.nameplate {
    height: 38px;
    overflow: hidden;
    border-radius: 6px;
    background: #232428;
}

.nameplate img,
.nameplate video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-note {
    min-height: 76px;
    padding: 12px;
    border-radius: var(--radius);
    color: var(--muted);
    background: #1e1f22;
    font-size: 13px;
    line-height: 1.4;
}

.preview-meta {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--panel);
}

.meta-line {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    font-size: 13px;
}

.meta-line code,
.meta-row code {
    overflow-wrap: anywhere;
    color: var(--text);
}

.fallback-art {
    display: grid;
    width: 92px;
    height: 92px;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--green));
    font-size: 28px;
    font-weight: 800;
}

.import-panel {
    display: grid;
    gap: 12px;
    margin: 16px 20px 0;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--panel);
}

.import-panel h2,
.import-panel p {
    margin: 0;
}

.import-panel p {
    color: var(--muted);
}

.import-panel textarea {
    width: 100%;
    min-height: 240px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    background: #1e1f22;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.import-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.import-actions button {
    padding: 0 12px;
}

.empty-state {
    padding: 36px;
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--panel);
    text-align: center;
}

.detail-dialog {
    width: min(980px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--panel);
}

.detail-dialog::backdrop {
    background: rgb(0 0 0 / 72%);
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 4px;
    color: var(--text);
    background: rgb(30 31 34 / 86%);
    font-size: 24px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(280px, 42%) 1fr;
    max-height: calc(100vh - 28px);
    overflow: auto;
}

.detail-media {
    display: grid;
    min-height: 430px;
    place-items: center;
    background: #1e1f22;
}

.detail-media img,
.detail-media video {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
}

.detail-body {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 24px;
}

.detail-body h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.detail-body p {
    margin: 0;
    color: var(--muted);
}

.meta-table {
    display: grid;
    gap: 8px;
}

.meta-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.asset-list {
    display: grid;
    gap: 8px;
}

.asset-list a {
    overflow-wrap: anywhere;
    color: #9fb3ff;
}

.hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .discord-shell {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .channel-panel {
        display: none;
    }

    .shop-layout {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
    }
}

@media (max-width: 720px) {
    body {
        overflow: auto;
    }

    .discord-shell {
        display: block;
        height: auto;
    }

    .guild-rail {
        flex-direction: row;
        height: 64px;
    }

    .topbar,
    .toolbar-actions {
        display: grid;
    }

    .toolbar-actions input {
        width: 100%;
    }

    .stats-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .shop-layout,
    .stats-strip,
    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero-rail {
        grid-auto-columns: minmax(280px, 90vw);
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }
}
