:root {
  --bg: #0b1220;
  --bg-soft: #111a2b;
  --card: #131d31;
  --line: #22304a;
  --text: #e6edf7;
  --muted: #8ba0bf;
  --accent: #4fd1a1;
  --danger: #f2545b;
  --warn: #f2b544;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 15% -10%, #16233a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
button {
  font: inherit; color: var(--text); background: #1d2b45; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: .15s;
}
button:hover { background: #26385a; }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; }
button.tiny { padding: 4px 10px; font-size: 12px; }
button.danger { border-color: #6a2a30; color: #ff8b90; }
button.warn { border-color: #6a5324; color: var(--warn); }
input, select {
  font: inherit; color: var(--text); background: #0d1626; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.hidden { display: none !important; }
.msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
.inline-msg { margin-left: 10px; }

/* 登录 */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-card label { display: block; margin: 20px 0 8px; color: var(--muted); font-size: 13px; }
.login-card button { width: 100%; margin-top: 16px; background: var(--accent); color: #06231a; border: 0; font-weight: 600; }
.login-card button:hover { filter: brightness(1.08); background: var(--accent); }
.hint { color: #6d84a4; font-size: 12px; margin-top: 14px; line-height: 1.5; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 16px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.brand.small h1 { font-size: 15px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #4fd1a1, #2b8fbe); color: #06231a; font-weight: 800; font-size: 19px;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: rgba(11,18,32,.9);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 12px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.pill.up { color: #0c2c20; background: var(--accent); border-color: transparent; font-weight: 600; }
.pill.down { color: #2c0c0e; background: var(--danger); border-color: transparent; font-weight: 600; }

/* 布局 */
.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; padding: 20px 22px 40px; max-width: 1240px; margin: 0 auto;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.card.span2 { grid-column: span 2; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { font-size: 14px; letter-spacing: .2px; }
.tip { color: var(--muted); font-size: 12px; }
.sub-head { font-size: 13px; color: var(--muted); margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: #0e1727; border: 1px solid #1b2a42; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat b { font-size: 15px; font-weight: 600; }
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.player { background: #16324a; color: #9fe0ff; border-radius: 999px; padding: 3px 12px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* 配置 */
.config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; }
.field.bool { flex-direction: row; align-items: center; justify-content: space-between; background: #0e1727; border: 1px solid #1b2a42; border-radius: 10px; padding: 9px 12px; }
.switch { position: relative; width: 42px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #243449; border-radius: 999px; cursor: pointer; transition: .2s;
}
.switch i::after {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  background: #8ba0bf; top: 3px; left: 3px; transition: .2s;
}
.switch input:checked + i { background: rgba(79,209,161,.35); }
.switch input:checked + i::after { background: var(--accent); transform: translateX(19px); }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #0e1727; border: 1px solid #1b2a42; border-radius: 10px; padding: 9px 12px;
  font-size: 13px;
}
.row .meta { color: var(--muted); font-size: 12px; }
.small-list .row { padding: 6px 10px; font-size: 12px; }
.inline { display: flex; gap: 10px; align-items: center; }
.inline button { flex: none; }
input[type="file"] { padding: 6px 8px; }

.console-out, .logs {
  background: #080e18; border: 1px solid #1b2a42; border-radius: 10px; padding: 12px;
  font: 12px/1.6 "Cascadia Code", Consolas, monospace; color: #a8c6e6;
  white-space: pre-wrap; word-break: break-all; overflow: auto; margin: 0;
}
.console-out { min-height: 120px; max-height: 220px; }
.logs { height: 260px; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .card.span2 { grid-column: span 1; }
  .stats, .config-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
