/* 订货通 · 四端操作台 单页样式（无外部依赖，可 file:// 离线打开） */
:root {
  --ink: #1b2536;
  --ink-2: #3c4a5e;
  --muted: #6b7789;
  --line: #e3e8f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --brand: #1677ff;
  --brand-dark: #0e5fd8;
  --brand-soft: #eaf2ff;
  --red: #d9363e;
  --red-soft: #fdeeee;
  --green: #00874a;
  --orange: #c26a00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --topbar-h: 60px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(22, 119, 255, .5); outline-offset: 2px; border-radius: 4px; }

/* ================= 顶栏 ================= */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; height: 100%; padding: 0 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px;
  background: linear-gradient(135deg, #1677ff, #0b4fc0);
}
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); line-height: 1.1; }
.nav { display: flex; gap: 4px; margin-left: 8px; overflow: hidden; }
.nav a { color: var(--ink-2); padding: 7px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.nav a:hover { background: #f0f4fa; text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.progress { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.progress .bar { width: 92px; height: 6px; border-radius: 99px; background: #e6ebf3; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1677ff, #4d9bff); transition: width .25s; }
.progress b { color: var(--ink); font-variant-numeric: tabular-nums; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); height: 34px;
  padding: 0 12px; border-radius: 9px; font-size: 13px;
}
.icon-btn:hover { border-color: #c9d4e5; background: #f8fafc; }
.icon-btn[aria-pressed="true"] { background: var(--brand-soft); border-color: #b8d3ff; color: var(--brand-dark); }

/* ================= 布局 ================= */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
section.block { padding: 38px 0 8px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.block-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.block-head h2 { margin: 0; font-size: 24px; letter-spacing: .2px; }
.block-head p { margin: 0 0 2px; color: var(--muted); font-size: 14px; }
.block-head .spacer { flex: 1; }

/* ================= 首屏 ================= */
.hero { padding: 46px 0 30px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--brand-dark);
  background: var(--brand-soft); border: 1px solid #cfe2ff; padding: 4px 10px; border-radius: 99px;
}
.hero h1 { margin: 14px 0 10px; font-size: clamp(28px, 4vw, 42px); line-height: 1.2; letter-spacing: -.5px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { max-width: 760px; margin: 0; color: var(--ink-2); font-size: 16px; }
.scope-note {
  margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; max-width: 860px;
  background: #fff8e6; border: 1px solid #ffe3a3; color: #8a5a00;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}
.scope-note b { color: #6f4700; }

.role-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.role-card {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.role-card:hover { transform: translateY(-2px); border-color: #c8d6ea; }
.role-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--role-color); }
.role-card .top { display: flex; align-items: center; gap: 8px; }
.role-card .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--role-color); }
.role-card h3 { margin: 0; font-size: 16px; }
.role-card .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.role-card p { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.redlines { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.redline {
  background: #fff; border: 1px solid #f5d8d8; border-left: 4px solid var(--red);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #5c2525;
}
.redline b { display: block; color: var(--red); margin-bottom: 3px; font-size: 13px; }

/* ================= 筛选 ================= */
.filters {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: rgba(244, 246, 250, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent; padding: 14px 0 12px; margin-bottom: 4px;
}
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 99px; padding: 6px 13px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { color: var(--muted); font-size: 11px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .n { color: #c8d0dc; }
.chip.role[data-role="ops"] .sw { background: #3c8dbc; }
.chip.role[data-role="store"] .sw { background: #1677ff; }
.chip.role[data-role="ghs"] .sw { background: #00a65a; }
.chip.role[data-role="driver"] .sw { background: #f39c12; }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.search-wrap { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 99px; height: 38px; padding: 0 14px; min-width: 280px;
}
.search-box input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; width: 100%; color: var(--ink); }
.search-box .ico { width: 13px; height: 13px; border: 2px solid #a4afbf; border-radius: 50%; position: relative; flex: none; }
.search-box .ico::after { content: ""; position: absolute; width: 6px; height: 2px; background: #a4afbf; transform: rotate(45deg); right: -4px; bottom: -1px; }
.result-line { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; color: var(--muted); font-size: 13px; }
.result-line .clear { border: 0; background: none; color: var(--brand); padding: 0; }
.empty-state {
  display: none; padding: 60px 20px; text-align: center; color: var(--muted);
  background: #fff; border: 1px dashed #d7dfeb; border-radius: var(--radius);
}
.empty-state.show { display: block; }

/* ================= 场景卡片 ================= */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.scene-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s, border-color .15s;
}
.scene-card:hover { transform: translateY(-2px); border-color: #c8d6ea; }
.scene-card.hidden { display: none; }
.cover { position: relative; height: 178px; background: #eef2f7; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.cover .placeholder {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; background: repeating-linear-gradient(45deg, #f3f6fa, #f3f6fa 10px, #eef2f7 10px, #eef2f7 20px);
}
.cover.failed img { display: none; }
.cover.failed .placeholder { display: flex; }
.cover .badges { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.scene-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.scene-body h3 { margin: 0; font-size: 17px; line-height: 1.4; }
.scene-body .summary { margin: 7px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.55; flex: 1; }
.mnemonic { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mnemonic span {
  font-size: 11.5px; color: var(--ink-2); background: #f3f6fb; border: 1px solid #e6ecf5;
  border-radius: 99px; padding: 2px 9px;
}
.mnemonic span + span::before { content: "→ "; color: #a5b1c2; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.meta code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: #4a5a70; }
.scene-foot { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent;
  background: #fff; color: var(--ink-2); font-size: 13.5px; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: #c9d4e5; background: #f8fafc; }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.scene-foot .steps-n { font-size: 12px; color: var(--muted); }
.master-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--muted); user-select: none; cursor: pointer; border: 0; background: none; padding: 4px;
}
.master-toggle .box {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #c3ccd9; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px;
}
.master-toggle[aria-pressed="true"] .box { background: var(--green); border-color: var(--green); }
.master-toggle[aria-pressed="true"] { color: var(--green); }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
}
.badge.role-ops { background: #e8f2f9; color: #2a709b; }
.badge.role-store { background: #e8f1ff; color: #1560c9; }
.badge.role-ghs { background: #e6f7ee; color: #00713d; }
.badge.role-driver { background: #fff3e0; color: #a85f00; }
.badge.cat { background: #f1f3f7; color: #5a6577; }

/* ================= 处理顺序 ================= */
.flow-grid { display: grid; grid-template-columns: 1.2fr 1fr .9fr; gap: 16px; }
.flow-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.flow-card h3 { margin: 0 0 12px; font-size: 16px; }
.flow-list { list-style: none; margin: 0; padding: 0; counter-reset: f; }
.flow-list li { position: relative; padding: 0 0 12px 32px; font-size: 13.5px; color: var(--ink-2); counter-increment: f; }
.flow-list li::before {
  content: counter(f); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.flow-list li:last-child { padding-bottom: 0; }
.flow-list li b { color: var(--ink); }
.flow-list li .src { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ================= 状态表 ================= */
.state-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.state-tools .search-box { min-width: 320px; }
.state-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.state-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.state-card h3 {
  margin: 0; padding: 12px 16px; font-size: 14px; background: #f8fafc; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; color: var(--ink);
}
.state-card h3 span { color: var(--muted); font-weight: 400; font-size: 12px; }
.state-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.state-card td { padding: 8px 16px; border-bottom: 1px solid #f0f3f8; vertical-align: top; }
.state-card tr:last-child td { border-bottom: 0; }
.state-card td:first-child { width: 92px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.state-card td:nth-child(2) { font-weight: 600; white-space: nowrap; }
.state-card td:nth-child(3) { color: var(--muted); font-size: 12.5px; }
.state-card tr.hidden { display: none; }

/* ================= FAQ ================= */
.faq { display: grid; gap: 10px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.faq summary {
  list-style: none; cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 14.5px;
  display: flex; align-items: center; gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 400; font-size: 18px; }
.faq details[open] summary::after { content: "–"; }
.faq .a { padding: 0 0 16px; color: var(--ink-2); font-size: 13.5px; }
.faq .a .btn { margin-top: 10px; height: 30px; font-size: 12.5px; }

/* ================= 免责 ================= */
.disclaimer {
  margin: 0 0 50px; padding: 18px 20px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 12.5px; color: var(--muted); line-height: 1.8;
}
.disclaimer b { color: var(--ink-2); }
footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 12.5px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }

/* ================= 步骤弹窗 ================= */
dialog.step-dialog {
  width: min(1400px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0;
  border: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(10, 20, 40, .35);
  overflow: hidden; background: #fff; color: var(--ink);
}
dialog.step-dialog::backdrop { background: rgba(10, 18, 32, .55); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head .badges { display: flex; gap: 6px; }
.dlg-head h3 { margin: 0; font-size: 17px; }
.zoom-top { margin-left: auto; height: 32px; padding: 0 12px; font-size: 12.5px; }
.dlg-head .dlg-close { margin-left: 4px; }
.dlg-close {
  border: 0; background: #f2f4f8; width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; color: var(--ink-2);
}
.dlg-body { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); max-height: calc(100vh - 200px); }
.dlg-img { background: #101827; display: flex; align-items: center; justify-content: center; padding: 14px; min-height: 320px; position: relative; }
.dlg-img img { max-height: calc(100vh - 260px); max-width: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.35); cursor: zoom-in; }
.dlg-img .placeholder { color: #8fa0b8; font-size: 13px; text-align: center; display: none; }
.dlg-img.failed img { display: none; }
.dlg-img.failed .placeholder { display: block; }
.dlg-side { padding: 18px 20px 20px; overflow: auto; border-left: 1px solid var(--line); }
.dlg-side .step-title { font-size: 17px; margin: 0 0 8px; }
.dlg-side .detail { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.dlg-side .redline-box {
  background: var(--red-soft); border: 1px solid #f7d3d3; color: #8c2b2b; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.dlg-side .redline-box b { color: var(--red); }
.dlg-side .mini { font-size: 12px; color: var(--muted); line-height: 1.7; word-break: break-all; }
.dlg-side .mini code { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: #3e5168; background: #f3f6fa; padding: 1px 5px; border-radius: 4px; }
.dlg-steps { display: flex; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); overflow-x: auto; }
.dlg-steps button {
  flex: none; min-width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.5px; padding: 0 10px;
}
.dlg-steps button[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.dlg-steps button.done { border-color: #b6e3cb; color: var(--green); background: #f1fbf6; }
.dlg-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px 16px; }
.dlg-foot .hint { color: var(--muted); font-size: 12px; margin-right: auto; }
.dlg-foot .btn { min-width: 92px; }

/* ================= 大图查看 ================= */
dialog.lightbox {
  inset: 0; margin: 0; padding: 0; border: 0; width: 100vw; max-width: 100vw;
  height: 100vh; max-height: 100vh; background: #0b1220; color: #e8eef7; overflow: hidden;
}
dialog.lightbox[open] { display: flex; flex-direction: column; }
dialog.lightbox::backdrop { background: #0b1220; }
.lb-bar {
  display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.lb-title { font-size: 14px; color: #dbe6f5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.lb-bar .spacer { flex: 1; }
.lb-btn, .lb-close {
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #dfe9f7;
  border-radius: 8px; height: 30px; padding: 0 11px; font-size: 12.5px; cursor: pointer;
}
.lb-btn:hover, .lb-close:hover { background: rgba(255,255,255,.14); }
.lb-close { background: #2c6fb5; border-color: #2c6fb5; color: #fff; }
.lb-pct { min-width: 46px; text-align: center; font-size: 12px; color: #9fb3cf; font-variant-numeric: tabular-nums; }
.lb-stage { flex: 1; overflow: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.lb-stage img {
  display: block; margin: 0 auto; max-width: none; height: auto;
  border-radius: 5px; box-shadow: 0 12px 44px rgba(0,0,0,.55); cursor: zoom-out;
}

/* ================= 设置面板 ================= */
.popover {
  position: fixed; right: 20px; top: 72px; z-index: 60; width: 280px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(10, 20, 40, .18);
  padding: 14px; display: none;
}
.popover.show { display: block; }
.popover h4 { margin: 0 0 8px; font-size: 14px; }
.popover p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.popover .btn { width: 100%; margin-top: 8px; }

/* ================= 响应式 ================= */
@media (max-width: 1020px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .role-grid, .redlines { grid-template-columns: repeat(2, 1fr); }
  .flow-grid { grid-template-columns: 1fr 1fr; }
  .state-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .dlg-body { grid-template-columns: 1fr; max-height: calc(100vh - 220px); overflow: auto; }
  .dlg-side { border-left: 0; border-top: 1px solid var(--line); }
  .dlg-img img { max-height: 42vh; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
  .brand { flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .top-actions { gap: 6px; margin-left: auto; flex: 0 0 auto; }
  .progress { gap: 0; flex: 0 0 auto; }
  .progress span:first-child { font-size: 0; }      /* 手机端只留 0/21，避免顶栏换行 */
  .progress b { font-size: 13px; }
  .progress .bar { display: none; }
  .icon-btn { flex: 0 0 auto; padding: 0 10px; white-space: nowrap; }
  .wrap { padding: 0 14px; }
  .grid, .role-grid, .redlines, .flow-grid { grid-template-columns: 1fr; }
  .search-wrap { margin-left: 0; width: 100%; }
  .search-box { min-width: 0; width: 100%; }
  .filters { position: static; }
  .state-tools .search-box { min-width: 0; width: 100%; }
  dialog.step-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
  .dlg-body { grid-template-columns: 1fr; max-height: calc(100vh - 210px); }
  .dlg-img { min-height: 220px; }
  .dlg-img img { max-height: none; width: 100%; }   /* 手机端竖屏截图按宽度显示，正文在下方滚动 */
  .dlg-foot .hint { display: none; }
  .dlg-head { flex-wrap: wrap; gap: 8px 10px; padding: 12px 14px; }
  .dlg-head .badges { order: 1; width: 100%; }
  .dlg-head h3 { order: 2; flex: 1 1 auto; min-width: 0; font-size: 16px; }
  .zoom-top { order: 3; margin-left: 0; }
  .dlg-head .dlg-close { order: 4; margin-left: 0; }
  .lb-bar { gap: 6px; padding: 8px 10px; }
  .lb-title { flex: 1 1 100%; max-width: none; }
  #lbFit { display: none; }                 /* 竖屏默认就是适宽，适应屏幕与它等价 */
  .lb-btn { padding: 0 9px; }
  .lb-stage { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .topbar, .filters, .hero .role-grid, .redlines, .dlg-steps, .dlg-foot, .popover, .scene-foot .master-toggle { display: none !important; }
  body { background: #fff; }
  .scene-card { break-inside: avoid; }
  dialog.step-dialog { position: static; width: 100%; max-height: none; box-shadow: none; }
  dialog.lightbox, .zoom-top { display: none !important; }
}

/* ================= 录屏 ================= */
.video-badge {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  border: 0; border-radius: 999px; padding: 5px 11px;
  background: rgba(17, 24, 39, .82); color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(4px); box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.video-badge:hover { background: #d94a4a; }
.video-top { margin-left: 0; height: 32px; padding: 0 12px; font-size: 12.5px; }
.video-top[hidden] { display: none; }

dialog.video-dialog {
  width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 40px); margin: auto;
  padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: #0f1726; color: #e8eef7; box-shadow: 0 28px 90px rgba(0,0,0,.5);
}
dialog.video-dialog[open] { display: flex; flex-direction: column; }
dialog.video-dialog::backdrop { background: rgba(5, 10, 20, .72); backdrop-filter: blur(3px); }
.vid-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.vid-heading { min-width: 0; }
.vid-kicker { display: block; font-size: 11px; letter-spacing: .06em; color: #79b8ff; }
.vid-heading h3 { margin: 3px 0 0; font-size: 16px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-head .dlg-close { margin-left: auto; background: rgba(255,255,255,.1); color: #dbe6f5; }
.vid-head .dlg-close:hover { background: rgba(255,255,255,.2); }
.vid-stage {
  position: relative; flex: 1; min-height: 200px; max-height: calc(100vh - 220px);
  display: flex; align-items: center; justify-content: center; padding: 8px; background: #000;
}
.vid-stage video { max-width: 100%; max-height: calc(100vh - 236px); width: auto; height: auto; border-radius: 6px; background: #000; }
.vid-stage .placeholder { display: none; color: #8fa0b8; font-size: 13px; text-align: center; padding: 60px 0; }
.vid-stage.failed video { display: none; }
.vid-stage.failed .placeholder { display: block; }
.vid-chapters { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.1); }
.vid-chapters button {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05); color: #c9d6e8;
  border-radius: 9px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.vid-chapters button:hover { background: rgba(255,255,255,.12); }
.vid-chapters button[aria-selected="true"] { background: #2c6fb5; border-color: #2c6fb5; color: #fff; }
.ch-time { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; }
.vid-foot { display: flex; align-items: center; gap: 10px; padding: 0 16px 12px; color: #8ea3c0; font-size: 12px; }
.vid-foot .vid-time { margin-left: auto; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  dialog.video-dialog { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .vid-head { padding: 10px 12px; }
  .vid-heading h3 { font-size: 14px; }
  .vid-stage { max-height: calc(100vh - 210px); padding: 4px; }
  .vid-stage video { max-height: calc(100vh - 226px); }
  .vid-chapters { padding: 8px 12px; }
  .vid-foot { padding: 0 12px 10px; }
}
@media print {
  dialog.video-dialog, .video-badge, .video-top { display: none !important; }
}
