:root {
  color-scheme: light;
  --canvas: #f3f4ef;
  --paper: #ffffff;
  --paper-soft: #f8faf7;
  --ink: #17201d;
  --muted: #65716c;
  --line: #d5ddd8;
  --line-strong: #b9c6bf;
  --accent: #08796c;
  --accent-soft: #dcefeb;
  --coral: #d45f43;
  --blue: #2d6f9f;
  --code: #121816;
  --code-line: #29332f;
  --code-text: #e8f0ec;
  --code-muted: #aebbb5;
  --danger: #b9382f;
  --shadow: 0 18px 50px rgba(24, 42, 35, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(45, 111, 159, 0.28);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.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;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(243, 244, 239, 0.94);
  backdrop-filter: blur(12px);
}

.header-inner,
.intro-inner,
.builder-grid,
.matrix-section,
.cli-section,
.footer-inner {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.icon-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand {
  gap: 11px;
  font-weight: 750;
  font-size: 15px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--coral);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-link {
  min-height: 38px;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.icon-link:hover {
  color: var(--ink);
}

.icon-link svg,
.action-button svg,
.icon-button svg,
.privacy-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.intro {
  padding: 44px 0 36px;
}

.intro-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 56px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 44px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-copy {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 16px;
}

.builder-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  min-height: 680px;
}

.controls {
  padding: 34px 34px 38px 0;
  border-right: 1px solid var(--line);
}

fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.control-group {
  margin: 0 0 22px;
}

.control-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

label,
legend,
.meta-label {
  display: block;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.control-row label {
  margin: 0;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
}

input:hover,
select:hover {
  border-color: #8e9d96;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
}

.protocol-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-button {
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.segment-button:hover {
  color: var(--ink);
}

.segment-button[aria-checked="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(24, 42, 35, 0.1);
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-button {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.client-button:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

.client-button[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.client-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
  font-size: 9px;
  font-weight: 850;
}

.client-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.mode-dot.guided {
  background: var(--blue);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.field-grid .control-group {
  margin-bottom: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.advanced-controls {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.advanced-controls summary {
  padding: 14px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-grid {
  padding-bottom: 8px;
}

.output-panel {
  min-width: 0;
  margin: 34px 0 38px 34px;
  display: grid;
  grid-template-rows: auto auto minmax(300px, 1fr) auto;
  align-self: stretch;
  overflow: hidden;
  border: 1px solid var(--code-line);
  border-radius: 7px;
  background: var(--code);
  color: var(--code-text);
  box-shadow: var(--shadow);
}

.output-toolbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--code-line);
}

.output-heading h2 {
  margin: 5px 0 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.output-status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #41675f;
  border-radius: 4px;
  color: #82d6c4;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-badge.guided {
  border-color: #43657d;
  color: #9bccef;
}

.output-target {
  min-width: 0;
  color: var(--code-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.action-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3a4842;
  border-radius: 5px;
  background: #1b2421;
  color: var(--code-text);
  cursor: pointer;
}

.action-button {
  min-height: 38px;
  gap: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 750;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
}

.action-button:hover,
.icon-button:hover {
  border-color: #64756d;
  background: #24302c;
}

.error-message {
  margin: 16px 18px 0;
  padding: 10px 12px;
  border: 1px solid #8b433e;
  border-radius: 5px;
  background: #321e1c;
  color: #ffc2bc;
  font-size: 13px;
}

.code-shell {
  min-width: 0;
  min-height: 300px;
  margin: 0;
  padding: 24px;
  overflow: auto;
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

.output-meta {
  padding: 0 18px 18px;
  border-top: 1px solid var(--code-line);
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 0;
  color: var(--code-muted);
}

.privacy-note svg {
  margin-top: 2px;
  color: #82d6c4;
}

.privacy-note p {
  margin: 0;
  font-size: 12px;
}

.doctor-block {
  padding: 13px 0;
  border-top: 1px solid var(--code-line);
  border-bottom: 1px solid var(--code-line);
}

.meta-label {
  color: var(--code-muted);
}

.doctor-command-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doctor-command-row code {
  min-width: 0;
  flex: 1;
  color: #dce9e3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.config-notes {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0 0 0 18px;
  color: var(--code-muted);
  font-size: 12px;
}

.matrix-section {
  padding: 78px 0 72px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 25px;
}

.section-heading h2,
.cli-section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
}

.section-heading > p {
  max-width: 380px;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

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

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: transparent;
  text-align: left;
}

th,
td {
  height: 56px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

th {
  height: 48px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

tbody tr:hover {
  background: rgba(255, 255, 255, 0.55);
}

.matrix-client {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 720;
}

.matrix-client .client-mark {
  width: 25px;
  height: 25px;
}

.compat-yes {
  color: var(--accent);
  font-weight: 850;
}

.compat-no {
  color: #9ba59f;
}

.mode-label {
  color: var(--blue);
  font-weight: 750;
  text-transform: capitalize;
}

.source-link {
  color: var(--muted);
  text-decoration-color: #98a49e;
  text-underline-offset: 3px;
}

.source-link:hover {
  color: var(--ink);
}

.cli-section {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(420px, 1.25fr);
  align-items: center;
  gap: 60px;
  padding: 52px 0;
  border-top: 1px solid var(--line-strong);
}

.cli-command {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 11px 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
}

.cli-command code {
  min-width: 0;
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.icon-button.light {
  border-color: var(--line);
  background: var(--paper-soft);
  color: var(--ink);
}

.icon-button.light:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}

footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: #d9e1dd;
}

.footer-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: #aebbb5;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100% - 40px));
  padding: 10px 14px;
  border: 1px solid #2d433b;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 30px rgba(20, 30, 26, 0.22);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

noscript {
  display: block;
  padding: 12px 20px;
  background: #fff1d8;
  color: #6b4b18;
  text-align: center;
}

@media (max-width: 920px) {
  .intro-inner,
  .builder-grid,
  .cli-section {
    grid-template-columns: 1fr;
  }

  .intro-inner {
    gap: 18px;
  }

  .intro-copy {
    max-width: 620px;
  }

  .controls {
    padding: 30px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .output-panel {
    min-height: 640px;
    margin: 30px 0;
  }

  .cli-section {
    gap: 28px;
  }
}

@media (max-width: 620px) {
  .header-inner,
  .intro-inner,
  .builder-grid,
  .matrix-section,
  .cli-section,
  .footer-inner {
    width: min(100% - 24px, 1220px);
  }

  .site-header .brand span:last-child {
    display: none;
  }

  .intro {
    padding: 32px 0 26px;
  }

  h1 {
    font-size: 34px;
  }

  .protocol-options {
    grid-template-columns: 1fr;
  }

  .client-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-wide {
    grid-column: auto;
  }

  .output-panel {
    min-height: 600px;
    border-radius: 6px;
  }

  .output-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .output-actions {
    width: 100%;
  }

  .action-button {
    flex: 1;
  }

  .code-shell {
    padding: 18px;
    font-size: 12px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .section-heading > p {
    text-align: left;
  }

  .matrix-section {
    padding: 58px 0 52px;
  }

  .cli-section {
    padding: 42px 0;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
