:root {
  --paper: #f4efe4;
  --paper-deep: #e9e0d0;
  --ink: #171712;
  --muted: #6c685e;
  --line: #c7bca8;
  --red: #c7281c;
  --red-dark: #801b14;
  --green: #196c52;
  --amber: #bc7b11;
  --white: #fffdf7;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 23, 18, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 18, .018) 1px, transparent 1px),
    var(--paper);
  background-size: 29px 29px, 29px 29px, auto;
  font-family: var(--sans);
  font-size: 16px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; background: var(--ink); color: white; padding: .8rem 1rem; z-index: 100; }
.skip-link:focus { top: 1rem; }

.masthead {
  max-width: 1580px;
  margin: 0 auto;
  padding: 24px 32px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 3px double var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--red); color: var(--white); font: 800 25px/1 var(--serif);
  transform: rotate(-2deg); box-shadow: 3px 3px 0 var(--ink);
}
.brand b { display: block; font: 800 21px/1.1 var(--serif); letter-spacing: .03em; }
.brand small { display: block; margin-top: 5px; font: 700 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.issue { margin: 12px 0 0 58px; color: var(--muted); font: 11px/1 var(--mono); letter-spacing: .08em; }
.header-links { display: flex; align-items: center; gap: 18px; font-size: 13px; font-weight: 700; }
.header-links a { text-underline-offset: 4px; }
.health-badge { border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; color: var(--muted); }
.health-badge.ok { color: var(--green); border-color: var(--green); }

.truth-ribbon {
  min-height: 40px; padding: 9px 24px; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  font-size: 12px; letter-spacing: .05em;
}
.truth-ribbon b { color: #ff7568; }
.truth-ribbon i { color: #68675f; }

main { max-width: 1580px; margin: 0 auto; padding: 0 32px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .55fr); min-height: 430px; border-bottom: 1px solid var(--ink); }
.hero-copy { padding: 78px 5vw 56px 0; border-right: 1px solid var(--ink); }
.eyebrow { margin: 0 0 18px; color: var(--red); font: 800 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { max-width: 900px; margin: 0; font: 900 clamp(54px, 6.6vw, 108px)/.96 var(--serif); letter-spacing: -.045em; }
.hero h1 em { color: var(--red); font-style: normal; }
.dek { max-width: 770px; margin: 30px 0 0; font: 500 clamp(17px, 1.3vw, 22px)/1.75 var(--serif); color: #3e3b34; }
.hero-proof { padding: 64px 0 48px 4vw; }
.hero-proof > p { margin: 0 0 30px; font: 800 12px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.hero-proof dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.hero-proof dl div { min-height: 118px; padding: 18px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.hero-proof dt { font: 800 42px/1 var(--serif); color: var(--red); }
.hero-proof dd { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.workspace { display: grid; grid-template-columns: minmax(310px, .85fr) minmax(400px, 1.15fr) minmax(350px, 1fr); border-left: 1px solid var(--ink); }
.panel { min-height: 790px; padding: 28px; border-right: 1px solid var(--ink); position: relative; background: rgba(244, 239, 228, .76); }
.panel-heading { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 22px; border-bottom: 3px double var(--ink); }
.step { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font: 800 11px/1 var(--mono); }
.panel-heading p { margin: 2px 0 4px; font: 700 9px/1 var(--mono); letter-spacing: .16em; color: var(--red); }
.panel-heading h2 { margin: 0; font: 800 25px/1 var(--serif); }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; margin: 25px 0 22px; border: 1px solid var(--ink); }
.mode { appearance: none; border: 0; background: transparent; padding: 12px 8px; cursor: pointer; font-size: 13px; font-weight: 800; }
.mode + .mode { border-left: 1px solid var(--ink); }
.mode.active { background: var(--ink); color: var(--paper); }
.field-stack { display: grid; gap: 9px; }
.field-stack label { margin-top: 8px; font: 800 13px/1.35 var(--sans); }
.field-stack label span { color: var(--muted); font-weight: 500; font-size: 11px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 0; background: rgba(255, 253, 247, .72);
  padding: 13px 14px; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
textarea { resize: vertical; line-height: 1.65; }
.field-note { margin: 0; padding: 12px; background: #e5dac7; color: #5b5243; font-size: 12px; line-height: 1.6; }
.ai-toggle { margin-top: 24px; padding: 16px 0; display: flex; align-items: center; gap: 12px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); cursor: pointer; }
.ai-toggle input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; opacity: 0; pointer-events: none; overflow: hidden; clip-path: inset(50%); }
.switch { width: 42px; height: 23px; flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 99px; position: relative; }
.switch::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: var(--ink); left: 3px; top: 3px; transition: .2s; }
.ai-toggle input:checked + .switch { background: var(--red); border-color: var(--red); }
.ai-toggle input:checked + .switch::after { transform: translateX(19px); background: white; }
.ai-toggle b, .ai-toggle small { display: block; }
.ai-toggle b { font-size: 13px; }
.ai-toggle small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.analyze-button, .copy-button { border: 0; background: var(--red); color: white; cursor: pointer; font-weight: 800; }
.analyze-button { width: 100%; margin-top: 18px; padding: 17px 18px; display: flex; justify-content: space-between; align-items: center; box-shadow: 4px 4px 0 var(--ink); }
.analyze-button:hover { background: var(--red-dark); transform: translate(1px, 1px); box-shadow: 3px 3px 0 var(--ink); }
.analyze-button:disabled { opacity: .55; cursor: wait; }
.form-error { color: var(--red-dark); font-size: 12px; font-weight: 700; line-height: 1.5; }

.empty-state { min-height: 610px; display: grid; place-items: center; align-content: center; text-align: center; padding: 30px; }
.empty-state h3 { margin: 28px 0 8px; font: 800 23px/1.2 var(--serif); }
.empty-state p { max-width: 330px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-orbit { width: 100px; height: 100px; border: 1px solid var(--line); border-radius: 50%; position: relative; animation: rotate 14s linear infinite; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.empty-orbit::before { inset: 12px; }.empty-orbit::after { inset: 30px; background: var(--red); border: 0; }
.empty-orbit span { width: 12px; height: 12px; background: var(--ink); border-radius: 50%; position: absolute; top: -6px; left: 44px; }
@keyframes rotate { to { transform: rotate(360deg); } }

.score-ledger { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.score-ledger article { padding: 15px 11px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.score-ledger small { display: block; min-height: 31px; color: var(--muted); font-size: 10px; }
.score-ledger strong { font: 800 31px/1 var(--serif); }
.score-ledger span { font-size: 9px; color: var(--muted); }
.analysis-section { padding: 20px 0; border-top: 1px solid var(--line); }
.section-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
.section-label span { color: var(--red); font: 700 10px/1 var(--mono); letter-spacing: .12em; }
.section-label b { font: 800 15px/1 var(--serif); }
.tag-list { display: flex; gap: 7px; flex-wrap: wrap; }
.tag-list span { padding: 7px 9px; border: 1px solid var(--line); background: var(--white); font-size: 11px; }
.policy-list { display: grid; gap: 10px; }
.policy-card { border: 1px solid var(--line); background: rgba(255,253,247,.56); padding: 13px; }
.policy-card h3 { margin: 0; font: 800 14px/1.45 var(--serif); }
.policy-card p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.policy-card a { display: inline-block; margin-top: 9px; color: var(--red-dark); font-size: 10px; font-weight: 800; text-underline-offset: 3px; }
.policy-score { float: right; font: 800 20px/1 var(--serif); color: var(--red); }
.risk-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.risk-list li { padding-left: 18px; position: relative; color: #554d40; font-size: 11px; line-height: 1.5; }
.risk-list li::before { content: "!"; position: absolute; left: 0; top: 1px; width: 12px; height: 12px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: white; font: 800 8px/1 var(--mono); }

.draft-panel { background: rgba(234, 224, 206, .72); }
.draft-empty { min-height: 620px; display: grid; align-content: center; padding: 24px; }
.draft-empty blockquote { margin: 0; font: 800 28px/1.5 var(--serif); }
.draft-empty blockquote::before { content: "“"; display: block; color: var(--red); font-size: 72px; line-height: .5; margin-bottom: 20px; }
.draft-empty p { margin: 24px 0 0; color: var(--muted); font-size: 12px; }
.draft-meta { margin: 24px 0 9px; display: flex; justify-content: space-between; align-items: center; font: 700 10px/1 var(--mono); }
.draft-mode { padding: 6px 8px; background: var(--green); color: white; }
.draft-mode.fallback { background: var(--amber); }
.draft-text { min-height: 280px; background: var(--white); border: 1px solid var(--ink); font: 500 14px/1.8 var(--serif); }
.draft-actions { display: flex; align-items: center; gap: 12px; margin: 11px 0 24px; }
.copy-button { padding: 11px 16px; }
.copy-button:disabled { background: #8a857b; cursor: not-allowed; opacity: .72; }
.draft-actions span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.draft-actions span.open { color: var(--green); font-weight: 800; }
.gate-heading { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 3px double var(--ink); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.checklist { display: grid; }
.check-item { display: grid; grid-template-columns: 20px 1fr; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.check-item input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--green); }
.check-item.blocked { color: var(--red-dark); }
.check-item a { display: block; margin-top: 3px; color: var(--red-dark); }
.check-warning { display: block; margin-top: 4px; color: var(--red-dark); font-size: 9px; font-weight: 800; }
.no-publish { margin: 18px 0 0; padding: 11px; border: 1px solid var(--red); color: var(--red-dark); font-size: 10px; line-height: 1.5; }

.methodology { padding: 80px 0 100px; border-bottom: 3px double var(--ink); }
.methodology h2 { max-width: 800px; margin: 0 0 38px; font: 800 clamp(34px, 4.2vw, 66px)/1.08 var(--serif); letter-spacing: -.03em; }
.methodology ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.methodology li { min-height: 170px; padding: 20px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); counter-increment: step; }
.methodology li::before { content: "0" counter(step); display: block; margin-bottom: 42px; color: var(--red); font: 800 12px/1 var(--mono); }
.methodology li b, .methodology li span { display: block; }
.methodology li b { font: 800 15px/1.25 var(--serif); }
.methodology li span { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.55; }

footer { max-width: 1580px; margin: 0 auto; padding: 28px 32px 48px; display: flex; justify-content: space-between; gap: 30px; color: var(--muted); font-size: 11px; }
footer a { text-underline-offset: 3px; }
.toast { position: fixed; z-index: 50; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 18px; background: var(--ink); color: white; box-shadow: 4px 4px 0 var(--red); font-size: 12px; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .draft-panel { grid-column: 1 / -1; min-height: auto; }
  .panel { min-height: 720px; }
  .draft-panel > div:not(.panel-heading) { max-width: 760px; margin-inline: auto; }
  .methodology ol { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .masthead { padding: 18px 16px 14px; align-items: flex-start; }
  .brand b { font-size: 17px; }.brand small { font-size: 8px; }
  .issue, .header-links a { display: none; }
  .health-badge { font-size: 10px; }
  .truth-ribbon { justify-content: flex-start; padding-inline: 16px; }
  main { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 58px 0 40px; border-right: 0; }
  .hero h1 { font-size: clamp(48px, 16vw, 78px); }
  .hero-proof { padding: 30px 0 42px; }
  .workspace { grid-template-columns: 1fr; }
  .panel, .draft-panel { min-height: auto; grid-column: auto; padding: 22px 18px; }
  .empty-state, .draft-empty { min-height: 440px; }
  .score-ledger strong { font-size: 26px; }
  .methodology { padding: 60px 0; }
  .methodology ol { grid-template-columns: 1fr 1fr; }
  .methodology li { min-height: 145px; }
  footer { padding-inline: 16px; flex-direction: column; }
}

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