body {
    margin: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
    background: #0f0f19;
    color: #e9e9ef;
    line-height: 1.6;
}

details,
section {
    scroll-margin-top: 80px;
}

.documentation {
    max-width: 90%;
    margin: 2rem auto;
    padding: clamp(1rem, 2vw, 2rem);
    background: #171724;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.doc-header {
    background: linear-gradient(135deg, #ff79c6, #bd93f9);
    padding: 2rem 1rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.doc-header h1 {
    color: #fff;
    font-size: clamp(2rem, 3vw, 2.8rem);
    margin: 0;
}

.doc-header .subtitle {
    color: #f1fa8c;
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-top: 0.5rem;
}

.docs-controls {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #171724;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #2e2e40;
}

.search-container input#searchInput,
.category-dropdown select#categorySelect {
    flex: 1;
    min-width: 200px;
    padding: 0.9rem;
    border: 1px solid #2e2e40;
    background: #1f1f2f;
    color: #e9e9ef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-container input#searchInput:focus,
.category-dropdown select#categorySelect:focus {
    border-color: #50fa7b;
    background: #24243b;
    outline: none;
}

.collapsible details {
    background: #222236;
    border: 1px solid #2e2e40;
    border-radius: 8px;
    margin: 0.65rem 0;
    padding: 0.6rem 0.8rem;
    transition: background 0.3s ease;
}

.collapsible details[open] {
    background: #24243b;
}

.collapsible details summary {
    display: block;
    cursor: pointer;
    font-weight: 600;
    color: #50fa7b;
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    line-height: 1.4;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.collapsible details summary:hover,
.collapsible details summary:focus {
    background: #30304a;
    color: #7bffb0;
    outline: none;
}

.collapsible details summary::-webkit-details-marker {
    display: none;
}

pre {
    background: #141423;
    border: 1px solid #2e2e40;
    border-radius: 8px;
    padding: clamp(0.75rem, 1.5vw, 1rem);
    overflow-x: auto;
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
}

code {
    font-family: "Fira Code", monospace;
    color: #8be9fd;
}

.rainbow .comment {
    color: #6272a4;
    font-style: italic;
}

.rainbow .string {
    color: #f1fa8c;
}

.rainbow .number {
    color: #bd93f9;
}

.rainbow .boolean {
    color: #ffb86c;
    font-weight: 600;
}

.rainbow .keyword {
    color: #ff79c6;
    font-weight: 600;
}

.rainbow .operator {
    color: #ff5555;
}

.rainbow .builtin {
    color: #8be9fd;
}

.rainbow .function {
    color: #50fa7b;
}

.rainbow .type {
    color: #ffa07a;
    font-style: italic;
    font-weight: 600;
}

details.build-only summary::after {
    content: " • Build-only";
    font-size: 0.85em;
    color: #ffb86c;
    margin-left: 0.5rem;
}

details.progression summary::after {
    content: " • Progression";
    font-size: 0.85em;
    color: #50fa7b;
    margin-left: 0.5rem;
}

details.build-only {
    border-left: 4px solid #ffb86c;
}

details.progression {
    border-left: 4px solid #50fa7b;
}

/* Documentation tables */
.documentation table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.documentation table thead {
    background: #222236;
}

.documentation table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: #50fa7b;
    font-weight: 600;
    border-bottom: 1px solid #2e2e40;
}

.documentation table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2e2e40;
    color: #e9e9ef;
    vertical-align: top;
}

.documentation table tr:nth-child(even) {
    background: #1f1f2f;
}

.documentation table tr:nth-child(odd) {
    background: #171724;
}

.documentation table tr:hover {
    background: #24243b;
    transition: background 0.2s ease;
}

.documentation table .dodont td:first-child {
    color: #50fa7b;
    font-weight: 500;
}

.documentation table .dodont td:last-child {
    color: #ff5555;
    font-weight: 500;
}

#scrollTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1100;
    background: #50fa7b;
    color: #171724;
    border: none;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: none;
    transition: background 0.3s ease, transform 0.2s ease;
    animation: pulseGlow 2.5s infinite;
}

#scrollTopBtn:hover {
    background: #7bffb0;
    transform: translateY(-3px);
}

#scrollTopBtn:active {
    transform: translateY(0);
}

.doc-footer {
    background: #141423;
    padding: 1.5rem;
    text-align: center;
    margin-top: 3rem;
    border-top: 1px solid #2e2e40;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
}

.doc-footer p {
    margin: 0.5rem 0;
    color: #9a9ab0;
    font-size: 0.9rem;
}

.doc-footer a {
    color: #50fa7b;
    text-decoration: none;
    margin: 0 0.5rem;
}

.copy-link {
    display: block;
    margin-left: 0.5em;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: #555;
}

.copy-link:hover {
    color: #000;
}

.copy-link:focus {
    outline: none;
}

.doc-footer a:hover {
    text-decoration: underline;
}

.glow-pulse {
    animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 5px rgba(255, 121, 198, 0.6),
            0 0 10px rgba(255, 121, 198, 0.4);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 121, 198, 0.8),
            0 0 20px rgba(255, 121, 198, 0.6);
    }

    100% {
        box-shadow: 0 0 5px rgba(255, 121, 198, 0.6),
            0 0 10px rgba(255, 121, 198, 0.4);
    }
}

@media (min-width: 1200px) {
    .documentation {
        max-width: 70%;
    }

    .docs-controls {
        justify-content: space-between;
    }
}

@media (max-width: 600px) {

    .documentation table,
    .documentation table thead,
    .documentation table tbody,
    .documentation table th,
    .documentation table td,
    .documentation table tr {
        display: block;
        width: 100%;
    }

    .documentation table thead {
        display: none;
    }

    .documentation table tr {
        margin-bottom: 1rem;
        border: 1px solid #2e2e40;
        border-radius: 8px;
        overflow: hidden;
        background: #1f1f2f;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }

    .documentation table td {
        border: none;
        padding: 0.75rem 1rem;
        position: relative;
    }

    .documentation table .dodont td:first-child {
        border-left: 4px solid #50fa7b;
    }

    .documentation table .dodont td:last-child {
        border-left: 4px solid #ff5555;
    }

    .documentation table .dodont td:first-child::before {
        content: "Do";
        font-weight: 600;
        color: #50fa7b;
        display: block;
        margin-bottom: 0.25rem;
    }

    .documentation table .dodont td:last-child::before {
        content: "Don’t";
        font-weight: 600;
        color: #ff5555;
        display: block;
        margin-bottom: 0.25rem;
    }

    .docs-controls {
        flex-direction: column;
    }

    .category-dropdown {
        width: 100%;
    }

    .category-dropdown select#categorySelect {
        flex: 1;
    }

    .collapsible details {
        padding: 0.8rem;
    }

    .collapsible details summary {
        font-size: 0.95rem;
    }

    pre {
        font-size: 0.85rem;
    }
}