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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    display: flex;
    min-height: 100vh;
    background: #f5f5f5;
    color: #222;
}

#sidebar {
    width: 260px;
    background: #222;
    color: #ccc;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid #3a3a3a;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.sidebar-logo {
    width: 56px;
    height: 56px;
}

.sidebar-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.12em;
}

.version {
    font-size: 0.8rem;
    color: #777;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid #3a3a3a;
    margin-bottom: 0.75rem;
}

.sidebar-btn {
    flex: 1;
    text-align: center;
    padding: 0.3rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ccc;
    background: #333;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-btn:hover {
    background: #444;
    color: #fff;
}

.sidebar-btn.disabled {
    color: #555;
    cursor: default;
    pointer-events: none;
}

.nav-doc-label {
    padding: 0.6rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: #888;
    margin-bottom: 0.25rem;
}

#nav-links {
    list-style: none;
}

#nav-links .nav-section {
    padding: 0.6rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

#nav-links .nav-section:hover {
    color: #ccc;
}

.section-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.6rem;
    margin-right: 0.2rem;
}

#nav-links .nav-section:not(.collapsed) .section-arrow {
    transform: rotate(90deg);
}

.section-items {
    list-style: none;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}

.section-items.hidden {
    max-height: 0;
}

.section-items li {
    position: relative;
    margin-left: 1.8rem;
    padding-left: 1rem;
    border-left: 1px solid #444;
}

.section-items li:last-child {
    border-left-color: transparent;
}

.section-items li::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    width: 0.75rem;
    height: 0;
    border-top: 1px solid #444;
}

.section-items li:last-child::before {
    border-left: 1px solid #444;
    height: 50%;
    top: 0;
}

#nav-links a {
    display: block;
    padding: 0.12rem 0.5rem;
    color: #aaa;
    text-decoration: none;
    font-size: 0.78rem;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    transition: background 0.15s, color 0.15s;
}

#nav-links a:hover {
    background: #333;
    color: #fff;
}

#nav-links a.active {
    background: #3a3a3a;
    color: #fff;
}

/* Content area — centered within remaining window */
#content {
    margin-left: 260px;
    width: calc(100% - 260px);
    display: flex;
    justify-content: center;
    padding: 2rem 3rem;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
}

#doc-content {
    max-width: 800px;
    width: 100%;
    font-size: 0.88rem;
}

#doc-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #ddd;
}

#doc-content h2 {
    font-size: 1.15rem;
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
    color: #333;
}

#doc-content h3 {
    font-size: 0.98rem;
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

#doc-content p {
    line-height: 1.65;
    margin-bottom: 0.85rem;
}

#doc-content code {
    background: #e8e8e8;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.88em;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
}

#doc-content pre {
    background: #222;
    color: #ddd;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
    line-height: 1.5;
}

#doc-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

#doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.82rem;
}

#doc-content th, #doc-content td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid #ccc;
}

#doc-content th {
    background: #e8e8e8;
    font-weight: 600;
}

#doc-content tr:nth-child(even) {
    background: #f0f0f0;
}

#doc-content ul, #doc-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.85rem;
    line-height: 1.6;
}

#doc-content blockquote {
    border-left: 4px solid #999;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: #ececec;
    color: #444;
}

#doc-content strong {
    font-weight: 600;
}

.error {
    color: #c0392b;
    padding: 1rem;
    background: #fde8e8;
    border-radius: 4px;
}

/* Landing page */
.ascii-banner {
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #333;
    background: none;
    padding: 0;
    margin-bottom: 2rem;
    border: none;
    border-radius: 0;
    white-space: pre;
}

.landing-content {
    max-width: 700px;
    width: 100%;
    padding-top: 3rem;
}

.landing-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: #444;
}

.landing-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.75rem;
    color: #999;
    line-height: 1.6;
}

/* Compiler page */
.compiler-content {
    padding: 1rem;
    align-items: stretch;
}

.compiler-container {
    display: flex;
    gap: 1rem;
    max-width: 1400px;
    width: 100%;
    height: calc(100vh - 2rem);
}

.compiler-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #e8e8e8;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
}

.panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

.run-btn, .clear-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
}

.run-btn:hover:not(:disabled), .clear-btn:hover {
    background: #ddd;
}

.run-btn:disabled {
    color: #aaa;
    border-color: #ddd;
    cursor: default;
}

.code-area {
    flex: 1;
    padding: 1rem;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    border: none;
    outline: none;
    resize: none;
    background: #1a1a1a;
    color: #ddd;
    tab-size: 4;
}

.code-area::placeholder {
    color: #555;
}

.repl-panel {
    background: #111;
}

.repl-output {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #ccc;
}

.repl-line {
    margin-bottom: 0.25rem;
}

.repl-info {
    color: #666;
}

.repl-input-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-top: 1px solid #333;
    background: #1a1a1a;
    flex-shrink: 0;
}

.repl-prompt {
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.8rem;
    color: #666;
    margin-right: 0.5rem;
}

.repl-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
    font-size: 0.8rem;
    color: #ccc;
}

.repl-input::placeholder {
    color: #444;
}

.repl-input:disabled {
    cursor: default;
}

@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    #content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    .compiler-container {
        flex-direction: column;
        height: auto;
    }
    .compiler-panel {
        min-height: 40vh;
    }
}
