:root {
  color-scheme: dark;
  --bg: #07090c;
  --surface: #101318;
  --surface-2: #171b21;
  --surface-3: #1d222a;
  --border: #292f38;
  --border-bright: #3a424e;
  --text: #f4f6f8;
  --muted: #9ca5b2;
  --muted-2: #727d8b;
  --accent: #58d68d;
  --accent-soft: rgba(88, 214, 141, .12);
  --blue: #62a8ff;
  --focus: #f4c95d;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; }
button, input { font: inherit; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - var(--max-width)) / 2));
  background: rgba(7, 9, 12, .9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.menu-page { display: flex; flex-direction: column; }

.menu-main {
  width: min(var(--max-width), calc(100% - 48px));
  margin: auto;
  padding: 72px 0 88px;
}

.menu-intro { max-width: 690px; margin-bottom: 45px; }
.eyebrow {
  margin: 0 0 13px;
  color: var(--accent);
  font: 700 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.menu-intro h1 {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 66px);
  line-height: 1.06;
  letter-spacing: 0;
}

.menu-intro > p:last-child { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.7; }

.system-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.system-card {
  min-height: 170px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.system-card:hover { transform: translateY(-3px); border-color: var(--border-bright); background: var(--surface-2); }
.system-card:focus-visible, .back-link:focus-visible, .letter-link:focus-visible, .clear-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.system-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  color: var(--text);
}

.windows-icon { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.windows-icon i { display: block; background: var(--blue); }
.terminal-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  background: #090b0e;
  color: var(--accent);
  font: 700 17px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.system-copy { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.system-copy strong { font-size: 22px; }
.system-copy small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.arrow { color: var(--muted-2); font-size: 25px; transition: transform .18s ease, color .18s ease; }
.system-card:hover .arrow { color: var(--text); transform: translateX(4px); }

.site-footer {
  padding: 22px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  text-align: center;
  font-size: 12px;
}

.commands-page { background-color: var(--bg); }
.commands-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 9, 12, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.commands-nav {
  width: min(var(--max-width), calc(100% - 48px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color .15s ease;
}
.back-link:hover { color: var(--text); }
.page-system { color: var(--muted-2); font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }

.commands-main { width: min(var(--max-width), calc(100% - 48px)); margin: 0 auto; padding: 52px 0 80px; }
.commands-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; margin-bottom: 30px; }
.commands-intro h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.12; letter-spacing: 0; }
.commands-intro p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.7; }
.command-count { padding-bottom: 4px; color: var(--muted); font: 600 13px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }

.search-panel { position: relative; margin-bottom: 16px; }
.search-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  width: 17px;
  height: 17px;
  border: 2px solid var(--muted-2);
  border-radius: 50%;
  transform: translateY(-57%);
  pointer-events: none;
}
.search-icon::after { content: ""; position: absolute; width: 7px; height: 2px; right: -6px; bottom: -3px; background: var(--muted-2); transform: rotate(45deg); }
.search-input {
  width: 100%;
  height: 54px;
  padding: 0 52px 0 50px;
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.clear-search {
  position: absolute;
  top: 50%; right: 12px;
  width: 32px; height: 32px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  cursor: pointer;
}
.clear-search:hover { background: var(--surface-3); color: var(--text); }
.clear-search[hidden] { display: none; }

.letter-index {
  position: sticky;
  top: 64px;
  z-index: 10;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 18px;
  background: var(--bg);
  scrollbar-width: thin;
}
.letter-link {
  min-width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.letter-link:hover { background: var(--surface-2); color: var(--text); }

.command-groups { display: grid; gap: 28px; }
.letter-group { scroll-margin-top: 116px; }
.letter-heading {
  margin: 0 0 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.command-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.command-button {
  min-width: 0;
  min-height: 178px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.command-button:hover { transform: translateY(-2px); border-color: var(--border-bright); background: var(--surface-2); }
.command-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.command-button-top { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.command-name { color: var(--text); font: 700 15px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.command-arrow { color: var(--muted-2); font-size: 18px; line-height: 1; transition: color .16s ease, transform .16s ease; }
.command-button:hover .command-arrow { color: var(--accent); transform: translateX(3px); }
.command-purpose {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.category { align-self: end; justify-self: start; padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.empty-state { display: none; padding: 70px 24px; border: 1px dashed var(--border-bright); border-radius: 7px; color: var(--muted); text-align: center; }
.empty-state.visible { display: block; }
.noscript { width: min(var(--max-width), calc(100% - 48px)); margin: 40px auto; padding: 16px; border: 1px solid #66551f; background: #211d0f; color: #ffe38a; }

.menu-link {
  color: var(--muted-2);
  text-decoration: none;
  font-size: 13px;
}
.menu-link:hover { color: var(--text); }
.menu-link:focus-visible, .primary-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.detail-main { width: min(1040px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0 86px; }
.detail-hero { padding-bottom: 36px; border-bottom: 1px solid var(--border); }
.detail-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.detail-platform { margin: 0 0 11px; color: var(--accent); font: 700 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.detail-hero h1 { margin: 0; font: 700 clamp(34px, 6vw, 58px)/1.08 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.detail-category { flex: 0 0 auto; margin-bottom: 5px; padding: 6px 9px; border: 1px solid var(--border-bright); border-radius: 4px; color: var(--muted); font-size: 11px; }
.detail-purpose { max-width: 800px; margin: 22px 0 0; color: #d8dde4; font-size: 17px; line-height: 1.75; }

.reference-section { padding: 34px 0; border-bottom: 1px solid var(--border); }
.reference-section h2 { margin: 0 0 16px; font-size: 19px; line-height: 1.3; }
.reference-section > p, .section-heading-row p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.detail-syntax { margin: 0; padding: 18px 20px; border: 1px solid #242b34; border-radius: 6px; background: #080a0d; overflow-x: auto; }
.detail-syntax code { color: #d9ffe8; font: 13px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-heading-row h2 { margin-bottom: 6px; }
.parameter-count { flex: 0 0 auto; color: var(--muted-2); font: 600 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.parameter-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.parameter-table { width: 100%; border-collapse: collapse; background: var(--surface); text-align: left; }
.parameter-table th, .parameter-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.parameter-table tr:last-child td { border-bottom: 0; }
.parameter-table th { background: var(--surface-2); color: var(--muted-2); font-size: 11px; font-weight: 700; }
.parameter-table th:first-child { width: 25%; }
.parameter-table th:nth-child(2) { width: 43%; }
.parameter-token { color: var(--accent); font: 700 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.parameter-purpose { color: #d9dde3; font-size: 13px; line-height: 1.65; }
.parameter-value { color: var(--muted); font-size: 12px; line-height: 1.65; }
.help-section { border-bottom: 0; }
.help-commands { display: grid; gap: 8px; margin-top: 17px; }
.help-command { display: block; padding: 13px 15px; border: 1px solid var(--border); border-radius: 5px; background: #080a0d; color: #d9ffe8; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.invalid-detail { min-height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.invalid-detail[hidden], .detail-main[hidden] { display: none; }
.invalid-detail h1 { margin: 0 0 13px; font-size: 38px; }
.invalid-detail > p:not(.eyebrow) { margin: 0 0 26px; color: var(--muted); }
.primary-link { display: inline-flex; padding: 11px 14px; border-radius: 5px; background: var(--text); color: #080a0d; text-decoration: none; font-size: 13px; font-weight: 700; }

@media (max-width: 820px) {
  .system-grid { grid-template-columns: 1fr; }
  .system-card { min-height: 116px; }
  .commands-intro { grid-template-columns: 1fr; gap: 8px; }
  .command-count { padding: 0; }
  .command-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar { height: 58px; padding: 0 18px; }
  .menu-main, .commands-main, .commands-nav, .detail-main { width: calc(100% - 32px); }
  .menu-main { padding: 48px 0 64px; }
  .menu-intro { margin-bottom: 30px; }
  .menu-intro > p:last-child { font-size: 16px; }
  .system-card { padding: 21px; }
  .commands-nav { min-height: 58px; }
  .commands-main { padding-top: 34px; }
  .letter-index { top: 58px; }
  .command-list { grid-template-columns: 1fr; }
  .command-button { min-height: 150px; }
  .detail-main { padding-top: 34px; }
  .detail-heading-row { align-items: flex-start; flex-direction: column; gap: 15px; }
  .detail-category { margin: 0; }
  .detail-purpose { font-size: 15px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .parameter-table, .parameter-table tbody, .parameter-table tr, .parameter-table td { display: block; width: 100%; }
  .parameter-table thead { display: none; }
  .parameter-table tr { padding: 14px; border-bottom: 1px solid var(--border); }
  .parameter-table tr:last-child { border-bottom: 0; }
  .parameter-table td { padding: 0; border: 0; }
  .parameter-table td + td { margin-top: 7px; }
}

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