:root {
    color-scheme: dark;
    --bg: #0b141f;
    --bg-2: #101c2b;
    --panel: #16202d;
    --panel-2: #1b2a3a;
    --panel-3: #223448;
    --text: #dfe8f2;
    --muted: #8f98a6;
    --line: #2a3a4c;
    --accent: #66c0f4;
    --accent-2: #8bc53f;
    --danger: #d65b5b;
    --warn: #d9b44a;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 20% 0%, rgba(102, 192, 244, 0.14), transparent 32rem),
        linear-gradient(180deg, #16263a 0, var(--bg) 22rem, #0a111b 100%);
    color: var(--text);
    font: 16px/1.5 Arial, Helvetica, sans-serif;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #0d1824;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(102, 192, 244, 0.16);
}

textarea {
    min-height: 86px;
    resize: vertical;
}

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

th,
td {
    border-bottom: 1px solid rgba(102, 192, 244, 0.12);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

h1,
h2,
h3 {
    margin: 0 0 14px;
    font-weight: 700;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px max(18px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(102, 192, 244, 0.12);
    background: rgba(23, 37, 54, 0.96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(14px);
}

.brand {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
}

.topbar nav,
.tabs,
.admin-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar nav a,
.tabs a,
.admin-nav a {
    color: #c7d5e0;
    padding: 8px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.topbar nav a:hover,
.tabs a.active,
.tabs a:hover,
.admin-nav a:hover {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(102, 192, 244, 0.22), rgba(139, 197, 63, 0.12));
}

.wallet-pill {
    border: 1px solid rgba(139, 197, 63, 0.35);
    color: #c7f284 !important;
}

.page {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 30px 0 64px;
}

.hero {
    min-height: 260px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    padding: 48px;
    margin-bottom: 22px;
    border: 1px solid rgba(102, 192, 244, 0.18);
    border-radius: 4px;
    background:
        linear-gradient(110deg, rgba(18, 42, 64, 0.94), rgba(24, 68, 98, 0.82) 54%, rgba(45, 82, 58, 0.68)),
        #172536;
    box-shadow: var(--shadow);
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: 48px;
    line-height: 1.08;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, #75b022, #8bc53f);
    color: #102006;
    font-weight: 800;
    padding: 10px 16px;
    cursor: pointer;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.18);
}

.button:hover {
    filter: brightness(1.08);
}

.button.small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 14px;
}

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

.card,
.panel,
.auth-box {
    border: 1px solid rgba(102, 192, 244, 0.14);
    border-radius: 4px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.game-card {
    overflow: hidden;
    transition: transform 140ms ease, border-color 140ms ease;
}

.game-card:hover {
    transform: translateY(-2px);
    border-color: rgba(102, 192, 244, 0.46);
}

.game-card > div:not(.cover) {
    padding: 18px;
}

.cover {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 8;
    background:
        linear-gradient(135deg, rgba(102, 192, 244, 0.34), rgba(139, 197, 63, 0.2)),
        #101c2b;
    color: #ffffff;
    font-size: 68px;
    font-weight: 900;
}

.badge {
    display: inline-flex;
    width: fit-content;
    border: 1px solid rgba(102, 192, 244, 0.22);
    border-radius: 3px;
    color: #c7d5e0;
    background: rgba(0, 0, 0, 0.16);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.badge.rare {
    color: var(--accent);
}

.badge.epic {
    color: #b79cff;
}

.badge.legendary {
    color: var(--warn);
}

.game-shell,
.market-layout,
.profile-grid {
    display: grid;
    gap: 18px;
}

.game-header,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.game-frame {
    width: 100%;
    min-height: 680px;
    border: 1px solid rgba(102, 192, 244, 0.18);
    border-radius: 4px;
    background: #000;
    box-shadow: var(--shadow);
}

.boards,
.market-layout,
.profile-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.market-layout .panel:first-child,
.market-history {
    grid-column: 1 / -1;
}

.panel {
    padding: 18px;
    overflow: auto;
}

.panel h2 {
    margin-top: 0;
}

.chart {
    height: 280px;
    border: 1px solid rgba(102, 192, 244, 0.16);
    border-radius: 3px;
    background:
        linear-gradient(rgba(102, 192, 244, 0.12) 1px, transparent 1px) 0 0 / 100% 25%,
        linear-gradient(90deg, rgba(102, 192, 244, 0.1) 1px, transparent 1px) 0 0 / 12.5% 100%,
        #0b141f;
}

.chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

.market-stats,
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.market-stats span,
.stat {
    border: 1px solid rgba(102, 192, 244, 0.14);
    border-radius: 4px;
    background: rgba(8, 15, 24, 0.42);
    padding: 14px;
}

.market-stats b,
.stat strong {
    display: block;
    color: #ffffff;
    font-size: 26px;
}

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

.stats.compact {
    margin: 0 0 18px;
}

.auth-box {
    width: min(420px, 100%);
    margin: 40px auto;
    padding: 24px;
}

.auth-box form,
.form-grid,
.inline-form {
    display: grid;
    gap: 12px;
}

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

.form-grid.wide textarea {
    grid-column: 1 / -1;
}

.inline-form,
.table-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form {
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(102, 192, 244, 0.12);
}

.inline-form input {
    max-width: 150px;
}

.alert,
.notice {
    border-radius: 3px;
    padding: 10px 12px;
}

.alert {
    border: 1px solid rgba(214, 91, 91, 0.32);
    background: rgba(214, 91, 91, 0.13);
    color: #ffd7d7;
}

.notice {
    border: 1px solid rgba(139, 197, 63, 0.32);
    background: rgba(139, 197, 63, 0.12);
    color: #d7f7aa;
}

.positive {
    color: #b8e986;
}

.negative {
    color: #ff9d9d;
}

@media (max-width: 900px) {
    .hero {
        align-items: stretch;
        flex-direction: column;
        padding: 34px;
    }

    .hero h1 {
        font-size: 38px;
    }
}

@media (max-width: 720px) {
    .topbar,
    .game-header,
    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        position: static;
    }

    .page {
        width: min(calc(100% - 20px), 1180px);
        padding-top: 18px;
    }

    .hero {
        min-height: 0;
        padding: 24px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .boards,
    .market-layout,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .game-frame {
        min-height: 520px;
    }

    .inline-form,
    .table-form {
        align-items: stretch;
        flex-direction: column;
    }

    th,
    td {
        padding: 10px 8px;
    }
}
