:root {
  --page: #ffffff;
  --ink: #111318;
  --muted: #747987;
  --faint: #9da2ad;
  --border: #dfe1e5;
  --divider: #eef0f2;
  --hover: #f7f8f8;
  --green: #20b889;
  --green-soft: #e7f8f2;
  --yellow: #f7b51d;
  --yellow-soft: #fff3c4;
  --orange: #f58a51;
  --red: #e95055;
  --red-soft: #ffebec;
  --gray-bar: #e7e8eb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(18, 22, 33, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  width: 100%;
  max-width: 718px;
  margin: 0 auto;
  padding: 32px 24px 36px;
  flex: 1;
}

.status-header {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-intro {
  margin: -6px 0 18px;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.service-tabs {
  min-width: 0;
  margin-left: auto;
  padding: 3px;
  border: 1px solid #e1e3e7;
  border-radius: 7px;
  background: #f5f6f7;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.service-tabs::-webkit-scrollbar {
  display: none;
}

.service-tab {
  min-width: 72px;
  height: 28px;
  padding: 0 11px;
  border-radius: 4px;
  color: #727783;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 680;
  letter-spacing: .075em;
  line-height: 1;
  text-decoration: none;
  transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.service-tab:hover {
  color: #24272d;
  background: rgba(255, 255, 255, .72);
}

.service-tab.is-active {
  color: #fff;
  background: #292b31;
  box-shadow: 0 1px 3px rgba(17, 19, 24, .18);
}

.wordmark {
  color: #08090a;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.8px;
  line-height: 1;
  text-decoration: none;
}

.wordmark-mark {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: #fff;
  background: #111318;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wordmark-mark svg {
  width: 17px;
  height: 17px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checker-link {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #d4d7dc;
  border-radius: 5px;
  color: #555b66;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 570;
  text-decoration: none;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.checker-link:hover {
  color: var(--ink);
  border-color: #b9bdc4;
  background: #fafafa;
}

.checker-link svg {
  width: 16px;
  height: 16px;
}

.language-button {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #d4d7dc;
  border-radius: 5px;
  color: #555b66;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.02em;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.language-button:hover {
  color: var(--ink);
  border-color: #b9bdc4;
  background: #fafafa;
}

.primary-button,
.outline-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.primary-button {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 5px;
  color: #fff;
  background: #292b31;
  font-size: 13px;
  font-weight: 600;
}

.primary-button:hover {
  background: #111318;
}

.primary-button svg,
.outline-button svg {
  width: 17px;
  height: 17px;
}

.primary-button:disabled,
.outline-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.loading-card,
.empty-card {
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #dfe1e5;
  border-top-color: #4b4f58;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.health-banner {
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.health-banner.degraded {
  border-color: var(--yellow);
}

.health-banner.down {
  border-color: var(--red);
}

.health-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  background: var(--green-soft);
  font-size: 15px;
  font-weight: 570;
}

.health-banner.degraded .health-head {
  background: var(--yellow-soft);
}

.health-banner.down .health-head {
  background: var(--red-soft);
}

.status-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--green);
}

.status-icon.degraded,
.status-icon.maintenance {
  color: var(--yellow);
}

.status-icon.down {
  color: var(--red);
}

.status-icon.unknown {
  color: var(--faint);
}

.health-meta {
  margin-left: auto;
  color: #6f7380;
  font-size: 12px;
  font-weight: 400;
}

.health-services {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding: 16px;
  border-top: 1px solid var(--divider);
}

.service-pill {
  border-radius: 4px;
  padding: 3px 9px;
  color: #8b5700;
  background: #fff0cb;
  font-size: 13px;
  font-weight: 520;
}

.health-banner.down .service-pill {
  color: #a92c32;
  background: #ffe3e4;
}

.incident-preview-list {
  border-top: 1px solid var(--divider);
}

.incident-preview {
  display: flex;
  gap: 10px;
  padding: 15px 16px 16px;
  color: inherit;
  text-decoration: none;
}

.incident-preview + .incident-preview {
  border-top: 1px solid var(--divider);
}

.incident-preview:hover {
  background: var(--hover);
}

.incident-preview-body {
  min-width: 0;
}

.incident-preview-title {
  margin-bottom: 5px;
  color: var(--ink);
  font-weight: 560;
}

.incident-preview-text {
  margin-bottom: 7px;
  color: #333741;
  font-size: 13px;
}

.incident-preview-meta {
  color: var(--muted);
  font-size: 12px;
}

.system-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.system-card-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
}

.system-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.system-heading h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 570;
  letter-spacing: -0.1px;
}

.date-window {
  color: #959aa6;
  font-size: 12px;
  white-space: nowrap;
}

.date-window::before {
  content: "‹";
  padding-right: 8px;
  color: #a9adb6;
  font-size: 20px;
  line-height: 0;
  vertical-align: -1px;
}

.date-window::after {
  content: "›";
  padding-left: 8px;
  color: #d5d7dc;
  font-size: 20px;
  line-height: 0;
  vertical-align: -1px;
}

.last-update {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platforms {
  display: block;
}

.service-row {
  border-bottom: 1px solid var(--divider);
  background: #fff;
}

.service-row:last-child {
  border-bottom: 0;
}

.service-summary {
  list-style: none;
  padding: 15px 16px 14px;
  cursor: pointer;
  user-select: none;
}

.service-summary::-webkit-details-marker {
  display: none;
}

.service-summary:hover {
  background: #fcfcfd;
}

.service-line {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-info {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9bdc5;
  border-radius: 50%;
  color: #999ea9;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.component-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.component-count svg {
  width: 10px;
  height: 6px;
  color: #b2b6bf;
  transition: transform 160ms ease;
}

.service-row[open] .component-count svg {
  transform: rotate(180deg);
}

.service-source-type {
  overflow: hidden;
  color: #a0a4ae;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-uptime {
  margin-left: auto;
  color: #959aa5;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-bars {
  height: 16px;
  display: grid;
  grid-template-columns: repeat(90, minmax(1px, 1fr));
  gap: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.history-bar {
  min-width: 2px;
  height: 16px;
  border-radius: 1px;
  background: var(--gray-bar);
}

.history-bar.ok {
  background: #21be8b;
}

.history-bar.degraded,
.history-bar.maintenance {
  background: #f8b91f;
}

.history-bar.down {
  background: #f36f5d;
}

.history-bar.unknown {
  background: #e4e6e9;
}

.service-detail {
  padding: 0 16px 16px 40px;
}

.detail-inner {
  padding-top: 13px;
  border-top: 1px solid var(--divider);
}

.source-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.source-line a,
.incident-link {
  color: #4c5566;
  text-decoration: underline;
  text-decoration-color: #c2c6ce;
  text-underline-offset: 2px;
}

.source-line a:hover,
.incident-link:hover {
  color: var(--ink);
}

.source-badge {
  border-radius: 4px;
  padding: 2px 6px;
  color: #256c56;
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 620;
}

.source-badge.probe {
  color: #72581b;
  background: #fff2cf;
}

.detail-section {
  margin-top: 16px;
}

.detail-title {
  margin: 0 0 8px;
  color: #5f6470;
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

.component-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f5;
}

.component-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--faint);
}

.component-dot.ok { background: var(--green); }
.component-dot.degraded,
.component-dot.maintenance { background: var(--yellow); }
.component-dot.down { background: var(--red); }

.component-name {
  overflow: hidden;
  color: #383c44;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-state {
  margin-left: auto;
  color: #989da7;
  font-size: 10px;
  white-space: nowrap;
}

.incident-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.incident-item {
  padding: 9px 10px;
  border-radius: 5px;
  background: #f8f8f9;
}

.incident-title {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #30333a;
  font-size: 12px;
  font-weight: 540;
}

.incident-meta {
  margin: 3px 0 0 14px;
  color: var(--muted);
  font-size: 11px;
}

.no-data {
  color: #a0a4ad;
  font-size: 12px;
}

.history-action {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.outline-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cfd2d7;
  border-radius: 6px;
  color: #1f2228;
  background: #fff;
  font-size: 13px;
  box-shadow: 0 1px 1px rgba(20, 24, 34, 0.02);
}

.outline-button:hover {
  border-color: #b9bdc4;
  background: #fafafa;
}

.footer {
  width: 100%;
  max-width: 718px;
  margin: 0 auto;
  padding: 54px 24px 31px;
  color: #9a9eaa;
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
}

.footer p {
  margin: 0 auto;
  max-width: 660px;
}

.footer .powered {
  margin-bottom: 17px;
  color: #858a96;
  font-size: 12px;
  font-weight: 540;
}

@media (max-width: 640px) {
  .page-main {
    padding: 18px 16px 28px;
  }

  .status-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 18px;
  }

  .page-intro {
    margin-top: 0;
  }

  .service-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin-left: 0;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .wordmark {
    grid-column: 1;
    grid-row: 1;
  }

  .wordmark {
    font-size: 20px;
  }

  .wordmark-mark {
    width: 23px;
    height: 23px;
  }

  .primary-button {
    min-height: 32px;
    padding: 6px 9px;
  }

  .checker-link {
    width: 32px;
    min-height: 32px;
    padding: 0;
    justify-content: center;
  }

  .checker-link span {
    display: none;
  }

  .language-button {
    min-width: 32px;
    height: 32px;
  }

  .health-banner {
    margin-bottom: 18px;
  }

  .health-meta,
  .last-update,
  .service-source-type {
    display: none;
  }

  .system-heading {
    width: 100%;
    justify-content: space-between;
  }

  .date-window {
    font-size: 11px;
  }

  .service-summary {
    padding: 14px 12px;
  }

  .service-line {
    gap: 6px;
  }

  .service-name {
    max-width: 44vw;
  }

  .service-info {
    display: none;
  }

  .component-count {
    font-size: 0;
  }

  .service-uptime {
    font-size: 11px;
  }

  .history-bars {
    grid-template-columns: repeat(90, minmax(2px, 1fr));
    gap: 1px;
  }

  .service-detail {
    padding: 0 12px 14px;
  }

  .component-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    padding: 42px 20px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
