/*
 * 史料方法审计、技术验证与评委演示。
 * 独立于生产包加载，便于静态导出后继续维护且不覆盖用户已有样式。
 */

:root {
  --audit-ink: #15393d;
  --audit-deep: #082c31;
  --audit-paper: #f6f0e3;
  --audit-paper-2: #fffaf0;
  --audit-line: #c8bda8;
  --audit-red: #9c3b32;
  --audit-gold: #a66d17;
  --audit-blue: #176b87;
  --audit-violet: #6b4b8a;
  --audit-green: #2f6e55;
  --audit-focus: #0b71a3;
}

.method-audit,
.method-audit * {
  box-sizing: border-box;
}

.method-audit {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(64px, 8vw, 118px) max(24px, calc((100vw - 1320px) / 2));
  background:
    radial-gradient(circle at 12% 10%, rgba(166, 109, 23, 0.12), transparent 28%),
    linear-gradient(180deg, #f7f1e5, #ece3d2);
  color: var(--audit-ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.method-audit::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(21, 57, 61, 0.035) 32px);
  content: "";
  pointer-events: none;
}

.audit-kicker {
  margin: 0 0 14px;
  color: var(--audit-red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.audit-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: end;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--audit-line);
}

.audit-hero h2,
.audit-section-head h3 {
  margin: 0;
  font-family: STSong, SimSun, serif;
  font-weight: 500;
}

.audit-hero h2 {
  max-width: 860px;
  font-size: clamp(38px, 5.8vw, 78px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.audit-hero > p {
  max-width: 540px;
  margin: 0;
  color: #516466;
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.9;
}

.evidence-legend {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.evidence-legend li,
.evidence-tag {
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.78);
  color: var(--audit-ink);
}

.evidence-legend li {
  display: flex;
  min-height: 48px;
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.evidence-legend b,
.evidence-tag b {
  font-family: Georgia, serif;
  font-size: 17px;
}

.type-direct { color: #8c2f2b !important; }
.type-truth { color: #245f46 !important; }
.type-model { color: #5e4a8d !important; }
.type-catalog { color: #315e78 !important; }
.type-external { color: #8b5d16 !important; }
.type-inference { color: #5c5050 !important; }
.type-gap { color: #884a00 !important; border-style: dashed !important; }

.audit-block {
  margin-top: clamp(58px, 7vw, 100px);
}

.audit-section-head {
  display: flex;
  margin-bottom: 26px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.audit-section-head h3 {
  font-size: clamp(31px, 4.2vw, 56px);
  line-height: 1.12;
}

.audit-section-head p {
  max-width: 520px;
  margin: 0;
  color: #5a6869;
  line-height: 1.75;
}

.qr-four-layers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.qr-layer {
  min-height: 330px;
  padding: 24px;
  border: 1px solid var(--audit-line);
  border-top: 5px solid var(--audit-ink);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 16px 50px rgba(35, 48, 45, 0.06);
}

.qr-layer:nth-child(1) { border-top-color: var(--audit-red); }
.qr-layer:nth-child(2) { border-top-color: var(--audit-violet); }
.qr-layer:nth-child(3) { border-top-color: var(--audit-gold); }
.qr-layer:nth-child(4) { border-top-color: var(--audit-ink); }

.qr-layer > span {
  display: block;
  margin-bottom: 18px;
  color: #6b6e68;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.qr-layer h4 {
  margin: 0 0 15px;
  font-family: STSong, SimSun, serif;
  font-size: 25px;
  font-weight: 600;
}

.qr-layer ul,
.qr-layer dl {
  margin: 0;
  padding: 0;
}

.qr-layer ul { padding-left: 20px; }

.qr-layer li,
.qr-layer p,
.qr-layer dd {
  color: #3f5456;
  font-size: 14px;
  line-height: 1.72;
}

.qr-layer li + li { margin-top: 8px; }
.qr-layer dt { margin-top: 10px; color: var(--audit-red); font-size: 12px; font-weight: 800; }
.qr-layer dd { margin: 3px 0 0; }

.flow-boundary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.flow-boundary article {
  padding: 22px 24px;
  border: 1px solid var(--audit-line);
  background: rgba(255,255,255,.42);
}

.flow-boundary b,
.flow-boundary span { display: block; }
.flow-boundary b { margin-bottom: 8px; color: var(--audit-red); font-size: 13px; }
.flow-boundary span { font-family: STSong, SimSun, serif; font-size: clamp(18px, 2vw, 25px); line-height: 1.5; }

.validation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.validation-module {
  min-width: 0;
  padding: 24px;
  border: 1px solid #aeb8af;
  border-radius: 4px;
  background: var(--audit-deep);
  color: #eef3e9;
}

.validation-module header {
  min-height: 112px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}

.validation-module header span { color: #d0a95d; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.validation-module h4 { margin: 8px 0; font-family: STSong, SimSun, serif; font-size: 25px; }
.validation-module header p { margin: 0; color: #b8c7c5; font-size: 13px; line-height: 1.55; }

.metric-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.metric-table th,
.metric-table td {
  padding: 9px 6px;
  border-bottom: 1px solid rgba(255,255,255,.13);
  text-align: left;
  overflow-wrap: anywhere;
}

.metric-table th { color: #d6b66e; font-weight: 700; }
.metric-table td { color: #e4ebe6; }
.metric-table td:not(:first-child) { text-align: center; }

.insufficient-note {
  margin: 16px 0 0;
  padding: 12px;
  border-left: 3px solid #d6b66e;
  background: rgba(255,255,255,.06);
  color: #f3e9cf;
  font-size: 12px;
  line-height: 1.6;
}

.boundary-checks {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.boundary-checks li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: #dfe8e3;
  font-size: 12px;
  line-height: 1.45;
}

.boundary-checks b { color: #e2b85f; }

.baseline-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 2.2fr;
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--audit-line);
  background: var(--audit-line);
}

.baseline-strip div {
  min-height: 115px;
  padding: 20px;
  background: var(--audit-paper-2);
}

.baseline-strip strong,
.baseline-strip span { display: block; }
.baseline-strip strong { font-family: Georgia, serif; font-size: 34px; color: var(--audit-red); }
.baseline-strip span { margin-top: 6px; color: #506062; font-size: 13px; line-height: 1.55; }
.baseline-strip .baseline-warning strong { font-family: STSong, SimSun, serif; font-size: 20px; }

.runtime-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.runtime-status article {
  padding: 24px;
  border: 1px solid var(--audit-line);
  background: rgba(255,250,240,.74);
}

.runtime-status .runtime-online { border-left: 5px solid var(--audit-violet); }
.runtime-status .runtime-offline { border-left: 5px dashed var(--audit-blue); }
.runtime-status strong { display: block; margin-bottom: 8px; font-size: 18px; }
.runtime-status p { margin: 0; color: #526264; line-height: 1.7; }

.source-ledger-wrap {
  overflow-x: auto;
  border: 1px solid var(--audit-line);
  background: rgba(255,250,240,.72);
}

.source-ledger {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 13px;
}

.source-ledger th,
.source-ledger td {
  padding: 15px 14px;
  border-bottom: 1px solid #d8cebd;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.source-ledger th { background: #e2d8c5; color: #334c4f; }
.source-ledger a { color: #155e79; text-underline-offset: 3px; }
.source-level {
  display: inline-grid;
  width: 31px;
  height: 31px;
  border: 2px solid currentColor;
  border-radius: 50%;
  place-items: center;
  font-family: Georgia, serif;
  font-weight: 900;
}
.level-a { color: #8c2f2b; }
.level-b { color: #236046; }
.level-c { color: #8a5b13; border-style: dashed; }

.judge-demo-launch {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 900;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid #ead6aa;
  border-radius: 999px;
  background: #8f352e;
  box-shadow: 0 12px 35px rgba(20,28,26,.26);
  color: #fff9e9;
  cursor: pointer;
  font: 750 14px/1 Inter, "Microsoft YaHei", sans-serif;
}

.judge-demo-launch:hover { background: #762a25; transform: translateY(-2px); }

.judge-demo[hidden] { display: none !important; }
.judge-demo {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(4, 20, 23, .92);
  place-items: center;
}

.judge-demo-panel {
  display: grid;
  width: min(1180px, 100%);
  height: min(780px, calc(100vh - 36px));
  height: min(780px, calc(100dvh - 36px));
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(231, 211, 168, .65);
  border-radius: 8px;
  background: #f6f0e3;
  box-shadow: 0 30px 100px rgba(0,0,0,.42);
}

.judge-demo-head,
.judge-demo-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.judge-demo-head {
  padding: 14px 18px;
  border-bottom: 1px solid #c9bdab;
  background: #0c3438;
  color: #f5efdf;
}

.judge-demo-head strong { margin-right: auto; }
.judge-demo-progress { color: #d8bd7f; font-size: 12px; }
.judge-demo-head button,
.judge-demo-controls button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 700;
}

.judge-demo-stage {
  min-height: 0;
  overflow: auto;
  padding: clamp(24px, 4.2vw, 58px);
}

.demo-step {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: clamp(24px, 5vw, 70px);
  min-height: 100%;
  align-items: center;
}

.demo-step.single { grid-template-columns: 1fr; text-align: center; }
.demo-copy small { color: var(--audit-red); font-weight: 800; letter-spacing: .12em; }
.demo-copy h2 { margin: 12px 0 18px; color: var(--audit-ink); font: 500 clamp(34px, 5vw, 70px)/1.1 STSong, SimSun, serif; }
.demo-copy p,
.demo-copy li { color: #435a5d; font-size: clamp(15px, 1.5vw, 19px); line-height: 1.75; }
.demo-copy ul { padding-left: 22px; }
.demo-copy li + li { margin-top: 7px; }

.demo-image {
  position: relative;
  width: min(440px, 100%);
  margin: auto;
  overflow: hidden;
  border: 10px solid #e8decb;
  box-shadow: 0 20px 60px rgba(33,43,40,.2);
}

.demo-image img { display: block; width: 100%; height: auto; }
.demo-box { position: absolute; border: 3px solid #e0362e; background: rgba(224,54,46,.08); }
.demo-box span { position: absolute; top: -27px; left: -3px; padding: 4px 7px; background: #e0362e; color: white; font-size: 11px; white-space: nowrap; }
.box-date { left: 1.67%; top: 18.38%; width: 11.57%; height: 50.54%; }
.box-amount { left: 75.18%; top: 1.71%; width: 13.96%; height: 39.95%; }
.box-price { left: 67.42%; top: 17.06%; width: 10.62%; height: 42.76%; }

.demo-candidates,
.demo-facts {
  display: grid;
  gap: 10px;
}
.demo-candidates article,
.demo-facts article {
  padding: 16px 18px;
  border: 1px solid #c8bdab;
  background: #fffaf0;
}
.demo-candidates b,
.demo-facts b { display: block; margin-bottom: 5px; color: var(--audit-red); }
.demo-candidates p,
.demo-facts p { margin: 0; color: #455c5e; line-height: 1.55; }

.demo-lock {
  padding: clamp(30px, 7vw, 90px);
  border: 2px dashed var(--audit-red);
  background: #fffaf0;
}
.demo-lock b { display: block; color: var(--audit-red); font: 500 clamp(38px, 7vw, 86px)/1 STSong, SimSun, serif; }
.demo-lock p { margin: 20px auto 0; max-width: 700px; }
.demo-final-quote { max-width: 940px; margin: auto; color: var(--audit-ink); font: 500 clamp(34px, 5.4vw, 72px)/1.25 STSong, SimSun, serif; }
.demo-final-note { margin-top: 28px !important; color: var(--audit-red) !important; font-size: clamp(18px, 2vw, 28px) !important; font-weight: 800; }

.judge-demo-controls {
  padding: 14px 18px;
  border-top: 1px solid #c9bdab;
  background: #ebe1cf;
}
.judge-demo-controls .demo-time { margin-right: auto; color: #5a6867; font-size: 12px; }
.judge-demo-controls button { color: var(--audit-ink); }
.judge-demo-controls button.primary { border-color: var(--audit-red); background: var(--audit-red); color: #fff; }
.judge-demo-controls button:disabled { opacity: .42; cursor: not-allowed; }

.audit-missing-image {
  display: grid;
  min-height: 180px;
  padding: 24px;
  border: 2px dashed #a86a5f;
  background: #f3e7d6;
  color: #743e37;
  place-items: center;
  text-align: center;
  font-weight: 700;
}

body.judge-demo-open { overflow: hidden; }

:is(.method-audit, .judge-demo) :is(button, a):focus-visible {
  outline: 3px solid var(--audit-focus);
  outline-offset: 3px;
}

html.static-export .scan-beam,
html.static-export .pipeline-console .progress-track > * {
  animation: none !important;
}

@media (max-width: 1080px) {
  .evidence-legend { grid-template-columns: repeat(4, 1fr); }
  .qr-four-layers { grid-template-columns: repeat(2, 1fr); }
  .validation-grid { grid-template-columns: 1fr; }
  .validation-module header { min-height: auto; }
  .baseline-strip { grid-template-columns: repeat(3, 1fr); }
  .baseline-warning { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .method-audit { padding-inline: 16px; }
  .audit-hero,
  .audit-section-head,
  .flow-boundary,
  .runtime-status,
  .demo-step { grid-template-columns: 1fr; }
  .audit-section-head { align-items: start; flex-direction: column; }
  .evidence-legend { grid-template-columns: repeat(2, 1fr); }
  .qr-four-layers { grid-template-columns: 1fr; }
  .qr-layer { min-height: auto; }
  .baseline-strip { grid-template-columns: 1fr; }
  .baseline-warning { grid-column: auto; }
  .judge-demo-launch { right: 12px; bottom: 12px; }
  .judge-demo { padding: 0; }
  .judge-demo-panel { width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .judge-demo-head { flex-wrap: wrap; }
  .judge-demo-stage { padding: 24px 18px; }
  .judge-demo-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .judge-demo-controls .demo-time { grid-column: 1 / -1; }
  .demo-image { width: min(320px, 86vw); }
}

@media (prefers-reduced-motion: reduce) {
  .method-audit *,
  .judge-demo *,
  .judge-demo-launch {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .judge-demo-launch:hover { transform: none; }
}

@media (forced-colors: active) {
  .method-audit,
  .validation-module,
  .judge-demo,
  .judge-demo-panel,
  .judge-demo-head,
  .judge-demo-controls,
  .judge-demo-launch {
    background: Canvas;
    color: CanvasText;
  }
  .qr-layer,
  .validation-module,
  .runtime-status article,
  .source-ledger-wrap,
  .demo-candidates article,
  .demo-facts article,
  .demo-lock {
    border: 2px solid CanvasText;
  }
  .demo-box { border-color: Highlight; background: transparent; }
  .demo-box span { background: Highlight; color: HighlightText; }
}
