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

body {
    background-color: #000;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
    height: 100vh;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
}

::selection {
    background: #42d392;
    color: #000;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor {
    padding: 20px;
    padding-bottom: 150px;
    font-size: 14px;
    color: #fff;
    width: max-content;
    min-width: 100%;
}

.line {
    display: flex;
    line-height: 1.5;
    white-space: nowrap;
    align-items: flex-start;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.line-number {
    color: #555;
    margin-right: 20px;
    user-select: none;
    min-width: 20px;
    text-align: right;
}

.line-comment {
    color: #555;
    font-style: italic;
}

.line-meta {
    color: #555;
}

.line-content a.reading-link {
    color: #999;
    text-decoration: underline;
}

.line-content a.reading-link:hover {
    color: #42d392;
}

.reading-note {
    color: #444;
    font-style: italic;
}

.line-content a {
    color: #fff;
    text-decoration: underline;
}

.line-content a:hover {
    color: #42d392;
}

/* Comment-styled navigation links */
a.comment-link {
    color: #555;
    font-style: italic;
    text-decoration: none;
    transition: color 0.2s ease;
}

a.comment-link:hover {
    color: #42d392;
}

/* Terminal */
.terminal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #000;
    border-top: 1px solid #1a1a1a;
    font-size: 14px;
    line-height: 1.5;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
}

.terminal-history {
    overflow-y: auto;
    padding: 8px 20px 0;
    flex: 1 1 auto;
    scrollbar-width: none;
}

.terminal-history::-webkit-scrollbar {
    display: none;
}

.terminal-history-entry {
    margin-bottom: 4px;
}

.terminal-history-cmd {
    display: flex;
    align-items: flex-start;
}

.terminal-history-cmd .cmd-text {
    color: #fff;
}

.terminal-output {
    color: #999;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 2px 0;
}

.terminal-output a {
    color: #6cb6ff;
    text-decoration: underline;
}

.terminal-output a:hover {
    color: #42d392;
}

.terminal-output.error {
    color: #ff6b6b;
}

.terminal-output.success {
    color: #42d392;
}

.terminal-output.system {
    color: #555;
    font-style: italic;
}

.terminal-input-line {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding: 4px 20px 12px;
    flex-shrink: 0;
}

.terminal-prompt {
    user-select: none;
    flex-shrink: 0;
    margin-right: 8px;
}

.terminal-prompt .arrow {
    color: #42d392;
}

.terminal-prompt .tilde {
    color: #6cb6ff;
}

.terminal-display {
    position: relative;
    white-space: pre;
    min-height: 1.5em;
    flex: 1;
}

.terminal-display .block-cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.15em;
    background-color: #fff;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

.terminal-hidden-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@media (max-width: 768px) {
    .editor {
        font-size: 12px;
        padding: 10px;
        padding-right: 10px;
    }

    .line {
        white-space: normal;
    }

    .line-number {
        margin-right: 10px;
        min-width: 15px;
    }

    .terminal {
        font-size: 12px;
    }

    .terminal-history {
        padding: 6px 10px 0;
    }

    .terminal-input-line {
        padding: 4px 10px 8px;
    }

    .terminal-hint {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}
