:root {
    --primary: #1d4ed8;
    --bg: #f3f4f6;
    --text: #1f2937;
    --muted: #4b5563;
    --line: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    letter-spacing: 0;
    line-height: 1.2;
}

main {
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    scroll-margin-top: 1rem;
}

section:target {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

h2 {
    margin-top: 0;
    font-size: 1.5rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0;
}

.feature-heading-link {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 0.25rem;
}

.feature-heading-link:hover {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

.feature-heading-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 4px;
}

h3 {
    letter-spacing: 0;
}

p {
    color: var(--muted);
}

main > section > p {
    margin: 0 0 1.25rem;
}

header {
    display: block;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: clamp(1rem, 3vw, 2rem);
    text-align: center;
    position: relative;
    z-index: 10;
}

header .inner,
footer .inner {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

header p {
    color: #4b5563;
    font-size: 1.1rem;
    margin: 0.5rem 0 0;
}

footer {
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    width: 100%;
}

footer .inner {
    padding: clamp(1rem, 3vw, 2rem);
}

details {
    margin-top: 1.5rem;
    background: #1f2937;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}

summary {
    color: #d1d5db;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
    background: #374151;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '▾';
    transition: transform 0.18s ease;
}

details[open] summary::after {
    transform: rotate(180deg);
}

summary:hover {
    background: #4b5563;
}

pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    color: #e5e7eb;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.4;
}

code {
    color: #334155;
    background: #eef2f7;
    border-radius: 4px;
    padding: 1px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

button,
select,
input {
    font: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible,
pre:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 3px;
}

.demo-button,
.demo-panel button,
.button-row button {
    min-height: 2.5rem;
    border: 1px solid #2563eb;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-weight: 700;
}

.demo-button.secondary,
.demo-panel button.secondary,
.button-row button.secondary {
    border-color: var(--line);
    background: #fff;
    color: var(--text);
}

select,
input {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 9px;
    min-width: 0;
}

.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.grid,
.grid-responsive,
.grid-three {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.grid.three {
    grid-template-columns: 1fr;
}

.surface,
.demo-panel {
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #fafafa;
    max-width: 100%;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0;
}

.demo-panel > .button-row:first-child,
.demo-panel > .toolbar:first-child {
    margin-top: 0;
}

.demo-panel > :last-child,
.surface > :last-child {
    margin-bottom: 0;
}

.status-line {
    min-height: 24px;
    color: #0f766e;
    font-weight: 700;
    margin: 0.75rem 0 0;
}

.status-line + pre {
    margin-top: 0.75rem;
}

.intentional-a11y-note {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid #d97706;
    border-radius: 0.375rem;
    background: #fffbeb;
    color: #78350f;
}

.intentional-a11y-note p {
    margin: 0.35rem 0 0;
    line-height: 1.5;
}

.lab-overview {
    border: 0;
    color: #e2e8f0;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}

.lab-overview h2,
.lab-overview p,
.lab-overview code {
    color: inherit;
}

.lab-overview h2 {
    border-color: rgba(255, 255, 255, 0.15);
}

.lab-overview code {
    background: rgba(255, 255, 255, 0.12);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.metric {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
}

.metric strong,
.metric span {
    display: block;
}

.metric strong {
    color: #fff;
    font-size: 1.25rem;
}

.metric span {
    color: #bfdbfe;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.lab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.lab-controls select {
    flex: 1 1 280px;
    color: var(--text);
    background: #fff;
}

.lab-controls button {
    min-height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    padding: 0.5rem 0.8rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    font-weight: 700;
}

.lab-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
}

.feature-card {
    border: 1px solid #dbe4ef;
    border-radius: 9px;
    padding: 0.9rem;
    background: #fff;
    min-width: 0;
}

.feature-card strong,
.feature-card span {
    display: block;
}

.feature-card span {
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.feature-card pre,
.demo-panel pre,
.surface pre {
    margin-top: 0.75rem;
    border-radius: 7px;
    color: #dbeafe;
    background: #0f172a;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.runtime-log {
    min-height: 9rem;
    max-height: 18rem;
    overflow: auto;
}

.runtime-log,
#adapter-output {
    border-radius: 7px;
    color: #e2e8f0;
    background: #0f172a;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.test-pass {
    color: #047857 !important;
}

.test-note {
    padding: 0.75rem 1rem;
    border-left: 4px solid #1d4ed8;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 5px;
}

.lab-overview .test-note {
    color: #1e3a8a;
}

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

.debug-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: #1f2937;
    color: white;
    border: 1px solid #374151;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .grid,
    .grid-responsive {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 640px) {
    main {
        padding: 1rem;
    }

    section {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .badge {
        display: block;
        width: fit-content;
        margin: 0.25rem 0 0 0;
    }
}

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

    summary::after {
        transition: none;
    }
}

/* BEGIN GENERATED EXAMPLE CONTROLS */
button,
input,
select,
textarea:not([data-editor]) {
    font: inherit;
    line-height: 1.5;
}

button,
input[type='button'],
input[type='submit'],
input[type='reset'],
.demo-button,
.demo-panel button,
.button-row button,
.lab-controls button {
    min-height: 2.75rem;
    max-width: 100%;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--primary, #1d4ed8);
    border-radius: 6px;
    color: #fff;
    background: var(--primary, #1d4ed8);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

button:hover:where(:not(:disabled)),
input[type='button']:hover:where(:not(:disabled)),
input[type='submit']:hover:where(:not(:disabled)),
input[type='reset']:hover:where(:not(:disabled)),
.demo-button:hover,
.demo-panel button:hover:where(:not(:disabled)),
.button-row button:hover:where(:not(:disabled)),
.lab-controls button:hover:where(:not(:disabled)) {
    background: var(--primary-hover, #1e40af);
}

button.secondary,
.demo-button.secondary,
.demo-panel button.secondary,
.button-row button.secondary {
    border-color: var(--line, #e5e7eb);
    color: var(--text, #1f2937);
    background: #fff;
}

button.secondary:hover:where(:not(:disabled)),
.demo-button.secondary:hover,
.demo-panel button.secondary:hover:where(:not(:disabled)),
.button-row button.secondary:hover:where(:not(:disabled)) {
    background: #f1f5f9;
}

button.danger {
    border-color: #b91c1c;
    background: #b91c1c;
}

button.danger:hover:where(:not(:disabled)) {
    background: #991b1b;
}

select,
.lab-controls select,
input:not(
    [type='checkbox'],
    [type='radio'],
    [type='range'],
    [type='hidden'],
    [type='button'],
    [type='submit'],
    [type='reset'],
    [type='file']
),
textarea:not([data-editor]) {
    min-width: 0;
    max-width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 6px;
    color: var(--text, #1f2937);
    background: #fff;
}

input[type='checkbox'],
input[type='radio'] {
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 0;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: revert;
    border-radius: revert;
    background: revert;
    vertical-align: middle;
    accent-color: var(--primary, #1d4ed8);
}

input[type='range'] {
    max-width: 100%;
    accent-color: var(--primary, #1d4ed8);
}

input[type='hidden'] {
    display: none;
}

input[type='file'] {
    max-width: 100%;
    color: var(--text, #1f2937);
}

input::file-selector-button {
    min-height: 2.75rem;
    margin-right: 0.65rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 6px;
    color: var(--text, #1f2937);
    background: #fff;
    font: inherit;
    cursor: pointer;
}

.auto-run-control {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.75rem;
}

@supports selector(label:has(input)) {
    label:has(> input[type='checkbox'], > input[type='radio']) {
        display: inline-flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.45rem;
        min-height: 2.75rem;
    }
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.field-control {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

input.compact-input {
    width: 6rem;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 3px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
    background: #f1f5f9;
}
/* END GENERATED EXAMPLE CONTROLS */
