:root {
  color-scheme: dark;
  --background: #080808;
  --surface: #121212;
  --surface-accent: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #d0d0d0;
  --text-tertiary: #a8acbe;
  --accent-start: #ff5a3c;
  --accent: #f08a45;
  --accent-end: #72b95d;
  --gradient: linear-gradient(92deg, var(--accent-start), var(--accent) 48%, var(--accent-end));
  --border-rgb: 153, 153, 153;
  --border-opacity-subtle: .15;
  --bg-secondary: rgba(255,255,255,.04);
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-lg: 0 12px 35px rgba(0,0,0,.22);
  --ui-space-1: .25rem;
  --ui-space-2: .5rem;
  --ui-space-3: .75rem;
  --ui-space-4: 1rem;
  --ui-control-h: 44px;
  --ui-line: 1px solid rgba(var(--border-rgb), var(--border-opacity-subtle));
  --ui-edge: color-mix(in srgb, var(--text-tertiary) 60%, transparent);
  --ui-focus-ring: var(--accent);
  --bg: var(--background);
  --surface-2: var(--surface-accent);
  --border: rgba(var(--border-rgb), var(--border-opacity-subtle));
  --border-strong: var(--ui-edge);
  --text: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-tertiary);
  --ok: #72b95d;
  --ok-soft: rgba(114,185,93,.14);
  --warn: #f5a742;
  --warn-soft: rgba(245,167,66,.15);
  --err: #ff5a3c;
  --err-soft: rgba(255,90,60,.13);
  --shadow: 0 3px 12px rgba(0,0,0,.15);
}

html.day {
  color-scheme: light;
  --background: #faf6ec;
  --surface: #fdfaf2;
  --surface-accent: #ede7d6;
  --text-primary: #0a0a0c;
  --text-secondary: #1f1f24;
  --text-tertiary: #45454d;
  --border-rgb: 110, 110, 120;
  --border-opacity-subtle: .28;
  --bg-secondary: rgba(10,10,12,.04);
  --ok: #3d7b32;
  --warn: #c87629;
  --err: #c33520;
  --shadow: 0 3px 12px rgba(0,0,0,.15);
}

* { box-sizing: border-box; }
html { background: var(--background); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text-primary); font-family: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, a { font: inherit; }
.container { width: min(760px, calc(100% - 40px)); margin-inline: auto; }

.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--ui-space-2); height: 4rem; padding: 0 var(--ui-space-4); border-bottom: var(--ui-line); background: var(--background); }
.app-logo { display: flex; align-items: center; gap: var(--ui-space-2); color: var(--text-primary); font-weight: 600; text-decoration: none; }
.app-logo img { width: 1.75rem; height: 1.75rem; }
.ui-spacer { flex: 1; }
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ui-space-2); min-height: var(--ui-control-h); padding: 0 var(--ui-space-4); border: 1px solid var(--ui-edge); border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font-weight: 500; line-height: 1.2; cursor: pointer; white-space: nowrap; }
.ui-btn:hover { background: var(--bg-secondary); border-color: var(--text-tertiary); }
.ui-btn:focus-visible { outline: 2px solid var(--ui-focus-ring); outline-offset: 2px; }
.ui-btn--ghost { border-color: transparent; }
.ui-btn--sm { min-height: 32px; padding: 0 var(--ui-space-3); font-size: .85rem; }
.ui-btn--icon { width: var(--ui-control-h); padding: 0; }
.ui-btn svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ui-btn--sm svg { width: 14px; }
.ui-btn .sun { display: none; }
html.night .ui-btn .sun { display: block; }
html.night .ui-btn .moon { display: none; }
.ui-menu { position: fixed; inset: 3.7rem 1rem auto auto; min-width: 12rem; margin: 0; padding: var(--ui-space-1); border: var(--ui-line); border-radius: var(--radius-md); background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-lg); text-align: left; }
.ui-menu > button { display: flex; align-items: center; gap: var(--ui-space-2); width: 100%; min-height: 40px; padding: 0 var(--ui-space-3); border: 0; border-radius: var(--radius-sm); background: none; color: inherit; cursor: pointer; }
.ui-menu > button:hover, .ui-menu > button:focus-visible { background: var(--bg-secondary); outline: none; }
.ui-menu > button[aria-current="true"] { background: var(--bg-secondary); }
.ui-menu > button b { min-width: 1.5rem; font-size: .75rem; }

main { padding: 56px 0 84px; }
.overall { --tone: var(--ok); display: flex; align-items: center; gap: 14px; padding: 20px 22px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); border-radius: 10px; }
.overall.degraded { --tone: var(--warn); background: var(--warn-soft); }
.overall.outage { --tone: var(--err); background: var(--err-soft); }
.overall-icon { display: grid; place-items: center; flex: none; width: 27px; height: 27px; color: white; background: var(--tone); border-radius: 50%; font-weight: 700; }
.overall h1 { margin: 0; color: var(--text); font-size: 17px; line-height: 1.3; }
.overall p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.overall.loading { --tone: var(--text-3); background: var(--surface); border-color: var(--border); }

.uptime-section { padding-top: 52px; }
.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-intro h2, .incidents-section > h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.section-intro p { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }
.section-intro > span { color: var(--text-3); font-size: 11px; }
.service-list { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.service-row { padding: 22px; border-bottom: 1px solid var(--border); }
.service-row:last-child { border-bottom: 0; }
.service-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.service-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.service-title h3 small { display: block; margin-top: 3px; color: var(--text-3); font: 400 10px/1.4 "DM Mono", monospace; }
.state { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--ok); font-size: 12px; font-weight: 600; }
.state::before { content: ""; width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.state.degraded, .state.checking { color: var(--warn); }
.state.outage { color: var(--err); }
.history-bar { display: flex; gap: 3px; height: 28px; margin: 18px 0 8px; }
.history-bar i { flex: 1; min-width: 2px; background: var(--ok); border-radius: 2px; opacity: .88; cursor: help; transition: transform .12s ease, opacity .12s ease; }
.history-bar i.degraded, .history-bar i.checking { background: var(--warn); }
.history-bar i.outage { background: var(--err); }
.history-bar i:last-child { opacity: 1; }
.history-bar i:hover, .history-bar i:focus-visible { opacity: 1; outline: 2px solid var(--text-primary); outline-offset: 2px; transform: scaleY(1.12); }
.status-tooltip { position: fixed; z-index: 100; width: max-content; max-width: min(280px, calc(100vw - 20px)); padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--text-primary); color: var(--background); box-shadow: var(--shadow-lg); font-size: 11px; font-weight: 500; line-height: 1.45; white-space: pre-line; pointer-events: none; transform: translate(-50%, -100%); }
.status-tooltip.below { transform: translate(-50%, 0); }
.status-tooltip[hidden] { display: none; }
.uptime-meta { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; color: var(--text-3); font-size: 11px; }
.uptime-meta strong { color: var(--text-2); font: 500 11px/1 "DM Mono", monospace; }
.uptime-meta span:last-child { text-align: right; }
.service-details { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; color: var(--text-3); font-size: 10px; }
.regions { display: flex; align-items: center; gap: 5px; }
.region-dot { width: 7px; height: 7px; background: var(--ok); border-radius: 50%; }
.region-dot.down { background: var(--err); }
.region-dot.checking { background: var(--warn); }
.source-line { margin: 10px 2px 0; color: var(--text-3); font-size: 10px; text-align: right; }

.incidents-section { padding-top: 64px; }
.incidents-section > h2 { margin-bottom: 18px; }
.incident-day { padding: 23px 0; border-top: 1px solid var(--border); }
.incident-day h3 { margin: 0 0 12px; font-size: 14px; }
.incident-day > p { margin: 0; color: var(--text-3); font-size: 13px; }
.incident { padding-left: 15px; border-left: 3px solid var(--accent); }
.incident h4 { margin: 0; font-size: 14px; }
.incident p { margin: 5px 0 0; color: var(--text-2); font-size: 12px; }
.incident time { display: block; margin-top: 7px; color: var(--text-3); font: 400 10px/1.4 "DM Mono", monospace; }
.loading-copy { color: var(--text-3); font-size: 13px; }
.skeleton { min-height: 145px; background: linear-gradient(100deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

footer { border-top: 1px solid var(--border); }
.footer-inner { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--text-3); font-size: 11px; }
.footer-inner a { color: var(--text-2); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; text-underline-offset: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 600px) {
  .container { width: min(100% - 28px, 760px); }
  main { padding-top: 38px; }
  .section-intro { align-items: flex-start; flex-direction: column; gap: 8px; }
  .service-row { padding: 19px 17px; }
  .service-title { align-items: flex-start; }
  .history-bar { gap: 2px; height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
