@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

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

:root {
    --bg: #0a0a0a;
    --terminal-bg: #1a1a2e;
    --header-bg: #16213e;
    --green: #00ff41;
    --dim-green: #00aa2a;
    --cyan: #00d4ff;
    --red: #ff3333;
    --yellow: #ffcc00;
    --purple: #b388ff;
    --white: #e0e0e0;
    --dim: #666;
    --prompt-user: #5ef78e;
    --prompt-sep: #e0e0e0;
    --prompt-path: #5eaeff;
    --prompt-dollar: #e0e0e0;
}

body {
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    overflow: hidden;
}

/* CRT Scanline overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
}

.scanlines::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
}

/* CRT flicker */
.crt {
    width: 90%;
    max-width: 900px;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.98; }
    15% { opacity: 0.96; }
    20% { opacity: 0.99; }
    100% { opacity: 0.98; }
}

/* Terminal window */
.terminal {
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 0 30px rgba(0, 255, 65, 0.1),
        0 0 60px rgba(0, 0, 0, 0.5),
        inset 0 0 80px rgba(0, 255, 65, 0.02);
    border: 1px solid #333;
}

/* Header bar (macOS style) */
.terminal-header {
    background: var(--header-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #333;
    user-select: none;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
    margin-right: 16px;
}

.terminal-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.btn-close { background: #ff5f57; }
.btn-minimize { background: #ffbd2e; }
.btn-maximize { background: #28c940; }

.btn-close:hover { background: #ff3b30; }
.btn-minimize:hover { background: #f5a623; }
.btn-maximize:hover { background: #1db954; }

.terminal-title {
    color: #888;
    font-size: 13px;
    flex: 1;
    text-align: center;
    margin-right: 60px;
}

/* Terminal body */
.terminal-body {
    background: var(--terminal-bg);
    padding: 16px;
    height: 75vh;
    max-height: 600px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
    background: var(--terminal-bg);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Lines */
.line {
    font-size: 13px;
    line-height: 1.6;
    color: var(--white);
    white-space: pre;
    min-height: 1.6em;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Text classes */
.error { color: var(--red); }
.error-bold { color: var(--red); font-weight: 700; }
.warning { color: var(--yellow); }
.info { color: var(--cyan); }
.dim { color: var(--dim); }
.link { color: var(--purple); }
.ascii-art { color: var(--green); font-weight: 700; }
.neofetch { color: var(--green); }

/* Prompt styling */
.prompt-user { color: var(--prompt-user); font-weight: 700; }
.prompt-sep { color: var(--prompt-sep); }
.prompt-path { color: var(--prompt-path); font-weight: 700; }
.prompt-dollar { color: var(--prompt-dollar); }

/* Input line */
.input-line {
    display: flex;
    align-items: center;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 2px;
}

.input-line .prompt {
    color: var(--white);
    white-space: nowrap;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.input-line .prompt .prompt-sep { color: var(--prompt-sep); }
.input-line .prompt .prompt-path { color: var(--prompt-path); font-weight: 700; }
.input-line .prompt .prompt-dollar { color: var(--prompt-dollar); }

#cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--white);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    caret-color: var(--green);
    caret-shape: block;
    line-height: 1.6;
}

/* Blinking cursor via caret */
@supports (caret-shape: block) {
    #cmd-input {
        caret-shape: block;
    }
}

/* Selection */
::selection {
    background: rgba(0, 255, 65, 0.2);
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .crt {
        width: 98%;
    }

    .terminal-body {
        height: 80vh;
        padding: 12px;
    }

    .line, #cmd-input, .input-line {
        font-size: 11px;
    }

    .terminal-title {
        font-size: 11px;
    }
}

/* CRT turn on animation */
@keyframes turnOn {
    0% {
        transform: scaleY(0.01) scaleX(0.01);
        filter: brightness(30);
    }
    20% {
        transform: scaleY(0.01) scaleX(1);
        filter: brightness(10);
    }
    40% {
        transform: scaleY(1) scaleX(1);
        filter: brightness(2);
    }
    100% {
        transform: scaleY(1) scaleX(1);
        filter: brightness(1);
    }
}

.terminal {
    animation: turnOn 0.6s ease-out;
}

/* Subtle glow on text */
.ascii-art {
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.error-bold {
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
}
