/* mcproxy-admin — 深夜机房面板
   钢灰中性色 + 单一琥珀指示灯；层次靠表面明度，不靠阴影。 */

:root {
  --bg: #0e1113;
  --surface: #14181b;
  --surface-2: #191e22;
  --surface-3: #1f2529;
  --line: rgba(226, 232, 236, 0.08);
  --line-2: rgba(226, 232, 236, 0.14);
  --text: #e5e9ec;
  --text-2: #9aa4ab;
  --text-3: #6a747b;
  --amber: #d9a441;
  --amber-soft: rgba(217, 164, 65, 0.12);
  --red: #c4665a;
  --red-soft: rgba(196, 102, 90, 0.1);
  --r-1: 6px;
  --r-2: 8px;
  --r-3: 12px;
  --sans: "Inter", "Helvetica Neue", "Noto Sans SC", "Source Han Sans SC",
    "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0, 0.1, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

::selection { background: rgba(217, 164, 65, 0.25); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(226, 232, 236, 0.12);
  border-radius: 8px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(226, 232, 236, 0.2); }

:focus-visible {
  outline: 2px solid rgba(217, 164, 65, 0.5);
  outline-offset: 1px;
}

.micro {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }

/* ── 品牌 ─────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 8px; }
.mark {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--amber);
  flex: none;
}
.brand-name { font-size: 13px; font-weight: 500; color: var(--text); }

/* ── 登录 ─────────────────────────────────────────────────── */
.auth { display: none; min-height: 100dvh; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }
.auth.is-active { display: grid; }

.auth-brand {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.auth-brand .brand-name { font-size: 14px; }
.brand-sub { margin: 8px 0 0 16px; font-size: 12px; color: var(--text-3); }

.spec-block { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); }
.spec-label { margin-bottom: 10px; }
.auth-meta { margin-top: 0; }
.spec { display: grid; gap: 6px; }
.spec > div { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: baseline; }
.spec dt { font-size: 11px; color: var(--text-3); }
.spec dd { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

.auth-panel { display: flex; align-items: center; padding: 48px clamp(48px, 10vw, 168px) 48px clamp(40px, 8vw, 120px); }
.auth-form { width: 100%; max-width: 340px; }
.auth-form h1 { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.hint { margin: 6px 0 26px; font-size: 12.5px; color: var(--text-3); }

/* ── 控件 ─────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}
.field-note { font-size: 11px; color: var(--text-3); margin: -6px 0 14px; }

input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  background: #0f1315;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  transition: border-color 120ms var(--ease);
}
input::placeholder { color: var(--text-3); }
input:hover { border-color: rgba(226, 232, 236, 0.2); }
input:focus { outline: none; border-color: rgba(217, 164, 65, 0.65); background: #11161a; }
input:focus-visible { outline: 1px solid rgba(217, 164, 65, 0.3); outline-offset: 1px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease),
    color 120ms var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(226, 232, 236, 0.2); }
.btn:active { background: #232a2f; }
.btn[disabled] { opacity: 0.55; cursor: default; }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #191307;
  font-weight: 500;
}
.btn-primary:hover { background: #e2b155; border-color: #e2b155; }
.btn-primary:active { background: #cf9c3c; }

.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--surface-3); color: var(--text); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }

.btn-icon { width: 30px; height: 30px; padding: 0; }

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(196, 102, 90, 0.4);
  color: #e2a49b;
}
.btn-danger:hover { background: rgba(196, 102, 90, 0.18); border-color: rgba(196, 102, 90, 0.6); color: #f0b8af; }

.btn-block { width: 100%; height: 38px; }
.auth-foot { margin-top: 12px; line-height: 1.5; }

.form-error { min-height: 18px; margin: 0 0 8px; font-size: 12px; color: var(--red); }

/* ── 顶栏 ─────────────────────────────────────────────────── */
.app { display: none; height: 100dvh; flex-direction: column; }
.app.is-active { display: flex; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-target {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--text-3);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.metric { display: flex; align-items: baseline; gap: 6px; }
.metric-label { font-size: 11px; color: var(--text-3); }
.metric-value {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* ── 主区域 ───────────────────────────────────────────────── */
.main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 20px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 16px;
  align-items: stretch;
  grid-template-rows: minmax(0, 1fr);
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 0; }
.panel-grow { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-grow .log { flex: 1; max-height: none; min-height: 180px; }

/* ── 面板 ─────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head > .icon { color: var(--text-3); }
.panel-head h2 { font-size: 12.5px; font-weight: 500; }
.panel-head .count { margin-left: auto; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── 在线玩家表 ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.grid td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(226, 232, 236, 0.05);
  color: var(--text-2);
  white-space: nowrap;
}
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: rgba(226, 232, 236, 0.025); }
.grid .col-action { width: 44px; text-align: right; }

.cell-player { display: flex; align-items: center; gap: 8px; }
.cell-player .name { color: var(--text); font-weight: 500; }
.cell-player .uuid { font-size: 10.5px; color: var(--text-3); }
.grid .num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.grid .target { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

.row-action {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color 120ms var(--ease), background-color 120ms var(--ease),
    border-color 120ms var(--ease);
}
.row-action:hover { color: var(--red); background: var(--red-soft); border-color: rgba(196, 102, 90, 0.35); }

.empty {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 26px 14px;
  color: var(--text-3);
}
.empty > .icon { margin-top: 1px; }
.empty p { font-size: 12.5px; }
.empty .micro { margin-top: 2px; font-family: var(--mono); font-size: 11px; }

/* ── 名单 ─────────────────────────────────────────────────── */
.list { max-height: 340px; overflow-y: auto; }
.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid rgba(226, 232, 236, 0.05);
}
.list-row:last-child { border-bottom: 0; }
.list-row .name {
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-row .rm {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms var(--ease), color 120ms var(--ease), background-color 120ms var(--ease);
}
.list-row:hover .rm, .rm:focus-visible { opacity: 1; }
@media (hover: none) { .list-row .rm { opacity: 1; } }
.list-row .rm:hover { color: var(--red); background: var(--red-soft); }
.list-empty { padding: 14px; font-size: 12px; color: var(--text-3); }

.add-row {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.add-row input { height: 30px; font-size: 12.5px; }
.add-row .btn { height: 30px; padding: 0 10px; }

.micro.is-on { color: var(--amber); }

/* ── 开关 ─────────────────────────────────────────────────── */
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform 140ms var(--ease), background-color 140ms var(--ease);
}
.switch[aria-checked="true"] {
  background: var(--amber-soft);
  border-color: rgba(217, 164, 65, 0.5);
}
.switch[aria-checked="true"]::after { transform: translateX(14px); background: var(--amber); }

/* ── 日志 ─────────────────────────────────────────────────── */
.log {
  max-height: 288px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
}
.log-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(226, 232, 236, 0.04);
}
.log-row:last-child { border-bottom: 0; }
.log-time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.log-msg { color: var(--text-2); word-break: break-word; }
.log-msg em { font-style: normal; color: var(--text); }

/* ── 弹窗 ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 10, 11, 0.72);
}
.modal {
  width: 100%;
  max-width: 348px;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-3);
}
.modal h2 { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.modal-body { font-size: 12.5px; color: var(--text-2); margin-bottom: 18px; }
.modal-body strong { color: var(--text); font-weight: 500; font-family: var(--mono); }
.modal .field:first-of-type { margin-top: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal .form-error { margin-bottom: 0; }

/* ── 提示 ─────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 320px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--text-3);
  border-radius: var(--r-2);
  font-size: 12.5px;
  color: var(--text);
}
.toast.is-ok { border-left-color: var(--amber); }
.toast.is-err { border-left-color: var(--red); }
.toast .icon { margin-top: 2px; }

/* ── 窄屏 ─────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .app { height: auto; }
  .main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; align-items: start; }
  .panel-grow, .panel-grow .log { flex: none; }
  .panel-grow .log { max-height: 288px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .spec-block { display: none; }
  .auth-meta { display: none; }
  .auth-panel { padding: 32px 20px 48px; align-items: flex-start; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-target { display: none; }
  .topbar-right { gap: 10px; }
  .main { padding: 14px 12px 24px; }
}
