/* 三层入口和产物阅读；配色与现有纸本/墨色主题一致。 */
.apt-workbench,
[data-testid='ai-review-history-commentary'],
[data-product-tier] {
  --apt-paper: #191714;
  --apt-input: #141310;
  --apt-ink: #f6f0e6;
  --apt-muted: #b6aea2;
  --apt-line: #484036;
  --apt-accent: #ed9eb5;
  --apt-action: #a72f2a;
  color: var(--apt-ink);
  font-family: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}
html.light-mode :is(.apt-workbench, [data-product-tier], .apt-commentary-reader),
html[data-ft-mode='paper'] :is(.apt-workbench, [data-product-tier], .apt-commentary-reader) {
  --apt-paper: #fffcf6;
  --apt-input: #fffdf9;
  --apt-ink: #29231e;
  --apt-muted: #655c52;
  --apt-line: #d9cfc0;
  --apt-accent: #990f3d;
  --apt-action: #a32d2a;
}
.apt-workbench {
  box-sizing: border-box;
  order: 3;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto 20px;
  padding: 20px;
  background: var(--apt-paper);
  border: 1px solid var(--apt-line);
  border-radius: 8px;
}
.apt-workbench h2 { margin: 0 0 16px; font-size: 17px; font-weight: 650; line-height: 1.5; }
.apt-tier-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.apt-tier-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 4px 10px;
  padding: 14px;
  min-height: 100px;
  border: 1px solid var(--apt-line);
  border-radius: 6px;
  background: var(--apt-input);
  color: var(--apt-ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.apt-tier-choice[aria-pressed='true'] { border-color: var(--apt-accent); outline: 1px solid var(--apt-accent); }
.apt-tier-choice strong { font-size: 15px; line-height: 24px; }
.apt-step { display: block; width: 24px; line-height: 24px; border-radius: 50%; text-align: center; background: var(--apt-line); font-size: 12px; }
.apt-tier-choice[aria-pressed='true'] .apt-step { background: var(--apt-action); color: #fffaf2; }
.apt-tier-description { grid-column: 2; color: var(--apt-muted); font-size: 12px; line-height: 1.7; }
.apt-product-panel { padding-top: 16px; min-width: 0; }
.apt-product-panel h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.apt-fields { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.apt-field { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.apt-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--apt-line);
  border-radius: 5px;
  font: inherit;
  background: var(--apt-input);
  color: var(--apt-ink);
  text-overflow: ellipsis;
}
.apt-helper { margin: 0; color: var(--apt-muted); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.apt-source-link { display: inline-block; color: var(--apt-accent); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; margin: 0 0 10px; }
.apt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.apt-primary,
.apt-secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 9px 16px;
  border: 1px solid var(--apt-line);
  border-radius: 5px;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
  background: var(--apt-input);
  color: var(--apt-ink);
  text-decoration: none;
}
.apt-primary { background: var(--apt-action); color: #fffaf2; border-color: var(--apt-action); }
.artifact-toolbar .apt-secondary { background: transparent; color: var(--artifact-ink); border-color: var(--artifact-border); }
.artifact-toolbar .apt-secondary:focus-visible { outline: 2px solid var(--artifact-accent); outline-offset: 3px; }
.apt-workbench button:disabled,
[data-product-tier] button:disabled { opacity: .55; cursor: default; }
.apt-workbench :is(button, select, a):focus-visible,
[data-testid='ai-review-history-commentary'] :is(button, a):focus-visible,
[data-product-tier] :is(button, a):focus-visible { outline: 2px solid var(--apt-accent); outline-offset: 3px; }
.apt-status { margin: 12px 0 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.apt-error { color: var(--apt-accent); }
app-ai-review[data-product-mode='report'] app-ai-review-form,
app-ai-review[data-product-mode='speaker'] app-ai-review-form { display: none !important; }
.apt-workbench[hidden],
.apt-status[hidden] { display: none !important; }
.apt-badge { display: inline-block; padding: 3px 8px; border: 1px solid currentColor; border-radius: 4px; color: var(--apt-accent, #ed9eb5); font-size: 12px; line-height: 1.7; }
html.light-mode .apt-history-badge,
html[data-ft-mode='paper'] .apt-history-badge { color: #990f3d; }
.apt-history-badge { margin: 0 0 8px; }
app-ai-review-history .history-action-cell:has(> [data-testid^='history-commentary-']) { flex-wrap: wrap; }
app-ai-review-history [data-testid^='history-commentary-'] { flex: 0 0 auto; white-space: nowrap; }
app-ai-review-history [data-product-mode='speech'] :is(.history-health-chip, .history-card-meta, [data-testid^='history-reanalyze-']),
app-ai-review-history [data-product-mode='speaker'] :is(.history-health-chip, .history-card-meta, .history-result-pill, [data-testid^='history-reanalyze-']) { display: none !important; }
app-ai-review-artifacts[data-product-tier] { display: block; height: auto; min-height: 0; background: var(--apt-paper); color: var(--apt-ink); }
.apt-reader { max-width: 960px; margin: 0 auto; padding: 24px 28px 40px; box-sizing: border-box; overflow-wrap: anywhere; }
.apt-commentary-reader { width: min(960px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 1px solid var(--apt-line); border-radius: 8px; background: var(--apt-paper); overflow: auto; }
.apt-commentary-reader::backdrop { background: #0008; }
.apt-commentary-reader > header { position: sticky; top: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--apt-line); background: var(--apt-paper); }
.apt-commentary-reader h2 { margin: 0; font-size: 18px; }
.apt-commentary-reader .apt-actions { margin: 0; }
.apt-commentary-reader .apt-reader { padding: 20px; }
.apt-reader-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--apt-line); }
.apt-reader h1 { font-size: 26px; line-height: 1.5; margin: 24px 0 10px; }
.apt-reader h2 { font-size: 20px; line-height: 1.6; margin: 20px 0 8px; }
.apt-reader > .apt-prose { padding-top: 24px; font-size: 17px; line-height: 1.95; }
.apt-prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.apt-dimensions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.apt-player-commentary { margin-top: 20px; padding: 18px; border: 1px solid var(--apt-line); border-radius: 6px; }
.apt-player-commentary h3 { margin: 0 0 12px; font-size: 17px; line-height: 1.6; }
.apt-player-commentary p { margin: 0; font-size: 15px; line-height: 1.9; }
.apt-dimension { min-width: 0; padding: 18px; border: 1px solid var(--apt-line); border-radius: 6px; }
.apt-dimension-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.apt-dimension h3 { margin: 0; font-size: 16px; line-height: 1.6; }
.apt-score { color: var(--apt-accent); font-size: 14px; font-weight: 600; }
.apt-dimension p { margin: 0; font-size: 14px; line-height: 1.9; }
.apt-quote { padding-left: 12px; margin: 14px 0 0; border-left: 3px solid var(--apt-line); color: var(--apt-muted); font-size: 13px; line-height: 1.9; white-space: pre-wrap; }
.apt-personal-topic { margin: 0 0 12px; color: var(--apt-muted); font-size: 15px; line-height: 1.8; }
.apt-reader > .apt-source-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; margin-bottom: 0; }
.apt-reader .apt-personal-identity { margin-top: 14px; font-size: 18px; }
.apt-personal-summary { margin: 24px 0; padding: 18px 20px; border-left: 3px solid var(--apt-accent); background: var(--apt-input); }
.apt-personal-summary h2 { margin-top: 0; }
.apt-personal-summary p { margin: 0; font-size: 16px; line-height: 1.9; }
.apt-training-card,
.apt-evidence-card { min-width: 0; margin-top: 16px; padding: 20px; border: 1px solid var(--apt-line); border-radius: 6px; background: var(--apt-input); }
.apt-training-card h3,
.apt-evidence-card h3 { margin: 0 0 12px; font-size: 16px; line-height: 1.7; }
.apt-training-card > p { margin: 0; font-size: 15px; line-height: 1.9; }
.apt-action-steps { margin: 0; }
.apt-action-steps dt { margin: 16px 0 6px; color: var(--apt-accent); font-size: 14px; font-weight: 650; }
.apt-action-steps dt:first-child { margin-top: 0; }
.apt-action-steps dd { margin: 0; font-size: 15px; line-height: 1.9; }
.apt-action-evidence { margin: 16px 0; padding: 14px; border-left: 2px solid var(--apt-line); }
.apt-action-evidence .apt-quote { margin-top: 6px; border: 0; padding: 0; }
.apt-evidence-location { margin: 0; color: var(--apt-muted); font-size: 12px; line-height: 1.8; }
.apt-evidence-button { margin-top: 10px; font-size: 13px; }
.apt-evidence-card:focus { outline: 2px solid var(--apt-accent); outline-offset: 4px; }
.apt-evidence-card .apt-quote { margin: 0; }
.apt-personal-limits,
.apt-public-notice { margin: 20px 0; padding: 14px 16px; border: 1px solid var(--apt-line); border-radius: 5px; color: var(--apt-muted); font-size: 13px; line-height: 1.9; }
.apt-personal-limits h2 { margin: 0 0 10px; font-size: 16px; color: var(--apt-ink); }
.apt-personal-limits p { margin: 0 0 6px; }
.apt-original { margin-top: 20px; }
.apt-original summary,
.apt-personal-share > summary { min-height: 44px; display: flex; align-items: center; padding: 8px 0; box-sizing: border-box; cursor: pointer; font-size: 15px; line-height: 1.8; color: var(--apt-accent); }
.apt-original summary:focus-visible,
.apt-personal-share > summary:focus-visible { outline: 2px solid var(--apt-accent); outline-offset: 3px; }
.apt-original summary::before,
.apt-personal-share > summary::before { content: '▸'; display: inline-block; flex: 0 0 20px; }
.apt-original[open] summary::before,
.apt-personal-share[open] > summary::before { content: '▾'; }
.apt-personal-share { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--apt-line); }
.apt-share-permission { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 10px 0; min-height: 44px; box-sizing: border-box; cursor: pointer; font-size: 13px; line-height: 1.8; }
.apt-share-permission input { flex: 0 0 auto; width: 18px; height: 18px; margin: 3px 0; accent-color: var(--apt-action); }
.apt-share-row { margin-top: 16px; padding: 16px; border: 1px solid var(--apt-line); border-radius: 5px; }
.apt-share-row .apt-field { width: 100%; }
.apt-share-row input { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 10px; border: 1px solid var(--apt-line); border-radius: 4px; background: var(--apt-input); color: var(--apt-ink); font: inherit; font-size: 13px; }
.apt-share-row input:focus-visible,
.apt-share-permission input:focus-visible { outline: 2px solid var(--apt-accent); outline-offset: 3px; }
.apt-personal-share button:disabled { opacity: .55; cursor: default; }
@media (max-width: 760px) {
  .apt-workbench { padding: 16px; }
  .apt-tier-choice { padding: 10px; grid-template-columns: 1fr; gap: 6px; }
  .apt-tier-description { grid-column: 1; }
  .apt-tier-choice strong { font-size: 14px; }
  .apt-tier-description { font-size: 11px; }
  .apt-reader { padding: 18px 16px 32px; }
  .apt-reader h1 { font-size: 22px; }
  .apt-dimensions { grid-template-columns: minmax(0, 1fr); }
  .apt-personal-summary { padding: 16px; }
  .apt-training-card,
  .apt-evidence-card { padding: 16px; }
  .apt-action-evidence { padding: 12px; }
  .apt-share-row .apt-actions > button { width: 100%; }
}
@media (max-width: 420px) {
  .apt-workbench { padding: 12px; }
  .apt-tier-choices { gap: 7px; }
  .apt-tier-description { display: none; }
  .apt-tier-choice { min-height: 80px; padding: 10px 8px; }
  .apt-tier-choice strong { font-size: 13px; }
  .apt-product-panel { padding-top: 14px; }
}
