:root {
  --ink: #111820;
  --ink-2: #1b2833;
  --paper: #f3f5f6;
  --white: #fff;
  --text: #17212a;
  --muted: #64717b;
  --line: #cbd2d7;
  --line-dark: #3a4a56;
  --yellow: #f1c232;
  --cyan: #168a9b;
  --green: #2f8a62;
  --coral: #d95849;
  --blue: #276fbf;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; letter-spacing: 0; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  color: var(--text);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.55;
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, pre:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.cli-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px max(20px, calc((100vw - 1240px) / 2));
  color: #fff;
  background: var(--ink);
  border-bottom: 3px solid var(--yellow);
}
.cli-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; text-decoration: none; }
.cli-brand img { width: 38px; height: 38px; object-fit: contain; }
.cli-brand span { display: grid; gap: 2px; line-height: 1.05; }
.cli-brand strong { font-size: 13px; }
.cli-brand small { color: #9db0bd; font: 700 8px/1 var(--mono); }
.cli-nav-links { margin-left: auto; display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.cli-nav-links::-webkit-scrollbar { display: none; }
.cli-nav-links a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  color: #bec9d1;
  border: 1px solid transparent;
  border-radius: 5px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.cli-nav-links a:hover { color: #fff; border-color: #4b5c69; background: #202e39; }
.cli-nav-links a.active { color: var(--ink); background: var(--yellow); }

main > section, .directory-head { padding-inline: max(20px, calc((100vw - 1180px) / 2)); }
.directory-head {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 44px;
  padding-top: 48px;
  padding-bottom: 40px;
  color: #fff;
  background: var(--ink-2);
  border-bottom: 1px solid var(--line-dark);
}
.directory-title > p, .section-heading > div > p {
  color: var(--cyan);
  font: 800 11px/1.2 var(--mono);
}
.directory-title > p { color: #71c2cc; }
.directory-title h1 { margin-top: 10px; font-size: clamp(34px, 5vw, 58px); line-height: 1.06; }
.directory-title > span { display: block; max-width: 720px; margin-top: 16px; color: #c6d0d7; font-size: 16px; }
.directory-facts { display: grid; grid-template-columns: repeat(3, 108px); border: 1px solid var(--line-dark); }
.directory-facts > div { min-height: 82px; padding: 14px; border-right: 1px solid var(--line-dark); }
.directory-facts > div:last-child { border-right: 0; }
.directory-facts dt { min-height: 29px; display: flex; align-items: center; gap: 7px; font: 850 21px/1 var(--mono); }
.directory-facts dd { margin-top: 8px; color: #93a5b2; font-size: 10px; font-weight: 750; }
.state-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: #788994; }
.state-dot.ready { background: #53d3ad; box-shadow: 0 0 0 4px rgba(83, 211, 173, .12); }
.state-dot.failed { background: var(--coral); }

.workbuddy-band, .catalog-band, .quickstart-band, .api-band { padding-top: 58px; padding-bottom: 64px; }
.workbuddy-band { background: #e8ecef; border-bottom: 1px solid var(--line); }
.catalog-band { background: var(--white); border-bottom: 1px solid var(--line); }
.quickstart-band { background: #f4f6f7; border-bottom: 1px solid var(--line); }
.api-band { background: #e8ecef; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 460px); gap: 48px; align-items: end; }
.section-heading h2 { margin-top: 8px; font-size: 30px; line-height: 1.18; }
.section-heading > p { color: var(--muted); font-size: 13px; }

.profile-switch { width: max-content; max-width: 100%; display: flex; flex-wrap: wrap; gap: 3px; margin-top: 28px; padding: 3px; border: 1px solid #aab4bb; background: #dce2e5; }
.profile-button {
  min-width: 100px;
  min-height: 36px;
  padding: 0 14px;
  color: #53616b;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font: 750 12px/1 "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer;
}
.profile-button:hover { color: var(--ink); background: #f5f7f8; }
.profile-button.active { color: #fff; background: var(--ink); }

.workbuddy-layout { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(240px, .58fr); gap: 26px; align-items: stretch; margin-top: 16px; }
.prompt-tool { min-width: 0; overflow: hidden; border: 1px solid #26343e; border-radius: 6px; background: var(--ink); box-shadow: 0 18px 48px rgba(28, 39, 47, .14); }
.prompt-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px 8px 18px;
  color: #a8bac6;
  background: #202d37;
  border-bottom: 1px solid #344652;
  font: 750 10px/1 var(--mono);
}
.prompt-toolbar > span { display: flex; align-items: center; gap: 8px; }
.prompt-toolbar > span i { width: 8px; height: 8px; border-radius: 50%; background: #53d3ad; }
.copy-button {
  min-width: 132px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-radius: 4px;
  font-family: inherit;
  cursor: pointer;
}
.copy-button:hover { background: #ffda62; }
.copy-button span { font-size: 18px; }
.copy-button b { font-size: 12px; }
#workbuddyPrompt {
  height: 420px;
  overflow: auto;
  padding: 22px;
  color: #dce7ed;
  background: var(--ink);
  font: 12px/1.7 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.prompt-notes { padding: 22px 0 0 6px; }
.prompt-notes > p { color: var(--coral); font: 800 11px/1 var(--mono); }
.prompt-notes ol { list-style: none; margin-top: 20px; border-top: 1px solid #b9c2c8; }
.prompt-notes li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid #b9c2c8; }
.prompt-notes li b { font-size: 13px; }
.prompt-notes li span { color: var(--muted); font-size: 12px; }
.prompt-notes > a { display: inline-flex; gap: 12px; margin-top: 20px; color: var(--blue); text-decoration: none; font-size: 12px; font-weight: 800; }
.copy-status { min-height: 22px; margin-top: 10px; color: var(--green); font-size: 12px; font-weight: 750; }

.cli-catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
.cli-entry { min-width: 0; padding: 24px; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 6px; background: #fff; }
.cli-entry[data-accent="cyan"] { border-top-color: var(--cyan); }
.cli-entry[data-accent="coral"] { border-top-color: var(--coral); }
.cli-entry[data-accent="yellow"] { border-top-color: var(--yellow); }
.cli-entry header { min-height: 54px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.cli-index { color: #8a969e; font: 800 12px/1 var(--mono); }
.cli-entry header small { color: var(--muted); font: 750 8px/1 var(--mono); }
.cli-entry h3 { margin-top: 6px; font-size: 21px; line-height: 1.1; }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.cli-entry > p { min-height: 82px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.cli-meta { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cli-meta > div { min-width: 0; padding: 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cli-meta dt { color: #78858e; font-size: 9px; font-weight: 800; }
.cli-meta dd { margin-top: 5px; color: var(--text); font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.cli-meta code { font-family: var(--mono); }
.hash-line { min-height: 46px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 0 12px; background: #edf1f3; border: 1px solid #d4dade; border-top: 0; }
.hash-line span { color: #697781; font-size: 9px; font-weight: 800; }
.hash-line code { overflow: hidden; color: #32424d; font: 10px/1.3 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 20px; }
.entry-actions a { color: var(--blue); text-decoration: none; font-size: 11px; font-weight: 800; }
.entry-actions a:hover { text-decoration: underline; }
.entry-actions .download-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
}
.entry-actions .download-action:hover { background: #263844; text-decoration: none; }
.download-action span { font-size: 16px; }

.quickstart-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 32px; margin-top: 30px; align-items: stretch; }
.quickstart-flow ol { list-style: none; border-top: 1px solid var(--line); }
.quickstart-flow li { min-height: 86px; display: grid; grid-template-columns: 42px 1fr; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.quickstart-flow li > span { color: var(--coral); font: 800 12px/1 var(--mono); }
.quickstart-flow b { font-size: 13px; }
.quickstart-flow p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.command-tool { min-width: 0; overflow: hidden; border: 1px solid #26343e; border-radius: 6px; background: var(--ink); }
.command-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; color: #9eb0bc; background: #202d37; border-bottom: 1px solid #344652; font: 750 10px/1 var(--mono); }
.icon-copy { width: 34px; height: 32px; color: #fff; background: transparent; border: 1px solid #526572; border-radius: 4px; font-size: 18px; cursor: pointer; }
.icon-copy:hover { background: #31424e; }
.command-tool pre { min-height: 220px; padding: 20px; overflow: auto; color: #dce7ed; font: 11px/1.8 var(--mono); white-space: pre; }

.api-table { margin-top: 28px; border-top: 1px solid #aeb8bf; }
.api-row { min-height: 54px; display: grid; grid-template-columns: 72px minmax(280px, 1.15fr) minmax(220px, 1fr) 80px; gap: 16px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #aeb8bf; text-decoration: none; }
.api-row:not(.api-header):hover { background: #f8fafb; }
.api-header { min-height: 38px; color: #64727c; font-size: 9px; font-weight: 850; }
.api-row b { color: var(--blue); font: 800 10px/1 var(--mono); }
.api-row code { min-width: 0; color: #273640; font: 11px/1.4 var(--mono); overflow-wrap: anywhere; }
.api-row span { color: #53616b; font-size: 12px; }
.api-row em { width: max-content; color: var(--green); font-size: 10px; font-style: normal; font-weight: 850; }

footer {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px max(20px, calc((100vw - 1180px) / 2));
  color: #a7b5bf;
  background: var(--ink);
  font-size: 11px;
}
footer a { color: #dbe4e9; text-decoration: none; }
footer a:hover { color: var(--yellow); }

@media (max-width: 900px) {
  .cli-nav { padding-inline: 16px; }
  .cli-brand small { display: none; }
  .cli-nav-links a:nth-last-child(2), .cli-nav-links a:last-child { display: none; }
  .directory-head { grid-template-columns: 1fr; align-items: start; gap: 28px; }
  .directory-facts { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .section-heading { grid-template-columns: 1fr; gap: 12px; }
  .workbuddy-layout { grid-template-columns: 1fr; }
  .prompt-notes { padding: 4px 0 0; }
  .prompt-notes ol { display: grid; grid-template-columns: repeat(3, 1fr); }
  .prompt-notes li { grid-template-columns: 1fr; align-content: start; padding: 14px; border-right: 1px solid #b9c2c8; }
  .cli-catalog { grid-template-columns: 1fr; }
  .cli-entry > p { min-height: 0; }
  .quickstart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .cli-nav { min-height: 58px; gap: 10px; }
  .cli-brand span { display: none; }
  .cli-brand img { width: 34px; height: 34px; }
  .cli-nav-links { gap: 2px; }
  .cli-nav-links a { min-height: 32px; padding: 0 8px; font-size: 11px; }
  .cli-nav-links a:nth-child(4), .cli-nav-links a:nth-child(5) { display: none; }
  .directory-head { min-height: 0; padding-top: 34px; padding-bottom: 30px; }
  .directory-title h1 { font-size: 36px; }
  .directory-title > span { font-size: 14px; }
  .directory-facts > div { min-height: 72px; padding: 11px; }
  .directory-facts dt { font-size: 16px; }
  .directory-facts dd { font-size: 9px; }
  .workbuddy-band, .catalog-band, .quickstart-band, .api-band { padding-top: 40px; padding-bottom: 46px; }
  .section-heading h2 { font-size: 25px; }
  .profile-switch { width: 100%; }
  .profile-button { min-width: 0; flex: 1; padding-inline: 7px; }
  .copy-button { min-width: 112px; }
  #workbuddyPrompt { height: 470px; padding: 17px; font-size: 11px; }
  .prompt-notes ol { grid-template-columns: 1fr; }
  .prompt-notes li { grid-template-columns: 70px 1fr; padding-inline: 0; border-right: 0; }
  .cli-entry { padding: 18px; }
  .cli-entry header { grid-template-columns: 32px minmax(0, 1fr); }
  .status-label { grid-column: 2; }
  .cli-meta { grid-template-columns: 1fr; }
  .hash-line { grid-template-columns: 1fr; gap: 2px; align-content: center; }
  .api-table { border-top: 0; overflow: visible; }
  .api-header { display: none; }
  .api-row:not(.api-header) {
    width: 100%;
    min-height: 76px;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 7px 10px;
    align-items: start;
    padding: 14px 8px;
    border-top: 1px solid #aeb8bf;
  }
  .api-row b { grid-column: 1; grid-row: 1; padding-top: 2px; }
  .api-row code { grid-column: 2; grid-row: 1; }
  .api-row span { grid-column: 2; grid-row: 2; }
  .api-row em { grid-column: 1; grid-row: 2; }
  footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
