:root {
  color-scheme: light;
  --bg: #eef0f4;
  --panel: #ffffff;
  --surface: #f7f8fa;
  --surface-hover: #e9ebef;
  --text: #17181a;
  --muted: #666b74;
  --subtle: #8b9099;
  --line: rgba(18,20,24,.12);
  --line-soft: rgba(18,20,24,.07);
  --focus: #5554d9;
  --one: #6b7280;
  --two: #059669;
  --three: #2563eb;
  --four: #dc2626;
  --five: #d97706;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090a;
  --panel: #0f1011;
  --surface: #191a1b;
  --surface-hover: #242529;
  --text: #f7f8f8;
  --muted: #a7abb2;
  --subtle: #747982;
  --line: rgba(255,255,255,.1);
  --line-soft: rgba(255,255,255,.06);
  --focus: #828fff;
  --one: #d1d5db;
  --two: #34d399;
  --three: #60a5fa;
  --four: #f87171;
  --five: #fbbf24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 280px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 10px;
  top: 10px;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
}
.skip-link:focus { transform: translateY(0); }

.shell { width: 100%; padding-inline: 14px; }
.app-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto auto minmax(320px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--three) 18%, transparent), transparent);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.brand-mark circle:nth-of-type(1) { fill: var(--two); stroke: none; }
.brand-mark circle:nth-of-type(2) { fill: var(--three); stroke: none; }
.brand-mark circle:nth-of-type(3) { fill: var(--four); stroke: none; }
h1 { margin: 0; font-size: 15px; line-height: 1; font-weight: 650; letter-spacing: -.2px; }

.class-controls { min-width: 0; display: flex; align-items: center; gap: 9px; }
.total-count { color: var(--subtle); font-size: 11px; white-space: nowrap; }
.class-nav { display: flex; align-items: center; gap: 5px; }
.class-nav a {
  --accent: var(--muted);
  min-width: 48px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
}
.class-nav a:hover { color: var(--text); background: var(--surface-hover); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.toolbar { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.search-wrap { position: relative; width: min(320px, 100%); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.search-input {
  width: 100%;
  min-height: 36px;
  padding: 0 88px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.search-input:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 22%, transparent); }
.search-meta {
  position: absolute;
  right: 7px;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 5px;
  transform: translateY(-50%);
}
.clear-slot { width: 24px; height: 24px; display: grid; place-items: center; }
.search-shortcut {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--subtle);
  font: 500 11px/1.45 var(--mono);
}
.clear-search {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 0;
  border-radius: 5px;
  background: var(--surface-hover);
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.result-count { width: 2ch; color: var(--muted); font: 650 11px/1 var(--mono); text-align: right; white-space: nowrap; }
.theme-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover, .clear-search:hover { background: var(--surface-hover); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
.theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.theme-toggle:focus-visible, .clear-search:focus-visible, .empty-clear:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.code-section {
  --accent: var(--one);
  scroll-margin-top: 72px;
  margin-top: 26px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 78%, transparent), 0 10px 26px rgba(0,0,0,.055);
}
.code-section[data-class="2"] { --accent: var(--two); }
.code-section[data-class="3"] { --accent: var(--three); }
.code-section[data-class="4"] { --accent: var(--four); }
.code-section[data-class="5"] { --accent: var(--five); }
.section-header {
  min-height: 30px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 9px;
  padding-inline: 3px;
}
.class-mark { color: var(--accent); font: 700 18px/1 var(--mono); letter-spacing: -.5px; }
.section-title { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: -.35px; }
.section-note { color: var(--muted); font-size: 12px; }
.section-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 86%, var(--accent));
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}
.section-toggle:hover { border-color: var(--accent); color: var(--text); background: var(--surface-hover); }
.toggle-symbol { color: var(--accent); font: 700 17px/1 var(--mono); }
.section-toggle[aria-expanded="true"] .toggle-symbol { font-size: 0; }
.section-toggle[aria-expanded="true"] .toggle-symbol::before { content: '−'; font-size: 17px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, 296px); gap: 7px; justify-content: start; }
.status-card {
  width: 296px;
  height: 94px;
  min-width: 0;
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr);
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
}
.status-card:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); background: color-mix(in srgb, var(--panel) 95%, var(--accent)); }
.status-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.status-code { color: var(--accent); font: 700 20px/1.25 var(--mono); letter-spacing: -1px; }
.status-body { min-width: 0; }
.status-heading { min-height: 20px; display: flex; align-items: center; gap: 6px; }
.status-title { min-width: 0; margin: 0; overflow: hidden; font-size: 15.5px; line-height: 1.25; letter-spacing: -.1px; text-overflow: ellipsis; white-space: nowrap; }
.status-description {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.status-source { margin-left: auto; color: var(--subtle); font: 600 10px/1.4 var(--mono); text-decoration: none; white-space: nowrap; }
.status-badge { padding: 1px 5px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; white-space: nowrap; }

.secondary-grid { grid-column: 1 / -1; padding-top: 7px; }

.status-dialog {
  --accent: var(--one);
  width: min(640px, calc(100vw - 32px));
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 26px 80px rgba(0,0,0,.42);
}
.status-dialog[data-class="2"] { --accent: var(--two); }
.status-dialog[data-class="3"] { --accent: var(--three); }
.status-dialog[data-class="4"] { --accent: var(--four); }
.status-dialog[data-class="5"] { --accent: var(--five); }
.status-dialog::backdrop { background: rgba(5,6,8,.54); backdrop-filter: blur(8px); }
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}
.dialog-close span { display: block; transform: translateY(-1px); }
.dialog-close:hover { background: var(--surface-hover); color: var(--text); }
.dialog-heading { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 20px; padding-right: 36px; }
.dialog-code { color: var(--accent); font: 750 clamp(42px, 8vw, 58px)/1 var(--mono); letter-spacing: -3px; }
.dialog-kicker { margin: 0 0 4px; color: var(--subtle); font: 600 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.status-dialog h2 { margin: 0; font-size: clamp(24px, 4vw, 32px); line-height: 1.1; letter-spacing: -.6px; }
.dialog-description { margin: 24px 0; color: var(--muted); font-size: 19px; line-height: 1.55; }
.dialog-footer { min-height: 32px; display: flex; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.dialog-badge { font-size: 12px; }
.dialog-source { margin-left: auto; color: var(--accent); font: 600 12px/1.4 var(--mono); text-decoration: none; }
.dialog-source:hover { text-decoration: underline; text-underline-offset: 3px; }

.empty-state { margin: 32px 0; padding: 38px 20px; text-align: center; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.empty-state h2 { margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); }
.empty-clear { min-height: 38px; padding: 0 13px; border: 0; border-radius: 7px; background: var(--text); color: var(--bg); cursor: pointer; }
.site-footer { margin-top: 22px; padding: 13px 0 18px; border-top: 1px solid var(--line-soft); color: var(--subtle); font-size: 11px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-underline-offset: 2px; }

@media (max-width: 980px) {
  .app-bar { grid-template-columns: auto 1fr; gap: 8px 14px; }
  .class-controls { grid-column: 1 / -1; grid-row: 2; }
  .toolbar { grid-column: 2; grid-row: 1; }
  .code-section { scroll-margin-top: 108px; }
}

@media (max-width: 620px) {
  .app-bar { position: relative; grid-template-columns: 1fr auto; padding: 8px 10px; }
  .toolbar { grid-column: 1 / -1; grid-row: 2; }
  .search-wrap { width: 100%; max-width: none; }
  .total-count { display: none; }
  .class-controls { grid-column: 1 / -1; grid-row: 3; width: 100%; }
  .class-nav { width: 100%; }
  .class-nav a { flex: 1 1 0; min-width: 0; }
  .shell { padding-inline: 10px; }
  .code-section { scroll-margin-top: 8px; padding-top: 14px; }
  .card-grid { grid-template-columns: 1fr; }
  .status-card { width: 100%; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 360px) {
  .status-card { grid-template-columns: 40px minmax(0, 1fr); padding: 9px; }
  .status-title { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
