.compatibility-page {
  --compat-green: #67dfa4;
  --compat-amber: #ffc66d;
  min-height: 100vh;
  background: var(--ink);
  font-family: var(--sans);
}

.compatibility-page h1,
.compatibility-page h2,
.compatibility-page h3 {
  font-family: var(--title);
  font-weight: 400;
}

.compatibility-page button,
.compatibility-page select,
.compatibility-page textarea,
.compatibility-page input { font: inherit; }

.compatibility-page button { cursor: pointer; }
.compatibility-page button:disabled { cursor: not-allowed; opacity: .5; }
.compatibility-page :focus-visible { outline: 2px solid var(--blue-2); outline-offset: 3px; }

.compat-skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
  transform: translateY(-160%);
}
.compat-skip:focus { transform: translateY(0); }

.compat-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(5,7,11,.9);
  backdrop-filter: blur(14px);
}
.compat-nav { min-height: 72px; display: flex; align-items: center; gap: 28px; }
.compat-nav .brand { margin-right: auto; }
.compat-nav .brand img { display: block; width: 92px; }
.compat-nav-links { display: flex; align-items: center; gap: 26px; color: #c6d0df; font-size: .92rem; }
.compat-nav-links a { transition: color .15s ease; }
.compat-nav-links a:hover,
.compat-nav-links a[aria-current="page"] { color: white; }
.compat-nav-links a[aria-current="page"] { box-shadow: 0 1px 0 var(--blue-2); }
.compat-nav-cta {
  padding: 10px 15px;
  border: 1px solid var(--blue);
  color: white !important;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.compat-nav-cta:hover {
  background: var(--blue);
  box-shadow: 4px 4px 0 var(--blue-2);
  transform: translateY(-1px);
}

.compat-mobile-menu { display: none; position: relative; }
.compat-mobile-menu summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: white;
  cursor: pointer;
  list-style: none;
}
.compat-mobile-menu summary::-webkit-details-marker { display: none; }
.compat-mobile-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(78vw,280px);
  display: grid;
  padding: 8px;
  border: 1px solid var(--line);
  background: #080d15;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.compat-mobile-panel a { min-height: 44px; display: flex; align-items: center; padding: 0 12px; }
.compat-mobile-panel a:hover,
.compat-mobile-panel a[aria-current="page"] { color: var(--blue-2); }

.compat-hero {
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: center;
  padding: clamp(64px,8vw,116px) 0;
  border-bottom: 1px solid var(--line);
}
.compat-hero-grid {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr);
  gap: clamp(48px,6vw,96px);
  align-items: center;
}
.compat-hero h1 {
  max-width: 850px;
  margin-bottom: 28px;
  font-size: clamp(3.4rem,6.4vw,6.8rem);
  line-height: 1.04;
  letter-spacing: -.025em;
}
.compat-lede {
  max-width: 780px;
  margin-bottom: 0;
  color: #c0cad8;
  font-size: clamp(1.15rem,2vw,1.42rem);
  line-height: 1.7;
}
.compat-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 34px; }

.local-boundary,
.sample-panel,
.contract-guide,
.mapping-panel,
.compat-result {
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.local-boundary:hover,
.local-boundary:focus-within {
  border-color: var(--blue);
  box-shadow: 4px 4px 0 rgba(118,161,255,.55);
}
.sample-panel:focus-within,
.mapping-panel:focus-within,
.compat-result:focus-within {
  border-color: var(--blue);
}
.local-boundary > header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  color: #cdd7e5;
  font-size: .82rem;
}
.local-boundary > header b { color: var(--compat-green); font-weight: 600; }
.local-boundary details { border-bottom: 1px solid var(--line); }
.local-boundary summary {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 20px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.local-boundary summary::-webkit-details-marker { display: none; }
.local-boundary summary:hover { color: var(--blue-2); }
.local-boundary summary i {
  color: var(--blue-2);
  font-size: 1.25rem;
  font-style: normal;
  font-weight: 400;
  transition: transform .15s ease;
}
.local-boundary details[open] summary i { transform: rotate(45deg); }
.local-boundary details p {
  margin: -5px 0 0;
  padding: 0 48px 20px 20px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}
.local-boundary > footer { padding: 18px 20px; color: #91a0b6; font-size: .75rem; line-height: 1.5; }

.compat-rules { border-bottom: 1px solid var(--line); background: #080c13; }
.compat-rules .wrap { min-height: 64px; display: flex; align-items: center; }
.compat-rules p { margin: 0; color: #9aa9be; font-size: .82rem; }
.compat-rules strong { color: #dfe7f2; font-weight: 600; }

.compat-workspace {
  padding: 104px 0;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  scroll-margin-top: 70px;
}
.noscript-warning { margin: 0 0 34px; padding: 16px; border: 1px solid var(--red); color: #ffd4d4; background: #1b0b0e; }
.compat-section-head { max-width: 900px; margin-bottom: 44px; }
.compat-section-head h2,
.mapping-panel h2,
.compat-result h2,
.compat-next h2 {
  margin-bottom: 20px;
  font-size: clamp(2.25rem,4vw,3.8rem);
  line-height: 1.1;
}
.compat-section-head > p,
.mapping-panel > header > p,
.compat-next-grid > div:last-child { color: var(--muted); font-size: 1rem; line-height: 1.75; }

.sample-layout {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(300px,.6fr);
  gap: 28px;
  align-items: start;
}
.sample-panel { padding: clamp(24px,3.5vw,42px); }
.sample-panel > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.sample-panel h3,
.contract-guide h3 { margin: 0; font-size: 1.15rem; line-height: 1.4; }
.sample-utilities { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.quiet-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: #c4d0e1;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.quiet-button:hover { border-color: var(--blue); background: rgba(47,112,255,.08); color: white; }

.profile-picker { display: grid; gap: 8px; margin-bottom: 20px; }
.profile-picker > label { color: white; font-size: .85rem; font-weight: 600; }
.profile-picker select,
.format-picker select,
.mapping-field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 38px 0 12px;
  background: #0c1420;
  color: white;
  transition: border-color .15s ease, background-color .15s ease;
}
.profile-picker select:hover,
.format-picker select:hover,
.mapping-field select:hover { border-color: var(--blue); }
.profile-picker small { color: var(--muted); font-size: .78rem; line-height: 1.55; }

.file-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(190px,.45fr);
  gap: 14px;
}
.file-picker,
.format-picker {
  min-height: 84px;
  padding: 17px;
  border: 1px solid var(--line);
  background: #080d15;
  transition: border-color .15s ease, background-color .15s ease;
}
.file-picker { display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
.file-picker:hover { border-color: var(--blue); background: rgba(47,112,255,.06); }
.file-picker span { color: white; font-weight: 600; }
.file-picker small { margin-top: 4px; color: var(--muted); }
.file-row input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-picker:has(+ input:focus-visible) { border-color: var(--blue-2); outline: 2px solid var(--blue-2); outline-offset: 3px; }
.format-picker { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: .75rem; }
.format-picker select,
.mapping-field select { min-height: 40px; padding-left: 10px; }

.input-divider { display: flex; align-items: center; gap: 14px; margin: 25px 0 16px; color: #8191a8; font-size: .75rem; }
.input-divider::before,
.input-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.paste-label { display: block; margin-bottom: 8px; color: #b9c5d7; font-size: .8rem; }
#sample-paste {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 17px;
  background: #070b12;
  color: #dce6f5;
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.55;
  transition: border-color .15s ease;
}
#sample-paste:hover { border-color: #3a4b66; }
#sample-paste::placeholder { color: #59667a; }
.input-state { min-height: 21px; margin: 9px 0 18px; color: #7f91aa; font-size: .72rem; }

.sample-confirmation {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
  padding: 17px;
  border: 1px solid var(--line);
  color: #c4cede;
  font-size: .78rem;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.sample-confirmation:hover,
.sample-confirmation:focus-within { border-color: var(--blue); background: rgba(47,112,255,.05); }
.sample-confirmation input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); }
.sample-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px; }
.sample-actions #sample-status { flex: 1 1 260px; color: var(--muted); font-size: .75rem; }
#sample-status[data-tone="error"] { color: var(--red); }
#sample-status[data-tone="success"] { color: var(--compat-green); }

.contract-guide { position: sticky; top: 98px; padding: 30px; }
.profile-guide-name { margin: 13px 0 0; color: var(--blue-2); font-weight: 600; line-height: 1.55; }
.contract-guide dl { margin: 24px 0; border-top: 1px solid var(--line); }
.contract-guide dl > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.contract-guide dt { margin-bottom: 4px; color: #eef4ff; font-weight: 600; font-size: .8rem; }
.contract-guide dd { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.contract-guide > p:last-child { margin: 0; color: #8ea0b8; font-size: .76rem; line-height: 1.65; }

.mapping-panel { margin-top: 72px; padding: clamp(24px,3.5vw,42px); scroll-margin-top: 92px; }
.mapping-panel[hidden],
.compat-result[hidden],
#result-findings[hidden],
#result-remediations[hidden] { display: none; }
.mapping-panel > header {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(280px,.65fr);
  gap: 40px;
  align-items: end;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.mapping-panel h2 { margin-bottom: 0; }
.mapping-panel > header > p { margin: 0; font-size: .9rem; }
.mapping-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; margin-top: 1px; background: var(--line); }
.mapping-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--panel);
  transition: background-color .15s ease, box-shadow .15s ease;
}
.mapping-field:hover,
.mapping-field:focus-within { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--blue); }
.mapping-label { min-height: 42px; color: white; font-weight: 600; font-size: .82rem; }
.mapping-field small { margin: 1px 0 11px; color: #8495ae; font-size: .7rem; }

.compat-result { margin-top: 28px; overflow: hidden; }
.result-header {
  display: grid;
  grid-template-columns: minmax(0,1.2fr) minmax(340px,.8fr);
  gap: 44px;
  padding: clamp(28px,4vw,48px);
  border-bottom: 1px solid var(--line);
}
.result-header > div:first-child > span {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid var(--compat-green);
  color: var(--compat-green);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
}
.compat-result[data-status="needs_mapping"] .result-header > div:first-child > span,
.compat-result[data-status="scoped_adapter"] .result-header > div:first-child > span { border-color: var(--compat-amber); color: var(--compat-amber); }
.compat-result[data-status="blocked"] .result-header > div:first-child > span { border-color: var(--red); color: var(--red); }
.result-header h2 { margin: 20px 0 13px; font-size: clamp(2rem,3.4vw,3.4rem); }
.result-header > div:first-child > p { max-width: 730px; margin: 0; color: var(--muted); }
.result-metrics { display: grid; grid-template-columns: .7fr 1.3fr; border: 1px solid var(--line); }
.result-metrics p {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin: 0;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #080d15;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.result-metrics p:last-child { border-right: 0; }
.result-metrics p:hover { background: var(--panel-2); box-shadow: inset 0 -3px 0 var(--blue); }
.result-metrics strong { overflow-wrap: anywhere; color: white; font-size: clamp(1.15rem,2.2vw,2rem); line-height: 1.1; }
.result-metrics span { margin-top: 9px; color: #8c9bb0; font-size: .72rem; }

.result-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); }
.result-grid > section,
.result-grid > aside { min-width: 0; padding: clamp(26px,3.5vw,42px); }
.result-grid > aside { border-left: 1px solid var(--line); background: #080d15; }
.result-grid h3 { margin: 0 0 20px; color: #dce7f7; font-family: var(--sans); font-size: .82rem; font-weight: 600; }
.result-checks,
#result-findings-list,
#result-remediation-list { margin: 0; padding: 0; list-style: none; }
.result-checks > li {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left .15s ease, background-color .15s ease;
}
.result-checks > li:first-child { padding-top: 0; }
.result-checks > li:hover { padding-left: 8px; background: rgba(47,112,255,.035); }
.check-marker { align-self: start; padding: 5px 7px; border: 1px solid var(--compat-green); color: var(--compat-green); font-size: .68rem; text-align: center; }
.check-warn .check-marker { border-color: var(--compat-amber); color: var(--compat-amber); }
.check-fail .check-marker { border-color: var(--red); color: var(--red); }
.check-copy b { display: block; color: white; font-size: .85rem; }
.check-copy p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
#result-findings,
#result-remediations { margin-bottom: 30px; }
#result-findings-list li,
#result-remediation-list li { position: relative; padding: 0 0 12px 17px; color: #aebbd0; font-size: .75rem; line-height: 1.55; }
#result-findings-list li::before,
#result-remediation-list li::before { content: "\2192"; position: absolute; left: 0; color: var(--blue-2); }
.claim-boundary { padding: 4px 0 4px 20px; border-left: 2px solid var(--blue); }
.claim-boundary h3 { margin-bottom: 20px; }
.claim-boundary b { display: block; color: #dbe6f6; font-size: .8rem; }
.claim-boundary p { margin: 5px 0 17px; color: #a5b3c7; font-size: .8rem; line-height: 1.6; }
.claim-boundary p:last-child { margin-bottom: 0; }

.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; padding: 24px clamp(26px,3.5vw,42px); border-top: 1px solid var(--line); }
.result-actions .text-link { font-size: .82rem; }

.compat-next { padding: 96px 0; border-bottom: 1px solid var(--line); background: #070a10; }
.compat-next-grid { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: clamp(44px,8vw,120px); }
.compat-next h2 { margin-bottom: 0; }

.compat-footer { padding: 46px 0; background: var(--ink); }
.compat-footer > .wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.compat-footer-brand img { width: 92px; }
.compat-footer-brand p { margin: 13px 0 0; color: var(--muted); font-size: .8rem; }
.compat-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 18px; color: var(--muted); font-size: .78rem; }
.compat-footer nav a { transition: color .15s ease; }
.compat-footer nav a:hover { color: white; }

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

@media (max-width: 1180px) {
  .compat-nav-links { gap: 18px; font-size: .86rem; }
}

@media (max-width: 980px) {
  .compat-hero { min-height: auto; }
  .compat-hero-grid,
  .sample-layout,
  .result-header,
  .result-grid,
  .compat-next-grid { grid-template-columns: 1fr; }
  .contract-guide { position: static; }
  .mapping-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .result-grid > aside { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 860px) {
  .compat-nav-links { display: none; }
  .compat-mobile-menu { display: block; }
}

@media (max-width: 760px) {
  .compat-nav { min-height: 64px; }
  .compat-hero { padding: 72px 0; }
  .compat-hero h1 { font-size: clamp(2.85rem,12vw,4.8rem); }
  .compat-rules .wrap { padding-block: 16px; }
  .compat-workspace { padding: 72px 0; }
  .sample-panel > header,
  .compat-footer > .wrap { flex-direction: column; align-items: flex-start; }
  .sample-utilities { justify-content: flex-start; }
  .mapping-panel > header,
  .file-row,
  .mapping-grid,
  .result-metrics { grid-template-columns: 1fr; }
  .result-metrics p { min-height: 106px; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-metrics p:last-child { border-bottom: 0; }
  .compat-footer nav { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .compat-hero-actions,
  .sample-actions,
  .result-actions { align-items: stretch; flex-direction: column; }
  .compat-hero-actions .button,
  .sample-actions .button,
  .sample-actions .quiet-button,
  .result-actions .button { width: 100%; }
  .sample-actions #sample-status { flex-basis: auto; }
  .sample-panel,
  .mapping-panel { padding: 20px; }
  .result-header,
  .result-grid > section,
  .result-grid > aside { padding: 24px 20px; }
  .result-checks > li { grid-template-columns: 58px 1fr; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .compatibility-page * { scroll-behavior: auto !important; }
  .compat-nav-links a,
  .compat-nav-cta,
  .local-boundary,
  .sample-panel,
  .contract-guide,
  .mapping-panel,
  .compat-result,
  .local-boundary summary i,
  .quiet-button,
  .profile-picker select,
  .format-picker select,
  .mapping-field select,
  .file-picker,
  #sample-paste,
  .sample-confirmation,
  .mapping-field,
  .result-metrics p,
  .result-checks > li,
  .compat-footer nav a { transition: none; }
  .local-boundary:hover,
  .local-boundary:focus-within,
  .sample-panel:hover,
  .sample-panel:focus-within,
  .contract-guide:hover,
  .mapping-panel:hover,
  .mapping-panel:focus-within,
  .compat-result:hover,
  .compat-result:focus-within,
  .compat-nav-cta:hover { transform: none; }
}
