:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #fffdf8;
  --surface-2: #efece4;
  --ink: #1b1f1d;
  --muted: #656a63;
  --line: #dedbd1;
  --accent: #0d6b5f;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --warn: #7a5200;
  --warn-bg: #faefd6;
  --danger: #8f3a2e;
  --danger-bg: #f8e5df;
  --ok: #2c6339;
  --ok-bg: #e2f0e3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 31, 29, .04);
  --font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101413;
    --surface: #171d1b;
    --surface-2: #1e2623;
    --ink: #e7ece8;
    --muted: #9aa49d;
    --line: #2b3531;
    --accent: #6ad3bd;
    --accent-ink: #08201b;
    --accent-soft: #17352f;
    --warn: #e8c27a;
    --warn-bg: #332a17;
    --danger: #e6a294;
    --danger-bg: #39221d;
    --ok: #9dd3a6;
    --ok-bg: #1c3222;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101413;
  --surface: #171d1b;
  --surface-2: #1e2623;
  --ink: #e7ece8;
  --muted: #9aa49d;
  --line: #2b3531;
  --accent: #6ad3bd;
  --accent-ink: #08201b;
  --accent-soft: #17352f;
  --warn: #e8c27a;
  --warn-bg: #332a17;
  --danger: #e6a294;
  --danger-bg: #39221d;
  --ok: #9dd3a6;
  --ok-bg: #1c3222;
  --shadow: none;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding-inline: 16px;
}

/* header */
.top {
  padding: 22px 0 14px;
}

.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  margin: 0;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.brand .dot { color: var(--accent); }

.brand small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 450;
  letter-spacing: 0;
  color: var(--muted);
}

.theme {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.theme:hover { color: var(--ink); border-color: var(--accent); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme svg { width: 20px; height: 20px; display: block; }
.theme .i-moon { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme .i-moon { display: block; }
}

[hidden] { display: none !important; }

/* search */
.searchbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0 12px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}

.searchbar.is-stuck { border-bottom-color: var(--line); }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field input {
  width: 100%;
  height: 52px;
  padding: 0 52px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  box-shadow: var(--shadow);
  appearance: none;
}

.search-field input::placeholder { color: var(--muted); opacity: .9; }
.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-field kbd {
  position: absolute;
  right: 12px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font: 12px/1.6 ui-monospace, "SFMono-Regular", Menlo, monospace;
  pointer-events: none;
}

.search-field input:not(:placeholder-shown) + kbd { display: none; }

/* category chips */
.chips {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0 0 14px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.chips li { flex: 0 0 auto; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* sections */
main { padding-bottom: 8px; }

.section {
  padding: 14px 0 18px;
  scroll-margin-top: 122px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
}

.section h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -.01em;
}

.count {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.section-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* cards */
.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.card:hover { border-color: var(--accent); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.card:active { background: var(--surface-2); }

@media (hover: hover) {
  a.card:hover { transform: translateY(-1px); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 17px;
  font-weight: 640;
  line-height: 1.35;
}

.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.card-static { border-style: dashed; background: transparent; box-shadow: none; }
.card-static .card-title { color: var(--muted); }

.badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--active { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge--auth { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge--pending { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge--warn { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.badge--temp { color: var(--muted); background: var(--surface-2); border-color: transparent; }

.url {
  color: var(--muted);
  font: 11.5px/1.5 ui-monospace, "SFMono-Regular", Menlo, monospace;
  overflow-wrap: anywhere;
}

/* subgroup */
.subgroup {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.subgroup summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  list-style: none;
}

.subgroup summary::-webkit-details-marker { display: none; }
.subgroup summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
}
.subgroup[open] summary::after { content: "−"; }
.subgroup summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }

.sublist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0 8px 8px;
  list-style: none;
}

.sublist a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.sublist a:hover { color: var(--accent); }
.sublist a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

/* collapsed temp section */
.section--collapsed {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0;
}

.section--collapsed > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
}

.section--collapsed > summary::-webkit-details-marker { display: none; }
.section--collapsed > summary h2 { font-size: 17px; margin: 0; }
.section--collapsed > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 20px;
}
.section--collapsed[open] > summary::after { content: "−"; }
.section--collapsed > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }

.section-body { padding: 0 12px 12px; }
.section-body .section-note { margin: 0 4px 10px; }

/* empty state */
.empty {
  display: none;
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.empty.is-on { display: block; }

.section.is-filtered { display: none; }

/* footer */
.foot {
  margin-top: 26px;
  padding: 18px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.foot p { margin: 0 0 6px; }
.foot strong { color: var(--ink); font-weight: 560; }
.foot .retired { opacity: .85; }

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

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sublist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sublist a { border-top: 0; }
  .section { padding: 18px 0 22px; }
}

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brand { font-size: 30px; }
  .wrap { padding-inline: 24px; }
  .section { padding: 22px 0 26px; }
}

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