/* MC 服务器状态监测 · 深色游戏风（无外部字体/图片依赖） */

:root {
  --bg: #070b14;
  --bg-soft: #0c1322;
  --panel: rgba(17, 25, 41, 0.86);
  --panel-line: rgba(94, 122, 163, 0.22);
  --text: #e8eefb;
  --text-dim: #9fb0c9;
  --text-mute: #7d8da6;
  --green: #41d17d;
  --blue: #4aa8ff;
  --amber: #f7b955;
  --red: #ff6b6b;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(74, 168, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(65, 209, 125, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(94, 122, 163, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 122, 163, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(1200px 700px at 50% 0%, #000 20%, transparent 85%);
  -webkit-mask-image: radial-gradient(1200px 700px at 50% 0%, #000 20%, transparent 85%);
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 20px;
  color: #06210f;
  background: linear-gradient(145deg, #58e894, #2fae66);
  box-shadow: 0 8px 20px rgba(65, 209, 125, 0.28);
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.3px;
}

.brand .sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  appearance: none;
  border: 1px solid var(--panel-line);
  background: rgba(30, 43, 66, 0.7);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(45, 63, 94, 0.8);
  border-color: rgba(122, 158, 209, 0.45);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(145deg, #58e894, #2fae66);
  border-color: transparent;
  color: #05230f;
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  color: var(--text-dim);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12.5px;
}

.link-btn,
.icon-btn {
  border: none;
  background: none;
  color: var(--text-mute);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.link-btn:hover,
.icon-btn:hover {
  color: var(--blue);
  background: rgba(74, 168, 255, 0.1);
}

.icon-btn.danger:hover {
  color: var(--red);
  background: rgba(255, 107, 107, 0.12);
}

/* ------------------------------ 概览卡片 ------------------------------ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(65, 209, 125, 0.85), rgba(74, 168, 255, 0.55));
  opacity: 0.8;
}

.stat-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-mute);
  letter-spacing: 0.4px;
}

.stat-value {
  display: block;
  margin: 6px 0 2px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.stat-value.online {
  color: var(--green);
}

.stat-hint {
  font-size: 11.5px;
  color: var(--text-mute);
}

/* ------------------------------ 面板 ------------------------------ */

.panel {
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
  backdrop-filter: blur(6px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.panel-head h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  margin-right: 9px;
  border-radius: 2px;
  vertical-align: -2px;
  background: linear-gradient(180deg, var(--green), rgba(65, 209, 125, 0.25));
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input {
  appearance: none;
  background: rgba(9, 15, 27, 0.85);
  border: 1px solid var(--panel-line);
  border-radius: 9px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: rgba(74, 168, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.14);
}

.input::placeholder {
  color: #5f7089;
}

#searchInput {
  width: 230px;
}

.select {
  padding-right: 26px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #7d8da6 50%),
    linear-gradient(135deg, #7d8da6 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% + 2px), calc(100% - 10px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ------------------------------ 服务器卡片 ------------------------------ */

.server-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.server-card {
  position: relative;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  background: rgba(11, 18, 31, 0.82);
  padding: 14px 16px 12px;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.server-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--green));
  opacity: 0.75;
}

.server-card:hover {
  transform: translateY(-2px);
  border-color: rgba(122, 158, 209, 0.4);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

.server-card.is-offline {
  opacity: 0.92;
}

.server-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.server-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.server-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a5566;
  flex: 0 0 auto;
}

.dot.on {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(65, 209, 125, 0.18);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(65, 209, 125, 0.16); }
  50% { box-shadow: 0 0 0 6px rgba(65, 209, 125, 0.05); }
}

.server-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.online {
  color: var(--green);
  background: rgba(65, 209, 125, 0.12);
  border-color: rgba(65, 209, 125, 0.3);
}

.badge.offline {
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.28);
}

.badge.pending {
  color: var(--amber);
  background: rgba(247, 185, 85, 0.1);
  border-color: rgba(247, 185, 85, 0.28);
}

.badge.ghost {
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--panel-line);
  font-variant-numeric: tabular-nums;
}

.server-addr {
  margin: 8px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-mute);
}

.server-addr code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #b9cbe6;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 5px;
}

.server-motd {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: pre-line;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.server-error {
  margin: 0 0 8px;
  font-size: 12px;
  color: #ffb0b0;
  background: rgba(255, 107, 107, 0.08);
  border-left: 2px solid rgba(255, 107, 107, 0.6);
  padding: 5px 8px;
  border-radius: 4px;
  word-break: break-word;
}

.capacity {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 10px;
}

.capacity > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent, var(--green)), rgba(74, 168, 255, 0.7));
  transition: width 0.5s ease;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 0;
  border-top: 1px dashed rgba(94, 122, 163, 0.2);
  border-bottom: 1px dashed rgba(94, 122, 163, 0.2);
}

.metrics > div {
  min-width: 0;
}

.metrics span {
  display: block;
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 2px;
  white-space: nowrap;
}

.metrics strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-mute);
}

.server-foot .sample {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}

/* ------------------------------ 图表 ------------------------------ */

.chart-box {
  position: relative;
  height: 300px;
  padding-top: 4px;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.empty {
  padding: 30px 12px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  border: 1px dashed rgba(94, 122, 163, 0.28);
  border-radius: 10px;
}

.empty p {
  margin: 0 0 10px;
}

.load-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #ffc9c9;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.45);
  border-radius: 8px;
  word-break: break-word;
}

.chart-box .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: none;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  margin: 6px 0 14px;
  line-height: 1.8;
}

/* ------------------------------ 定时采集 ------------------------------ */

.cron-box {
  border: 1px solid rgba(74, 168, 255, 0.28);
  background: rgba(74, 168, 255, 0.06);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.cron-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.cron-box p {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.cron-box code {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(7, 11, 20, 0.8);
  border: 1px solid var(--panel-line);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: #a9e8c3;
  word-break: break-all;
}

/* ------------------------------ 弹窗 ------------------------------ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 15, 0.72);
  backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(122, 158, 209, 0.25);
  border-radius: 16px;
  background: #0e1626;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92vh;
  overflow-y: auto;
}

.modal h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.modal label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.modal input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.form-tip {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-mute);
  line-height: 1.6;
}

/* ------------------------------ 首次运行提示 ------------------------------ */

.init-banner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(247, 185, 85, 0.35);
  background: linear-gradient(90deg, rgba(247, 185, 85, 0.14), rgba(247, 185, 85, 0.04));
  font-size: 13px;
}

.init-text {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.init-pass {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(7, 11, 20, 0.85);
  color: #ffd98a;
  border: 1px solid rgba(247, 185, 85, 0.35);
  letter-spacing: 0.6px;
  user-select: all;
}

.init-hint {
  color: var(--text-dim);
  font-size: 12px;
}

/* ------------------------------ 诊断页 ------------------------------ */

.fatal {
  margin-top: 32px;
}

.fatal h1 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #ffb0b0;
}

.fatal-msg {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid var(--red);
  font-size: 13.5px;
  word-break: break-word;
}

.diag-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 12.5px;
}

.diag-table th,
.diag-table td {
  border: 1px solid var(--panel-line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.diag-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-weight: 600;
}

.diag-table tr.ok td:nth-child(2) {
  color: var(--green);
}

.diag-table tr.bad td:nth-child(2) {
  color: var(--red);
}

.muted {
  color: var(--text-mute);
  font-size: 12px;
}

/* ------------------------------ Toast ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100vw - 40px);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--panel-line);
  background: rgba(14, 22, 38, 0.96);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.toast.success {
  border-color: rgba(65, 209, 125, 0.4);
  color: #b8f0cd;
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.42);
  color: #ffc2c2;
}

/* ------------------------------ 响应式 ------------------------------ */

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

@media (max-width: 720px) {
  .wrap {
    padding: 0 14px 44px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 14px 12px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-actions .btn {
    flex: 1 1 auto;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-value {
    font-size: 22px;
  }

  .server-list {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  #searchInput {
    width: 100%;
  }

  .panel-tools {
    width: 100%;
  }

  .panel-tools .input,
  .panel-tools .btn {
    flex: 1 1 auto;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .chart-box {
    height: 240px;
  }

  .init-banner {
    margin: 12px 14px 0;
  }
}

/* 登录框内的「忘记密码怎么办」折叠说明 */
.forgot-pass {
  margin-top: 12px;
  border: 1px solid rgba(120, 160, 255, 0.22);
  border-radius: 10px;
  background: rgba(120, 160, 255, 0.06);
  padding: 10px 12px;
}

.forgot-pass > summary {
  cursor: pointer;
  font-size: 13.5px;
  color: #9fb4d8;
  list-style: none;
  user-select: none;
}

.forgot-pass > summary::-webkit-details-marker {
  display: none;
}

.forgot-pass > summary::before {
  content: '▸ ';
  color: #41d17d;
}

.forgot-pass[open] > summary::before {
  content: '▾ ';
}

.forgot-pass[open] > summary {
  margin-bottom: 8px;
  color: #cfe0fb;
}

.forgot-body {
  font-size: 13px;
  line-height: 1.7;
  color: #a9bcd9;
}

.forgot-body p {
  margin: 6px 0;
}

.forgot-body ol {
  margin: 6px 0;
  padding-left: 20px;
}

.forgot-body li {
  margin: 8px 0;
}

.forgot-body code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  background: rgba(120, 160, 255, 0.14);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}

.forgot-body .forgot-note {
  color: #7f93b3;
  font-size: 12.5px;
}
