/* ═══════════════════════════════════════════════════════
   TERMINAL — Core Layout & Typography
   ═══════════════════════════════════════════════════════ */

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

html, body {
    height: 100%;
    overflow: hidden;
    background: #000;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

::selection {
    background: var(--selection-bg);
    color: var(--text-bright);
}

/* ─── Boot Screen ────────────────────────────────────── */

#boot-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: opacity 0.6s ease;
}

#boot-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.boot-content {
    text-align: center;
    animation: bootPulse 2s ease-in-out infinite;
}

.boot-logo {
    font-size: 48px;
    color: var(--text-primary);
    text-shadow: 0 0 20px var(--glow-strong), 0 0 40px var(--glow-color);
    margin-bottom: 24px;
    animation: bootGlow 1.5s ease-in-out infinite alternate;
}

.boot-text {
    color: var(--text-dim);
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.boot-cursor {
    color: var(--text-primary);
    animation: blink 1s step-end infinite;
    margin-left: 4px;
}

@keyframes bootPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes bootGlow {
    from { text-shadow: 0 0 20px var(--glow-color), 0 0 40px transparent; }
    to { text-shadow: 0 0 30px var(--glow-strong), 0 0 60px var(--glow-color); }
}

/* ─── Terminal Container ─────────────────────────────── */

#terminal {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

#terminal.booting #input-line {
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* ─── Output Area ────────────────────────────────────── */

#output {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 12px;
    word-wrap: break-word;
}

/* Custom scrollbar */
#output::-webkit-scrollbar {
    width: 5px;
}

#output::-webkit-scrollbar-track {
    background: transparent;
}

#output::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

#output::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Firefox scrollbar */
#output {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* ─── Output Lines ───────────────────────────────────── */

#output .line {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 1.4em;
    line-height: 1.5;
}

#output .line.command-echo {
    color: var(--text-bright);
    margin-top: 8px;
}

#output .line.error {
    color: var(--error-color);
}

#output .line.system {
    color: var(--text-dim);
    font-size: 13px;
}

#output .line.highlight {
    color: var(--text-bright);
    text-shadow: 0 0 8px var(--glow-color);
}

#output .line.ascii-art {
    color: var(--text-bright);
    text-shadow: 0 0 10px var(--glow-color);
    line-height: 1.15;
    white-space: pre;
    font-size: 13px;
    overflow-x: auto;
}

#output .line.matrix-line {
    color: var(--text-primary);
    opacity: 0.7;
    line-height: 1.1;
    white-space: pre;
}

/* ─── Links ──────────────────────────────────────────── */

#output a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s, text-shadow 0.2s;
}

#output a:hover {
    color: var(--link-hover);
    text-shadow: 0 0 10px var(--glow-color);
}

#output a:focus-visible {
    outline: 1px solid var(--text-primary);
    outline-offset: 2px;
}

/* ─── Input Line ─────────────────────────────────────── */

#input-line {
    display: flex;
    align-items: center;
    padding: 10px 0 4px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt {
    color: var(--prompt-color);
    white-space: nowrap;
    user-select: none;
    text-shadow: 0 0 6px var(--glow-color);
    font-weight: 700;
}

#cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    caret-color: var(--text-primary);
    text-shadow: 0 0 3px var(--glow-color);
}

/* ─── Blinking Cursor ────────────────────────────────── */

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

/* ─── Autocomplete Hint ──────────────────────────────── */

.autocomplete-hint {
    color: var(--text-dim);
    opacity: 0.5;
    font-style: italic;
}

/* ─── Responsive ─────────────────────────────────────── */

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    #terminal {
        padding: 14px;
    }

    .prompt {
        font-size: 12px;
    }

    #output .line.ascii-art {
        font-size: 8px;
        line-height: 1.05;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    #terminal {
        padding: 10px;
    }

    .prompt {
        font-size: 11px;
    }

    #output .line.ascii-art {
        font-size: 5.5px;
        line-height: 1;
    }

    .boot-logo {
        font-size: 32px;
    }

    .boot-text {
        font-size: 11px;
        letter-spacing: 2px;
    }
}
