* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  background: #f3f6fb;
  color: #1f2933;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ????????????? JS ?????????????????????????? */
.detail-root {
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.detail-root.detail-root--ready {
  opacity: 1;
}

/* 首页根节点淡入，避免中间态闪烁 */
.home-root {
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.home-root.home-root--ready {
  opacity: 1;
}

.page-header {
  background: linear-gradient(135deg, #1f2937, #111827);
  color: #fff;
  padding: 16px 16px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  position: relative;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.menu-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(249, 250, 251, 0.18);
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s ease-out, transform 0.12s ease-out;
}

.menu-button:hover {
  background: rgba(15, 23, 42, 0.95);
  transform: translateY(-1px);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-left: 8px;
}

.search-wrapper {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 14px 48px 14px 20px;
  border-radius: 999px;
  border: none;
  font-size: 16px;
  outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 30px rgba(0, 0, 0, 0.25);
  color: #111827;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  background: transparent;
  border: none;
  padding: 4px;
  line-height: 1;
  cursor: pointer;
}

.search-icon:hover {
  color: #6b7280;
}

.search-icon:active {
  transform: translateY(-50%) scale(0.98);
}

.search-icon:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.65);
  outline-offset: 3px;
  border-radius: 8px;
}

.search-icon-img {
  width: 18px;
  height: 18px;
  display: block;
}

.page-body {
  flex: 1;
  padding: 24px 16px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  color: #374151;
  font-weight: 600;
}

.section-header-icon {
  margin-right: 8px;
  font-size: 18px;
}

.section-header-title {
  font-size: 18px;
}

.cards-grid {
  /* 瀑布流：避免某一张卡片内容变长导致同一行其它卡片也被迫变高 */
  column-count: 2;
  column-gap: 16px;
}

.command-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  border: 1px solid #e5e7eb;
  cursor: pointer;
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    border-color 0.12s ease-out, background 0.12s ease-out;
}

.command-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  border-color: #2563eb;
  background: #f9fafb;
}

.command-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.command-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  height: 2.9em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.badge-count {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
}

.empty-tip {
  margin-top: 24px;
  font-size: 14px;
  color: #9ca3af;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  /* ç§ťé¤ backdrop-filter äťĽćĺć§č˝ďźéżĺĺĄéĄ? */
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
  will-change: opacity;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50vw;
  max-width: 360px;
  background: #020617;
  color: #e5e7eb;
  padding: 16px 14px 20px;
  box-shadow: 4px 0 20px rgba(15, 23, 42, 0.6);
  transform: translate3d(-100%, 0, 0);
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  display: flex;
  flex-direction: column;
  will-change: transform;
  backface-visibility: hidden;
}

.sidebar.active {
  transform: translate3d(0, 0, 0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
}

.sidebar-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
}

.sidebar-section-label {
  font-size: 13px;
  color: #6b7280;
  margin: 8px 0 4px;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

.sidebar-item-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e5e7eb;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-item-btn span {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-item-btn:hover {
  background: rgba(31, 41, 55, 0.9);
}

.sidebar-item-btn.active {
  background: #1d4ed8;
  color: #e5e7eb;
}

/* čŻŚćéĄľć ˇĺź? */
.detail-body {
  color: #111827;
}

.detail-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* ĎęÇéŇł header ˛źžÖ */
.detail-page-header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px !important;
}

.detail-page-header .header-left {
  flex: 1;
  min-width: 0;
}

.detail-page-header .header-right {
  margin-left: 12px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
}

.back-link {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(249, 250, 251, 0.15);
  background: rgba(15, 23, 42, 0.4);
  font-weight: 500;
  transition: background 0.2s ease-out;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.back-link:hover {
  background: rgba(15, 23, 42, 0.7);
}

.detail-page-header .header-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expand-toggle-btn {
  position: relative;
  width: 60px;
  height: 26px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(249, 250, 251, 0.15);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s ease-out;
  display: flex;
  align-items: center;
  padding: 0;
  outline: none;
  overflow: hidden;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; /* ŇĆłýĘÖťúśËľăť÷ťŇÉŤ¸ßÁÁ */
  appearance: none;
  -webkit-appearance: none;
}

.expand-toggle-btn:focus,
.expand-toggle-btn:focus-visible,
.expand-toggle-btn:active {
  outline: none;
  box-shadow: none;
}

.expand-toggle-btn:hover {
  background: rgba(15, 23, 42, 0.8);
}

.expand-toggle-btn.active {
  background: rgba(37, 99, 235, 0.8);
  border-color: rgba(37, 99, 235, 0.9);
}

.expand-toggle-btn.active:hover {
  background: rgba(37, 99, 235, 0.95);
}

.toggle-label {
  position: absolute;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
  top: 50%;
  transform: translateY(-50%);
}

.expand-toggle-btn.active .toggle-label {
  left: 37px;
}

.toggle-text {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 1;
  box-sizing: border-box;
}

.toggle-text-off {
  position: absolute;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #e5e7eb;
  opacity: 1;
  transition: opacity 0.2s ease-out;
  white-space: nowrap;
}

.toggle-text-on {
  position: absolute;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #e5e7eb;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  white-space: nowrap;
}

.expand-toggle-btn.active .toggle-text-off {
  opacity: 0;
}

.expand-toggle-btn.active .toggle-text-on {
  opacity: 1;
}

.detail-page-body {
  flex: 1;
  padding: 24px 16px 40px;
  max-width: 960px;
  margin: 0 auto;
}

.command-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
}

.command-meta {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
}

.content-block {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  border: 1px solid #e5e7eb;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

/* 基础语法块（详情页） */
.syntax-block {
  margin: 8px 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed #d1d5db;
  background: #f9fafb;
}

.syntax-row {
  display: block;
  margin-bottom: 8px;
}

.syntax-row:last-child {
  margin-bottom: 0;
}

.syntax-label {
  display: inline-block;
  color: #6b7280;
  font-weight: 600;
  font-size: 14px;
  margin-right: 4px;
}

.syntax-value-wrapper {
  display: inline;
}

.syntax-value {
  color: #374151;
  font-size: 14px;
  word-break: break-word;
}

.syntax-value--command {
  color: #2563eb;
  font-weight: 700;
  font-family: 'Courier New', 'Consolas', monospace;
}

.syntax-code {
  display: block;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  color: #111827;
  background: #f3f4f6;
  border-radius: 6px;
  /* 右侧给复制图标/已复制提示留出足够空间（图标16px + 间距6px + 已复制文字约40px + 安全边距），避免文字被盖住 */
  padding: 8px 70px 8px 10px;
  /* 允许长命令自动换行 */
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: hidden;
  /* 确保长文本可以换行显示，不会和复制按钮重合 */
  min-width: 0;
  box-sizing: border-box;
}

.syntax-code-wrapper {
  position: relative;
  flex: 1;
}

.syntax-copy-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  background-image: url('../img/copy.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
  transform: translateY(-50%);
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.syntax-copy-btn:hover {
  opacity: 0.8;
}

.syntax-copy-btn.copied {
  opacity: 0.5;
}

.copy-feedback {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #10b981;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}

.syntax-copy-btn.copied + .copy-feedback,
.param-example-copy-btn.copied + .copy-feedback {
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  font-size: 14px;
}

thead {
  background: #f3f4f6;
}

th,
td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
}

th {
  font-weight: 600;
  color: #374151;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

/* 概要卡片（如果后续需要可以复用），当前逻辑只用基础语法块 */
.summary-card-mobile {
  display: none;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.summary-card-row {
  margin-bottom: 14px;
  padding-bottom: 14px;
  line-height: 1.8;
  border-bottom: 1px solid #e5e7eb;
}

.summary-card-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.summary-label {
  color: #6b7280;
  font-weight: 600;
  font-size: 15px;
  display: inline-block;
  min-width: auto;
  margin-right: 4px;
}

.summary-value {
  color: #374151;
  font-size: 15px;
  word-break: break-word;
}

.summary-command {
  color: #2563eb;
  font-weight: 700;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 16px;
}

/* 参数卡片容器：手机端 UI 为主，桌面端也使用同一套布局 */
.param-cards-mobile {
  display: block;
  margin-top: 16px;
}

.param-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease-out;
  /* 确保卡片本身不会因为内容展开而导致页面整体变形 */
  max-width: 100%;
  box-sizing: border-box;
  /* 确保卡片容器本身有最小高度，即使内容隐藏也不会"变小" */
  min-height: 48px;
}

.param-card:hover {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.param-card.expanded {
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.15);
}

.param-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  background: #f9fafb;
  user-select: none;
  transition: background 0.2s ease-out;
}

.param-card-header:hover {
  background: #f3f4f6;
}

.param-card.expanded .param-card-header {
  background: #f0f4ff;
  border-bottom: 1px solid #e5e7eb;
}

.param-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.param-flag {
  color: #2563eb;
  font-family: 'Courier New', monospace;
  font-weight: 700;
}

.param-full-name {
  color: #6b7280;
  font-size: 13px;
  font-weight: 400;
}

.param-card-toggle {
  color: #9ca3af;
  font-size: 12px;
  transition: transform 0.2s ease-out, color 0.2s ease-out;
}

.param-card.expanded .param-card-toggle {
  transform: rotate(180deg);
  color: #2563eb;
}

.param-card-content {
  padding: 14px;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.6;
  /* 严格限制展开时的最大高度，避免点击 ON/OFF 时页面变形 */
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  /* 确保内容不会溢出导致页面变形 */
  word-wrap: break-word;
  /* 固定高度，即使内容再多也不会让页面变长 */
  box-sizing: border-box;
  /* 确保内容区域在显示时占用空间，隐藏时不占用空间，但不会影响卡片容器本身 */
  transition: none;
}

.param-card-row {
  margin-bottom: 10px;
}

.param-card-row:last-child {
  margin-bottom: 0;
}

.param-label {
  color: #6b7280;
  font-weight: 600;
  display: inline-block;
  min-width: auto;
  margin-right: 4px;
}

.param-value {
  color: #374151;
}

.param-card-example {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.param-example-wrapper {
  position: relative;
}

.param-example-code {
  display: block;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  /* 右侧给复制图标/已复制提示留出足够空间（图标16px + 间距6px + 已复制文字约40px + 安全边距），避免文字被盖住 */
  padding: 8px 70px 8px 10px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 12px;
  color: #111827;
  /* 允许长命令自动换行，而不是横向滚动 */
  white-space: pre-wrap;
  overflow-x: hidden;
  margin-top: 6px;
  word-break: break-all;
  /* 确保长文本可以换行显示，不会和复制按钮重合 */
  min-width: 0;
  box-sizing: border-box;
}

.param-example-copy-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
}

.not-found {
  margin-top: 40px;
  font-size: 15px;
  color: #ef4444;
}

/* ććşçŤŻďź~6.7 ĺŻ¸ďźĺŽ˝ĺşŚ <= 480px ĺˇŚĺłďź? */
@media (max-width: 480px) {
  .page-header {
    padding: 12px 10px 18px;
  }
  .page-title {
    font-size: 16px;
  }
  .search-wrapper {
    max-width: 100%;
  }
  .search-input {
    padding: 10px 40px 10px 16px;
    font-size: 14px;
  }
  .page-body {
    padding: 16px 10px 24px;
  }
  .cards-grid {
    column-count: 2;
    column-gap: 10px;
  }
  .command-card {
    margin: 0 0 10px;
  }
  .command-card {
    padding: 10px 10px;
  }
  .command-name {
    font-size: 15px;
    text-align: center;
  }
  .command-desc {
    font-size: 12px;
    display: block;
  }

  /* ĎęÇéŇł headerŁ¨ĘÖťúśËŁŠ */
  .detail-page-header {
    padding: 14px 10px !important;
  }

  .header-title {
    font-size: 16px;
  }
  .back-link {
    font-size: 15px;
    height: 26px;
    padding: 0 8px;
    border-radius: 7px;
  }

  .expand-toggle-btn {
    /* ĘÖťúśËŁşĘšÓĂšĚś¨żí¸ßľÄťŹśŻżŞšŘŁŹąÜĂâ padding ¸˛¸ÇľźÖÂ´íÎť/Ô˝˝ç */
    width: 56px;
    height: 24px;
    border-radius: 12px;
    padding: 0;
    font-size: 10px;
  }

  .toggle-label {
    width: 18px;
    height: 18px;
    left: 3px;
  }

  .expand-toggle-btn.active .toggle-label {
    /* 56 - 18 - 3 = 35 */
    left: 35px;
  }

  .toggle-text-on,
  .toggle-text-off {
    font-size: 9px;
  }

  .toggle-text-on {
    left: 3px;
  }

  .toggle-text-off {
    right: 3px;
  }
  .detail-page-body {
    padding: 16px 10px 24px;
  }
  .command-title {
    font-size: 20px;
  }
  .content-block {
    padding: 14px 12px;
    border-radius: 12px;
  }
  /* 手机端参数卡片进一步收紧高度，防止一展开就拉得太长导致页面变形 */
  .param-card-content {
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    /* 固定高度，确保点击 ON/OFF 时页面不会变形 */
    box-sizing: border-box;
  }
  .syntax-block {
    margin: 6px 0 14px;
    padding: 10px 10px;
  }
  .syntax-label {
    font-size: 13px;
  }
  .syntax-value {
    font-size: 13px;
  }
  .syntax-code {
    font-size: 12px;
    /* 手机端也确保右侧有足够空间给复制按钮和已复制提示 */
    padding: 6px 60px 6px 8px;
  }
  .syntax-copy-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* 中等屏幕及以上：只调整列表列数，详情页仍统一使用「手机端卡片」样式 */
@media (min-width: 768px) {
  .cards-grid {
    column-count: 2;
  }
  /* 桌面端不再使用表格版本，全部隐藏 */
  .summary-table-desktop,
  .param-table-desktop {
    display: none;
  }
}

/* ĺ¤§ĺąĺšďźä¸ĺďźćĄé˘ďź992px ĺäťĽä¸ďź */
@media (min-width: 992px) {
  .cards-grid {
    column-count: 3;
  }
}

/* čśĺ¤§ĺąĺšďźĺĺďźĺ¤§ćĄé˘ďź1200px ĺäťĽä¸ďź */
@media (min-width: 1200px) {
  .cards-grid {
    column-count: 4;
  }
}

