/* Uptime Status — 现代卡片风 / 手动切换深浅色 */

:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --glow-1: rgba(23, 178, 106, 0.16);
  --glow-2: rgba(56, 130, 246, 0.13);
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eaeff6;
  --border: #e6eaf1;
  --border-strong: #d5deea;
  --text: #0f1729;
  --text-muted: #5b6a83;
  --text-faint: #93a0b4;
  --accent: #17b26a;
  --accent-2: #34d17f;
  --accent-text: #079455;
  --accent-soft: rgba(23, 178, 106, 0.12);
  --danger: #e5484d;
  --danger-2: #f2686c;
  --danger-text: #ce2c31;
  --danger-soft: rgba(229, 72, 77, 0.12);
  --bar-none: #e4e9f0;
  --header-bg: rgba(255, 255, 255, 0.78);
  --tooltip-bg: #0f1729;
  --tooltip-text: #f4f7fb;
  --shadow-card: 0 1px 2px rgba(15, 23, 41, 0.04), 0 14px 30px -18px rgba(15, 23, 41, 0.3);
  --shadow-hover: 0 2px 6px rgba(15, 23, 41, 0.07), 0 26px 44px -20px rgba(15, 23, 41, 0.36);
  --radius-lg: 18px;
  --radius-md: 12px;
}

/* 深色主题：只由右上角按钮控制（不跟随系统） */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d17;
  --glow-1: rgba(23, 178, 106, 0.22);
  --glow-2: rgba(56, 130, 246, 0.2);
  --surface: #0f172a;
  --surface-2: #141e33;
  --surface-3: #1b2740;
  --border: #1e2a41;
  --border-strong: #2b3a55;
  --text: #e8eefb;
  --text-muted: #94a4bf;
  --text-faint: #6b7c99;
  --accent: #22c07a;
  --accent-2: #3ee08f;
  --accent-text: #4ade9a;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --danger: #f0575c;
  --danger-2: #ff7a7e;
  --danger-text: #ff8b8f;
  --danger-soft: rgba(240, 87, 92, 0.16);
  --bar-none: #22304a;
  --header-bg: rgba(11, 17, 30, 0.72);
  --tooltip-bg: #e8eefb;
  --tooltip-text: #0b1220;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 34px -20px rgba(0, 0, 0, 0.8);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.45), 0 28px 48px -22px rgba(0, 0, 0, 0.9);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 10% -12%, var(--glow-1), transparent 62%),
    radial-gradient(820px 460px at 92% -6%, var(--glow-2), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 顶部导航 */
#header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

#header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: live 2.4s ease infinite;
}

@keyframes live {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 9px transparent; }
}

.navi {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navi a {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.navi a:hover { background: var(--surface-2); color: var(--text); }

/* 深浅色切换按钮 */
.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

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

.theme-toggle svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .ico-moon { display: none; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ico-moon { display: block; }

/* 站点列表
   注意：这里不能用 position / transform，
   否则会成为 tooltip 绝对定位的参照物，把气泡挤成竖排文字 */
#uptime {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 0 6px;
}

.site {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 15px;
  transition: box-shadow 0.24s ease, border-color 0.24s ease;
}

.site:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* 外链图标 */
.link {
  flex: none;
  width: 14px;
  height: 14px;
  text-indent: -99999px;
  overflow: hidden;
  background-color: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3zM5 5h6V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-6h-2v6H5V5z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3zM5 5h6V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-6h-2v6H5V5z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transition: background-color 0.18s ease;
}

.link:hover { background-color: var(--accent); }

/* 状态徽章 */
.status {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--text-muted);
  --ring: transparent;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--ring);
}

.status.ok { --ring: var(--accent-soft); background: var(--accent-soft); color: var(--accent-text); }

.status.down {
  --ring: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.status.down::before { animation: live 1.8s ease infinite; }

.status.unknow { background: var(--surface-3); color: var(--text-muted); }

/* 时间轴 */
.timeline {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 34px;
  margin: 16px 0 9px;
}

.timeline i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px;
  background: var(--bar-none);
  box-shadow: inset 0 -10px 14px -12px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.timeline i.ok { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.timeline i.down { background: linear-gradient(180deg, var(--danger-2), var(--danger)); }
.timeline i.none { background: var(--bar-none); }

.timeline i:hover { transform: scaleY(1.12); filter: saturate(1.2) brightness(1.04); }

/* 汇总 */
.summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 11px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.summary span:nth-child(2) { min-width: 0; flex: 1; }
.summary span:first-child,
.summary span:last-child { flex: none; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* 加载态 */
.loading {
  width: 36px;
  height: 36px;
  margin: 30px auto;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 提示气泡
   强制按内容宽度排版，避免被容器挤成竖排 */
.tooltip {
  width: max-content !important;
  max-width: min(340px, calc(100vw - 28px)) !important;
  white-space: normal !important;
  padding: 8px 11px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  background-color: var(--tooltip-bg) !important;
  color: var(--tooltip-text) !important;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.55) !important;
  font-variant-numeric: tabular-nums;
}

/* 页脚 */
#footer {
  padding: 28px 0 44px;
  text-align: center;
  font-size: 12.5px;
  line-height: 2;
  color: var(--text-faint);
}

#footer a {
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

#footer a:hover { color: var(--accent-text); border-bottom-color: currentColor; }

/* 手机端 */
@media (max-width: 680px) {
  .container { padding: 0 14px; }

  /* 顶栏保持单行：logo 靠左，导航 + 主题按钮靠右，都不换行 */
  #header .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .logo { flex: 0 1 auto; min-width: 0; font-size: 15px; gap: 7px; }
  .logo::before { width: 9px; height: 9px; box-shadow: 0 0 0 3px var(--accent-soft); }

  .navi {
    flex: none;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0;
    margin-left: auto;
  }
  .navi a { padding: 5px 7px; font-size: 12px; }
  .theme-toggle { width: 28px; height: 28px; margin-left: 4px; }

  #uptime { padding-top: 18px; gap: 11px; }

  .site { padding: 15px 14px 13px; border-radius: var(--radius-md); }

  .meta { flex-wrap: wrap; gap: 6px 10px; }
  .name { flex: 1 1 auto; min-width: 0; font-size: 14.5px; }

  .timeline { height: 26px; gap: 1px; margin: 12px 0 8px; }
  .timeline i { border-radius: 2px; }

  /* 汇总分两行：第一行「今天 …… 日期」，第二行说明文字 */
  .summary { flex-wrap: wrap; align-items: baseline; gap: 3px 10px; font-size: 12px; }
  .summary span:first-child { order: 1; }
  .summary span:last-child { order: 2; margin-left: auto; }
  .summary span:nth-child(2) { order: 3; flex: 1 1 100%; min-width: 0; }

  .status { padding: 4px 9px 4px 7px; }
}

/* 超窄屏（320 ~ 380px）：进一步压缩，保证顶栏仍是一行 */
@media (max-width: 380px) {
  .logo { font-size: 14px; gap: 6px; }
  .navi a { padding: 5px 6px; font-size: 11.5px; }
  .theme-toggle { width: 26px; height: 26px; margin-left: 3px; }
}

/* 无障碍 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
