/* CSS Variables for Themes */
:root {
    --bg: #050510;
    --fg: #e0e0ff;
    --accent1: #ff45c7;
    --accent2: #00eaff;
    --muted: #7777aa;
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --fg: #e0e0e0;
    --accent1: #888888;
    --accent2: #666666;
    --muted: #555555;
}

[data-theme="light"] {
    --bg: #f5f5f5;
    --fg: #1a1a1a;
    --accent1: #0066cc;
    --accent2: #00aa88;
    --muted: #666666;
}

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

body {
    font-family: VT323, "Press Start 2P", ui-monospace, "Courier New", monospace;
    font-size: 20px;
    line-height: 1.4;
    background: var(--bg);
    color: var(--fg);
    overflow: hidden;
}

#terminal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: VT323, "Press Start 2P", ui-monospace, monospace;
    line-height: 1.4;
    overflow: auto;
    outline: none;
    padding: 16px 16px calc(16px + var(--kb-safe, 0px)) 16px;
}

#output {
    white-space: pre-wrap;
    word-break: break-word;
}

#input-line {
    display: flex;
    align-items: baseline;
    gap: 0;
    white-space: pre;
}

#prompt, #input-text, #cursor {
    display: inline;
    vertical-align: baseline;
}

#input-text {
    min-width: 1px;
}

.cursor {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    background: var(--fg);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

#mobile-input {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    opacity: 0;
    font-size: 16px;
}

.error {
    color: var(--accent1);
}

.muted {
    color: var(--muted);
}

.accent {
    color: var(--accent2);
}

/* Visual Effects */
[data-fx="on"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 1000;
}

[data-fx="on"]::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: flicker 3s infinite;
    z-index: 999;
}

@keyframes flicker {
    0%, 100% { opacity: 0.97; }
    50% { opacity: 1; }
    25%, 75% { opacity: 0.95; }
}

[data-fx="on"] {
    animation: glitch 8s infinite;
}

@keyframes glitch {
    0%, 90%, 100% {
        text-shadow: 0 0 transparent;
    }
    92% {
        text-shadow: 1px 0 var(--accent1), -1px 0 var(--accent2);
        transform: translateX(2px);
    }
    94% {
        text-shadow: -1px 0 var(--accent1), 1px 0 var(--accent2);
        transform: translateX(-2px);
    }
    96% {
        text-shadow: 0 0 transparent;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    #terminal {
        padding: 10px 10px calc(10px + var(--kb-safe, 0px)) 10px;
    }
}

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