:root {
  --bg: oklch(0.97 0.006 80);
  --panel: oklch(0.99 0.004 80);
  --ink: oklch(0.22 0.02 50);
  --muted: oklch(0.5 0.02 55);
  --line: oklch(0.88 0.012 75);
  --line-strong: oklch(0.78 0.02 70);
  --accent: oklch(0.5 0.16 28);
  --accent-soft: oklch(0.94 0.03 50);
  --chip: oklch(0.955 0.01 80);
  --header: oklch(0.2 0.02 50);
  --header-ink: oklch(0.96 0.008 80);
  --header-dim: oklch(0.72 0.02 70);
  --side: 15.5rem;
  --bar: 3.25rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --font: "Instrument Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 0.75rem); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.45;
  font-optical-sizing: auto;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
code, .mono { font-family: var(--mono); font-size: 0.78em; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--header);
  color: var(--header-ink);
  padding: 0 0.85rem 0 1rem;
}
.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.header-nav {
  display: flex;
  gap: 0.15rem;
  height: 100%;
  flex: 0 0 auto;
}
.header-nav a {
  display: flex;
  align-items: center;
  padding: 0 0.7rem;
  color: var(--header-dim);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
}
.header-nav a:hover { color: var(--header-ink); }
.header-nav a[aria-current="page"] {
  color: var(--header-ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.header-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  margin-left: auto;
}
.tabs {
  display: flex;
  gap: 0;
  border: 1px solid oklch(1 0 0 / 0.16);
  border-radius: 2px;
  overflow: hidden;
  flex: 0 0 auto;
}
.tab {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--header-dim);
  background: transparent;
  border: 0;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
}
.tab[aria-pressed="true"],
.tab.is-on {
  background: var(--header-ink);
  color: var(--header);
}
.tab:hover:not([aria-pressed="true"]):not(.is-on) {
  color: var(--header-ink);
}
.search {
  width: 16rem;
  max-width: 32vw;
  height: 1.85rem;
  border: 1px solid oklch(1 0 0 / 0.28);
  background: oklch(1 0 0 / 0.1);
  color: var(--header-ink);
  font: inherit;
  font-size: 0.8rem;
  padding: 0 0.6rem;
  outline: none;
  border-radius: 2px;
}
.search::placeholder { color: oklch(0.82 0.015 80); }
.search:focus { border-color: oklch(1 0 0 / 0.55); background: oklch(1 0 0 / 0.14); }
.count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--header-dim);
  white-space: nowrap;
  min-width: 3.4rem;
}

.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: calc(100vh - var(--bar));
}
.rail {
  position: sticky;
  top: var(--bar);
  height: calc(100vh - var(--bar));
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0.85rem 0 2rem;
}
.rail-label {
  margin: 0 1rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail a {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.35rem;
  align-items: baseline;
  padding: 0.32rem 1rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
}
.rail a:hover { background: var(--accent-soft); }
.rail a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.rail .idx {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}
.rail .n {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}

.page {
  min-width: 0;
  padding: 1.15rem 1.75rem 4rem;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-strong);
}
.page-head h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.page-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.page-meta code {
  color: var(--ink);
}

.dim-block { margin: 0 0 1.75rem; }
.dim-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.45rem;
}
.dim-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.dim-head .n {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.field {
  display: grid;
  grid-template-columns: minmax(15rem, 0.34fr) minmax(0, 0.66fr);
  gap: 0 1.35rem;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 0.85rem 1rem 1rem;
}
.field:first-of-type { border-radius: 3px 3px 0 0; }
.field:last-of-type {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 3px 3px;
}
.field:only-of-type { border-radius: 3px; border-bottom: 1px solid var(--line); }
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.field-zh {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}
.field-path {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin: 0.1rem 0 0;
  word-break: break-all;
}
.field-n {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  flex: 0 0 auto;
}
.enums {
  display: flex;
  flex-direction: column;
}
.enum {
  padding: 0.38rem 0;
  border-top: 1px solid var(--line);
}
.enum:first-child { border-top: 1px solid var(--line-strong); }
.enum code {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  word-break: break-all;
}
.enum span {
  display: block;
  font-size: 0.78rem;
  color: var(--ink);
  line-height: 1.4;
  margin-top: 0.12rem;
}
.prompt-col {
  min-width: 0;
  background: oklch(0.975 0.01 82);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.65rem 0.8rem 0.75rem;
}
.prompt-k {
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.prompt-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.prompt-body .pk {
  font-family: var(--mono);
  font-size: 0.74em;
  color: var(--accent);
}

.empty { color: var(--muted); padding: 2rem 0; }

.cases { display: flex; flex-direction: column; gap: 0.55rem; max-width: 46rem; }
.case {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.85rem 1rem;
  border-radius: 3px;
}
.case:hover { border-color: var(--ink); }
.case .k {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.2rem;
}
.case .t {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
}
.case .d {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.foot {
  margin-top: 2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 72ch;
}

@media (max-width: 1100px) {
  .field { grid-template-columns: 1fr; gap: 0.75rem; }
}

@media (max-width: 860px) {
  .app-header {
    height: auto;
    flex-wrap: wrap;
    padding: 0.45rem 0.75rem 0.55rem;
    row-gap: 0.4rem;
  }
  .header-main {
    width: 100%;
    margin-left: 0;
  }
  .search { max-width: none; flex: 1; width: auto; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.2rem;
  }
  .rail-label { width: 100%; margin: 0 0 0.3rem; }
  .rail a {
    display: inline-flex;
    gap: 0.3rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--panel);
  }
  .page { padding: 0.9rem 0.85rem 3rem; }
  .field { grid-template-columns: 1fr; gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
