:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-code: #f4f4f5;
    --bg-nav: #1a1a2e;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-nav: #e2e8f0;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --accent-light: rgba(108, 99, 255, 0.1);
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --code-bg: #1e1e2e;
    --code-text: #cdd6f4;
    --keyword: #cba6f7;
    --string: #a6e3a1;
    --comment: #6c7086;
    --function: #89b4fa;
    --number: #fab387;
    --type: #f9e2af;
    --operator: #89dceb;
    --sidebar-width: 280px;
    --header-height: 64px;
}

[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-code: #1e1e2e;
    --bg-nav: #0a0a15;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-nav: #e2e8f0;
    --accent: #7c73ff;
    --accent-hover: #9a93ff;
    --accent-light: rgba(124, 115, 255, 0.15);
    --border: #2d2d44;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP",
        sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition:
        background 0.3s,
        color 0.3s;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* Header 　*/
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-nav);
    color: var(--text-nav);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
}

.header-logo img {
    height: 32px;
    width: auto;
}

.header-logo .logo-text {
    background: linear-gradient(135deg, #6c63ff, #89b4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav a {
    color: var(--text-nav);
    font-size: 0.95rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.header-nav a:hover {
    opacity: 1;
    color: white;
}

.theme-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 24px 0;
    z-index: 900;
    transition: transform 0.3s;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-title {
    padding: 8px 24px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.sidebar-link {
    display: block;
    padding: 6px 24px 6px 32px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.sidebar-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-light);
    font-weight: 500;
}

/* Main content */
.main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 48px 64px;
    max-width: 900px;
    min-height: calc(100vh - var(--header-height));
}

.main-full {
    margin-left: 0;
    margin-top: var(--header-height);
    max-width: 100%;
    padding: 0;
}

/* Hero */
.hero {
    text-align: center;
    padding: 80px 24px 60px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), #89b4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 64px 48px;
}

.feature-card {
    padding: 32px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Quick start section */
.quickstart {
    padding: 64px 48px;
    max-width: 900px;
    margin: 0 auto;
}

.quickstart h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    text-align: center;
}

/* Code blocks */
pre {
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: 12px;
    padding: 24px;
    overflow-x: auto;
    font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 16px 0;
    border: 1px solid var(--border);
}

code {
    font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", monospace;
}

:not(pre) > code {
    background: var(--bg-code);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #16161e;
    padding: 8px 16px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    margin-top: 16px;
}

.code-header + pre {
    margin-top: 0;
    border-radius: 0 0 12px 12px;
}

.code-lang {
    font-size: 0.8rem;
    color: var(--comment);
    font-family: monospace;
}

.copy-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--comment);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Syntax highlighting */
.kw {
    color: var(--keyword);
}
.str {
    color: var(--string);
}
.cm {
    color: var(--comment);
    font-style: italic;
}
.fn {
    color: var(--function);
}
.num {
    color: var(--number);
}
.tp {
    color: var(--type);
}
.op {
    color: var(--operator);
}

/* Content typography */
.content h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.content h2 {
    font-size: 1.7rem;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.content ul,
.content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.content blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--accent-light);
    border-radius: 0 8px 8px 0;
}

.content blockquote p {
    margin: 0;
    color: var(--text-primary);
}

/* Tables */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.95rem;
}

.content th,
.content td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    text-align: left;
}

.content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.content tr:nth-child(even) {
    background: var(--bg-secondary);
}

/* Navigation links */
.nav-links {
    display: flex;
    justify-content: space-between;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.nav-link .title {
    font-weight: 600;
}

/* Playground */
.playground {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 24px 0;
}

.playground-header {
    padding: 12px 20px;
    background: var(--bg-nav);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playground-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.playground-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 300px;
}

.playground-input {
    border-right: 1px solid var(--border);
}

.playground-input textarea {
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: var(--code-bg);
    color: var(--code-text);
    border: none;
    padding: 20px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
}

.playground-output {
    padding: 20px;
    background: var(--bg-primary);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.playground-run {
    padding: 6px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.playground-run:hover {
    background: var(--accent-hover);
}

/* Search */
.search-box {
    position: relative;
}

.search-box input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 16px 8px 36px;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 220px;
    outline: none;
    transition: all 0.2s;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-box input:focus {
    border-color: var(--accent);
    width: 300px;
    background: rgba(255, 255, 255, 0.15);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    padding: 48px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer a {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 32px 20px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero .subtitle {
        font-size: 1.1rem;
    }

    .features {
        padding: 40px 20px;
    }

    .playground-body {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: block;
    }

    .search-box input {
        width: 160px;
    }

    .search-box input:focus {
        width: 200px;
    }

    .header-nav {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .quickstart {
        padding: 40px 16px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 899;
}

.sidebar-overlay.active {
    display: block;
}
