@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-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #e0e0e0;
    --text-muted: #888;
    --accent: #E07A3A;
    --error: #ef4444;
    --font-mono: 'JetBrains Mono', monospace;
    --font-size: 14px;
    --line-height: 1.6;
}

html, body {
    height: 100%;
    background: var(--bg-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text-primary);
}

.terminal-wrapper {
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.terminal {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
    white-space: pre-wrap;
}

.input-line {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.prompt-user, .prompt-host { color: var(--accent); }
.prompt-path { color: #7dd3fc; }
.prompt-at, .prompt-colon, .prompt-dollar { color: var(--text-muted); }

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size);
    caret-color: var(--accent);
}

.welcome-banner {
    margin-bottom: 1rem;
}

.banner-ascii {
    color: var(--accent);
    font-size: 10px;
    line-height: 1.2;
    height: 8em;
    overflow: hidden;
}

.banner-message {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.banner-scene {
    color: var(--accent);
    font-size: 12px;
    line-height: 1.1;
    height: 13em;
    overflow: hidden;
}

.output-command { color: var(--text-primary); }
.output-line { color: var(--text-primary); }
.line-normal { color: var(--text-primary); }
.line-accent { color: var(--accent); }
.line-error { color: var(--error); }
.line-muted { color: var(--text-muted); }

/* === Theme: Claude (default) === */
.theme-claude {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #e0e0e0;
    --text-muted: #888;
    --accent: #E07A3A;
}

/* === Theme: Classic Green === */
.theme-green {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111;
    --text-primary: #00ff41;
    --text-muted: #00aa2a;
    --accent: #00ff41;
}

/* === Theme: Amber Retro === */
.theme-amber {
    --bg-primary: #0a0800;
    --bg-secondary: #151000;
    --text-primary: #ffb000;
    --text-muted: #aa7500;
    --accent: #ffb000;
}

/* === CRT Scanline Effect === */
.crt {
    position: relative;
}

.crt::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 999;
}

.crt::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 998;
}

.crt .terminal {
    animation: flicker 0.1s infinite alternate;
}

@keyframes flicker {
    0%   { opacity: 0.97; }
    100% { opacity: 1; }
}

/* === Mobile Toolbar === */
.mobile-toolbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--accent);
    padding: 0.5rem;
    gap: 0.5rem;
    justify-content: center;
    z-index: 100;
}

.mobile-toolbar button {
    background: var(--bg-primary);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 14px;
    cursor: pointer;
    min-width: 48px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-toolbar button:active {
    background: var(--accent);
    color: var(--bg-primary);
}

/* === Responsive === */
@media (max-width: 768px) {
    :root {
        --font-size: 12px;
    }

    .terminal {
        padding: 0.5rem;
        /* Make room for mobile toolbar */
        padding-bottom: 3.5rem;
    }

    .banner-ascii {
        font-size: 6px;
    }

    .mobile-toolbar {
        display: flex;
    }

    .input-line {
        font-size: 12px;
    }

    /* Prevent iOS zoom on input focus */
    .terminal-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size: 11px;
    }

    .banner-ascii {
        font-size: 5px;
    }

    .terminal {
        padding: 0.25rem;
        padding-bottom: 3.5rem;
    }
}

/* === Scrollbar Styling === */
.terminal-output::-webkit-scrollbar {
    width: 6px;
}

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

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

.terminal-output {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-primary);
}

.terminal-output * {
    overflow-anchor: none;
}

.scroll-anchor {
    overflow-anchor: auto;
    height: 1px;
}