:root {
  color-scheme: dark;
  --bg: #08100f;
  --surface: #0d1715;
  --ink: #dff8ef;
  --muted: #8eaaa2;
  --line: #28413b;
  --accent: #63e6bd;
  --accent-ink: #06100e;
  --warning: #f2b84b;
  --danger: #ff746c;
  --success: #63e6bd;
  --radius: 4px;
  --shadow: 0 18px 50px rgb(0 0 0 / 0.28);
  font-family: "IBM Plex Sans", Inter, ui-sans-serif, system-ui, sans-serif;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgb(99 230 189 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(99 230 189 / 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

code,
.analysis-mode,
.input-summary,
.metric-box,
table,
.recommendation-index,
.truth-note {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.site-header {
  border-color: var(--line);
  background: rgb(8 16 15 / 0.96);
}

.brand {
  color: var(--accent);
}

.brand-mark {
  width: 34px;
  height: 34px;
  font: 750 0.62rem/1 "IBM Plex Mono", monospace;
  border-color: var(--accent);
}

.header-note {
  margin: 0;
  color: #8de8cf;
}

.page-shell {
  padding-top: 38px;
}

h1 {
  max-width: 1080px;
  color: #c7ffe9;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 920px;
}

.truth-note {
  max-width: 920px;
  padding-left: 14px;
  border-left: 2px solid var(--warning);
  color: #c1d0cc;
  font-size: 0.88rem;
  line-height: 1.55;
}

.truth-note strong {
  color: var(--warning);
}

.tool-workbench {
  grid-template-columns: minmax(330px, 0.82fr) minmax(520px, 1.18fr);
}

.panel {
  min-width: 0;
  border-color: #34534b;
  background: rgb(10 20 18 / 0.96);
}

.panel-head,
.result-head {
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.panel h2,
.result-section h3 {
  margin-bottom: 0;
}

.panel h2 {
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  text-transform: uppercase;
}

.analysis-mode {
  color: #7bcdb9;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
}

textarea,
input {
  border-color: #395950;
  background: #07100e;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

textarea::placeholder,
input::placeholder {
  color: #637b75;
}

#chunks {
  min-height: 360px;
}

.input-summary {
  display: flex;
  gap: 18px;
  margin: -4px 0 18px;
  color: #89bcae;
  font-size: 0.78rem;
}

.analyze-button {
  width: 100%;
}

.form-message {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.84rem;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.metric-box {
  padding: 17px 16px;
  border-right: 1px solid var(--line);
}

.metric-box:last-child {
  border-right: 0;
}

.metric-box > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-box strong {
  color: var(--accent);
  font-size: clamp(1rem, 2vw, 1.45rem);
}

.metric-box strong span {
  color: inherit;
}

.result-section {
  margin-top: 24px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.section-heading h3,
.term-section h3 {
  color: #9cf4d9;
  font: 750 0.82rem/1.3 "IBM Plex Mono", monospace;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.section-heading span {
  color: var(--muted);
  font: 0.7rem/1.4 "IBM Plex Mono", monospace;
}

.recommendation-list {
  border-top: 1px solid var(--line);
}

.recommendation-row {
  display: grid;
  grid-template-columns: 48px 74px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.recommendation-index {
  color: #76aa9c;
}

.recommendation-action {
  font: 800 0.72rem/1 "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.recommendation-action[data-action="keep"] {
  color: var(--success);
}

.recommendation-action[data-action="remove"] {
  color: var(--warning);
}

.recommendation-reason {
  color: #c0d3ce;
}

.recommendation-score {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  text-align: right;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #8cb6aa;
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.pair-high {
  color: var(--warning);
  font-weight: 800;
}

.term-output {
  min-height: 48px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  color: #b9e4d8;
  font: 0.8rem/1.7 "IBM Plex Mono", monospace;
}

#cleaned-context {
  min-height: 210px;
}

.export-actions {
  justify-content: flex-start;
  margin-top: 12px;
}

.explain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 28px;
  border: 1px solid var(--line);
}

.explain-grid article {
  padding: clamp(20px, 3vw, 34px);
}

.explain-grid article + article {
  border-left: 1px solid var(--line);
}

.explain-grid h2,
.faq-section h2 {
  color: var(--accent);
  font: 750 0.94rem/1.3 "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.explain-grid li,
.faq-section p {
  color: #a9beb8;
  line-height: 1.7;
}

.faq-section {
  max-width: 920px;
  margin: 56px 0 20px;
}

.faq-section details {
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
}

.faq-section summary {
  color: #d7ece6;
  font-weight: 740;
}

.faq-section p {
  margin: 12px 0 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4vw 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 980px) {
  .tool-workbench,
  .explain-grid {
    grid-template-columns: 1fr;
  }

  .explain-grid article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    min-height: auto;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .header-note {
    max-width: 150px;
    text-align: right;
  }

  .page-shell {
    padding-top: 28px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric-box {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-box:last-child {
    border-bottom: 0;
  }

  .recommendation-row {
    grid-template-columns: 40px 64px minmax(0, 1fr);
    padding: 10px 0;
  }

  .recommendation-score {
    grid-column: 3;
    text-align: left;
  }

  .section-heading,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
