/* Fanzy 产品工作台 · 页面通用样式（遵循 Fanzy Web 设计规范 v3：近纯黑分层 + 品牌金点缀） */
:root {
  --l0: #060606;
  --l1: #0b0e15;
  --l2: #10131b;
  --l3: #171b24;
  --l4: #2d323f;
  --gold: #ffc93d;
  --gold-soft: #ffe19a;
  --gold-grad: linear-gradient(135deg, #ffe19a 0%, #ffcb43 100%);
  --on-gold: #3d2706;
  --text: rgba(255, 255, 255, 0.92);
  --text-2: rgba(255, 255, 255, 0.64);
  --text-3: rgba(255, 255, 255, 0.4);
  --line: rgba(255, 255, 255, 0.06);
  --line-ctl: rgba(255, 255, 255, 0.1);
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --radius-block: 12px;
  --radius-tag: 4px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--l0);
  color: var(--text);
  font: 15px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: 13px; }
code { background: var(--l3); padding: 1px 6px; border-radius: var(--radius-tag); overflow-wrap: anywhere; }
pre { background: var(--l1); border: 1px solid var(--line); border-radius: var(--radius-block); padding: 16px; overflow-x: auto; line-height: 1.6; }
pre code { background: none; padding: 0; }
img { max-width: 100%; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: rgba(6, 6, 6, 0.92);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 600; color: var(--text); white-space: nowrap; }
.topbar .brand b { color: var(--gold); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; font-size: 14px; }
.topbar nav a { color: var(--text-2); padding: 4px 10px; border-radius: 999px; }
.topbar nav a:hover, .topbar nav a.on { color: var(--text); background: var(--l3); text-decoration: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 80px; }
.wrap.narrow { max-width: 880px; }

h1 { font-size: 28px; line-height: 1.3; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 48px 0 16px; padding-top: 8px; }
h3 { font-size: 16px; margin: 28px 0 10px; }
.lead { color: var(--text-2); margin: 0 0 24px; font-size: 16px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); font-size: 13px; }

/* 卡片与网格 */
.card { background: var(--l2); border: 1px solid var(--line); border-radius: var(--radius-block); padding: 20px; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid .card + .card { margin-top: 0; }
.card h3 { margin-top: 0; }

/* 标签：语义标签不描边，10% 底 + 实色文字 */
.tag { display: inline-block; padding: 0 8px; border-radius: var(--radius-tag); font-size: 12px; line-height: 22px; white-space: nowrap; }
.tag.ok { background: rgba(52, 211, 153, 0.1); color: var(--ok); }
.tag.bad { background: rgba(248, 113, 113, 0.1); color: var(--bad); }
.tag.warn { background: rgba(251, 191, 36, 0.1); color: var(--warn); }
.tag.info { background: rgba(96, 165, 250, 0.1); color: var(--info); }
.tag.gold { background: rgba(255, 201, 61, 0.1); color: var(--gold); }
.tag.plain { background: var(--l3); color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--line-ctl); color: var(--text); background: var(--l3); cursor: pointer;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.4); text-decoration: none; }
.btn.primary { background: var(--gold-grad); color: var(--on-gold); border: 0; font-weight: 600; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: top; }
th { color: var(--text-2); font-weight: 500; background: var(--l1); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-block); }
.i18n-table { table-layout: fixed; min-width: 940px; }
.i18n-table th, .i18n-table td { padding: 10px 8px; }
.i18n-table th:first-child, .i18n-table td:first-child { width: 260px; white-space: nowrap; overflow-wrap: normal; word-break: normal; position: sticky; left: 0; z-index: 1; background: var(--l1); box-shadow: 1px 0 var(--line); }
.i18n-table th:nth-child(2), .i18n-table td:nth-child(2) { width: 160px; }
.i18n-table td:first-child code { white-space: nowrap; font-size: 12px; padding: 1px 2px; }
.i18n-table-wrap { max-width: 100%; }

/* 搜索与筛选 */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.search {
  flex: 1 1 260px; min-width: 0;
  padding: 9px 14px; border-radius: 999px; font: inherit; color: var(--text);
  background: var(--l3); border: 1px solid var(--line-ctl); outline: none;
}
.search:focus { border-color: var(--gold); }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-ctl); background: transparent; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--gold); color: var(--gold); }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; }
[hidden] { display: none !important; }

/* 提示块 */
.note { border-left: 3px solid var(--gold); background: var(--l1); padding: 12px 16px; border-radius: 0 var(--radius-block) var(--radius-block) 0; margin: 16px 0; }
.note.bad { border-color: var(--bad); }
.note.ok { border-color: var(--ok); }

/* 步骤与对话（使用规范、例子页） */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 20px 44px; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--l3); color: var(--gold); font-weight: 600; font-size: 13px;
}
.chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: var(--radius-block); white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: rgba(255, 201, 61, 0.1); color: var(--gold-soft); }
.bubble.ai { align-self: flex-start; background: var(--l3); }
.bubble .who { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.copy { cursor: pointer; }

/* 需求文档：截图 + 序号标注 */
.shot { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-block); overflow: hidden; background: var(--l1); }
.shot img { display: block; width: 100%; height: auto; }
.marker { position: absolute; border: 2px solid var(--gold); border-radius: 6px; pointer-events: none; }
.marker b {
  position: absolute; top: -12px; left: -12px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold-grad); color: var(--on-gold); display: grid; place-items: center; font-size: 13px;
}
.shots { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.shots figure { margin: 0; max-width: 420px; min-width: 0; }
.shots figcaption { color: var(--text-2); font-size: 13px; margin-top: 8px; }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--gold-grad); color: var(--on-gold); font-size: 13px; font-weight: 600; margin-right: 8px; flex: none; }
.req h3 { display: flex; align-items: center; margin: 0 0 12px; }
.req .cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.req .cols h4 { margin: 0 0 6px; font-size: 13px; }
.req ul { margin: 0; padding-left: 18px; }
.req .do h4 { color: var(--ok); }
.req .dont h4 { color: var(--bad); }
.req .acc h4 { color: var(--gold); }

/* 测试用例 */
.case { padding: 0; overflow: hidden; }
.case > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 14px 20px; }
.case > summary::-webkit-details-marker { display: none; }
.case > summary .id { font-family: var(--mono); color: var(--text-3); font-size: 13px; }
.case > summary .t { flex: 1; min-width: 0; }
.case .body { padding: 0 20px 20px; border-top: 1px solid var(--line); }
.case video { width: 100%; max-width: 420px; max-height: 560px; object-fit: contain; border-radius: var(--radius-block); background: #000; display: block; }
.media { display: grid; gap: 16px; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); margin-top: 16px; }
.media:has(.scenario-player) { grid-template-columns: minmax(0, 1fr); }
.scenario-player { width: 100%; min-width: 0; }
.scenario-player figure { margin: 0; }
.scenario-player img { display: block; width: 100%; max-height: 620px; object-fit: contain; background: #111; border: 1px solid var(--line); border-radius: 8px; }
.scenario-player figcaption { padding: 10px 0; overflow-wrap: anywhere; }
.scenario-player input[type=range] { width: 100%; }
.scenario-player button { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit; padding: 7px 10px; cursor: pointer; }
.scenario-player button:disabled { opacity: .4; cursor: default; }
.replay-thumbnails { position: relative; display: flex; width: 100%; min-width: 0; max-width: 100%; gap: 8px; overflow-x: auto; list-style: none; margin: 12px 0 0; padding: 4px 2px 10px; scroll-behavior: smooth; }
.replay-thumbnails li { flex: 0 0 112px; min-width: 0; }
.scenario-player .replay-thumbnails button { width: 100%; height: 150px; display: flex; flex-direction: column; gap: 6px; padding: 5px; text-align: left; }
.scenario-player .replay-thumbnails img { width: 100%; height: 96px; flex: 0 0 96px; object-fit: contain; border: 0; border-radius: 4px; }
.replay-thumbnails span { font-size: 11px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scenario-player .replay-thumbnails button[aria-pressed=true] { border-color: var(--gold, #ffd66b); outline: 2px solid var(--gold, #ffd66b); background: #ffd66b18; }
.stepshots { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.stepshots figure { margin: 0; flex: none; width: 160px; }
.stepshots img { border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.stepshots figcaption { font-size: 12px; color: var(--text-2); }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { background: var(--l2); border: 1px solid var(--line); border-radius: var(--radius-block); padding: 12px 18px; min-width: 120px; }
.stat b { display: block; font-size: 24px; }

.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.88); display: grid; place-items: center; z-index: 50; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; }

/* 首页版本行 */
.ver { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.ver .links { display: flex; gap: 8px; flex-wrap: wrap; }

footer.foot { color: var(--text-3); font-size: 12px; text-align: center; padding: 24px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .wrap { padding: 24px 16px 60px; }
  .media { grid-template-columns: 1fr; }
  .ver { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}

/* 新需求问卷 */
.qa { display: grid; gap: 14px; }
.qa fieldset { border: 1px solid var(--line); border-radius: var(--radius-block); background: var(--l2); padding: 16px 20px 20px; margin: 0; min-width: 0; }
.qa legend { padding: 0 6px; font-weight: 600; color: var(--gold-soft); }
.qa label { display: block; margin-top: 12px; font-size: 14px; color: var(--text); }
.qa label .dim { font-size: 12px; }
.qa .must { color: var(--gold); font-size: 12px; margin-left: 4px; }
.qa input[type=text], .qa textarea, .qa select {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px;
  background: var(--l1); color: var(--text); border: 1px solid var(--line-ctl); border-radius: 8px;
  font: inherit; font-size: 14px; outline: none;
}
.qa textarea { min-height: 72px; resize: vertical; line-height: 1.6; }
.qa input:focus, .qa textarea:focus, .qa select:focus { border-color: var(--gold); }
.qa .checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.qa .checks label { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.wrap:has(.qa-layout) { max-width: 1680px; padding-left: 48px; padding-right: 48px; }
.qa-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
/* 右栏撑满整列高度，里面的面板吸顶：父容器足够高，滚动时面板始终停在右侧 */
.qa-main { min-width: 0; }
.qa-side { align-self: stretch; min-width: 0; }
.qa-panel { position: -webkit-sticky; position: sticky; top: var(--qa-top, 88px); display: flex; flex-direction: column; height: calc(100vh - var(--qa-top, 88px) - 16px); height: calc(100dvh - var(--qa-top, 88px) - 16px); box-sizing: border-box; padding: 16px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius-block); background: var(--l2); }
.qa-panel h2 { margin: 0 0 4px; font-size: 18px; }
.qa-panel pre { flex: 1; min-height: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 13px; }
.qa-progress { font-size: 13px; color: var(--text-2); }
.qa-progress b { color: var(--gold); }
.qa .hint { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); white-space: pre-line; }
@media (max-width: 900px) {
  .wrap:has(.qa-layout) { padding-left: 16px; padding-right: 16px; }
  .qa-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .qa-panel { position: static; height: auto; }
  .qa-panel pre { max-height: 60vh; }
}
.qa-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.steps.outline > li > ol { margin: 6px 0 4px; padding-left: 20px; color: var(--text-2); }
.steps.outline > li > ol > li { margin: 2px 0; }
.qa [hidden] { display: none; }
/* 锚点跳转时标题不被吸顶导航遮住 */
main [id] { scroll-margin-top: 110px; }
