:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #101828;
  --muted: #475467;
  --muted-light: #667085;
  --border: #dfe5ec;
  --border-strong: #c9d2df;
  --primary: #155eef;
  --primary-dark: #004eeb;
  --primary-soft: #eff4ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --purple: #6938ef;
  --purple-soft: #f4f3ff;
  --shadow: 0 10px 32px rgba(16, 24, 40, .07), 0 2px 8px rgba(16, 24, 40, .04);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: linear-gradient(180deg, #fff 0, #f8fafc 560px); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--primary); }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-140%); z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--text); color: #fff; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.site-header { height: 72px; border-bottom: 1px solid #e7ebf0; background: rgba(255,255,255,.9); backdrop-filter: blur(16px); }
.header-inner { max-width: 1500px; height: 100%; margin: 0 auto; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #174ea6; font-weight: 750; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: var(--primary); font-size: 16px; box-shadow: 0 4px 12px rgba(21,94,239,.25); }
.github-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: #fff; text-decoration: none; font-size: 14px; font-weight: 650; transition: border-color .2s, box-shadow .2s, transform .2s; }
.github-link svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.github-link:hover { border-color: #98a2b3; box-shadow: 0 4px 12px rgba(16,24,40,.08); transform: translateY(-1px); }

.hero { max-width: 1500px; margin: 0 auto; padding: 32px 34px 44px; }
.hero-heading { margin: 0 0 22px 14px; }
.hero-heading h1 { margin: 0; font-size: clamp(38px, 4vw, 54px); line-height: 1.05; letter-spacing: -.045em; font-weight: 800; }
.hero-heading p { max-width: 720px; margin: 11px 0 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.workspace { display: grid; grid-template-columns: minmax(470px, .92fr) minmax(640px, 1.08fr); gap: 24px; align-items: stretch; }
.panel { min-width: 0; border: 1px solid rgba(208, 213, 221, .9); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.generator-panel { padding: 0 18px 18px; }
.results-panel { padding: 23px 18px 18px; display: flex; flex-direction: column; }

.tab-list { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.tab-button { position: relative; height: 54px; border: 0; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; }
.tab-button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.tab-button.is-active { color: var(--primary); }
.tab-button.is-active::after { background: var(--primary); }
.tab-panel { padding: 18px 0 0; }

.form-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-group legend, .field > span { display: block; margin: 0 0 8px; color: #344054; font-size: 13px; font-weight: 700; }
.field-group legend span, .field > span b { color: var(--text); }
.field > span em { color: var(--muted-light); font-style: normal; font-weight: 500; }

.segmented { display: grid; width: 100%; }
.segmented.two-options { grid-template-columns: 1fr 1fr; }
.segmented label { position: relative; min-width: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:first-child span { border-radius: 8px 0 0 8px; }
.segmented label:last-child span { border-radius: 0 8px 8px 0; margin-left: -1px; }
.segmented label span { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--border-strong); color: #344054; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.segmented svg { width: 17px; height: 17px; }
.segmented input:checked + span { position: relative; z-index: 1; border-color: #84adff; color: var(--primary); background: var(--primary-soft); }
.segmented input:focus-visible + span, .test-case-options input:focus-visible + span { outline: 3px solid rgba(21,94,239,.18); outline-offset: 2px; }

.field { display: block; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); outline: none; transition: border-color .18s, box-shadow .18s; }
.field input, .field select { height: 42px; padding: 0 12px; }
.field textarea { min-height: 188px; padding: 12px; resize: vertical; line-height: 1.55; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #84adff; box-shadow: 0 0 0 3px rgba(21,94,239,.12); }
.field input::placeholder, .field textarea::placeholder { color: #98a2b3; }
.field small { display: block; margin-top: 6px; color: var(--muted-light); font-size: 12px; line-height: 1.4; }
.full-width { margin-top: 16px; }
.input-fields { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.wide-field { grid-column: 1 / -1; }

.test-case-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.test-case-options label { position: relative; }
.test-case-options input { position: absolute; opacity: 0; pointer-events: none; }
.test-case-options span { display: grid; place-items: center; min-height: 38px; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 8px; color: #344054; background: #fff; text-align: center; font-size: 12px; font-weight: 650; cursor: pointer; }
.test-case-options input:checked + span { border-color: #84adff; color: var(--primary); background: var(--primary-soft); }

.button-row { display: grid; grid-template-columns: 1.38fr 1fr; gap: 12px; margin-top: 20px; }
.button-row button { min-height: 46px; border-radius: 9px; font-weight: 700; cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s, background .18s; }
.button-row svg { width: 19px; height: 19px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--primary); background: linear-gradient(180deg, #246bfd, #155eef); color: #fff; box-shadow: 0 5px 14px rgba(21,94,239,.23); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(21,94,239,.28); }
.secondary-button { display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--border-strong); background: #fff; }
.secondary-button:hover { border-color: #98a2b3; background: #f9fafb; }
.validator-buttons { grid-template-columns: 1fr 150px; }

.inline-status { display: flex; align-items: flex-start; gap: 9px; min-height: 44px; margin-top: 16px; padding: 11px 12px; border: 1px solid; border-radius: 9px; font-size: 12.5px; line-height: 1.5; }
.inline-status svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.inline-status.success { border-color: #abefc6; color: var(--success); background: var(--success-soft); }
.inline-status.error { border-color: #fecdca; color: var(--danger); background: var(--danger-soft); }
.inline-status.neutral { border-color: #b2ccff; color: #1849a9; background: var(--primary-soft); }
.inline-status.warning { border-color: #fedf89; color: var(--warning); background: var(--warning-soft); }

.results-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 35px; margin: 0 6px 14px; }
.results-header h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.result-actions { display: flex; align-items: center; gap: 6px; }
.result-actions button { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 5px 7px; border: 0; border-radius: 7px; background: transparent; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; }
.result-actions button:hover { background: var(--primary-soft); }
.result-actions svg { width: 16px; height: 16px; }

.table-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 11px 10px; border-bottom: 1px solid #eaecf0; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #475467; background: #f8fafc; font-size: 11.5px; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fcfcfd; }
tbody tr:hover { background: #f8faff; }
.rfc-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 750; letter-spacing: .01em; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; min-height: 24px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.status-pill.pass { color: var(--success); background: var(--success-soft); }
.status-pill.fail { color: var(--danger); background: var(--danger-soft); }
.status-pill.synthetic { color: #1849a9; background: var(--primary-soft); }
.status-pill.generic { color: var(--purple); background: var(--purple-soft); }
.status-pill.test-case { color: var(--warning); background: var(--warning-soft); }
.copy-row { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.copy-row:hover { color: var(--primary); background: var(--primary-soft); }
.copy-row svg { width: 16px; height: 16px; }

.code-preview { flex: 1; min-height: 350px; max-height: 490px; margin: 0; overflow: auto; padding: 16px; border: 1px solid #1d2939; border-radius: 11px; background: #101828; color: #e4e7ec; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-note { display: flex; align-items: flex-start; gap: 10px; margin-top: auto; padding: 14px 13px; border: 1px solid #b2ccff; border-radius: 9px; color: #1849a9; background: var(--primary-soft); font-size: 12.5px; line-height: 1.5; }
.result-note svg { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 1px; }
.result-note p { margin: 0; }
.result-note a { font-weight: 700; }

.support-content { max-width: 1432px; margin: 0 auto 48px; padding: 0 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.support-content article { padding: 24px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.75); }
.support-content h2 { margin: 0 0 8px; font-size: 17px; }
.support-content p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
footer { padding: 24px; border-top: 1px solid var(--border); color: var(--muted-light); background: #fff; text-align: center; font-size: 13px; }

[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(21,94,239,.25); outline-offset: 2px; }

@media (max-width: 1160px) {
  .workspace { grid-template-columns: 1fr; }
  .results-panel { min-height: 520px; }
  .support-content { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .site-header { height: 62px; }
  .header-inner { padding: 0 18px; }
  .github-link span { display: none; }
  .github-link { width: 40px; padding: 0; justify-content: center; }
  .hero { padding: 26px 14px 34px; }
  .hero-heading { margin-left: 4px; margin-bottom: 18px; }
  .hero-heading h1 { font-size: 38px; }
  .hero-heading p { font-size: 14px; }
  .workspace { gap: 16px; }
  .generator-panel, .results-panel { border-radius: 13px; }
  .generator-panel { padding: 0 13px 13px; }
  .results-panel { min-height: 0; padding: 18px 12px 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .input-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .test-case-options { grid-template-columns: 1fr 1fr; }
  .button-row, .validator-buttons { grid-template-columns: 1fr; }
  .primary-button, .secondary-button { width: 100%; }
  .results-header { align-items: flex-start; margin-inline: 2px; }
  .results-header h2 { font-size: 18px; }
  .result-actions { gap: 0; }
  .result-actions button { padding-inline: 6px; font-size: 0; }
  .result-actions svg { width: 18px; height: 18px; }
  .table-scroll { max-height: 430px; }
  table { min-width: 630px; }
  th, td { padding: 10px 8px; }
  .result-note { margin-top: 12px; }
  .support-content { padding: 0 14px; margin-bottom: 34px; }
  .support-content article { padding: 19px; }
}

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