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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-sidebar: #0f0f23;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --border: #27272a;
    --btn-bg: #27272a;
    --btn-hover: #3f3f46;
}

body.light {
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f5;
    --bg-sidebar: #fafafa;
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --border: #e4e4e7;
    --btn-bg: #f4f4f5;
    --btn-hover: #e4e4e7;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.container {
    display: flex;
    height: 100%;
    width: 100%;
}

.editor-area,
.content-area {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    background-color: var(--bg-primary);
}

.content-area {
    padding-top: 1rem;
}

.editor-area form {
    height: 100%;
}

textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
}

textarea::placeholder {
    color: var(--text-muted);
}

.sidebar {
    width: 290px;
    background-color: var(--bg-sidebar);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.logo {
    text-decoration: none;
    margin-bottom: 2rem;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316, #fb923c, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-img {
    max-width: 100%;
    height: auto;
    max-height: 50px;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--btn-bg);
    border: none;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

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

.btn svg {
    flex-shrink: 0;
}

.btn.inline {
    display: inline-flex;
}

.markdown-promo {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.markdown-promo h3 {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.markdown-promo p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.markdown-promo p:last-child {
    margin-bottom: 0;
}

.markdown-promo a {
    color: var(--accent);
    text-decoration: none;
}

.markdown-promo a:hover {
    text-decoration: underline;
}

.notice {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    margin-top: auto;
    margin-bottom: 1rem;
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1.5rem;
}

.copyright a {
    color: var(--accent);
    text-decoration: none;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--btn-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    margin: 0 auto;
    transition: background-color 0.2s;
}

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

.theme-toggle svg {
    color: var(--text-secondary);
}

body.dark .sun-icon {
    display: none;
}

body.dark .moon-icon {
    display: block;
}

body.light .sun-icon,
body:not(.dark) .sun-icon {
    display: block;
}

body.light .moon-icon,
body:not(.dark) .moon-icon {
    display: none;
}

.centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-page {
    text-align: center;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-message {
    background-color: #7f1d1d;
    border: 1px solid #dc2626;
    color: #fecaca;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

body.light .error-message {
    background-color: #fef2f2;
    border-color: #f87171;
    color: #991b1b;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column-reverse;
    }

    .sidebar {
        width: 100%;
        padding: 1rem;
        border-left: none;
        border-top: 1px solid var(--border);
        justify-content: center;
    }

    .actions {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
        margin-bottom: 0;
    }

    .btn {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }

    .notice {
        display: none;
    }

    .markdown-promo {
        display: none;
    }

    .theme-toggle {
        position: static;
        margin-top: 0.5rem;
    }

    .copyright {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--bg-sidebar);
        padding: 0.75rem;
        margin: 0;
        border-top: 1px solid var(--border);
    }

    .editor-area {
        padding-bottom: 3rem;
    }

}
