/* ============================================================
   霸王龙工具箱 · TREX TOOLBOX
   简约浅色主题 · 无外部依赖
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-tint: #f1f3f6;
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e6e8ec;
  --border-strong: #d5d9e0;

  --brand: #16a34a;
  --brand-dark: #15803d;
  --brand-soft: #e7f6ec;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --amber: #b45309;
  --amber-soft: #fdf1de;
  --red: #dc2626;
  --red-soft: #fdecec;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 10px 24px rgba(16, 24, 40, .06);
  --maxw: 1160px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.3; margin: 0; font-weight: 650; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.hidden { display: none !important; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: block; border-radius: 7px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text-strong); letter-spacing: .2px; }
.brand-en {
  font-size: 10px; color: var(--faint); letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600;
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 7px 13px; border-radius: 999px; font-size: 14px;
  color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
.site-nav a:hover { background: var(--bg-tint); color: var(--text-strong); text-decoration: none; }
.site-nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-toggle {
  display: none; margin-left: auto; width: 38px; height: 38px;
  border: 1px solid var(--border); background: var(--bg); border-radius: 9px;
  align-items: center; justify-content: center; cursor: pointer; color: var(--muted);
}

/* ---------- Hero ---------- */
.hero { background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.hero-inner { padding: 56px 20px 46px; max-width: 820px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--brand-dark);
  background: var(--brand-soft); border: 1px solid #cdead8;
  padding: 4px 11px; border-radius: 999px; margin-bottom: 16px;
}
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.hero-title { font-size: 34px; letter-spacing: -.4px; margin-bottom: 12px; }
.hero-lead { font-size: 16px; color: var(--muted); max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 30px;
  margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 22px; font-weight: 700; color: var(--text-strong); letter-spacing: -.3px; }
.stat-label { font-size: 12.5px; color: var(--muted); }

/* ---------- 区块 ---------- */
.section { padding: 52px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 26px; max-width: 720px; }
.section-title { font-size: 23px; letter-spacing: -.2px; }
.section-desc { color: var(--muted); font-size: 14.5px; margin-top: 7px; }

/* ---------- 主体布局：侧栏 + 内容 ---------- */
.layout { display: grid; grid-template-columns: 226px minmax(0, 1fr); gap: 26px; align-items: start; }
.sidebar { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }
.panel {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
}
.panel-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 10px;
}
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: 0; background: transparent; cursor: pointer;
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  text-align: left; transition: background .14s, color .14s;
}
.cat-item:hover { background: var(--bg-tint); }
.cat-item svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.cat-item .cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--bg-tint); border-radius: 999px; padding: 1px 7px; flex: none;
}
.cat-item.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.cat-item.is-active svg { color: var(--brand); }
.cat-item.is-active .cat-count { background: #d3eedd; color: var(--brand-dark); }

.plat-list, .status-list { display: flex; flex-direction: column; gap: 1px; }
.check-item, .radio-item {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 5px 8px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text);
}
.check-item:hover, .radio-item:hover { background: var(--bg-tint); }
.check-item input, .radio-item input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.check-item .cat-count, .radio-item .cat-count { margin-left: auto; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
.search-input {
  width: 100%; height: 38px; padding: 0 62px 0 34px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  font-size: 14px; font-family: inherit; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; background: var(--bg-soft); pointer-events: none;
}
.select {
  height: 38px; padding: 0 30px 0 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
  font-size: 13.5px; font-family: inherit; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.result-count { font-size: 13px; color: var(--muted); margin-left: auto; }
.result-count b { color: var(--text-strong); font-weight: 650; }
/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: 13.5px; font-weight: 550;
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--bg); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-tint); border-color: var(--faint); }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--bg-tint); color: var(--text-strong); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 工具卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-2px); }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.card-icon {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tint); color: var(--muted);
}
.card-icon svg { width: 21px; height: 21px; }
.card-head { min-width: 0; flex: 1; }
.card-title { font-size: 15.5px; font-weight: 650; color: var(--text-strong); margin-bottom: 3px; }
.card-meta { font-size: 12px; color: var(--faint); letter-spacing: -.1px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-tint); color: var(--muted); border: 1px solid transparent;
}
.badge svg { width: 11px; height: 11px; }
.badge-cat { background: var(--blue-soft); color: #1d4ed8; }
.badge-plat { background: var(--bg-tint); color: var(--muted); }
.badge-released { background: var(--brand-soft); color: var(--brand-dark); }
.badge-wip { background: var(--amber-soft); color: var(--amber); }
.badge-featured { background: #fff7e6; color: #b45309; border-color: #fde3b0; }
.card-summary {
  font-size: 13.5px; color: var(--muted); margin-top: 12px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-list { margin-top: 11px; display: flex; flex-direction: column; gap: 5px; }
.card-list li {
  display: flex; gap: 7px; font-size: 12.8px; color: var(--text); line-height: 1.5;
}
.card-list li svg { width: 14px; height: 14px; color: var(--brand); flex: none; margin-top: 3px; }
.card-specs {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--muted);
}
.spec { display: inline-flex; align-items: center; gap: 5px; }
.spec svg { width: 13px; height: 13px; color: var(--faint); }
.spec b { font-weight: 600; color: var(--text); }
.card-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.card-actions .btn { flex: 1; }
.card-actions .btn-ghost { flex: 0 0 auto; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg);
}
.empty svg { width: 34px; height: 34px; color: var(--border-strong); margin-bottom: 10px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-text { font-size: 13.5px; }

/* ---------- 更新服务 ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.step {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.step-title { font-size: 14px; font-weight: 650; margin-bottom: 5px; }
.step-text { font-size: 13px; color: var(--muted); line-height: 1.6; }
.step-text code { font-size: 12px; }

.hint { font-size: 12.5px; color: var(--faint); line-height: 1.6; }


.note {
  margin-top: 16px; padding: 13px 15px; border-radius: var(--radius);
  background: var(--blue-soft); border: 1px solid #d7e4fd;
  font-size: 13px; color: #1e40af; line-height: 1.65;
}
.note b { font-weight: 700; }
/* ---------- 详情弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .42); }
.modal-panel {
  position: relative; width: 100%; max-width: 660px; background: var(--bg);
  border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(16, 24, 40, .28);
  overflow: hidden; animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 18px 18px 16px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.modal-head .card-icon { width: 44px; height: 44px; }
.modal-titles { flex: 1; min-width: 0; }
.modal-title { font-size: 17.5px; font-weight: 680; margin-bottom: 3px; }
.modal-sub { font-size: 12.5px; color: var(--faint); }
.modal-close {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-tint); color: var(--text-strong); }
.modal-close svg { width: 15px; height: 15px; }
.modal-body { padding: 18px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px; border-top: 1px solid var(--border); background: var(--bg-soft);
}
.modal-foot .btn { flex: 1 1 auto; }
.detail-block { margin-bottom: 20px; }
.detail-block:last-child { margin-bottom: 0; }
.detail-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 8px;
}
.detail-text { font-size: 14px; color: var(--text); line-height: 1.72; }
.kv { display: grid; grid-template-columns: 106px minmax(0, 1fr); gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }
.kv dd.mono { font-family: var(--mono); font-size: 12px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.changelog { display: flex; flex-direction: column; gap: 12px; }
.log-item { border-left: 2px solid var(--border); padding-left: 13px; }
.log-item:first-child { border-left-color: var(--brand); }
.log-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.log-ver { font-size: 13.5px; font-weight: 650; color: var(--text-strong); font-family: var(--mono); }
.log-date { font-size: 12px; color: var(--faint); }
.log-notes { display: flex; flex-direction: column; gap: 3px; }
.log-notes li { font-size: 13px; color: var(--muted); line-height: 1.6; display: flex; gap: 7px; }
.log-notes li::before { content: "·"; color: var(--faint); font-weight: 700; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding: 34px 0 26px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.footer-brand { display: flex; gap: 10px; align-items: center; max-width: 330px; }
.footer-brand .brand-mark { width: 26px; height: 26px; }
.footer-brand-text { display: flex; flex-direction: column; }
.footer-brand-name { font-size: 14px; font-weight: 650; color: var(--text-strong); }
.footer-brand-desc { font-size: 12.5px; color: var(--muted); }
.footer-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-nav a { font-size: 13px; color: var(--muted); }
.footer-nav a:hover { color: var(--brand-dark); }
.footer-copy {
  width: 100%; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 10px;
}
.footer-copy .right { margin-left: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .cat-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cat-item { width: auto; border: 1px solid var(--border); background: var(--bg); }
  .cat-item.is-active { border-color: #cdead8; }
  .plat-list, .status-list { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
}
@media (max-width: 820px) {
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 62px;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 10px 16px 14px; box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 10px 12px; border-radius: var(--radius-sm); }
  .nav-toggle { display: flex; }
  .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hero-inner { padding: 38px 0 32px; }
  .hero-title { font-size: 26px; }
  .hero-lead { font-size: 14.5px; }
  .hero-stats { gap: 20px; }
  .stat-num { font-size: 19px; }
  .section { padding: 38px 0; }
  .section-title { font-size: 20px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .result-count { margin-left: 0; width: 100%; order: 3; }
  .search { max-width: none; flex-basis: 100%; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-body { max-height: 66vh; }
  .kv { grid-template-columns: 88px minmax(0, 1fr); }
  .card-actions { flex-direction: column; align-items: stretch; }
  .card-actions .btn-ghost { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .sidebar, .toolbar, .modal, .hero-actions { display: none !important; }
  body { background: #fff; }
}
.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; }
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600;
  color: var(--text-strong); list-style: none; display: flex; gap: 10px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--faint); font-weight: 400; font-size: 17px; line-height: 1; flex: none; }
.faq details[open] summary::before { content: "\2013"; }
.faq-body { padding: 0 14px 13px 41px; font-size: 13.5px; color: var(--muted); line-height: 1.78; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- 常见问题 / 使用说明 ---------- */
.faq-wide {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 10px; align-items: start;
}
.usage-list { display: flex; flex-direction: column; gap: 9px; counter-reset: us;
  list-style: none; margin: 0; padding: 0; }
.usage-list li {
  display: flex; gap: 10px; font-size: 13.5px; color: var(--text); line-height: 1.65;
}
.usage-list li::before {
  counter-increment: us; content: counter(us); flex: none; margin-top: 1px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 640px) {
  .faq-wide { grid-template-columns: minmax(0, 1fr); }
  .faq-body { padding-left: 14px; }
  .steps { margin-bottom: 16px; }
}
