:root {
    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-strong: #0f172a;
    --text: #111827;
    --muted: #667085;
    --line: #dbe3ee;
    --primary: #2f9ee8;
    --primary-dark: #157fc4;
    --primary-soft: #eaf6ff;
    --blue: #1976d2;
    --amber: #c87800;
    --danger: #c43d3d;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        linear-gradient(90deg, rgba(219, 227, 238, 0.55) 1px, transparent 1px),
        linear-gradient(180deg, #ffffff 0, #ffffff 74px, var(--bg) 74px);
    background-size: 96px 100%, auto;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(16px, 4vw, 48px);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand,
.main-nav,
.button-row,
.meta-row,
.section-row,
.panel-header,
.seller-strip,
.tabs {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #ffffff;
    background: var(--surface-strong);
    border-radius: 8px;
    font-size: 13px;
}

.main-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 14px;
    color: #344054;
}

.main-nav a,
.link-button {
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.nav-action {
    padding: 9px 13px;
    color: #ffffff !important;
    background: var(--primary);
    border-radius: 8px;
}

.inline-form {
    margin: 0;
}

.link-button {
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

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

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px clamp(16px, 4vw, 48px);
    color: var(--muted);
    background: #ffffff;
    border-top: 1px solid var(--line);
}

.market-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: end;
    min-height: 220px;
    padding: 28px;
    color: var(--text);
    background:
        linear-gradient(135deg, #ffffff, #eef8ff),
        repeating-linear-gradient(90deg, rgba(47, 158, 232, 0.08) 0 1px, transparent 1px 22px);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.market-hero.compact {
    min-height: 210px;
}

.hero-product-logo {
    display: grid;
    width: 132px;
    aspect-ratio: 1 / 1;
    place-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.hero-product-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-hero h1,
.section-row h1,
.auth-panel h1,
.listing-detail h1,
.chat-summary h1,
.empty-state h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.08;
}

.market-hero .lede {
    max-width: 660px;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.market-hero .eyebrow {
    color: var(--primary);
}

.lede,
.muted,
small {
    color: var(--muted);
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h2 {
    margin: 0 0 14px;
    font-size: 22px;
}

.section-row {
    justify-content: space-between;
    gap: 20px;
    margin: 34px 0 18px;
}

.section-row h1,
.section-row h2 {
    margin: 0;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    text-align: center;
}

.button.primary {
    color: #ffffff;
    background: var(--primary);
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    color: var(--text);
    background: #ffffff;
    border-color: var(--line);
}

.button.danger {
    color: #ffffff;
    background: var(--danger);
}

.button-row {
    flex-wrap: wrap;
    gap: 10px;
}

.game-grid,
.listing-grid,
.stat-grid,
.soon-grid {
    display: grid;
    gap: 16px;
}

.game-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.game-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    min-height: 120px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.game-art {
    display: grid;
    height: 100%;
    min-height: 120px;
    place-items: center;
    color: #ffffff;
    background: #c43d3d;
    font-size: 30px;
    font-weight: 900;
}

.game-card-body {
    display: grid;
    gap: 6px;
    padding: 18px;
}

.coming-soon {
    margin-top: 36px;
    padding: 26px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.shop-front {
    display: grid;
    gap: 20px;
}

.shop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0 20px;
    border-bottom: 1px solid var(--line);
}

.shop-topbar h1 {
    margin: 0;
    font-size: 44px;
    line-height: 1.05;
    letter-spacing: 0;
}

.shop-topbar span {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.shop-topbar .button {
    flex: 0 0 auto;
}

.category-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    color: #344054;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
}

.category-chip.active {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 16px;
}

.shop-product-grid {
    padding-top: 4px;
}

.product-card {
    display: grid;
    gap: 12px;
    min-height: 248px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 24px rgba(47, 158, 232, 0.12);
    transform: translateY(-1px);
}

.product-card.disabled {
    opacity: 0.75;
}

.product-logo-wrap {
    display: grid;
    aspect-ratio: 1 / 1;
    place-items: center;
    background:
        linear-gradient(135deg, #f8fbff, #eaf6ff);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.product-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-body {
    display: grid;
    gap: 7px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.product-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.product-card-body small {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card-body strong {
    font-size: 18px;
    line-height: 1.25;
}

.product-card-body em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.admin-product-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.admin-product-logo {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #f1f5f9;
}

.soon-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-top: 16px;
}

.soon-grid span,
.meta-row span,
.seller-strip span,
.status-pill,
.verified-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    background: #edf2f7;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.listing-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.listing-card,
.panel,
.form-card,
.stat-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.listing-card {
    overflow: hidden;
}

.listing-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #d9e2ec;
}

.listing-thumb.placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
}

.listing-body {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.listing-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
}

.listing-title-row h2 {
    margin: 0;
    font-size: 18px;
}

.meta-row,
.seller-strip {
    flex-wrap: wrap;
    gap: 8px;
}

.price-line {
    margin: 10px 0 16px;
    color: var(--primary);
    font-size: 28px;
    font-weight: 900;
}

.listing-detail,
.chat-shell,
.form-grid,
.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 24px;
    align-items: start;
}

.listing-detail > div,
.chat-summary {
    min-width: 0;
}

.screenshot-panel {
    display: grid;
    gap: 12px;
}

.screenshot-panel img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #d9e2ec;
}

.seller-strip {
    margin: 22px 0;
}

.blue-tick {
    display: inline-grid;
    width: 20px;
    height: 20px;
    margin-left: 5px;
    place-items: center;
    color: #ffffff;
    background: var(--blue);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 900;
}

.verified-badge {
    color: #0b4778;
    background: var(--primary-soft);
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(320px, 480px);
    justify-content: center;
    gap: 32px;
    align-items: start;
    padding-top: 40px;
}

.form-card,
.panel,
.stat-card,
.empty-state {
    padding: 22px;
}

.form-card {
    display: grid;
    gap: 16px;
}

.stack-form {
    display: grid;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.stack-form:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.form-card label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-size: 14px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid #c8d1df;
    border-radius: 8px;
}

textarea {
    resize: vertical;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-bottom: 24px;
}

.stat-card {
    display: grid;
    gap: 8px;
}

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

.stat-card strong {
    font-size: 25px;
}

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

.panel-header {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.panel-header a {
    color: var(--primary);
    font-weight: 800;
}

.compact-list {
    display: grid;
    gap: 10px;
}

.compact-item,
.chat-row {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

a.compact-item:hover,
.chat-row:hover {
    border-color: var(--primary);
}

.chat-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
    align-items: center;
}

.chat-shell {
    grid-template-columns: 320px minmax(0, 1fr);
}

.chat-summary,
.chat-panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chat-summary {
    padding: 22px;
}

.chat-panel {
    display: grid;
    min-height: 620px;
    grid-template-rows: 1fr auto;
    overflow: hidden;
}

.messages {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 20px;
}

.message {
    width: min(78%, 620px);
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.message p {
    margin: 6px 0;
}

.message.mine {
    justify-self: end;
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

.message.theirs {
    justify-self: start;
    background: #ffffff;
}

.message.system {
    justify-self: center;
    width: min(100%, 620px);
    background: #fff7e8;
    border-color: #ffd392;
}

.message.mine small {
    color: #ddf3eb;
}

.message-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--line);
}

.table-wrap {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: #475467;
    font-size: 13px;
    text-transform: uppercase;
}

td a {
    color: var(--primary);
    font-weight: 800;
}

.status-pill.pending_review,
.status-pill.pending {
    color: #7a4b00;
    background: #fff4d6;
}

.status-pill.approved {
    color: #0b4778;
    background: var(--primary-soft);
}

.status-pill.rejected,
.status-pill.cancelled {
    color: #842222;
    background: #ffe5e5;
}

.status-pill.sold {
    color: #0b4778;
    background: #e8f2ff;
}

.tabs {
    flex-wrap: wrap;
    gap: 8px;
}

.tabs a {
    padding: 8px 11px;
    color: #475467;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
}

.tabs a.active {
    color: #ffffff;
    background: var(--surface-strong);
    border-color: var(--surface-strong);
}

.detail-list {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px 16px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 800;
}

.detail-list dd {
    margin: 0;
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 12px;
    padding: 34px;
}

.admin-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding: 24px;
    color: #ffffff;
    background: var(--surface-strong);
    border-radius: 8px;
}

.admin-callout .eyebrow {
    color: #9bd7ff;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #ffffff;
    font-weight: 800;
}

.flash.success {
    color: #0b4778;
    background: var(--primary-soft);
    border-color: #b8def8;
}

.flash.error {
    color: #842222;
    background: #ffe8e8;
    border-color: #ffc6c6;
}

.flash.warning {
    color: #7a4b00;
    background: #fff4d6;
    border-color: #ffe0a6;
}

.status-line {
    margin: 0;
}

@media (max-width: 850px) {
    .site-header,
    .site-footer,
    .section-row,
    .shop-topbar,
    .admin-callout {
        align-items: flex-start;
        flex-direction: column;
    }

    .market-hero,
    .listing-detail,
    .chat-shell,
    .form-grid,
    .split-grid,
    .auth-panel {
        grid-template-columns: 1fr;
    }

    .market-hero {
        min-height: 260px;
        padding: 26px;
    }

    .market-hero h1,
    .shop-topbar h1,
    .section-row h1,
    .auth-panel h1,
    .listing-detail h1,
    .chat-summary h1,
    .empty-state h1 {
        font-size: 32px;
    }

    .field-row,
    .message-form,
    .chat-row,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .message {
        width: 100%;
    }
}
