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

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

a {
    color: var(--primary);
}

button,
input {
    font: inherit;
}

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

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

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

.site-header .subtitle {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 1.1rem;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 1rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.github-link:hover,
.site-footer a:hover {
    text-decoration: underline;
}

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

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

h2 {
    margin: 0 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bg);
    font-size: 1.5rem;
}

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

code,
pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

code {
    padding: 1px 4px;
    border-radius: 4px;
    color: #334155;
    background: #eef2f7;
}

pre {
    max-height: 18rem;
    overflow: auto;
    margin: 0;
    padding: 1rem;
    border-radius: 8px;
    color: #e2e8f0;
    background: #0f172a;
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

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

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

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

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

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

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

.eyebrow {
    margin: 0 0 0.35rem;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lab-overview .eyebrow {
    color: #bfdbfe;
}

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

.metric {
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    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;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-panel > p {
    margin: 0 0 1rem;
}

.status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    color: #9a3412;
    background: #fff7ed;
    font-size: 0.9rem;
    font-weight: 750;
}

.status-pill::before {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: currentcolor;
    content: "";
}

.status-pill[data-state="ready"],
.status-pill[data-state="online"] {
    color: #047857;
    background: #ecfdf5;
}

.status-pill[data-state="offline"] {
    color: #1d4ed8;
    background: #eff6ff;
}

.status-pill[data-state="error"] {
    color: #b91c1c;
    background: #fef2f2;
}

button {
    min-height: 2.65rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: #fff;
    background: var(--primary);
    font-weight: 750;
    cursor: pointer;
}

button:hover {
    background: #1e40af;
}

#demo-root {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.demo-card {
    margin: 0;
}

.demo-card h2,
.counter-card h3 {
    margin-top: 0;
}

.counter-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #fafafa;
}

.counter-card p:last-child {
    margin-bottom: 0;
}

.loading {
    padding: 1rem;
    color: var(--muted);
}

.site-footer {
    display: block;
    width: 100%;
    margin-top: auto;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: #fff;
}

.site-footer .container {
    display: flex;
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
    box-sizing: border-box;
}

.site-footer .inner {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.site-footer .meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer .meta strong {
    color: var(--text);
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.site-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

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

    main > section,
    .demo-card {
        margin-bottom: 1.5rem;
        padding: 1.25rem;
    }

    .counter-card,
    .site-footer .inner {
        align-items: flex-start;
        flex-direction: column;
    }
}

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

    summary::after {
        transition: none;
    }
}
