/*
 * Shared styles for the three library query pages
 * (commands.html, bonus.html, status.html).
 *
 * These pages previously would have needed three near-identical copies of this
 * file's contents, which is exactly how one page ends up subtly different from
 * the others. Original design system — no third-party UI kit or theme assets.
 */
:root {
  --bg: #0f1115;
  --bg-elev: #171a21;
  --bg-elev2: #1e222b;
  --line: #2a2f3a;
  --fg: #e6e9ef;
  --fg-dim: #9aa3b2;
  --accent: #7aa2f7;
  --accent-dim: #3d5a99;
  --warn: #e0af68;
  --ok: #9ece6a;
  --bonus: #e0af68;
  --status: #9ece6a;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  display: flex; flex-direction: column;
}
header {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
h1 span { color: var(--accent); }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: var(--fg-dim); text-decoration: none; font-size: 13px; padding: 5px 11px;
  border-radius: 7px; border: 1px solid transparent;
}
nav a:hover { color: var(--fg); border-color: var(--line); }
nav a.on { color: #fff; background: var(--accent-dim); border-color: var(--accent); }
.spacer { flex: 1; }

/* The query page's <main> is a column: coverage bar above, two panes below.
   minmax(0, …) 而不是 1fr：列表签名是不带空格的长 mono 文本，1fr 轨道的
   自动最小宽度会把整页撑到数千 px（手机上直接爆版），必须显式钳到 0。 */
main#query { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panes { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; }
aside {
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-elev); min-width: 0;
}
.searchbox { padding: 14px; border-bottom: 1px solid var(--line); position: relative; }
input[type=search] {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-elev2); color: var(--fg); font-size: 14px; outline: none;
}
input[type=search]:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(122,162,247,.12); }

/* 搜索历史下拉（容器由 query-page.js 装配） */
.history {
  position: absolute; top: calc(100% - 8px); left: 14px; right: 14px; z-index: 40;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0,0,0,.5); overflow: hidden;
}
.history .hrow { display: flex; align-items: center; gap: 10px; padding: 8px 13px; cursor: pointer; font-size: 13px; }
.history .hrow:hover, .history .hrow.sel { background: var(--bg-elev); }
.history .hrow .ico { color: var(--fg-dim); flex: none; display: flex; }
.history .hrow .kw { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .hrow .del { color: var(--fg-dim); font-size: 11px; padding: 3px 7px; border-radius: 6px; visibility: hidden; flex: none; }
.history .hrow:hover .del { visibility: visible; }
.history .hrow .del:hover { color: var(--fg); background: var(--bg-elev2); }
.history .hfoot { display: flex; justify-content: space-between; align-items: center; padding: 7px 13px;
  border-top: 1px solid var(--line); color: var(--fg-dim); font-size: 12px; }
.history .hfoot .clear { cursor: pointer; }
.history .hfoot .clear:hover { color: var(--fg); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chip {
  font-size: 12px; padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-elev2); color: var(--fg-dim);
  user-select: none; white-space: nowrap; flex: 0 0 auto;
}
.chip:hover { color: var(--fg); border-color: var(--accent-dim); }
.chip.active { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .6; margin-left: 4px; }

ul.results { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
ul.results li { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
ul.results li:hover { background: var(--bg-elev2); }
ul.results li.sel { background: var(--bg-elev2); box-shadow: inset 3px 0 0 var(--accent); }
.cname { font-family: var(--mono); font-size: 13.5px; color: var(--accent); }
.zhdot {
  font-family: system-ui, sans-serif; font-size: 10px; color: var(--ok);
  border: 1px solid #2f4a2a; border-radius: 4px; padding: 0 4px; margin-left: 5px; vertical-align: 1px;
}
.csig {
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ccat { font-size: 11px; color: var(--fg-dim); margin-top: 4px; }

section.detail { overflow-y: auto; padding: 26px 30px; min-height: 0; min-width: 0; }
.empty { color: var(--fg-dim); padding: 40px 30px; }
.dtitle { font-family: var(--mono); font-size: 22px; color: var(--accent); margin: 0 0 4px; }
.dsig {
  font-family: var(--mono); font-size: 13px; background: var(--bg-elev2);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  color: var(--fg); overflow-x: auto; white-space: pre; margin: 14px 0;
}
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.tag {
  font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--bg-elev2);
  color: var(--fg-dim); border: 1px solid var(--line);
}
.tag.lic, .tag.translated { color: var(--ok); border-color: #2f4a2a; }
.tag.untranslated { color: var(--warn); border-color: #4a3a2a; }
.translator-note {
  border-left: 3px solid var(--warn); background: #1d1a15; border-radius: 8px;
  padding: 11px 14px; margin: 12px 0; font-size: 13.5px; color: #e2d8c8; white-space: pre-wrap;
}
.translator-note strong { display: block; color: var(--warn); margin-bottom: 5px; font-size: 12.5px; letter-spacing: .5px; }
#i18nbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 22px;
  border-bottom: 1px solid var(--line); background: var(--bg-elev); font-size: 12.5px;
}
h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--fg-dim);
  margin: 24px 0 10px; font-weight: 600;
}
pre {
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; margin: 0 0 10px;
}
.doc { white-space: pre-wrap; font-size: 14px; color: #cfd6e4; overflow-wrap: break-word; }
table.args { width: 100%; border-collapse: collapse; font-size: 13px; }
table.args th, table.args td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.args th { color: var(--fg-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
table.args td.mono { font-family: var(--mono); color: var(--accent); }
.req { color: var(--warn); }
.opt { color: var(--fg-dim); }
a { color: var(--accent); }
footer { border-top: 1px solid var(--line); padding: 10px 22px; font-size: 12px; color: var(--fg-dim); }
code.inline { font-family: var(--mono); background: var(--bg-elev2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.hint { font-size: 12px; color: var(--fg-dim); padding: 0 14px 10px; }

/* 手机布局断点：窄视口，或「触屏 + 横屏 + 矮视口」（大屏手机横屏宽可到
   932px，纯宽度断点盖不住；平板横屏高 768+ 与桌面窄窗口都不会误中）。
   此条件与 query-page.js 的 mqMobile 必须保持一致。 */
@media (max-width: 860px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* 手机上放弃「应用壳」：整页自然滚动。原来列表、详情各自窝在内部
     小滚动框里（aside 45vh + detail 内滚），手机上只有一小块能滑，很约束。 */
  html, body { height: auto; }
  .panes { display: block; }
  aside { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  ul.results { overflow-y: visible; }
  /* 说明文就地展开在所点条目正下方；底部详情面板（含占位文案）不再使用。
     展开块挪位引起的画面稳定由 JS 手动补偿，这里关掉浏览器滚动锚定避免双重补偿。 */
  html { overflow-anchor: none; }
  section.detail { display: none; }
  ul.results li.m-detail { padding: 14px 16px 18px; background: var(--bg-elev2); cursor: default; }
  /* 被点条目行自身吸顶：长说明滚下去，那一行钉在站点导航下方，
     时刻说明在读哪条；再点它一下就是收起。top 跟随共享头部实际高度。 */
  .m-detail .dtitle { display: none; } /* 名称由吸住的条目行承载，正文不重复大标题 */
  ul.results li.m-open {
    position: sticky; top: var(--site-header-h, 47px); z-index: 5;
    background: var(--bg-elev2);
  }
  /* 参数表列数多，窄屏放不下就表内横向滚，别撑破页面 */
  table.args { display: block; overflow-x: auto; }
}
