:root {
    color-scheme: dark;
    --ink: #161513;
    --coal: #24221f;
    --panel: #302d28;
    --panel-soft: #3b3730;
    --line: #5a5348;
    --paper: #e9e1d3;
    --muted: #bfb4a1;
    --accent: #c94f32;
    --accent-bright: #e76740;
    --accent-dark: #8b321f;
    --green: #99b563;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--ink);
    color: var(--paper);
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(90deg, rgb(0 0 0 / 10%) 1px, transparent 1px) 0 0 / 42px 42px,
        linear-gradient(0deg, rgb(0 0 0 / 10%) 1px, transparent 1px) 0 0 / 42px 42px,
        radial-gradient(circle at 50% -20%, #57463a 0, var(--coal) 35%, var(--ink) 82%);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    opacity: .32;
    pointer-events: none;
    background: repeating-linear-gradient(-24deg, transparent 0 6px, rgb(255 255 255 / 2.5%) 6px 7px);
}

.site-shell {
    width: min(1180px, calc(100% - 2.5rem));
    min-height: 100vh;
    margin: 0 auto;
}

.site-header {
    display: flex;
    min-height: 88px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .8rem;
    color: var(--paper);
    letter-spacing: .08em;
    text-decoration: none;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; line-height: 1; }
.brand small { margin-top: .28rem; color: var(--muted); font-size: .58rem; font-weight: 700; }

.brand-mark {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border: 2px solid var(--accent);
    color: var(--accent-bright);
    font-family: Georgia, serif;
    font-size: .83rem;
    font-weight: 700;
}

.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a, .header-note { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
.site-nav a:hover { color: var(--paper); }
.site-nav .sign-out { color: var(--accent-bright); }
.header-note { color: var(--accent-bright); }

.card, .wide-card {
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
    background: linear-gradient(145deg, rgb(59 55 48 / 97%), rgb(37 34 30 / 97%));
    box-shadow: 0 24px 60px rgb(0 0 0 / 28%), inset 0 1px rgb(255 255 255 / 5%);
}

.card {
    width: min(100%, 610px);
    margin: 12vh auto 0;
    padding: clamp(2rem, 5vw, 4rem);
}

.wide-card {
    margin: 3.6rem 0;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.login-card h1 { max-width: 9ch; font-family: Georgia, serif; font-size: clamp(2.8rem, 7vw, 4.7rem); line-height: .94; }
.dashboard-card { margin-top: 8vh; }

.eyebrow {
    margin: 0 0 .8rem;
    color: var(--accent-bright);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0 0 1rem; font-size: clamp(2.2rem, 4vw, 3.35rem); font-weight: 500; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 1.35rem; font-weight: 500; }
p { color: var(--muted); line-height: 1.65; }

.button, .text-link, .small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 0;
    font: inherit;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.button {
    margin-top: 1.2rem;
    padding: 0 1.2rem;
    background: var(--accent);
    color: #fff7ee;
    box-shadow: inset 0 -2px rgb(0 0 0 / 20%);
}

.button:hover { background: var(--accent-bright); }
.secondary { margin-left: .6rem; background: #5d584d; }
.secondary:hover { background: #70685a; }
.text-link { margin-top: 1.3rem; color: var(--accent-bright); }
.text-link:hover { color: var(--paper); }
.back-link { margin: 0 0 2rem; }

.dashboard-actions { margin-top: 1rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 1.5rem 0;
}

.stat {
    padding: 1.1rem;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgb(36 40 41 / 95%), rgb(23 27 29 / 95%));
    box-shadow: inset 0 1px rgb(255 255 255 / 4%);
}

.stat span { display: block; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stat strong { display: block; margin-top: 0.35rem; color: var(--accent); font-size: 1.8rem; }
.stat small { display: block; margin-top: .3rem; color: var(--muted); font-size: .72rem; }
.dashboard-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-servers { margin-top: 1.8rem; }
.dashboard-section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.dashboard-section-title .eyebrow { margin-bottom: .35rem; }
.dashboard-section-title > span { color: var(--muted); font-size: .76rem; }
.server-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.status-server-card { display: block; min-width: 0; padding: 1.1rem 1.15rem; border: 1px solid var(--line); border-left: 3px solid #716b60; color: var(--paper); background: linear-gradient(145deg, rgb(28 28 25 / 96%), rgb(18 18 16 / 92%)); text-decoration: none; transition: border-color .15s ease, transform .15s ease, background .15s ease; }
.status-server-card:hover { border-color: var(--accent-bright); transform: translateY(-2px); background: linear-gradient(145deg, rgb(53 43 35 / 96%), rgb(25 23 20 / 94%)); }
.status-server-card.is-online { border-left-color: var(--green); }
.status-server-card.is-sponsored { border-top-color: #b9974b; box-shadow: inset 0 1px rgb(255 235 174 / 10%); }
.status-card-top, .status-card-footer { display: flex; justify-content: space-between; gap: .8rem; }
.status-card-top h3 { margin: 0; font-size: 1rem; }
.status-card-top p { margin: .24rem 0 0; font-size: .72rem; line-height: 1.25; }
.status-pill { align-self: flex-start; padding: .26rem .42rem; border: 1px solid var(--line); color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.is-online .status-pill { border-color: #667d3d; color: #b9d883; }
.status-population { display: flex; align-items: baseline; gap: .4rem; margin: 1.15rem 0 .8rem; }
.status-population strong { color: var(--paper); font-size: 2rem; line-height: 1; }
.status-population strong small { color: var(--muted); font-size: 1.05rem; }
.status-population > span, .status-card-meta, .status-card-footer { color: var(--muted); font-size: .72rem; }
.status-card-meta { display: flex; justify-content: space-between; gap: .6rem; padding-top: .7rem; border-top: 1px solid rgb(255 255 255 / 7%); }
.status-card-footer { align-items: center; margin-top: .8rem; font-size: .68rem; }
.status-card-footer b { color: var(--accent-bright); font-size: .68rem; }
.server-tag { display: inline-block; margin-right: .28rem; padding: .15rem .28rem; border: 1px solid var(--line); color: var(--muted); font-size: .56rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.server-tag.sponsor { border-color: #b9974b; color: #f0cf82; }
.history-panel { margin-top: 1.5rem; padding: 1.35rem; border: 1px solid var(--line); background: rgb(22 21 19 / 46%); }
.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .78rem; }
.history-periods { display: flex; gap: .45rem; flex-wrap: wrap; }
.history-periods .small-button { min-height: 34px; padding: 0 .7rem; background: #4e493f; color: var(--paper); }
.history-periods .small-button.active { background: var(--accent); color: #fff; }
.player-chart { display: block; width: 100%; height: min(38vw, 280px); min-height: 190px; margin-top: 1.25rem; overflow: visible; }
.chart-axis { stroke: rgb(233 225 211 / 20%); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent-bright); stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-label { fill: var(--muted); font-size: 24px; }
.history-legend { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .72rem; }
.history-legend i { display: inline-block; width: 18px; height: 3px; margin-right: .4rem; vertical-align: middle; background: var(--accent-bright); }

@media (max-width: 700px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-status-grid { grid-template-columns: 1fr; }
    .dashboard-section-title, .history-toolbar, .history-legend { align-items: flex-start; flex-direction: column; }
}

.empty-state {
    display: flex;
    gap: .9rem;
    align-items: center;
    margin-top: 2.2rem;
    padding: 1rem 0 0;
    border-top: 1px solid var(--line);
    color: var(--paper);
    font-size: .87rem;
}

.empty-state span { color: var(--muted); font-size: .78rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgb(153 181 99 / 65%); }

.panel {
    margin-top: 1.4rem;
    padding: 1.35rem;
    border: 1px solid var(--line);
    background: rgb(22 21 19 / 46%);
}

.panel h2 { margin-bottom: .35rem; }
.panel p { margin: 0; }
.node-list { margin-top: 2.6rem; }
.node-list-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.node-list-heading .eyebrow { margin-bottom: .35rem; }
.node-list-heading span { color: var(--muted); font-size: .78rem; }
.node-card { margin-top: 1rem; border: 1px solid var(--line); background: linear-gradient(145deg, rgb(26 25 22 / 88%), rgb(18 18 16 / 80%)); box-shadow: inset 0 1px rgb(255 255 255 / 3%); }
.node-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 2%); }
.node-card-header .eyebrow { margin-bottom: .3rem; }
.node-card-header h2 { font-size: 1.45rem; }
.node-label-form { display: flex; gap: .45rem; align-items: center; margin-top: .6rem; }
.node-label-form input { width: min(16rem, 100%); }
.node-label-form .small-button { margin: 0; white-space: nowrap; }
.node-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.node-section { min-width: 0; padding: 1.25rem 1.35rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.node-section:nth-child(2n) { border-right: 0; }
.node-section:nth-last-child(-n + 2) { border-bottom: 0; }
.node-section h3 { margin: 0; color: var(--paper); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.node-section p { min-height: 2.5rem; margin: .42rem 0 .9rem; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.node-section form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.node-section input { flex: 1 1 190px; min-width: 0; }
.node-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.node-actions form { display: block; }
.node-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.35rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.empty-node-list { margin: 0; padding: 1.3rem; border: 1px dashed var(--line); }
.form-hint { margin-top: .85rem !important; font-size: .8rem; }
.notice { margin-top: 1rem !important; padding: .8rem 1rem; border-left: 3px solid var(--green); background: rgb(153 181 99 / 12%); color: #d8e9b7; }
.role-guide { border-left: 3px solid var(--accent-dark); }

.form-grid, .inline-form { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: .45rem; color: var(--paper); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }

input:not([type="checkbox"]), select, textarea {
    min-width: 190px;
    min-height: 42px;
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: 0;
    outline: none;
    background: #201e1b;
    color: var(--paper);
    font: inherit;
}

input:not([type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--accent-bright); box-shadow: 0 0 0 2px rgb(201 79 50 / 20%); }
textarea { min-width: 260px; min-height: 84px; resize: vertical; }
.small-button { min-height: 42px; padding: 0 .9rem; background: #595348; color: var(--paper); }
.small-button:hover { background: #70685a; }

.danger-button {
    min-height: 34px;
    padding: 0 .7rem;
    border: 1px solid #9a422d;
    background: transparent;
    color: #e57a59;
    font: inherit;
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}

.danger-button:hover { background: #6f2d21; color: #fff0e8; }

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: .35rem .8rem;
    align-items: center;
}

.permission-choice {
    display: flex;
    gap: .45rem;
    align-items: center;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: none;
    white-space: nowrap;
}

.permission-choice input {
    width: 15px;
    height: 15px;
    min-height: 0;
    min-width: 0;
    margin: 0;
    accent-color: var(--accent);
}

.server-form { align-items: end; }
.server-options { display: grid; grid-template-columns: repeat(2, minmax(170px, 1fr)); gap: .45rem .8rem; padding: .65rem .8rem; border: 1px solid var(--line); }
.motd-field { align-self: stretch; }
.server-create-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: end; }
.server-create-grid > label { min-width: 0; }
.server-create-grid input, .server-create-grid select { min-width: 0; width: 100%; }
.server-create-grid .motd-field { grid-column: span 2; }
.server-create-grid .motd-field textarea { min-width: 0; width: 100%; }
.server-create-grid .server-options { grid-column: span 2; min-height: 84px; }
.server-create-grid .server-submit { width: 100%; margin: 0; }
.server-list { margin-top: 2.6rem; }
.server-card { margin-top: 1rem; border: 1px solid var(--line); background: linear-gradient(145deg, rgb(26 25 22 / 88%), rgb(18 18 16 / 80%)); box-shadow: inset 0 1px rgb(255 255 255 / 3%); }
.server-card-sponsored { border-color: #b9974b; background: linear-gradient(145deg, rgb(74 58 29 / 48%), rgb(25 23 17 / 92%)); box-shadow: inset 0 1px rgb(255 235 174 / 12%), 0 0 24px rgb(185 151 75 / 13%); }
.server-card-sponsored .server-card-header { border-bottom-color: #8b7441; background: linear-gradient(90deg, rgb(185 151 75 / 14%), transparent 58%); }
.server-card-sponsored .server-card-header .eyebrow::after { content: 'Sponsored server'; display: inline-block; margin-left: .65rem; padding: .22rem .45rem; border: 1px solid #b9974b; color: #f0cf82; font-size: .58rem; letter-spacing: .09em; vertical-align: middle; }
.server-card-sponsored .server-card-grid section { border-right-color: #6f5c35; }
.server-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem; border-bottom: 1px solid var(--line); }
.server-card-header .eyebrow { margin-bottom: .3rem; }
.server-card-header h2 { margin: 0; font-size: 1.35rem; }
.server-card-title-row { display: flex; align-items: center; gap: .7rem; }
.server-id-tag { margin-left: .45rem; padding: .16rem .32rem; border: 1px solid var(--line); color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .04em; text-transform: none; }
.server-live-status { display: inline-flex; align-items: center; gap: .35rem; padding: .26rem .5rem; border: 1px solid var(--line); color: var(--muted); font-size: .61rem; font-weight: 800; letter-spacing: .09em; line-height: 1; text-transform: uppercase; }
.server-live-status::before { width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; content: ""; }
.server-live-status.is-offline { border-color: #645b50; color: #998e7d; }
.server-live-status.is-online { border-color: #667d3d; color: #b9d883; }
.server-live-status.is-busy { border-color: var(--accent); color: #ff9b72; }
.server-motd { margin: .4rem 0 0; font-size: .8rem; }
.server-card-actions { display: flex; gap: .55rem; align-items: center; }
.server-card-actions form { margin: 0; }
.server-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.server-card-grid section { display: grid; gap: .4rem; min-width: 0; padding: 1rem 1.35rem; border-right: 1px solid var(--line); }
.server-card-grid section:last-child { border-right: 0; }
.server-card-grid span { color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.server-card-grid strong { min-height: 1.25rem; color: var(--paper); font-size: .88rem; font-weight: 700; overflow-wrap: anywhere; }
.server-card-grid code { justify-self: start; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { padding: 1rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--accent-bright); font-size: .67rem; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: .78rem; }
.optional { color: var(--muted); font-size: .64rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
.available { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
code { padding: .18rem .35rem; background: #1d1b18; color: #e3bc87; font-family: "Courier New", monospace; font-size: .8rem; }
.external-link { color: var(--accent-bright); font-size: .78rem; font-weight: 700; text-decoration: none; }
.external-link:hover { color: var(--paper); text-decoration: underline; }

.site-footer {
    padding: 1.7rem 0 2.5rem;
    color: #82796a;
    font-size: .68rem;
    letter-spacing: .08em;
    text-align: center;
    text-transform: uppercase;
}
.site-footer span { margin: 0 .5rem; color: var(--accent); }

.server-log-output {
    box-sizing: border-box;
    width: 100%;
    min-height: 32rem;
    max-height: 65vh;
    overflow: auto;
    margin: 1rem 0 0;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #151411;
    color: #d8d2c5;
    font: .82rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
}

@media (max-width: 620px) {
    .site-shell { width: min(100% - 1.4rem, 1180px); }
    .site-header { min-height: 74px; }
    .site-nav { gap: .8rem; }
    .site-nav a, .header-note { font-size: .65rem; }
    .brand small { display: none; }
    .card { margin-top: 7vh; }
    .wide-card { margin-top: 1.5rem; }
    .secondary { margin-left: 0; }
    .inline-form { min-width: 520px; }
    .permission-grid { grid-template-columns: 1fr; }
    .server-options { grid-template-columns: 1fr; }
    .server-create-grid { grid-template-columns: 1fr; }
    .server-create-grid .motd-field, .server-create-grid .server-options { grid-column: auto; }
    .server-card-header { flex-direction: column; }
    .server-card-title-row { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .server-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-card-grid section:nth-child(2) { border-right: 0; }
    .server-card-grid section:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
    .node-list-heading, .node-card-header, .node-card-footer { align-items: flex-start; flex-direction: column; }
    .node-grid { grid-template-columns: 1fr; }
    .node-section, .node-section:nth-child(2n), .node-section:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--line); }
    .node-section:last-child { border-bottom: 0; }
}
