/* status.aizzz.xyz：浅色 / 深色跟随系统，宽屏两列分组，窄屏单列。 */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #17171a;
  --muted: #64646e;
  --line: #e5e5e9;
  --hairline: #f1f1f3;
  --chip: #f3f3f5;
  --button: #26262c;
  --button-hover: #3a3a41;
  --button-text: #ffffff;
  --up: #22c09a;
  --slow: #f8bd2a;
  --down: #f3775b;
  --none: #e4e4e8;
  --tip-bg: #ffffff;
  --tip-shadow: 0 6px 24px rgb(20 20 30 / 0.12);
  --bars: 91;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101a2c;
    --card: #101a2c;
    --text: #e6ecf5;
    --muted: #a3b0c4;
    --line: #2a3a51;
    --hairline: #1e2c42;
    --chip: #22324a;
    --button: #e3e9f2;
    --button-hover: #ffffff;
    --button-text: #101a2c;
    --none: #2c3b52;
    --tip-bg: #16233a;
    --tip-shadow: 0 6px 24px rgb(0 0 0 / 0.45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 36px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.site-header h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.refresh {
  border: 0; border-radius: 8px; padding: 9px 14px; background: var(--button); color: var(--button-text);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.15s ease;
}
.refresh:hover { background: var(--button-hover); }
.refresh:disabled { cursor: progress; opacity: 0.75; }
:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }

.card { border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.notice {
  margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--slow); border-radius: 10px;
  background: color-mix(in srgb, var(--slow) 12%, var(--card)); font-size: 13px;
}
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }

/* 主推卡 */
.featured { margin-bottom: 18px; padding: 22px 24px 18px; }
.featured-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.featured-title { min-width: 0; }
.featured-title h2 { font-size: 26px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.featured-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.featured-uptime { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.featured-uptime strong { font-size: 42px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.featured-uptime span { color: var(--muted); font-size: 12px; }
.featured .bars { height: 20px; margin-top: 16px; }
.featured-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 12px; }

/* 系统状态面板 */
.panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 24px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 18px; font-weight: 600; }
.pager { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.pager-btn {
  width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.pager-btn:hover:not(:disabled) { background: var(--chip); }
.pager-btn:disabled { color: var(--line); cursor: default; }

.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.groups[aria-busy="true"] { opacity: 0.6; }
.groups > .empty { grid-column: 1 / -1; }
.groups[data-odd="true"] > .group:last-child { grid-column: 1 / -1; }
.group { min-width: 0; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.group:nth-child(odd):not(:last-child) { border-right: 1px solid var(--hairline); }
.groups[data-odd="true"] > .group:last-child { border-right: 0; }
.group:last-child, .groups[data-odd="false"] > .group:nth-last-child(2) { border-bottom: 0; }

.group-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 0; border: 0; background: none;
  color: var(--text); font-size: 14px; text-align: left; cursor: pointer;
}
.group-name { font-weight: 500; }
.count { color: var(--muted); }
.info {
  display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid var(--muted);
  border-radius: 50%; color: var(--muted); font-size: 9px; font-style: italic; font-family: Georgia, serif; cursor: help;
}
.chevron { width: 7px; height: 7px; margin: 0 4px 0 1px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: translateY(2px) rotate(-45deg); transition: transform 0.2s ease; }
.group[data-collapsed="true"] .chevron { transform: translateY(-2px) rotate(135deg); }
.group-uptime { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 汇总竖条与分组状态图标只在收起时出现；选择器要比 .glyph / .bars 的 display 更具体。 */
.group:not([data-collapsed="true"]) .collapsed-only { display: none; }

.group-children { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.22s ease, visibility 0s; }
.group-inner { min-height: 0; overflow: hidden; }
.group[data-collapsed="true"] .group-children { grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 0.22s ease, visibility 0s 0.22s; }

.row { padding-top: 12px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-uptime { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip {
  flex-shrink: 0; border-radius: 999px; padding: 0 7px; background: var(--chip); color: var(--muted);
  font-size: 11px; line-height: 18px; font-variant-numeric: tabular-nums;
}
.featured-meta .chip { font-size: 13px; line-height: 20px; padding: 0 8px; }

.status-line { display: inline-flex; align-items: center; gap: 6px; }
.glyph {
  display: inline-grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%;
  background: var(--up); color: #ffffff; font-size: 10px; font-weight: 800; line-height: 1;
}
.glyph.slow { background: var(--slow); }
.glyph.down { background: var(--down); }
.glyph.none { background: var(--muted); }

/* 检测竖条 */
.bars {
  display: grid; grid-template-columns: repeat(var(--bars), minmax(1px, 1fr)); gap: 2px;
  height: 16px; margin-top: 8px; border-radius: 2px; touch-action: pan-y; cursor: default;
}
.group > .bars { margin-top: 10px; }
.bar { min-width: 1px; border-radius: 1.5px; background: var(--none); transition: opacity 0.1s ease; }
.bar.up { background: var(--up); }
.bar.slow { background: var(--slow); }
.bar.down { background: var(--down); }
.bars:hover .bar:not(.active), .bars:focus-visible .bar:not(.active) { opacity: 0.55; }
.bars:focus-visible { outline-offset: 3px; }

.tooltip {
  position: fixed; top: 0; left: 0; z-index: 1000; min-width: 220px; max-width: min(320px, calc(100vw - 16px));
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--tip-bg);
  box-shadow: var(--tip-shadow); font-size: 13px; pointer-events: none; opacity: 0; transform: translate(-1000px, -1000px);
}
.tooltip.visible { opacity: 1; }
.tooltip.info-tip { min-width: 0; color: var(--muted); }
.tip-time { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--hairline); color: var(--muted); font-variant-numeric: tabular-nums; }
.tooltip.info-tip .tip-line { display: block; }
.tip-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tip-latency { color: var(--muted); font-variant-numeric: tabular-nums; }

.site-footer { padding-top: 30px; text-align: center; color: var(--muted); }
.powered { font-size: 14px; }
.powered a { color: var(--text); font-weight: 700; text-decoration: none; }
.powered a:hover { text-decoration: underline; }
.disclaimer { max-width: 640px; margin: 14px auto 0; font-size: 12px; line-height: 1.5; }

@media (max-width: 767px) {
  .page { width: calc(100% - 32px); padding-top: 20px; }
  .site-header h1 { font-size: 23px; }
  .featured { padding: 16px; }
  .featured-title h2 { font-size: 21px; }
  .featured-uptime strong { font-size: 32px; }
  .featured-foot { flex-direction: column; gap: 2px; }
  .panel-head { justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .pager { font-size: 12px; }
  .groups { grid-template-columns: minmax(0, 1fr); }
  .groups[data-odd="true"] > .group:last-child { grid-column: auto; }
  .group:nth-child(odd):not(:last-child) { border-right: 0; }
  .group:last-child { border-bottom: 0; }
  .groups[data-odd="false"] > .group:nth-last-child(2) { border-bottom: 1px solid var(--hairline); }
  .row-head { flex-wrap: wrap; row-gap: 2px; }
  .row-uptime { margin-left: auto; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
