html {
    height: 100%;
}

/* ─── Version Themes ─── */

body {
    /* v1.1 defaults (white phosphor — NeXT era) */
    --bg: #0f0e0d;
    --text: #b0ada6;
    --text-bright: #e8e4dc;
    --prompt-color: #c8c4bc;
    --link: #d0ccc4;
    --dim: #5a5750;
    --dim-bright: #6b6860;
    --phantom: #3d3a35;
    --warn: #e8e4dc;
    --error: #e8e4dc;

    font-family: 'Courier New', Courier, monospace;
    background: var(--bg);
    color: var(--text);
    padding: 20px;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body.v1-0 {
    /* Amber phosphor — monochrome CRT */
    --bg: #0d0b08;
    --text: #c49a1a;
    --text-bright: #ffb000;
    --prompt-color: #d4a017;
    --link: #e6a817;
    --dim: #6b4c00;
    --dim-bright: #7a5c00;
    --phantom: #4a3500;
    --warn: #ffb000;
    --error: #ffb000;
}

body.v2-0 {
    /* Modern terminal — cool tones */
    --bg: #0a0e14;
    --text: #abb2bf;
    --text-bright: #d4dce4;
    --prompt-color: #56b6c2;
    --link: #61afef;
    --dim: #4b5263;
    --dim-bright: #5c6370;
    --phantom: #3e4451;
    --warn: #e5c07b;
    --error: #e06c75;
}

@supports (-webkit-touch-callout: none) {
    /* iOS: 16px prevents Safari auto-zoom on input focus */
    #input {
        font-size: 16px;
    }
}

.terminal {
    max-width: 800px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.command {
    color: var(--text-bright);
}

.output {
    color: var(--text);
    margin: 10px 0 20px 0;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--text-bright);
    text-decoration: underline;
}

.disabled {
    color: var(--dim);
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 16px;
    background: var(--prompt-color);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

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

.dir {
    color: var(--link);
}

.file {
    color: var(--text);
}

.input-line {
    display: flex;
    align-items: center;
    margin-top: 20px;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-bright);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    outline: none;
    margin-left: 8px;
    caret-color: var(--prompt-color);
    min-width: 0;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
    padding: 0;
    field-sizing: content;
}

.clickable {
    cursor: pointer;
}

.clickable:hover {
    text-decoration: underline;
}

.hidden-file {
    color: var(--dim-bright);
}

.tab-hint {
    color: var(--dim);
    margin: 4px 0;
}

.motd {
    color: var(--text);
    line-height: 1.5;
}

.ascii-art {
    color: var(--prompt-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.15;
    margin: 0;
    overflow-x: auto;
    text-shadow:
        1px 1px 0 var(--dim-bright),
        2px 2px 0 var(--dim),
        3px 3px 0 var(--dim);
}

.art-sub {
    color: var(--dim-bright);
    text-shadow: none;
}

.system-info {
    color: var(--dim);
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    overflow-x: auto;
}

/* ─── v2.0 Header ─── */

.v2-header {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.2;
    margin: 0;
    overflow-x: auto;
}

.v2-logo {
    color: var(--prompt-color);
    text-shadow: 1px 1px 0 var(--dim), 2px 2px 0 var(--dim);
}

.v2-title {
    color: var(--text-bright);
}

.v2-rule {
    color: var(--dim);
}

.v2-label {
    color: var(--prompt-color);
}

#boot-screen {
    max-width: 800px;
    color: var(--text);
    line-height: 1.8;
    transition: opacity 0.4s ease;
}

/* ─── Glitch Effects ─── */

.screen-flicker {
    animation: screenFlicker 0.3s ease-in-out;
}

@keyframes screenFlicker {
    0%, 100% { opacity: 1; }
    10% { opacity: 0.3; }
    20% { opacity: 0.8; }
    30% { opacity: 0.2; }
    40% { opacity: 0.9; }
    50% { opacity: 0.1; }
    60% { opacity: 0.7; }
    70% { opacity: 0.4; }
    80% { opacity: 0.9; }
    90% { opacity: 0.3; }
}

.heavy-flicker {
    animation: heavyFlicker 0.5s ease-in-out;
}

@keyframes heavyFlicker {
    0%, 100% { opacity: 1; filter: none; }
    10% { opacity: 0.2; filter: hue-rotate(90deg); }
    20% { opacity: 0.8; filter: hue-rotate(180deg); }
    30% { opacity: 0.1; filter: hue-rotate(270deg); }
    40% { opacity: 0.9; filter: none; }
    50% { opacity: 0.15; filter: hue-rotate(120deg); }
    60% { opacity: 0.7; filter: hue-rotate(240deg); }
    70% { opacity: 0.3; filter: none; }
    80% { opacity: 0.85; filter: hue-rotate(60deg); }
    90% { opacity: 0.2; filter: hue-rotate(300deg); }
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(200, 196, 188, 0.03) 2px,
        rgba(200, 196, 188, 0.03) 4px
    );
    animation: scanScroll 8s linear infinite;
}

body.v1-0 .scanlines {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 176, 0, 0.03) 2px,
        rgba(255, 176, 0, 0.03) 4px
    );
}

@keyframes scanScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100vh; }
}

.crt-band {
    position: fixed;
    top: -10%;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px 10px rgba(255, 255, 255, 0.05);
    z-index: 9998;
    pointer-events: none;
    animation: crtSweep 3s linear forwards;
}

@keyframes crtSweep {
    0% { top: -10%; }
    100% { top: 110%; }
}

.phantom-line {
    color: var(--phantom);
    font-style: italic;
    opacity: 0;
    transition: opacity 1.5s ease;
    margin: 4px 0;
}

.phantom-line.visible {
    opacity: 1;
}

.ambient-system-line {
    color: var(--dim);
    opacity: 0;
    transition: opacity 0.4s ease;
    margin: 4px 0;
}

.ambient-system-line.visible {
    opacity: 1;
}

.timestamp-anomaly {
    background: #f55;
    color: #000;
}
