:root {
    color-scheme: dark;
    --bg: #0d1018;
    --panel: #151a25;
    --panel-soft: #1d1726;
    --line: #2a2f3d;
    --text: #f2f3f7;
    --muted: #a6adbf;
    --accent: #8bd918;
    --accent-2: #ffc400;
    --danger: #ff5f6d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    letter-spacing: 0;
}

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

.shell {
    width: min(1610px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0;
}

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 28px;
    align-items: center;
    margin-bottom: 34px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 22px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid #343b4d;
    border-radius: 50%;
    background: #151b28;
    color: var(--accent);
    font-size: 17px;
    line-height: 1;
}

.nav {
    display: flex;
    justify-content: center;
    gap: 22px;
    font-size: 14px;
    font-weight: 800;
}

.nav a,
.profile a {
    color: var(--muted);
}

.nav a.active,
.nav a:hover,
.profile a:hover {
    color: var(--text);
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.profile img,
.avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #111;
}

.button,
button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.button.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #111509;
}

.button.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #202635;
    color: var(--text);
}

.login-layout {
    min-height: 65vh;
    display: grid;
    place-items: center;
}

.login-panel,
.hero-band {
    width: min(720px, 100%);
    background: linear-gradient(135deg, #171d2a, #24172b);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 42px;
}

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

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 820px;
    margin-bottom: 14px;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1;
}

h2 {
    margin-bottom: 14px;
    font-size: 20px;
}

.muted {
    color: var(--muted);
    line-height: 1.65;
}

.page-grid,
.search-layout {
    display: grid;
    gap: 26px;
}

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

.stat-row article,
.server-result,
.search-head {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-row article {
    padding: 22px;
}

.stat-row span,
.server-meta span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-row strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}

.search-head {
    display: grid;
    grid-template-columns: 1fr minmax(360px, 560px);
    gap: 24px;
    align-items: end;
    padding: 26px;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #101520;
    color: var(--text);
    padding: 0 12px;
    font: inherit;
}

.filter-input {
    margin-bottom: 12px;
    background: #0d121d;
}

.server-result {
    min-height: 360px;
    overflow: hidden;
}

.empty-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.server-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 22px;
    padding: 24px;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
}

.server-title {
    margin: 0 0 8px;
    font-size: 24px;
}

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

.server-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.server-meta strong {
    display: block;
    margin-top: 7px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 18px;
    padding: 18px;
}

.server-main,
.players-panel {
    min-width: 0;
    background: #101520;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.server-main {
    display: grid;
    gap: 14px;
}

.panel-section {
    min-width: 0;
    background: #151b28;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title.compact {
    margin-bottom: 12px;
}

.section-title span {
    color: var(--accent-2);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.section-title strong {
    font-size: 15px;
}

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

.info-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.info-item {
    min-width: 0;
    padding: 13px;
    background: #101520;
    border: 1px solid #252b3a;
    border-radius: 6px;
}

.info-item span,
.variable-row span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.info-item strong,
.variable-row strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    background: #2d3345;
    color: #dce2f3;
    font-size: 12px;
    font-weight: 800;
}

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

.variable-row {
    display: grid;
    grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px;
    background: #101520;
    border: 1px solid #252b3a;
    border-radius: 6px;
}

.variable-row span {
    margin-bottom: 0;
    text-transform: none;
}

.resources {
    display: grid;
    gap: 8px;
}

.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    max-height: 520px;
    overflow: auto;
}

.resource-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 9px 10px;
    background: #1a2030;
    border: 1px solid #252b3a;
    border-radius: 4px;
    color: #dce2f3;
    font-size: 12px;
    font-weight: 700;
}

.resource-item[hidden],
.player-row[hidden] {
    display: none;
}

.players-list {
    display: grid;
    gap: 8px;
    max-height: 640px;
    overflow: auto;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    width: 100%;
    background: #1b2130;
    color: var(--text);
    text-align: left;
}

.player-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 70%);
}

.modal-panel {
    position: relative;
    width: min(720px, calc(100% - 32px));
    max-height: min(720px, calc(100vh - 32px));
    margin: 8vh auto;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.player-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-right: 40px;
}

.player-modal-head .avatar-fallback {
    width: 44px;
    height: 44px;
}

.player-modal-head h2 {
    margin-bottom: 2px;
}

.player-modal-head p {
    margin-bottom: 0;
}

.modal-panel h3 {
    margin: 10px 0 12px;
    font-size: 15px;
}

.icon-button {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    min-height: 34px;
    padding: 0;
    background: #222839;
    color: var(--text);
}

.error {
    padding: 24px;
    color: var(--danger);
    font-weight: 800;
}

.error.compact {
    padding: 0;
}

@media (max-width: 900px) {
    .shell {
        width: min(100% - 24px, 1610px);
        padding: 24px 0;
    }

    .topbar,
    .search-head,
    .server-summary,
    .content-grid {
        grid-template-columns: 1fr;
    }

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

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

    .stat-row,
    .server-meta,
    .info-grid,
    .info-grid.two {
        grid-template-columns: 1fr;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

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

    .section-title,
    .variable-row {
        grid-template-columns: 1fr;
    }

    .section-title {
        display: grid;
        align-items: start;
    }
}
