/* Lanthorn Host — the node's web UI. Same palette and components as the launcher,
 * so the two read as one product. Dark first, light behind
 * prefers-color-scheme; every colour is a token. */
:root {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-side: #0b0d10;
  --surface: #161a20;
  --surface-2: #1c2129;
  --surface-3: #242a33;
  --hover: rgba(255, 255, 255, 0.045);
  --active: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e7eaee;
  --text-2: #a3abb6;
  --text-3: #6d7682;
  --accent: #22d37a;
  --accent-hover: #43e392;
  --accent-soft: rgba(34, 211, 122, 0.13);
  --accent-text: #04140b;
  --ok: #3ccf8e;
  --ok-soft: rgba(60, 207, 142, 0.13);
  --warn: #f2b14c;
  --warn-soft: rgba(242, 177, 76, 0.12);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.12);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Cantarell", "Noto Sans", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f6f8;
    --bg-side: #eceef2;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --surface-3: #eef0f4;
    --hover: rgba(15, 23, 42, 0.04);
    --active: rgba(15, 23, 42, 0.07);
    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(15, 23, 42, 0.14);
    --text: #161a21;
    --text-2: #4e5764;
    --text-3: #8a93a0;
    --accent: #0f9d58;
    --accent-hover: #0b8148;
    --accent-soft: rgba(15, 157, 88, 0.1);
    --ok: #13915a;
    --ok-soft: rgba(19, 145, 90, 0.1);
    --warn: #b7791f;
    --warn-soft: rgba(183, 121, 31, 0.1);
    --bad: #d64545;
    --bad-soft: rgba(214, 69, 69, 0.09);
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.08);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 13.5px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
input, select, textarea, button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

.brand-mark { stroke: none; flex: none; border-radius: 22%; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; font-weight: 700; margin: 16px 0 6px; letter-spacing: -0.015em; }
.login-card .login-note { color: var(--text-2); margin-bottom: 20px; }
.login-card label { display: block; font-weight: 550; margin-bottom: 6px; }
.login-card input { width: 100%; height: 38px; padding: 0 12px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card label.check { display: flex; font-weight: 450; margin-bottom: 10px; }
.login-card .check input { width: 15px; height: 15px; margin: 2px 0 0; padding: 0; box-shadow: none; }
.login-card .login-note + .login-note { margin-top: -12px; }
.login-card select, .login-card textarea { width: 100%; margin-bottom: 14px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; color: inherit; }
.login-card textarea { resize: vertical; }
.notice-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.inline-error { color: var(--bad); margin-top: 12px; min-height: 1em; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: none; display: flex; flex-direction: column; background: var(--bg-side); border-right: 1px solid var(--line); padding: 16px 12px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; background: none; border: 0; border-radius: 7px; color: var(--text-2); font-weight: 500; text-align: left; cursor: pointer; }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item span:first-of-type { flex: 1; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-item.active svg { color: var(--accent); }
.nav-count { font-size: 11.5px; color: var(--text-3); }
.sidebar-foot { margin-top: auto; }
.node-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; }
.node-line { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.capacity { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 10px 0 12px; overflow: hidden; }
.capacity i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.3s; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.toolbar h1 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.toolbar-spacer { flex: 1; }
.content { padding: 16px 24px 48px; }
.page { max-width: 820px; }
.page-lead { color: var(--text-2); margin: 4px 0 16px; }

/* ---------- buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.icon-btn { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--text-2); cursor: pointer; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.field { height: 34px; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); outline: none; width: 100%; min-width: 0; }
select.field { appearance: none; -webkit-appearance: none; padding-right: 28px; background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a0' stroke-width='2' stroke-linecap='round'><path d='M7 10l5 5 5-5'/></svg>") no-repeat right 8px center / 14px; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; align-items: center; }
.form-grid > label { color: var(--text-2); font-weight: 500; }
.form-span { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- servers list ---------- */
.list-head, .inst {
  display: grid;
  grid-template-columns: 76px minmax(170px, 2fr) 104px minmax(90px, 1fr) 72px 70px 130px 76px 128px;
  column-gap: 14px; align-items: center;
}
.list-head { padding: 0 12px 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); border-bottom: 1px solid var(--line); }
.list { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; }
.inst { min-height: 60px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.inst:hover { border-color: var(--line-strong); }
.inst > div { min-width: 0; }
.inst .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst .sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst .cell { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inst .actions { display: flex; justify-content: flex-end; gap: 2px; }
.muted-em { color: var(--text-3) !important; }
.copyable { font-family: var(--mono); font-size: 12px; cursor: pointer; border-radius: 4px; padding: 2px 4px; margin-left: -4px; }
.copyable:hover { background: var(--surface-3); color: var(--text); }
.copy-failed { color: var(--bad); }

.state-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); text-transform: capitalize; }
.state-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-running { background: var(--ok-soft); color: var(--ok); }
.state-creating, .state-restarting, .state-starting { background: var(--warn-soft); color: var(--warn); }
.state-stopped, .state-exited { background: var(--surface-3); color: var(--text-3); }
.state-missing, .state-dead, .state-unknown { background: var(--bad-soft); color: var(--bad); }

/* ---------- installed game files ---------- */
.copy-head, .copy-row {
  display: grid;
  grid-template-columns: 76px minmax(170px, 2fr) 104px 110px minmax(120px, 1.5fr) 110px 180px;
  column-gap: 14px; align-items: center;
}
.copy-head { padding: 0 12px 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); border-bottom: 1px solid var(--line); }
.copy-row { min-height: 56px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.copy-row > div { min-width: 0; }
.copy-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-row .sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-row .cell { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.copy-row .actions { display: flex; justify-content: flex-end; gap: 6px; }
.copy-row.unused { border-color: var(--warn); }
/* A copy's update line spans the row under its name, so a long notice never
   squeezes the columns above it. */
.copy-row .update-line { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.copy-row .update-line .new { color: var(--ok); font-weight: 600; }
.copy-row .update-line .bad-text { color: var(--bad); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.link-btn:disabled { color: var(--text-3); cursor: default; text-decoration: none; }
.updates-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); font-size: 13px; color: var(--text-2); }
.updates-field { display: flex; align-items: center; gap: 8px; }
.updates-field select { width: auto; min-width: 150px; }
.updates-field input { width: 84px; }
.updates-games { margin: -4px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); font-size: 13px; color: var(--text-2); }
.updates-games > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--text); }
.updates-games-list { display: grid; gap: 0; padding: 0 14px 6px; }
.ug-row { display: grid; grid-template-columns: minmax(140px, 1.2fr) repeat(3, minmax(150px, 1fr)); gap: 8px 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.ug-row.ug-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 6px 0; border-top: 0; }
.ug-row select, .ug-row input[type="datetime-local"] { width: 100%; }
.ug-name { font-weight: 600; color: var(--text); padding-top: 6px; }
.ug-more { grid-column: 4; display: grid; gap: 6px; }
.ug-hours { display: flex; align-items: center; gap: 6px; }
.ug-hours select { width: auto; flex: 1; }
@media (max-width: 760px) {
  .ug-row { grid-template-columns: 1fr; }
  .ug-row.ug-head { display: none; }
  .ug-more { grid-column: auto; }
  .ug-row label.ug-field::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
}
.updates-note { flex: 1 1 260px; min-width: 0; font-size: 12px; color: var(--text-3); }
.state-unused { background: var(--warn-soft); color: var(--warn); }
.download-progress { display: flex; flex-direction: column; gap: 4px; }
.dl-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.dl-bar i { display: block; height: 100%; background: var(--ok); }

/* ---------- artwork ---------- */
.art { position: relative; overflow: hidden; flex: none; border-radius: 6px; background: linear-gradient(135deg, hsl(var(--h, 215) 45% 30%), hsl(calc(var(--h, 215) + 40) 50% 18%)); display: flex; align-items: center; justify-content: center; }
.art .art-letters { font-weight: 700; color: rgba(255, 255, 255, 0.9); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; }
.art img.loaded { opacity: 1; }
.art-thumb { width: 76px; height: 36px; }
.art-thumb .art-letters { font-size: 12.5px; }

/* ---------- games ---------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.game-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.game-card:hover { border-color: var(--line-strong); }
.game-card .art { width: 100%; height: auto; aspect-ratio: 460 / 215; border-radius: 0; }
.game-card .art .art-letters { font-size: 30px; opacity: 0.55; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 14.5px; font-weight: 650; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 550; }
.card-reason { font-size: 12px; color: var(--warn); }
.content-help { font-size: 12px; display: grid; gap: 6px; }
.content-help p { margin: 0; }
.content-path { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.content-path code { width: 100%; overflow-wrap: anywhere; font-size: 12px; padding: 4px 6px; border-radius: 6px; background: var(--surface-2, rgba(127,127,127,.12)); }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.card-actions .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.backup-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; margin: 8px 0; }
.backup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); }
.backup-when { font-weight: 600; flex: 1 0 auto; white-space: nowrap; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#backups-dialog .form-actions { flex-wrap: wrap; }
.backup-sub { margin-left: 16px; padding: 6px 10px; }
.backup-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.backup-schedule label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.backup-schedule select.field { width: auto; min-width: 0; max-width: 100%; }
.modal .backup-schedule input[type="number"] { width: 5em; }
.btn-danger-text { color: var(--bad); }
.schedule-hours { margin: 8px 0 4px 24px; }
.console-form { display: flex; gap: 8px; margin-top: 8px; }
.console-form .console-input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.verify-list { max-height: 200px; overflow: auto; margin: 8px 0; padding: 8px 8px 8px 26px; background: var(--surface-2); border-radius: var(--radius); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.game-card { position: relative; }
.card-remove { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: var(--radius); background: rgba(0, 0, 0, 0.45); color: #fff; cursor: pointer; }
.card-remove svg { width: 15px; height: 15px; }
.card-remove:hover { background: var(--bad); border-color: var(--bad); }
.game-card.unrunnable .art { filter: grayscale(0.85) brightness(0.7); }
.install-status { font-size: 12px; color: var(--text-2); }
.install-status.ok { color: var(--ok); }
.install-status.err { color: var(--bad); }

/* ---------- cards, items ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head h2 { font-size: 14.5px; font-weight: 650; flex: 1; }
.card-text { color: var(--text-2); margin-bottom: 12px; }
.item-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.item-list:empty { display: none; }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.item .item-main { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .item-meta { color: var(--text-3); font-size: 12px; }
.item-note { font-size: 12px; color: var(--warn); flex-basis: 100%; }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- empty ---------- */
.empty { max-width: 420px; margin: 64px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.empty-icon svg { width: 24px; height: 24px; color: var(--text-2); }
.empty h2 { font-size: 16px; font-weight: 650; }
.empty p { color: var(--text-2); margin-bottom: 6px; }

/* ---------- menus and dialogs ---------- */
.menu { position: fixed; z-index: 100; min-width: 220px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 10px; background: none; border: 0; border-radius: 6px; text-align: left; cursor: pointer; color: var(--text); }
.menu-item svg { width: 15px; height: 15px; color: var(--text-2); flex: none; }
.menu-item span { flex: 1; white-space: nowrap; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--accent); color: var(--accent-text); outline: none; }
.menu-item:hover:not(:disabled) svg { color: inherit; }
.menu-item:disabled { color: var(--text-3); cursor: default; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-head { padding: 6px 10px 4px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(5, 7, 10, 0.6); display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 48px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); }
.modal-hero { height: 120px; position: relative; }
.modal-hero .art { position: absolute; inset: 0; border-radius: 0; }
.modal-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--surface)); }
.modal-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal h3 { font-size: 16px; font-weight: 650; }
.modal label { font-weight: 550; color: var(--text-2); margin-top: 4px; }
.modal input[type="text"], .modal input[type="number"], .modal input[type="password"] { height: 36px; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); outline: none; width: 100%; }
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.advanced-wrap { display: flex; flex-direction: column; gap: 8px; }
.map-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 200px; overflow-y: auto; padding: 2px; }
.map-choice { height: 28px; padding: 0 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-family: var(--mono); font-size: 12px; }
.map-choice:hover { border-color: var(--line-strong); }
.map-choice.chosen { background: var(--accent); color: var(--accent-text); border-color: transparent; }

/* ---------- toasts ---------- */
.error-banner, .toast { position: fixed; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 12px; max-width: min(640px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; border-radius: 10px; box-shadow: var(--shadow); }
.error-banner { top: 16px; background: #3a1d20; border: 1px solid rgba(255, 107, 107, 0.35); color: #ffd9d9; }
@media (prefers-color-scheme: light) { .error-banner { background: #fff1f1; color: #8a1f1f; } }
.toast { bottom: 24px; background: var(--surface-3); border: 1px solid var(--line-strong); }
.error-banner button, .toast button { background: none; border: 0; color: inherit; opacity: 0.7; cursor: pointer; font-size: 18px; line-height: 1; }
.build-version { position: fixed; right: 14px; bottom: 8px; font-size: 11px; color: var(--text-3); pointer-events: none; z-index: 5; }

/* Disk space where game files live, in the sidebar card. */
.disk-line { display: flex; align-items: center; gap: 7px; margin: -4px 0 12px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.disk-line svg { width: 14px; height: 14px; flex: none; }
.disk-line.low { color: var(--warn); font-weight: 600; }

/* A crashed server, and its reason in the map column. */
.state-crashed { background: var(--bad-soft); color: var(--bad); }
.bad-text { color: var(--bad) !important; }
.inst .cell-players.clickable { cursor: pointer; }
.inst .cell-players.clickable:hover { color: var(--text); text-decoration: underline dotted; }

/* Leftover folders notice, above the list. */
.notice-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 14px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--text-2); font-size: 13px; }
.notice-bar span { flex: 1; min-width: 0; }
.btn.btn-small { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* Players dialog. */
.modal.modal-mid { max-width: 620px; }
.players-table { max-height: min(60vh, 520px); overflow: auto; }
.players-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 90px; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.players-headrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.players-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Server log: a wide dialog with the tail in a scrolling block. */
.modal.modal-wide { max-width: 980px; }
.log-head { display: flex; align-items: center; gap: 8px; }
.log-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.log-lines { height: 32px; width: auto; }
.log-text {
  margin: 0; height: min(60vh, 560px); overflow: auto; padding: 10px 12px;
  background: var(--bg-side); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}

/* Live usage: a strip under each running server, read every 2 s. */
.inst > .usage {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px;
  margin-top: 6px; padding: 10px 0 2px; border-top: 1px solid var(--line);
}
.metric { min-width: 0; }
.metric-top { display: flex; align-items: baseline; gap: 8px; }
.metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.metric-value { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-sub { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { display: block; width: 100%; height: 26px; margin: 4px 0 2px; }
.spark path { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.metric-cpu .spark path { stroke: var(--accent); }
.metric-mem .spark path { stroke: var(--warn); }
.metric-net .spark path { stroke: #6aa8ff; }
.metric-disk .spark { visibility: hidden; }
.metric-players .spark path { stroke: var(--text-2); }
.metric.warn .metric-value, .metric.warn .metric-sub { color: var(--warn); }
.metric.warn .spark path { stroke: var(--bad); }
.node-usage {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 28px;
  margin-bottom: 12px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.node-usage > div { display: flex; align-items: baseline; gap: 8px; }
.node-usage-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.node-usage-note { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* Between the phone layout and a wide window the Installed table's columns
   do not fit: the date goes first. */
@media (max-width: 1240px) {
  .copy-head, .copy-row { grid-template-columns: 76px minmax(150px, 2fr) 104px 96px minmax(100px, 1.5fr) 180px; }
  .copy-head > :nth-child(6), .copy-row > :nth-child(6):not(.update-line) { display: none; }
}
@media (max-width: 1000px) {
  .copy-head { display: none; }
  .copy-row { grid-template-columns: 76px 1fr auto; row-gap: 6px; }
  .copy-row > :nth-child(n+3):not(.actions):not(.update-line) { display: none; }
}
@media (max-width: 1180px) {
  .list-head, .inst { grid-template-columns: 76px minmax(150px, 2fr) 104px 72px 120px 128px; }
  .list-head > :nth-child(4), .inst > :nth-child(4), .list-head > :nth-child(6), .inst > :nth-child(6), .list-head > :nth-child(8), .inst > :nth-child(8) { display: none; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .brand { padding: 0 8px 0 0; }
  .brand-sub, .sidebar-foot .capacity { display: none; }
  /* The tabs get a row of their own and share it; scrolling is only the
     fallback for a screen narrower than any phone. */
  .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav-item { flex: 1 0 auto; justify-content: center; }
  .nav-item span:first-of-type { flex: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .node-card { padding: 6px 8px; display: flex; gap: 10px; align-items: center; border: 0; background: none; }
  .node-card .btn { width: auto; height: 30px; }
  .toolbar, .content { padding-left: 16px; padding-right: 16px; }
  .list-head { display: none; }
  .inst { grid-template-columns: 64px 1fr auto; row-gap: 6px; }
  .inst .art-thumb { width: 64px; height: 30px; }
  .inst > :nth-child(n+3):not(.actions):not(.usage) { display: none; }
  .inst > .usage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .nav-item { gap: 6px; padding: 0 8px; }
  .nav-item svg, .nav-count { display: none; }
  /* Announce keeps its icon and its tooltip; the words go. */
  #announce-btn { font-size: 0; gap: 0; padding: 0 10px; }
  .node-card .disk-line { display: none; }
  .node-line { white-space: nowrap; }
  /* A server's buttons take their own line, so its name is readable. */
  .inst { grid-template-columns: 56px 1fr; }
  .inst .art-thumb { width: 56px; height: 26px; }
  .inst > .actions { grid-column: 1 / -1; justify-content: flex-end; }
  .inst > .usage { grid-column: 1 / -1; }
}

/* Art: the picture whole (object-fit: contain) over a blurred, zoomed copy of
   itself. A Steam header fills the tile exactly; a portrait box cover gets a
   backdrop made of its own colours instead of empty bars. */
.art img.art-bg { object-fit: cover; filter: blur(14px) saturate(1.3) brightness(0.7); transform: scale(1.25); }
.art img.art-fg { object-fit: contain; }

/* ---------- adding a game ---------- */
.page-lead-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-lead-row .page-lead { flex: 1; min-width: 220px; }
.repo-packs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.repo-pack { display: flex; align-items: center; gap: 10px; }
.repo-pack-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.chip-muted { opacity: 0.75; font-style: italic; }

/* ---------- chat (ROADMAP.md §6.1) ---------- */
.chat-members { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chat-member { display: inline-flex; align-items: center; gap: 6px; }
.chat-member.muted { opacity: 0.6; }
.chat-log { max-height: 260px; min-height: 80px; overflow-y: auto; padding: 6px 2px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0; overflow-wrap: anywhere; }
.chat-line { font-size: 13.5px; line-height: 1.4; }
.chat-form { display: flex; gap: 8px; }
.chat-form .field { flex: 1; min-width: 0; }

/* ---------- official pack repository ---------- */
.official-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.official-row.hidden { display: none; }
.official-actions { display: flex; gap: 8px; }

/* Minecraft create form and moderation (MINECRAFT.md) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { height: 30px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; font-weight: 550; color: var(--text-2); cursor: pointer; }
.chip-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.mc-mem { display: grid; gap: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); }
.verdict { padding: 8px 10px; border-radius: var(--radius); font-size: 12.5px; line-height: 1.45; background: var(--surface-2); }
.verdict.ok { background: var(--ok-soft); }
.verdict.warn { background: var(--warn-soft); }
.verdict.bad { background: var(--bad-soft); }
.verdict strong { font-weight: 650; }
.warn-text { color: var(--warn); }
.check.eula, .check.boxed { align-items: flex-start; margin-top: 6px; padding: 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.check.eula input, .check.boxed input { margin-top: 2px; }
.moderation { display: flex; flex-direction: column; gap: 8px; }
.moderation h4 { font-size: 13px; font-weight: 650; margin-top: 6px; }
.mod-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.mod-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius); }
.mod-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mod-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mod-form { display: grid; grid-template-columns: 150px 1fr; gap: 6px; }
.mod-form .field:nth-child(3), .mod-form .btn { grid-column: 1 / -1; }
.modal select.field { height: 36px; }


/* Region move requests (Requests tab, through a controller). */
.req-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.req-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.req-line { font-weight: 550; overflow-wrap: anywhere; }
.chip.req-pending { background: var(--warn-soft); color: var(--warn); }
.chip.req-approved { background: var(--ok-soft); color: var(--ok); }
.chip.req-denied { background: var(--bad-soft); color: var(--bad); }
.req-card .form-actions { margin-top: 8px; }
#tab-panel-requests h3 { margin: 18px 0 8px; font-size: 14px; }

/* Account tab (accounts.rs): the QR an authenticator app scans, on white so
   every app reads it in either theme. */
.totp-qr { display: block; width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 6px; margin: 8px 0; }
#account-body { display: grid; gap: 14px; max-width: 560px; }
#account-body .panel label { display: block; margin: 10px 0 4px; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
#account-body .panel input { width: 100%; max-width: 360px; }
#account-body .panel .form-actions { margin-top: 12px; }
.acct-who { display: flex; align-items: center; gap: 8px; }
#login-code-wrap { margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; overflow-wrap: anywhere; }

/* Admin: sub-views, tables, the add-worker page, tooltips and menus. */
.adm-nav { margin-bottom: 14px; }
.adm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.adm-tab { position: relative; background: none; border: 0; padding: 9px 14px; color: var(--text-2); font: inherit; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.adm-tab:hover { color: var(--text); }
.adm-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.adm-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 11px; line-height: 18px; text-align: center; }
.adm-stack { display: grid; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.panel.center { text-align: center; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-title { margin: 0; font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.subpanel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.empty { color: var(--text-3); margin: 6px 0 2px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 16px; }
.stat-value { font-size: 22px; font-weight: 650; line-height: 1.2; }
.stat-label { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { text-align: left; color: var(--text-3); font-weight: 550; font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table td.who { white-space: normal; min-width: 150px; }
.adm-table td.act { text-align: right; width: 1%; }
.who-line { display: flex; align-items: center; gap: 8px; }
.who-name { font-weight: 600; }
.who-note { color: var(--text-3); font-size: 12px; margin-top: 2px; max-width: 360px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.up { background: var(--ok); }
.dot.down { background: var(--bad); }
.load-text { display: block; font-size: 12px; margin-bottom: 3px; }
.bar { width: 80px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.chip.st-ok { background: var(--ok-soft); color: var(--ok); }
.chip.st-warn { background: var(--warn-soft); color: var(--warn); }
.chip.st-busy { background: var(--warn-soft); color: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
.chip.st-info { background: var(--accent-soft); color: var(--accent); }
.chip.st-muted { background: var(--surface-3); color: var(--text-2); }
@keyframes pulse { 50% { opacity: 0.55; } }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.row-acts { display: flex; gap: 6px; flex: none; }
.link { background: none; border: 0; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }
.link:hover { color: var(--text); text-decoration: underline; }

/* The add-worker page. */
.adm-page { max-width: 760px; display: grid; gap: 14px; }
.page-top { margin-bottom: -6px; }
.page-h { margin: 0; font-size: 20px; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; color: var(--text-3); font-size: 13px; }
.steps li { display: flex; align-items: center; gap: 7px; padding-right: 14px; }
.steps li + li::before { content: ""; width: 22px; height: 1px; background: var(--line-strong); margin-right: 8px; }
.step-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-size: 11.5px; font-weight: 600; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active .step-n { background: var(--accent); color: var(--accent-text); }
.steps li.done .step-n { background: var(--ok-soft); color: var(--ok); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.fld label { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.fld .field { width: 100%; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.btn-row.center { justify-content: center; margin-top: 12px; }
.method-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg-b { background: var(--surface-2); border: 0; padding: 6px 14px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg-b + .seg-b { border-left: 1px solid var(--line-strong); }
.seg-b.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; letter-spacing: 0; }
.live { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-2); font-size: 13px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-ok { width: 48px; height: 48px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 24px; margin: 4px auto 10px; }

/* "?" help: the text appears on hover or focus, in one floating tip. */
.help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--text-3); font-size: 10px; font-weight: 700; line-height: 1; cursor: help; flex: none; user-select: none; }
.help:hover, .help:focus { color: var(--text); border-color: var(--text-3); outline: none; }
.tip { position: fixed; z-index: 1000; display: none; max-width: min(300px, calc(100vw - 16px)); padding: 8px 10px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); color: var(--text); font-size: 12.5px; font-weight: 450; line-height: 1.45; pointer-events: none; }
.pop-menu { position: fixed; z-index: 900; min-width: 170px; padding: 4px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); display: grid; }
.pop-item { background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.pop-item:hover { background: var(--surface-3); }
.pop-item.danger { color: var(--bad); }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
}

/* Spacing the markup once set inline; inline styles are refused by the page's
   content security policy. */
.mt-14 { margin-top: 14px; }
.mb-12 { margin-bottom: 12px; }
.form-actions.start { justify-content: flex-start; }
