:root {
  --bg: #0b0806;
  --bg-deep: #120c08;
  --text: #f6eee5;
  --muted: #c2b1a1;
  --faint: #a48f7e;
  --line: rgba(236, 199, 163, 0.14);
  --line-strong: rgba(236, 199, 163, 0.28);
  --accent: #f2ac67;
  --accent-deep: #cf7f43;
  --accent-soft: rgba(242, 172, 103, 0.11);
  --radius: 22px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", "Inter", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 720px at 8% -12%, rgba(131, 76, 40, 0.42), transparent 64%),
    radial-gradient(920px 680px at 92% 4%, rgba(84, 47, 28, 0.36), transparent 62%),
    radial-gradient(860px 620px at 50% 108%, rgba(62, 35, 22, 0.5), transparent 68%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(242, 172, 103, 0.32); color: #fff8f0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

input, textarea, button { font: inherit; }
a { color: inherit; }

* { scrollbar-color: rgba(242, 172, 103, 0.4) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(242, 172, 103, 0.28); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.aurora span {
  position: absolute;
  display: block;
  width: 52vw;
  height: 52vw;
  min-width: 420px;
  min-height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  background: radial-gradient(circle at 35% 35%, rgba(226, 141, 73, 0.55), rgba(91, 45, 24, 0.12) 62%, transparent 72%);
  animation: drift 18s ease-in-out infinite alternate;
}
.aurora span:first-child { top: -26vw; left: -14vw; }
.aurora span:last-child { bottom: -30vw; right: -12vw; animation-delay: -9s; opacity: 0.24; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(4vw, 3vw, 0) scale(1.12); } }

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 11, 8, 0.62);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 12px 36px -28px #000;
}
.masthead-inner { display: flex; align-items: center; gap: 32px; min-height: 70px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font: 700 14px/1 var(--display);
  letter-spacing: 0.16em;
  text-decoration: none;
}
.wordmark .dot { color: var(--accent); }
.mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(145deg, #ffd39c, var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 14px -5px rgba(242, 172, 103, 0.9);
  transform: rotate(-8deg);
}
.masthead-nav { display: flex; gap: 24px; margin-left: auto; }
.masthead-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  text-underline-offset: 5px;
  transition: color 160ms ease;
}
.masthead-nav a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); }
.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.035);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(242, 172, 103, 0.13); }

.intro { padding: 92px 0 76px; max-width: 880px; }
.intro h1 {
  font: 600 clamp(2.6rem, 6.1vw, 4.6rem)/1.04 var(--display);
  letter-spacing: -0.038em;
  margin: 0;
  max-width: 17ch;
  text-wrap: balance;
}
.intro h1 em { font-style: normal; color: var(--accent); }
.lede {
  font-size: clamp(1rem, 1.5vw, 1.08rem);
  line-height: 1.72;
  color: var(--muted);
  max-width: 66ch;
  margin: 26px 0 0;
}
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.intro-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 26px 0 0;
  color: var(--faint);
  font-size: 12px;
}
.intro-foot span { display: inline-flex; align-items: center; gap: 10px; }
.intro-foot span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--accent-deep); }

.intro > * { animation: rise 900ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.intro > :nth-child(1) { animation-delay: 60ms; }
.intro > :nth-child(2) { animation-delay: 150ms; }
.intro > :nth-child(3) { animation-delay: 240ms; }
.intro > :nth-child(4) { animation-delay: 330ms; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 24px, 0) scale(0.985); filter: blur(9px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 14px 19px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.075); border-color: rgba(242, 172, 103, 0.5); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-primary {
  background: linear-gradient(158deg, #ffc58a 0%, var(--accent) 42%, var(--accent-deep) 100%);
  border-color: rgba(255, 219, 180, 0.55);
  color: #2b1608;
  font-weight: 700;
  box-shadow: 0 16px 30px -16px rgba(226, 131, 62, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-primary:hover { background: linear-gradient(158deg, #ffd09c, #f7b674 44%, #d9884c); border-color: rgba(255, 231, 201, 0.75); }
.btn-quiet { background: rgba(255, 255, 255, 0.02); }
.btn-small { padding: 11px 15px; font-size: 11px; }
.btn-wide { width: 100%; margin-top: 20px; }
.btn:disabled { opacity: 0.5; cursor: progress; transform: none; }

.glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(68, 45, 30, 0.56), rgba(24, 17, 12, 0.76) 58%, rgba(30, 21, 15, 0.72));
  border: 1px solid rgba(242, 172, 103, 0.16);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
  box-shadow: 0 26px 60px -28px rgba(0, 0, 0, 0.9), 0 4px 14px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 230, 200, 0.14);
  overflow: hidden;
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 236, 210, 0.17), rgba(255, 236, 210, 0.035) 26%, transparent 52%);
}
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 226, 188, 0.68), rgba(255, 226, 188, 0.05) 34%, transparent 58%, rgba(242, 172, 103, 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: start;
}
.source-panel, .brief-panel { padding: 28px 30px 32px; }
.workbench > .glass { animation: rise 950ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.workbench > .glass:first-child { animation-delay: 360ms; }
.workbench > .glass:last-child { animation-delay: 450ms; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.panel-title { margin: 0; font: 600 17px/1.3 var(--display); letter-spacing: -0.015em; }
.panel-hint { color: var(--faint); font-size: 12px; }
.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stamp {
  padding: 6px 10px;
  border: 1px solid rgba(242, 172, 103, 0.38);
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

textarea, .key-row input, .deeper-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(10, 7, 5, 0.42);
  color: var(--text);
  caret-color: var(--accent);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
textarea {
  display: block;
  min-height: 168px;
  padding: 16px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  resize: vertical;
}
.key-row input, .deeper-form input { padding: 12px 14px; font-size: 13px; }
textarea:focus, .key-row input:focus, .deeper-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(10, 7, 5, 0.6);
  box-shadow: 0 0 0 3px rgba(242, 172, 103, 0.14);
}
textarea::placeholder, input::placeholder { color: #a08d7c; }
.charcount { margin: 9px 2px 0; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }

.keybar { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.key-row { display: flex; gap: 8px; }
.key-row input { font-family: var(--mono); letter-spacing: 0.01em; }
.fine { margin: 10px 1px 0; color: var(--faint); font-size: 11px; line-height: 1.6; }
.fine a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.fine a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.key-saved { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.saved-state { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.saved-dot { width: 7px; height: 7px; border-radius: 50%; background: #9bd2ae; box-shadow: 0 0 0 4px rgba(155, 210, 174, 0.12); }
.linkish {
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: none;
  padding: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.linkish:hover { color: var(--accent); border-color: var(--accent); }

.working { height: 2px; margin-top: 16px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.working > span:first-child { display: block; width: 34%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: sweep 1.2s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-110%); } to { transform: translateX(340%); } }
.notice {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(242, 172, 103, 0.3);
  border-radius: 10px;
  background: var(--accent-soft);
  color: #ffcf9c;
  font-size: 12px;
  line-height: 1.6;
}

.brief { min-width: 0; }
.verdict-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.verdict { flex: none; padding: 6px 10px; border: 1px solid transparent; border-radius: 99px; font: 700 10px/1 var(--sans); letter-spacing: 0.08em; white-space: nowrap; }
.verdict-holds { border-color: rgba(122, 210, 160, 0.35); background: rgba(122, 210, 160, 0.15); color: #a8e6c3; }
.verdict-fails { border-color: rgba(235, 120, 110, 0.32); background: rgba(235, 120, 110, 0.14); color: #ffb0a8; }
.verdict-unclear { border-color: rgba(242, 172, 103, 0.32); background: rgba(242, 172, 103, 0.13); color: #ffd0a0; }
.verdict-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.restated { padding-left: 18px; border-left: 2px solid var(--accent); }
.restated .field-label { margin-bottom: 8px; }
.restated-text { margin: 0; font: 400 25px/1.3 var(--serif); letter-spacing: -0.01em; }
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.objection { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.obj-no { color: var(--accent); font-size: 12px; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; }
.obj-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 6px; font: 500 18px/1.35 var(--serif); }
.obj-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.68; }
.sev { padding: 4px 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); color: var(--muted); font: 600 9px/1 var(--sans); letter-spacing: 0.08em; }
.sev-high { background: rgba(242, 172, 103, 0.16); color: #ffc58a; }
.sev-medium { background: rgba(255, 255, 255, 0.09); color: var(--muted); }
.sev-low { background: rgba(255, 255, 255, 0.05); color: var(--faint); }
.gap-list { list-style: none; margin: 0; padding: 0; }
.gap-list li { position: relative; padding: 9px 0 9px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.6; }
.gap-list li::before { content: ""; position: absolute; left: 0; top: 19px; width: 8px; height: 1px; background: var(--accent); }
.revision-text { margin: 0; padding: 18px 20px; border: 1px solid rgba(242, 172, 103, 0.2); border-radius: 14px; background: var(--accent-soft); font: 400 20px/1.48 var(--serif); }
.followup-text { margin: 0; font: 400 19px/1.5 var(--serif); }
.trace { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.trace summary { list-style: none; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary::before { content: "+"; margin-right: 9px; color: var(--accent); }
.trace[open] summary::before { content: "−"; }
.trace summary span { letter-spacing: 0; font-weight: 400; text-transform: none; }
.trace-body { padding-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.75; white-space: pre-wrap; }

.history { margin-top: 20px; padding: 0 30px; }
.history > summary { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 20px 0; list-style: none; cursor: pointer; }
.history > summary::-webkit-details-marker { display: none; }
.history-title { font: 600 17px/1.3 var(--display); letter-spacing: -0.015em; }
.history-title::before { content: "+"; margin-right: 10px; color: var(--accent); }
.history[open] .history-title::before { content: "−"; }
.history-count { margin-left: 8px; color: var(--faint); font: 500 11px/1 var(--sans); letter-spacing: 0.04em; }
.history-hint { color: var(--faint); font-size: 11px; }
.history-body { padding-bottom: 26px; }
.history-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.history-fine { margin: 0; color: var(--faint); font-size: 11px; }
.history-clear { flex: none; }
.history-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.history-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.history-claim { margin: 0; max-width: 72ch; font: 400 16px/1.45 var(--serif); }
.history-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; color: var(--faint); font-size: 11px; }
.history-actions { display: flex; gap: 16px; }
.history-delete { color: var(--faint); }
.history-delete:hover { color: #ffb0a8; border-color: #ffb0a8; }
.history-empty { margin: 0; padding: 22px 0 0; color: var(--faint); font-size: 12px; }

.deeper { margin-top: 20px; padding: 28px 30px 30px; animation: rise 950ms cubic-bezier(0.16, 1, 0.3, 1) 540ms both; }
.deeper-form { display: flex; gap: 8px; }
.deeper-form input { flex: 1; font-family: var(--serif); font-size: 17px; padding: 14px; }
.deeper-form .btn { flex: none; }
.deeper-answer { margin-top: 22px; padding-left: 18px; border-left: 2px solid var(--accent); font: 400 18px/1.62 var(--serif); max-width: 72ch; }
.deeper-answer:empty { display: none; }

.footer { padding: 28px 0 44px; border-top: 1px solid var(--line); margin-top: 20px; }
.footer p { margin: 0; color: var(--faint); font-size: 10px; letter-spacing: 0.1em; line-height: 1.9; }

@media (max-width: 920px) {
  .workbench { grid-template-columns: 1fr; }
  .masthead-nav { display: none; }
  .model-chip { margin-left: auto; }
  .intro { padding: 68px 0 54px; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 28px); }
  .masthead-inner { min-height: 62px; gap: 12px; }
  .model-chip { font-size: 9px; padding: 7px 9px; }
  .intro h1 { font-size: clamp(2.2rem, 10vw, 3rem); max-width: none; }
  .intro-actions { flex-direction: column; align-items: stretch; }
  .intro-actions .btn { width: 100%; }
  .source-panel, .brief-panel, .deeper { padding: 22px 20px 26px; }
  .history { padding: 0 20px; }
  .history > summary { flex-direction: column; align-items: flex-start; gap: 4px; }
  .history-bar { flex-direction: column; align-items: flex-start; }
  .panel-head { align-items: flex-start; }
  .stamp { font-size: 9px; }
  textarea { font-size: 17px; min-height: 148px; }
  .deeper-form { flex-direction: column; }
  .deeper-form .btn { width: 100%; }
  .restated-text { font-size: 22px; }
  .obj-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .aurora { display: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass { background: #1c130d; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .masthead { background: #100b08; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --muted: #f0e3d6; --faint: #dbc9b8; --line: rgba(255, 235, 213, 0.35); }
  .glass { background: #150f0b; }
}
