:root {
  --ink: #121210;
  --paper: #f2f0e8;
  --paper-2: #e5e1d5;
  --line: #2f302c;
  --muted: #62645d;
  --orange: #ff5b30;
  --cyan: #66e8f2;
  --yellow: #ffe14f;
  --red-soft: #ffd3c6;
  --header: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Satoshi, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}
button, textarea, input { font: inherit; letter-spacing: 0; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid #000;
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}
.brand-mark {
  width: 34px;
  height: 12px;
  flex: 0 0 auto;
  background: repeating-linear-gradient(135deg, var(--orange) 0 6px, var(--yellow) 6px 12px);
  border: 1px solid #fff;
}
#runtime {
  color: var(--cyan);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.workbench {
  min-height: calc(100vh - var(--header));
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 13fr);
  border-bottom: 2px solid var(--ink);
}
.editor-panel, .result-panel { min-width: 0; }
.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 26px 20px;
  border-right: 2px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 0 41px, rgba(255,91,48,.18) 41px 42px, transparent 42px),
    var(--paper);
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--orange);
  font: 800 9px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.eyebrow.cool { color: var(--cyan); }
h1, h2, p { overflow-wrap: anywhere; }
.editor-panel h1 {
  width: min(100%, 18ch);
  margin: 0;
  font-size: clamp(2.45rem, 4.55vw, 4.9rem);
  line-height: .92;
  letter-spacing: 0;
}
.intro {
  max-width: 62ch;
  margin: 0;
  color: #4d5049;
  font-size: 12px;
  line-height: 1.45;
}
.primary-actions, .result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.button, .utility-button, .icon-button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 160ms ease, background-color 160ms ease;
}
.button:hover:not(:disabled), .utility-button:hover, .icon-button:hover { transform: translateY(-1px); }
.button:focus-visible, .utility-button:focus-visible, .file-button:focus-within, .icon-button:focus-visible, textarea:focus-visible {
  outline: 3px solid #276bff;
  outline-offset: 2px;
}
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--orange); color: var(--ink); }
.button.dark { background: var(--ink); color: #fff; }
.cool-button { background: var(--cyan); color: var(--ink); border-color: var(--cyan); }
.outline-button { background: transparent; color: #fff; border-color: #6d7068; }
.error-banner {
  padding: 10px 12px;
  border: 1px solid #9d2e12;
  background: var(--red-soft);
  color: #6c1d0d;
  font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.notice-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}
.notice-label span {
  color: var(--muted);
  font: 600 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
textarea {
  display: block;
  width: 100%;
  min-height: 148px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  font: 500 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.utility-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.utility-button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 7px;
  font-size: 9px;
  line-height: 1.25;
  white-space: normal;
}
.file-button { display: flex; align-items: center; justify-content: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.live-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font: 600 9px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.result-panel {
  position: relative;
  display: flex;
  overflow: hidden;
  padding: 20px 24px;
  background: var(--ink);
  color: #fff;
}
.result-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image:
    linear-gradient(rgba(255,255,255,.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.15) 1px, transparent 1px);
  background-size: 32px 32px;
}
.scanner-line {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  opacity: 0;
}
.result-panel.is-scanning .scanner-line { animation: scan 520ms ease-out; }
@keyframes scan {
  0% { opacity: 0; transform: translateY(20px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(520px); }
}
.empty-state, .result-content {
  position: relative;
  z-index: 1;
  width: 100%;
  align-self: center;
}
.empty-state { max-width: 710px; padding: 16px; }
.empty-state h2 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.7rem, 5vw, 5.5rem);
  line-height: .92;
  letter-spacing: 0;
}
.empty-state > p:not(.eyebrow) {
  max-width: 58ch;
  color: #bdc1b8;
  font-size: 13px;
  line-height: 1.5;
}
.action-vocabulary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 26px;
  border-top: 1px solid #52564f;
  border-left: 1px solid #52564f;
}
.action-vocabulary span {
  min-width: 0;
  padding: 12px 7px;
  border-right: 1px solid #52564f;
  border-bottom: 1px solid #52564f;
  color: #aeb4aa;
  font: 700 8px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}
.result-content { align-self: flex-start; }
.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.result-heading h2 {
  max-width: 19ch;
  margin: 0;
  font-size: clamp(2.05rem, 3.7vw, 4.2rem);
  line-height: .92;
  letter-spacing: 0;
}
.icon-button {
  width: 44px;
  flex: 0 0 44px;
  padding: 0;
  border-color: #6b7067;
  background: transparent;
  color: #fff;
  font-size: 19px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border-top: 1px solid #555a51;
  border-left: 1px solid #555a51;
}
.metrics > div {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid #555a51;
  border-bottom: 1px solid #555a51;
}
.metrics span {
  display: block;
  color: #8f968a;
  font: 700 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.metrics strong {
  display: block;
  margin-top: 3px;
  color: var(--cyan);
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  white-space: nowrap;
}
.gap-summary {
  margin: 8px 0;
  color: var(--yellow);
  font: 800 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.evidence-list {
  border-top: 1px solid #555a51;
}
.evidence-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  border-bottom: 1px solid #555a51;
  animation: evidence-in 260ms ease-out both;
}
.evidence-row:nth-child(2) { animation-delay: 35ms; }
.evidence-row:nth-child(3) { animation-delay: 70ms; }
.evidence-row:nth-child(4) { animation-delay: 105ms; }
.evidence-row:nth-child(5) { animation-delay: 140ms; }
@keyframes evidence-in {
  from { opacity: .2; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
.evidence-label {
  min-width: 0;
  padding: 8px 8px 8px 0;
  border-right: 1px solid #555a51;
}
.evidence-label strong {
  display: block;
  font-size: 10px;
  line-height: 1.2;
}
.evidence-label span {
  display: inline-block;
  margin-top: 4px;
  color: var(--cyan);
  font: 800 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.evidence-row.missing .evidence-label span { color: var(--orange); }
.evidence-copy { min-width: 0; padding: 8px 0 8px 10px; }
.evidence-sentence {
  margin: 0;
  color: #eef1eb;
  font-size: 10px;
  line-height: 1.35;
}
.evidence-row.missing .evidence-sentence { color: #ffb6a4; }
.evidence-terms {
  margin: 3px 0 0;
  color: #8f968a;
  font: 600 8px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.result-actions {
  padding-top: 11px;
}
#export-status {
  min-width: 0;
  color: #9da39a;
  font: 600 8px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.reasoning-band {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(0, 2fr);
  gap: 42px;
  padding: 62px 28px 68px;
  border-bottom: 2px solid var(--ink);
}
.reasoning-title h2 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  line-height: .94;
  letter-spacing: 0;
}
.worked-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.worked-proof article {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.worked-proof strong { font-size: 12px; }
.worked-proof p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.misconception-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--orange);
  color: var(--ink);
}
.misconception-band > div {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(0, 1.7fr);
  gap: 18px;
  min-width: 0;
  padding: 24px 28px;
  border-right: 2px solid var(--ink);
}
.misconception-band > div:last-child { border-right: 0; }
.misconception-band strong { font-size: 13px; }
.misconception-band span { font-size: 11px; line-height: 1.5; }
.limits-band {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 28px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  :root { --header: 58px; }
  .site-header { padding: 0 16px; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .editor-panel { border-right: 0; border-bottom: 2px solid var(--ink); padding: 20px 16px; }
  .editor-panel h1 { width: min(100%, 18ch); font-size: clamp(2.45rem, 11vw, 3.5rem); }
  .result-panel { min-height: 720px; padding: 20px 16px; }
  .result-content, .empty-state { align-self: flex-start; padding-top: 0; }
  .result-heading h2 { max-width: 100%; font-size: 2.35rem; }
  .reasoning-band { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 44px 16px; }
  .reasoning-title h2 { max-width: 18ch; }
  .worked-proof { grid-template-columns: minmax(0, 1fr); }
  .misconception-band { grid-template-columns: minmax(0, 1fr); }
  .misconception-band > div { border-right: 0; border-bottom: 2px solid var(--ink); padding: 22px 16px; }
  .misconception-band > div:last-child { border-bottom: 0; }
  .limits-band { grid-template-columns: minmax(0, 1fr); padding: 20px 16px; }
}
@media (max-width: 520px) {
  .brand span:last-child { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
  #runtime { font-size: 8px; }
  .primary-actions .button { flex: 1 1 150px; }
  .utility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .utility-grid .file-button { grid-column: 1 / -1; }
  textarea { min-height: 166px; }
  .action-vocabulary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-vocabulary span:last-child { grid-column: 1 / -1; }
  .metrics strong { font-size: 1rem; }
  .evidence-row { grid-template-columns: 102px minmax(0, 1fr); }
  .result-actions .button { flex: 1 1 140px; }
  .misconception-band > div { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
