:root {
  --bg: #0d0b14;
  --panel: #16131f;
  --panel2: #1e1a2b;
  --line: #2c2640;
  --text: #ece9f5;
  --muted: #9a93b3;
  --accent: #8b5cf6;
  --accent2: #a78bfa;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2a1650 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
a { color: var(--accent2); cursor: pointer; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
h1 { font-size: 26px; margin: 0 0 16px; }
h1 small { color: var(--muted); font-size: 16px; font-weight: 500; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--accent2); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.err { color: #fca5a5; min-height: 20px; font-size: 14px; }

input, select {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.chk { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
label.chk input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); background: #2a2340; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.good { border-color: #1f6f3d; color: #86efac; }
.btn.warnb { border-color: #7a5410; color: #fcd34d; }
.btn.bad { border-color: #7f1d1d; color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 12px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

.row { display: flex; gap: 10px; align-items: center; }
.row > input { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-size: 18px; }
.brand small { color: var(--muted); }
.brand.big b { font-size: 22px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #a78bfa, #6d28d9); font-weight: 900; font-size: 22px;
  box-shadow: 0 6px 20px rgba(139,92,246,.45);
}

/* Layout */
.app { display: flex; min-height: 100%; }
.side {
  width: 230px; flex-shrink: 0; background: rgba(22,19,31,.85); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh;
}
nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
nav a i { font-style: normal; width: 22px; text-align: center; }
nav a:hover { background: var(--panel2); color: var(--text); }
nav a.active { background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(109,40,217,.15)); color: var(--text); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }
main { flex: 1; padding: 28px; max-width: 1300px; min-width: 0; }

.warn { background: #3b1d0a; border: 1px solid #7a3d10; color: #fed7aa; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { font-size: 24px; }
.stat small { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 { margin-bottom: 18px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.on { color: #86efac; } .off { color: #fca5a5; } .mid { color: #fcd34d; }
.dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); }
.dot.off { background: var(--bad); }
.dot.mid { background: var(--warn); }
.badge { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--panel2); }
.badge.on { background: #0f3a22; } .badge.off { background: #3a1010; } .badge.mid { background: #3a2a08; }

.feed { height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; margin-bottom: 10px; font-size: 14px; }
.feed.short { height: 200px; }
.feed.tall { height: 70vh; }
.feed .e { padding: 5px 8px; border-radius: 8px; background: var(--panel2); word-break: break-word; }
.feed .e.sys { color: var(--muted); font-style: italic; background: transparent; }
.feed .e .tm { color: var(--muted); font-size: 12px; margin-right: 8px; }
.feed .e b { color: var(--accent2); }

.console {
  height: 60vh; overflow: auto; background: #07060b; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 12px 0; font: 12.5px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all;
}
.console .w { color: #fcd34d; } .console .x { color: #fca5a5; } .console .c { color: #c4b5fd; } .console .j { color: #86efac; }
.prompt { color: var(--accent2); font-weight: 900; font-family: monospace; }

.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pl { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pl .top { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.pl img { width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; background: var(--panel2); }
.pl .btns .btn { padding: 5px 8px; font-size: 12px; }
.empty { color: var(--muted); padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-bottom: 14px; font-size: 14px; }
.kv span { color: var(--muted); }
.msa { border-color: var(--accent); background: linear-gradient(135deg, #22164a, #16131f); }
.msa .code { font: 900 34px/1 ui-monospace, monospace; letter-spacing: .15em; padding: 14px; background: #0b0913; border-radius: 12px; text-align: center; margin: 10px 0; user-select: all; }
.hotbar { display: flex; gap: 4px; }
.hotbar button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font-weight: 700; }
.hotbar button.sel { border-color: var(--accent); background: #2e2250; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.inv div { background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.inv div b { float: right; color: var(--accent2); }

.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; }
.rule.off { opacity: .55; }
.rule .body { flex: 1; min-width: 0; }
.rule .body b { display: block; font-size: 15px; }
.rule .body small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule .flash { animation: flash 1s; }
@keyframes flash { from { background: #3b2a6b; } to { background: transparent; } }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #3a3450; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: var(--panel2); border-radius: 99px; padding: 5px 8px 5px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.chip button { background: none; border: 0; color: #fca5a5; cursor: pointer; font-size: 14px; }

.modal { position: fixed; inset: 0; background: rgba(5,4,10,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; overflow-y: auto; }
.modal-box { width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.act { display: flex; gap: 8px; align-items: center; }
.act select { width: 190px; flex-shrink: 0; }
.act input { flex: 1; }
.act .x { background: none; border: 0; color: #fca5a5; font-size: 18px; cursor: pointer; }

.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; max-width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: in .2s; }
.toast.bad { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 10; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; overflow-x: auto; }
  .side .brand small, .side-foot span { display: none; }
  nav { flex-direction: row; gap: 2px; }
  nav a { padding: 8px 10px; font-size: 13px; }
  nav a i { display: none; }
  .side-foot { margin: 0; }
  main { padding: 16px; }
  h1 { font-size: 22px; }
  .act { flex-wrap: wrap; }
  .act select { width: 100%; }
}

textarea { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.grid2.tight { gap: 12px; margin-bottom: 0; }
.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sv { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sv.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(139,92,246,.15); }
.sv .top { display: flex; gap: 12px; align-items: center; }
.sv .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; font-size: 22px; flex-shrink: 0; overflow: hidden; }
.sv .ico img { width: 100%; height: 100%; image-rendering: pixelated; }
.sv .top b { display: block; }
.sv .top small { color: var(--muted); word-break: break-all; }
.sv .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.tag.own { background: #0f3a22; color: #86efac; }
.tag.ext { background: #1e2a4a; color: #93c5fd; }
.tag.cur { background: #2e2250; color: #c4b5fd; }
.sv .motd { font-size: 13px; color: var(--muted); min-height: 18px; }
.ping { background: var(--panel2); border-radius: 10px; padding: 12px; margin-top: 12px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.ping img { width: 48px; height: 48px; border-radius: 8px; image-rendering: pixelated; }
.rule .where { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 8px; vertical-align: 2px; }
.rule .where.ext { background: #1e2a4a; color: #93c5fd; }
option:disabled { color: #5c5572; }
