/* 导航页样式：MONKNOW 风格深色壁纸 + 玻璃拟态卡片 + 响应式网格 */

* { box-sizing: border-box; }

:root {
  --text: #eef1fa;
  --text-dim: #a3aecb;
  --accent: #7aa5ff;
  --green: #3ddc97;
  --gray: #7d879c;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.09);
  --radius: 16px;
}

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

body {
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(1100px 620px at 10% -8%, rgba(122, 92, 255, 0.30), transparent 62%),
    radial-gradient(950px 520px at 92% -4%, rgba(64, 156, 255, 0.26), transparent 60%),
    radial-gradient(1000px 720px at 50% 118%, rgba(38, 200, 180, 0.16), transparent 62%),
    linear-gradient(165deg, #0a0f20 0%, #111936 55%, #0b1127 100%);
  background-attachment: fixed;
}

/* 壁纸上的细网格纹样 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 48px);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 0%, black 20%, transparent 78%);
}

[hidden] { display: none !important; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  background: rgba(10, 14, 28, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.time-block { position: relative; z-index: 1; }

.clock {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.date {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.search-wrap {
  position: relative;
  z-index: 1;
  flex: 0 1 420px;
  min-width: 0;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-dim);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 12px 44px 12px 40px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#search::placeholder { color: var(--text-dim); }

#search:focus {
  border-color: rgba(122, 165, 255, 0.55);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 3px rgba(122, 165, 255, 0.18);
}

.search-wrap kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: inherit;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

#search:not(:placeholder-shown) + kbd { display: none; }

/* ---------- 标签页 ---------- */

.tabs {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  z-index: 1;
}

.tab {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
  border-color: rgba(122, 165, 255, 0.45);
}

.tab.is-active {
  color: #fff;
  background: rgba(122, 165, 255, 0.22);
  border-color: rgba(122, 165, 255, 0.6);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 内容区 ---------- */

.content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 8px;
}

.group { margin-bottom: 30px; }

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.group-icon { font-size: 20px; line-height: 1; }

.group-name {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.group-count {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  padding: 2px 9px;
  border-radius: 999px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

/* ---------- 卡片 ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease,
    background 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(122, 165, 255, 0.45);
  background: rgba(255, 255, 255, 0.085);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card.is-stopped { opacity: 0.55; filter: saturate(0.6); }

.card.is-disabled { cursor: not-allowed; }
.card.is-disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--card-border);
  background: var(--card-bg);
}

.card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.card-icon {
  font-size: 24px;
  line-height: 1;
  flex: none;
}

.card-icon.icon-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex: none;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.scope-chip {
  flex: none;
  font-size: 10px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  letter-spacing: 0.3px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-chip {
  font-size: 11px;
  color: var(--accent);
  background: rgba(122, 165, 255, 0.10);
  border: 1px solid rgba(122, 165, 255, 0.28);
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: background 0.15s, border-color 0.15s;
}

.domain-chip:hover {
  background: rgba(122, 165, 255, 0.2);
  border-color: rgba(122, 165, 255, 0.55);
}

.domain-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.domain-chip.is-more {
  color: var(--text-dim);
  cursor: default;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--card-border);
}

.domain-chip.is-more:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--card-border);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.status-dot.is-running {
  background: var(--green);
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.7);
}

.status-dot.is-stopped { background: var(--gray); }

.card-status { flex: none; }

.card-port {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* ---------- 加载骨架 ---------- */

.skeleton-group { margin-bottom: 30px; }

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  margin-bottom: 14px;
}

.sk-bar {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.sk-icon { width: 30px; height: 30px; border-radius: 50%; }
.sk-name { width: 45%; height: 14px; }
.sk-desc { width: 70%; height: 11px; }
.sk-foot { width: 30%; height: 11px; margin-top: 4px; }

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ---------- 错误 / 空状态 ---------- */

.error, .empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.error-icon {
  font-size: 30px;
  color: var(--accent);
}

.error-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 14px 0 6px;
}

.error-detail {
  font-size: 13px;
  margin: 0 0 18px;
  word-break: break-all;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(122, 165, 255, 0.16);
  border: 1px solid rgba(122, 165, 255, 0.45);
  padding: 9px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: rgba(122, 165, 255, 0.28); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 页脚 ---------- */

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px 20px 34px;
  color: var(--text-dim);
  font-size: 12px;
}

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

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 16px;
  }
  .time-block { text-align: center; }
  .clock { font-size: 28px; }
  .search-wrap { flex: 1 1 auto; }
  .content { padding: 20px 16px 4px; }
  .group-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-bar { animation: none; }
  .card { transition: none; }
}