:root {
  color-scheme: light dark;
  --background: 48 30% 96%;
  --foreground: 30 8% 10%;
  --card: 45 25% 93%;
  --card-hover: 45 22% 89%;
  --secondary: 45 22% 90%;
  --muted-foreground: 40 6% 39%;
  --accent: 217 84% 46%;
  --destructive: 4 70% 47%;
  --border: 45 18% 85%;
  --success: 142 58% 32%;
  --warn: 32 92% 42%;
  --font-jb: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-space: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: 30 8% 8%;
    --foreground: 45 25% 90%;
    --card: 30 7% 11%;
    --card-hover: 30 6% 14.5%;
    --secondary: 30 6% 15%;
    --muted-foreground: 40 8% 55%;
    --accent: 213 90% 64%;
    --destructive: 4 75% 60%;
    --border: 34 7% 20%;
    --success: 142 50% 52%;
    --warn: 38 92% 58%;
  }
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; }
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-jb);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: hsl(var(--border)); text-underline-offset: 3px; }
a:hover { text-decoration-color: hsl(var(--accent)); color: hsl(var(--accent)); }
:focus-visible { outline: 1px solid hsl(var(--accent)); outline-offset: 2px; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 12.5px; }
kbd {
  font-family: var(--font-jb);
  font-size: 11px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  padding: 0 4px;
  margin-left: 2px;
  color: hsl(var(--muted-foreground));
}

.top, main, .foot { max-width: 980px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; padding-bottom: 18px; border-bottom: 1px solid hsl(var(--border)); font-size: 13.5px; }
.brand { text-decoration: none; font-weight: 600; }
.mark { color: hsl(var(--accent)); font-weight: 400; }
#summary { text-decoration: none; font-variant-numeric: tabular-nums; }
#summary:hover { color: hsl(var(--accent)); }

.page-transition { animation: page-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) backwards; }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.hero { padding: 48px 0 28px; }
.page-title {
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 600;
  margin: 0 0 12px;
}
.cursor-blink::after { content: "▋"; color: hsl(var(--accent)); animation: sx-blink 1s step-end infinite; margin-left: 4px; font-weight: 400; }
@keyframes sx-blink { 50% { opacity: 0; } }
.lede { margin: 0; color: hsl(var(--muted-foreground)); max-width: 60ch; }

.controls { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 2; background: hsl(var(--background)); padding: 12px 0; border-bottom: 1px solid hsl(var(--border)); }
.search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 0 12px;
  transition: border-color .2s;
}
.search:focus-within { border-color: hsl(var(--accent)); }
.search-glyph { color: hsl(var(--accent)); }
.search input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 15px; color: inherit;
  background: none; border: 0; outline: none;
  padding: 11px 0;
}
.search input::placeholder { color: hsl(var(--muted-foreground)); }
.search input::-webkit-search-cancel-button { display: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-jb); font-size: 12.5px; color: hsl(var(--foreground));
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
  padding: 3px 8px; cursor: pointer; transition: border-color .2s, color .2s;
}
.chip:hover { border-color: hsl(var(--accent)); color: hsl(var(--accent)); }
.chip[aria-pressed="true"] { border-color: hsl(var(--foreground)); }
.chip[aria-pressed="true"]::before { content: "▸ "; color: hsl(var(--accent)); }
.chip .n { color: hsl(var(--muted-foreground)); margin-left: 4px; font-variant-numeric: tabular-nums; }

.group { margin-top: 36px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading { font-family: var(--font-space); font-size: clamp(1.35rem, 2.2vw, 1.7rem); letter-spacing: -0.01em; font-weight: 700; margin: 0; }
.section-heading::before { content: "■ "; color: hsl(var(--accent)); font-weight: 400; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.card {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid hsl(var(--border));
  padding: 18px 20px 16px;
  background: hsl(var(--card));
  text-decoration: none;
  transition: background-color .3s;
  min-width: 0;
}
.card:hover, .card.sel { background: hsl(var(--card-hover)); color: inherit; }
.card.sel { outline: 1px solid hsl(var(--accent)); outline-offset: -1px; }
.card:focus-visible { outline-offset: -1px; }
.card-top { display: flex; align-items: center; gap: 10px; }
.name { font-weight: 600; font-size: 16px; }
.arrow { margin-left: auto; color: hsl(var(--muted-foreground)); transition: transform .3s, color .3s; }
.card:hover .arrow, .card.sel .arrow { transform: translateX(2px); color: hsl(var(--accent)); }
.purpose { margin: 0; font-size: 13.5px; color: hsl(var(--foreground)); }
.host { font-size: 11px; color: hsl(var(--muted-foreground)); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: auto 0 0; padding: 4px 0 0; list-style: none; }
.tags li { font-size: 11px; padding: 0 5px; background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); }
mark { background: none; color: hsl(var(--accent)); }

.dot-wrap { position: relative; display: inline-flex; width: 8px; height: 8px; flex: none; }
.dot { width: 8px; height: 8px; background: hsl(var(--state, var(--border))); position: relative; transition: background-color .3s; }
.card[data-s="ok"] { --state: var(--success); }
.card[data-s="shipping"] { --state: var(--warn); }
.card[data-s="down"] { --state: var(--destructive); }
.card[data-s="unknown"] { --state: var(--muted-foreground); }
.card[data-s="ok"] .dot::before {
  content: ""; position: absolute; inset: 0; background: hsl(var(--state)); opacity: .55;
  animation: live-pulse 1.6s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes live-pulse { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.4); opacity: 0; } }
.state { font-size: 11px; color: hsl(var(--muted-foreground)); }
.card[data-s="down"] .state { color: hsl(var(--destructive)); }

.empty { margin-top: 32px; }

.foot { margin-top: 56px; padding-top: 18px; padding-bottom: 40px; border-top: 1px solid hsl(var(--border)); }
.foot p { margin: 4px 0; }
.keys kbd { margin-right: 2px; }

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

@media (max-width: 720px) {
  .hero { padding: 32px 0 20px; }
  .search kbd, .keys { display: none; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
