:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #64708a;
    --line: #e1e6f0;
    --accent: #3b78d9;
    --accent-ink: #ffffff;
    --danger: #d64545;
    --success: #2e9e62;
    --warn: #c98a12;
    --radius: 10px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1420;
        --panel: #171e2d;
        --ink: #e6ebf5;
        --muted: #8d98b0;
        --line: #283247;
        --accent: #5897fc;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }

/* ---------- top bar */
.topbar {
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    padding: .75rem 1.25rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
    background: var(--accent); color: var(--accent-ink); font-size: .8rem; letter-spacing: .03em;
}
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); }
.topbar nav a.active, .topbar nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.me { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.me .role { color: var(--muted); }
.me form { margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ---------- blocks */
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .label { color: var(--muted); font-size: .8rem; }
.stat .value { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- player header */
.player-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.player-head img { width: 64px; height: 64px; border-radius: 8px; image-rendering: pixelated; }
.player-head h1 { margin: 0; }

/* ---------- badges */
.badge {
    --c: #a7a6a6;
    display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
    color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.tag-online { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.tag-ban { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.tag-off { background: var(--bg); color: var(--muted); }
.val-true { color: var(--success); font-weight: 600; }
.val-false { color: var(--danger); font-weight: 600; }

/* ---------- tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.table-wrap { overflow-x: auto; }
.mini-head { width: 24px; height: 24px; border-radius: 4px; vertical-align: middle; margin-right: .4rem; image-rendering: pixelated; }

/* ---------- forms */
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
form.stack { display: grid; gap: .75rem; }
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local], select {
    font: inherit; color: var(--ink); background: var(--bg);
    border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem; min-width: 0;
}
input[type=color] { width: 48px; height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); padding: 2px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.checkbox { display: flex; align-items: center; gap: .4rem; color: var(--ink); }
button, .button {
    font: inherit; font-weight: 600; cursor: pointer;
    background: var(--accent); color: var(--accent-ink);
    border: 0; border-radius: 7px; padding: .5rem .9rem;
}
button.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.small { padding: .25rem .6rem; font-size: .82rem; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; }
.search { display: flex; gap: .5rem; }
.search input { flex: 1; font-size: 1rem; padding: .6rem .8rem; }

/* ---------- flash */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 10%, var(--panel)); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.flash-info { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }

/* ---------- login */
.login { max-width: 380px; margin: 8vh auto 0; }
.login .brand { justify-content: center; margin-bottom: 1.25rem; font-size: 1.15rem; }

@media (max-width: 640px) {
    .me { margin-left: 0; }
    dl.kv { grid-template-columns: 1fr; }
}
