:root {
    --bg: #fff;
    --black: #000;
    --border: #e0e0e0;
    --prompt: #666;
    --gray-500: #6b7280;
    --gray-700: #374151;
}
body.dark-mode {
    --bg: #000;
    --black: #00ff00;
    --border: rgba(0, 255, 0, 0.35);
    --prompt: #00ff00;
    --gray-500: rgba(0, 255, 0, 0.65);
    --gray-700: rgba(0, 255, 0, 0.9);
}

* { box-sizing: border-box; }

body {
    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.625;
    color: var(--gray-700);
    background: var(--bg);
    margin: 0 auto;
    max-width: 800px;
    padding: 60px 40px 96px;
    position: relative;
    transition: background 0.3s, color 0.3s;
}

header { margin-bottom: 48px; }

.logo {
    display: inline-block;
    color: var(--black);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: lowercase;
    text-decoration: none;
}
.logo:before {
    content: '✺';
    display: block;
    font-size: 64px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    margin: 0 0 24px;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

.top-nav {
    position: absolute;
    top: 32px;
    right: 48px;
    display: flex;
    gap: 32px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    z-index: 10;
}
.top-nav a { color: var(--black); text-decoration: none; }
.top-nav a:hover { text-decoration: underline; }

.file, .prompt-line {
    display: block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: var(--prompt);
    margin: 0;
}
.file { margin-bottom: 28px; }

h1 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--black);
    margin: 0 0 24px;
}

.meta { margin-bottom: 0; }
.meta .author {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin: 0 0 24px;
}
.meta .date {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0 0 24px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    border: 1px solid var(--border);
    padding: 2px 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: var(--black);
}

.repost-note {
    margin-top: 18px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: var(--prompt);
}
.repost-note a {
    color: var(--black);
    text-decoration: none;
    border-bottom: 1px solid var(--black);
}

.content {
    border-top: 1px solid var(--border);
    padding-top: 32px;
    margin-top: 32px;
    color: var(--gray-700);
}
.content > :first-child { margin-top: 0; }
.content h2, .content h3 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.8;
    font-weight: 700;
    color: var(--black);
    margin: 32px 0 8px;
    position: relative;
}
.content h2:before, .content h3:before { content: '## '; }
.content .heading-anchor {
    position: absolute;
    left: -24px;
    top: 0;
    width: 24px;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 0;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.content h2:hover > .heading-anchor,
.content h3:hover > .heading-anchor,
.content .heading-anchor:focus { opacity: 1; }
.content .heading-anchor:hover { color: var(--black); }
.content p, .content li {
    font-size: 16px;
    line-height: 1.625;
    color: var(--gray-700);
    margin: 0 0 16px;
}
.content ol, .content ul { margin: 0 0 16px; padding-left: 24px; }
.content a {
    color: var(--black);
    text-decoration: none;
    border-bottom: 1px solid var(--black);
}
.content blockquote {
    margin: 16px 0;
    padding: 0;
    border: 0;
    color: var(--black);
}
.content blockquote p { color: var(--black); }
.content blockquote p:before { content: '> '; color: var(--prompt); }
.content pre, .content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.65;
}
.content pre {
    display: block;
    margin: 16px 0;
    padding: 16px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--black);
    overflow-x: auto;
}
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}
.content th, .content td {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--border);
    vertical-align: top;
}
.content th {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: var(--black);
}
.content td { color: var(--gray-700); }
.content td p, .content th p { margin: 0; }
.content hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.content figure, .content img, .content svg { max-width: 100%; height: auto; }
.content img { display: block; margin: 24px auto; }

.content-end {
    border-top: 1px solid var(--border);
    margin-top: 32px;
    padding-top: 32px;
    color: var(--prompt);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 600;
}

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    font-family: 'Courier New', Courier, monospace;
}
.post-nav a {
    color: var(--gray-700);
    text-decoration: none;
    flex: 1;
    max-width: 50%;
    transition: color 0.15s;
}
.post-nav a:hover { color: var(--black); }
.post-nav .next { text-align: right; margin-left: auto; }
.post-nav .dir {
    font-size: 13px;
    color: var(--prompt);
    margin-bottom: 4px;
}
.post-nav .title {
    font-size: 14px;
    line-height: 1.4;
}

html { scroll-behavior: smooth; }
.toc { display: none; }
@media (min-width: 1240px) {
    .content { position: relative; }
    .toc {
        display: block;
        position: absolute;
        top: 0;
        left: 100%;
        margin-left: 60px;
        width: 200px;
        height: 100%;
    }
    .toc-inner {
        position: sticky;
        top: 72px;
        padding: 16px;
        border: 1px solid var(--border);
        background: var(--bg);
        font-family: 'Courier New', Courier, monospace;
        font-size: 13px;
        line-height: 1.5;
        max-height: calc(100vh - 144px);
        overflow-y: auto;
    }
    .toc-title { color: var(--prompt); margin: 0 0 12px; font-weight: 700; }
    .toc ul { list-style: none; padding: 0; margin: 0; }
    .toc li {
        margin: 0 0 4px;
        font-size: 13px;
        line-height: 1.5;
        color: inherit;
    }
    .toc a {
        display: block;
        padding: 4px 16px;
        margin: 0 -16px;
        color: var(--gray-500);
        text-decoration: none;
        border-bottom: 0;
        transition: color 0.15s, background 0.15s;
    }
    .toc .toc-sub a { padding-left: 32px; }
    .toc a:hover { color: var(--black); }
    .toc a.active { color: var(--bg); background: var(--black); }
}

.mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--black);
    color: var(--bg);
    border: none;
    padding: 8px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 50;
}
.mode-toggle:hover { opacity: 0.8; }

@media (max-width: 600px) {
    body { padding: 40px 20px 72px; }
    .top-nav { top: 20px; right: 20px; gap: 20px; }
    .logo:before { font-size: 56px; }
    .content table { font-size: 13px; }
    .content th, .content td { padding: 8px; }
    .content .heading-anchor { display: none; }
    .post-nav { flex-direction: column; gap: 16px; }
    .post-nav a { max-width: none; }
    .post-nav .next { text-align: left; }
    .mode-toggle {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 22px;
        font-size: 0;
    }
    .mode-toggle::before {
        content: '◐';
        font-size: 20px;
        line-height: 44px;
        display: block;
        text-align: center;
    }
}
