:root {
  --bg: #121212;
  --surface: #1c1b1a;
  --surface-2: #26241f;
  --border: #34312b;
  --text: #ece7df;
  --muted: #9a9389;
  --accent: #cd412b;
  --accent-hover: #e0533b;
  --ok: #5fae4a;
  --warn: #e0a325;
  --bad: #d9534f;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1rem; margin-bottom: 14px; letter-spacing: .02em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; margin: 10px 0 0; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .03em; }
.brand.big { font-size: 1.3rem; justify-content: center; margin-bottom: 18px; }
.logo {
  width: 22px; height: 22px; background: var(--accent);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
}
.home-link {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .88rem;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 7px; margin-right: 6px;
}
.home-link:hover, .home-link:focus-visible { color: var(--text); border-color: #4a463e; }
.user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.role-tag {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-left: 6px;
}

/* Layout */
.grid {
  display: grid; gap: 16px; padding: 20px; max-width: 1200px; margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.span-2 { grid-column: span 2; }
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; padding: 16px; }
  .span-2 { grid-column: span 1; }
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* Status */
.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pill {
  padding: 5px 12px; border-radius: 99px; font-weight: 650; font-size: .85rem; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.pill::before { content: "\25CF  "; }
.pill.online { background: rgba(95,174,74,.15); color: var(--ok); }
.pill.starting { background: rgba(224,163,37,.15); color: var(--warn); }
.pill.offline { background: rgba(217,83,79,.13); color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.banner, .result { border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; }
.banner { background: rgba(224,163,37,.12); color: var(--warn); border: 1px solid rgba(224,163,37,.3); }
.result.ok { background: rgba(95,174,74,.1); color: var(--ok); border: 1px solid rgba(95,174,74,.25); }
.result.fail { background: rgba(217,83,79,.1); color: var(--bad); border: 1px solid rgba(217,83,79,.3); }
.connect { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
code, kbd { font-family: var(--mono); background: var(--surface-2); padding: 3px 7px; border-radius: 5px; color: var(--text); }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 9px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: #4a463e; background: #2e2b25; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn.wide { width: 100%; }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }

/* Forms */
input {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); flex-wrap: wrap; }
label.check input[type=radio], label.check input[type=checkbox] { width: auto; accent-color: var(--accent); }
label.small { font-size: .82rem; }
.seed-input { width: 140px; padding: 4px 8px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { color: var(--muted); font-size: .8rem; padding: 0 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; }
.error { color: var(--bad); margin: 0; font-size: .9rem; }

/* Players */
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li { display: flex; justify-content: space-between; gap: 10px; background: var(--surface-2); padding: 8px 10px; border-radius: 7px; font-size: .9rem; }
.players li.muted { background: none; padding: 0; }
.players .meta { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; text-align: right; }

/* Console */
.console {
  background: #0b0b0a; border: 1px solid var(--border); border-radius: 8px; margin: 0;
  height: 340px; overflow: auto; padding: 10px 12px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.console .panel { color: var(--warn); }
.console .rcon { color: #7fb6e8; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); max-width: calc(100% - 32px); z-index: 10;
}
.toast.bad { border-color: var(--bad); color: var(--bad); }
