* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --background: #ffffff;
    --foreground: #18181b;
    --card: #ffffff;
    --card-foreground: #18181b;
    --border: #e4e4e7;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --accent: #f4f4f5;
    --accent-foreground: #18181b;
    --radius: 0.5rem;
}

:root.light {
    --background: #ffffff;
    --foreground: #18181b;
    --card: #ffffff;
    --card-foreground: #18181b;
    --border: #e4e4e7;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --accent: #f4f4f5;
    --accent-foreground: #18181b;
}

:root.dark {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #09090b;
    --card-foreground: #fafafa;
    --border: #27272a;
    --muted: #18181b;
    --muted-foreground: #a1a1aa;
    --accent: #27272a;
    --accent-foreground: #fafafa;
}

html.dark {
    background: var(--background);
    color: var(--foreground);
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --background: #09090b;
        --foreground: #fafafa;
        --card: #09090b;
        --card-foreground: #fafafa;
        --border: #27272a;
        --muted: #18181b;
        --muted-foreground: #a1a1aa;
        --accent: #27272a;
        --accent-foreground: #fafafa;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-inline-size: 1200px;
    margin-inline: auto;
    padding-block: 3rem;
    padding-inline: 1.5rem;
}

header {
    text-align: center;
    margin-block-end: 3rem;
    padding-block-end: 2rem;
    border-block-end: 1px solid var(--border);
    position: relative;
}

.theme-toggle {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 40px;
    block-size: 40px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--accent);
}

.theme-toggle svg {
    inline-size: 20px;
    block-size: 20px;
    stroke: var(--foreground);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle .sun-icon {
    display: none;
}

:root.dark .theme-toggle .sun-icon,
html.dark .theme-toggle .sun-icon {
    display: block;
}

:root.dark .theme-toggle .moon-icon,
html.dark .theme-toggle .moon-icon {
    display: none;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-block-end: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--muted-foreground);
    max-inline-size: 600px;
    margin-inline: auto;
}

.demo-section {
    margin-block-end: 3rem;
}

.controls {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-block-end: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-block-end: 0.5rem;
    color: var(--foreground);
}

.input-hint {
    display: block;
    margin-block-start: 0.375rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.control-group input {
    inline-size: 100%;
    padding-block: 0.625rem;
    padding-inline: 0.875rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.control-group input:focus {
    outline: none;
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.demo-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding-block: 4rem;
    padding-inline: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-block-size: 300px;
    transition: background 0.3s, border-color 0.3s;
}

.code-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.tabs {
    display: flex;
    border-block-end: 1px solid var(--border);
    background: var(--muted);
}

.tab {
    padding-block: 0.75rem;
    padding-inline: 1.5rem;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border-block-end: 2px solid transparent;
}

.tab:hover {
    color: var(--foreground);
    background: var(--accent);
}

.tab.active {
    color: var(--foreground);
    background: var(--card);
    border-block-end-color: var(--foreground);
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

pre {
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    padding: 1.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.7;
    transition: background 0.3s;
}

code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    color: var(--foreground);
}

/* Syntax highlighting */
.token-comment {
    color: #6a737d;
    font-style: italic;
}

.token-tag {
    color: #22863a;
}

.token-attr-name {
    color: #6f42c1;
}

.token-attr-value {
    color: #032f62;
}

.token-string {
    color: #032f62;
}

.token-keyword {
    color: #d73a49;
}

.token-function {
    color: #6f42c1;
}

.token-operator {
    color: #d73a49;
}

.token-punctuation {
    color: #24292e;
}

.token-number {
    color: #005cc5;
}

:root.dark .token-comment,
html.dark .token-comment {
    color: #8b949e;
}

:root.dark .token-tag,
html.dark .token-tag {
    color: #7ee787;
}

:root.dark .token-attr-name,
html.dark .token-attr-name {
    color: #d2a8ff;
}

:root.dark .token-attr-value,
html.dark .token-attr-value {
    color: #a5d6ff;
}

:root.dark .token-string,
html.dark .token-string {
    color: #a5d6ff;
}

:root.dark .token-keyword,
html.dark .token-keyword {
    color: #ff7b72;
}

:root.dark .token-function,
html.dark .token-function {
    color: #d2a8ff;
}

:root.dark .token-operator,
html.dark .token-operator {
    color: #ff7b72;
}

:root.dark .token-punctuation,
html.dark .token-punctuation {
    color: #c9d1d9;
}

:root.dark .token-number,
html.dark .token-number {
    color: #79c0ff;
}

.attributes-table {
    inline-size: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.attributes-table thead {
    background: var(--muted);
    font-weight: 600;
}

.attributes-table th {
    text-align: start;
    padding-block: 0.75rem;
    padding-inline: 1rem;
    border-block-end: 1px solid var(--border);
}

.attributes-table td {
    padding-block: 0.75rem;
    padding-inline: 1rem;
    border-block-end: 1px solid var(--border);
}

.attributes-table tbody tr:hover {
    background: var(--accent);
}

.attributes-table tbody tr:last-child td {
    border-block-end: none;
}

.attributes-table code {
    background: var(--muted);
    padding-block: 0.125rem;
    padding-inline: 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #f43f5e;
}

:root.dark .attributes-table code,
html.dark .attributes-table code {
    color: #fb7185;
}

.attributes-table td:nth-child(2) {
    color: var(--muted-foreground);
}

.attributes-table td:nth-child(3) {
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--muted-foreground);
}

footer {
    margin-block-start: 4rem;
    padding-block-start: 2rem;
    border-block-start: 1px solid var(--border);
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

footer a {
    color: var(--foreground);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.7;
}

@media (max-width: 768px) {
    .container {
        padding-block: 2rem;
        padding-inline: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

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

    .demo-container {
        padding-block: 3rem;
        padding-inline: 1rem;
        min-block-size: 200px;
    }

    .attributes-table {
        display: block;
        overflow-x: auto;
    }

    .attributes-table thead {
        display: none;
    }

    .attributes-table tbody,
    .attributes-table tr,
    .attributes-table td {
        display: block;
    }

    .attributes-table tr {
        margin-block-end: 1rem;
        padding-block-end: 1rem;
        border-block-end: 2px solid var(--border);
    }

    .attributes-table tr:last-child {
        border-block-end: none;
    }

    .attributes-table td {
        padding-block: 0.25rem;
        padding-inline: 0;
        border-block-end: none;
    }

    .attributes-table td:nth-child(1)::before {
        content: "Attribute: ";
        font-weight: 600;
    }

    .attributes-table td:nth-child(2)::before {
        content: "Type: ";
        font-weight: 600;
    }

    .attributes-table td:nth-child(3)::before {
        content: "Default: ";
        font-weight: 600;
    }

    .attributes-table td:nth-child(4)::before {
        content: "Description: ";
        font-weight: 600;
    }

    .tab {
        padding-block: 0.625rem;
        padding-inline: 1rem;
        font-size: 0.8125rem;
    }
}