/* RUKU Modded — enterprise console. Dark sidebar, light canvas, buttons everywhere. */
:root {
  --canvas: #f3f2f7;
  --surface: #ffffff;
  --ink: #201c2b;
  --muted: #6d6880;
  --faint: #9b96ab;
  --line: #e5e3ec;
  --line-strong: #d4d1de;
  --side-bg: #191322;
  --side-ink: #b9b2c9;
  --side-ink-strong: #f2eef8;
  --side-line: #2b2138;
  --gold: #e0a43c;
  --gold-deep: #b47f22;
  --primary: #322753;
  --primary-hover: #443768;
  --primary-ink: #ffffff;
  --ok: #1d8f4e;
  --ok-bg: #e7f6ed;
  --bad: #c0392b;
  --bad-bg: #fbeceb;
  --warn: #9a7b16;
  --warn-bg: #faf3d9;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --r: 8px;
  --shadow: 0 1px 2px rgba(32, 28, 43, .06), 0 1px 6px rgba(32, 28, 43, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--canvas); color: var(--ink);
  min-height: 100vh; line-height: 1.55; font-size: 14.5px;
}
a { text-decoration: none; }

/* ================= app shell ================= */
.app { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex-shrink: 0;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px; border-bottom: 1px solid var(--side-line);
}
.brand-text { color: var(--gold); font-weight: 800; letter-spacing: .18em; font-size: .95rem; }
.brand-text em { display: block; font-style: normal; color: var(--side-ink); font-size: .62rem; letter-spacing: .34em; font-weight: 600; }
.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: .66rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #6a5f80; padding: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  color: var(--side-ink); font-weight: 600; font-size: .92rem;
  padding: 9px 12px; border-radius: 7px; border-left: 3px solid transparent;
}
.nav-item:hover { background: #221a30; color: var(--side-ink-strong); }
.nav-item.on { background: #262038; color: var(--side-ink-strong); border-left-color: var(--gold); }
.nav-item svg { opacity: .75; }
.side-foot { padding: 14px 12px; border-top: 1px solid var(--side-line); }

.content { flex: 1; min-width: 0; padding: 28px 36px 20px; max-width: 1460px; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side-nav { flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .nav-label { display: none; }
  .side-foot { border-top: none; margin-left: auto; }
  .content { padding: 18px; }
}

/* ================= page chrome ================= */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 14px; margin-bottom: 20px;
}
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: .92rem; }
.hint { color: var(--faint); font-size: .8rem; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.head-actions form { margin: 0; }
footer { text-align: center; color: var(--faint); font-style: italic; padding: 26px 0 8px; font-size: .82rem; }

/* ================= cards & grid ================= */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 10px; }
h2 { font-size: .95rem; font-weight: 700; }
.card > h2 { margin-bottom: 12px; }
.count {
  background: var(--canvas); border: 1px solid var(--line); border-radius: 12px;
  padding: 1px 10px; font-size: .78rem; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid .card { margin-bottom: 0; }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: 1fr; } .cols-2 { grid-template-columns: 1fr; } }

/* ================= buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 7px; padding: 8px 16px; font-size: .9rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
button.btn { appearance: none; }
.btn-primary { background: var(--gold); color: #2a1c04; box-shadow: 0 1px 3px rgba(224, 164, 60, .4); }
.btn-primary:hover { background: #eeb44e; }
.btn-primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn-secondary { background: #fdf6ea; color: var(--gold-deep); border-color: var(--gold); }
.btn-secondary:hover { background: #faedd4; border-color: var(--gold-deep); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #e5b6b0; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 4px 12px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-side { width: 100%; background: transparent; color: var(--side-ink); border: 1px solid var(--side-line); }
.btn-side:hover { color: var(--side-ink-strong); border-color: #493a63; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.seg { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; box-shadow: var(--shadow); }
.btn-seg { border-radius: 5px; padding: 6px 18px; color: var(--muted); }
.btn-seg.on { background: var(--gold); color: #2a1c04; }
.btn-seg:not(.on):hover { background: var(--canvas); }

input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}

/* ================= forms ================= */
input, textarea {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 8px 12px; font-size: .92rem; font-family: inherit; width: 100%;
}
input::placeholder { color: var(--faint); }
.field-label { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.stack:last-child { margin-bottom: 0; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; }

/* ================= status band (dashboard) ================= */
.band { display: flex; align-items: center; gap: 20px; }
.band-main { flex: 1; min-width: 0; }
.band-title { font-size: 1.15rem; font-weight: 700; }
#srv-icon { border-radius: 8px; image-rendering: pixelated; border: 1px solid var(--line); }
.band-side { display: flex; gap: 26px; }
.kpi { text-align: right; }
.kpi span { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; display: block; }
.kpi label { color: var(--muted); font-size: .78rem; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 12px; border-radius: 14px; font-weight: 700; font-size: .8rem;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on   { background: var(--ok-bg);   color: var(--ok);   }
.pill.off  { background: var(--bad-bg);  color: var(--bad);  }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.tag {
  display: inline-block; background: var(--canvas); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 10px; margin: 2px 5px 2px 0; font-weight: 600; font-size: .85rem;
}
.addr {
  font-family: var(--mono); font-size: .98rem; color: var(--ink);
  background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 9px 15px; cursor: pointer; margin: 10px 0 4px; display: inline-block;
}
.addr:hover { border-color: var(--gold); }
.addr.copied { border-color: var(--ok); }
.addr.copied::after { content: "  ✓ copied"; color: var(--ok); font-size: .78rem; }

/* ================= list rows ================= */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.list-row:last-of-type { border-bottom: none; }
.list-row .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { color: var(--faint); font-size: .84rem; font-variant-numeric: tabular-nums; }
.list-row .actions { display: flex; gap: 8px; }
.mono { font-family: var(--mono); font-size: .86em; }

/* ================= messages ================= */
.notice {
  background: var(--ok-bg); border: 1px solid #bfe5cd; color: var(--ok);
  padding: 10px 16px; border-radius: 7px; margin-bottom: 16px; font-size: .92rem;
}
.error { color: var(--bad); margin: 8px 0; font-size: .92rem; }

/* ================= console ================= */
pre.console {
  background: #14111c; border: 1px solid #2b2138; border-radius: 7px;
  padding: 13px 15px; font-family: var(--mono); font-size: .77rem; line-height: 1.5;
  height: 420px; overflow: auto; color: #cbc5da; white-space: pre-wrap; word-break: break-word;
}

/* ================= MOTD editor ================= */
.palette { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch {
  width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--line-strong);
  cursor: pointer; padding: 0;
}
.swatch:hover { transform: scale(1.12); }
.swatch.fmt { background: var(--surface); font-weight: 700; font-size: .8rem; color: var(--ink); }
.motd-preview {
  background: #1b1b1b; border-radius: 7px; padding: 12px 16px;
  font-family: var(--mono); font-size: .95rem; line-height: 1.5; min-height: 58px;
}

/* ================= file explorer ================= */
.explorer { padding: 0; overflow: hidden; }
.crumb-bar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9fc;
}
.btn-crumb {
  background: transparent; color: var(--ink); padding: 4px 10px; font-size: .86rem;
  border-radius: 6px; font-weight: 600;
}
.btn-crumb:hover { background: var(--canvas); }
.crumb-sep { color: var(--faint); }
table.files { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.files th {
  text-align: left; font-size: .72rem; font-weight: 700; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: #faf9fc;
}
table.files td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
table.files tr:last-child td { border-bottom: none; }
.icon-cell { width: 34px; padding-right: 0 !important; }
.name-cell { font-weight: 600; }
td.meta { color: var(--faint); font-size: .83rem; }
td.num { text-align: left; }
tr.file-row[onclick] { cursor: pointer; }
tr.file-row[onclick]:hover td { background: #f6f4fa; }
pre.fileview, .editor textarea {
  background: #faf9fc; border: none; border-radius: 0;
  padding: 16px 18px; overflow: auto; font-family: var(--mono); font-size: .84rem;
  max-height: 64vh; width: 100%; line-height: 1.55;
}
.editor textarea { min-height: 52vh; resize: vertical; border-top: none; display: block; }
.editor .btn-row, .explorer .btn-row { padding: 12px 14px; border-top: 1px solid var(--line); margin: 0; }

/* ================= auth ================= */
.auth { max-width: 360px; margin: 12vh auto 0; }
.auth-card { text-align: center; padding: 34px 30px; }
.auth-card img { margin-bottom: 10px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; transform: none !important; } }

/* ---- most played ---- */
.mp-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.mp-row:last-child { border-bottom: none; }
.mp-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--canvas); border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 700; color: var(--muted); }
.mp-row:first-child .mp-rank { background: var(--gold); border-color: var(--gold); color: #2a1c04; }
.mp-name { flex: 1; font-weight: 600; color: var(--ink); }
.mp-time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: .84rem; }

/* ---- world stat tiles ---- */
.stat-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 1100px) { .stat-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } }
.stile {
  background: var(--canvas); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  transition: opacity .25s ease, transform .25s ease;
}
.stile.swap { opacity: 0; transform: translateY(8px); }
.stile-num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stile-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
