/*
 * CLI Terminal Styles
 * Corey Henderson's personal website
 * Windows Terminal / Alacritty inspired
 */

/* ===== FONTS ===== */
@font-face {
    font-family: 'Cascadia Code';
    src: local('Cascadia Code'),
         local('CaskaydiaCove Nerd Font'),
         url('https://fonts.cdnfonts.com/s/29131/Cascadia.woff') format('woff');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

/* Terminus TTF - Classic terminal font for retro CRT theme */
@font-face {
    font-family: 'Terminus';
    src: url('../fonts/TerminusTTF-4.49.3.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Terminus';
    src: url('../fonts/TerminusTTF-Bold-4.49.3.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Terminus';
    src: url('../fonts/TerminusTTF-Italic-4.49.3.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Terminus';
    src: url('../fonts/TerminusTTF-Bold-Italic-4.49.3.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Perfect DOS VGA 437 - Authentic IBM PC/DOS font */
@font-face {
    font-family: 'Perfect DOS VGA 437';
    src: url('../fonts/Perfect DOS VGA 437.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Ubuntu Mono - Classic Ubuntu terminal font */
@font-face {
    font-family: 'Ubuntu Mono';
    src: url('https://fonts.cdnfonts.com/s/14905/UbuntuMono-R.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ubuntu Mono';
    src: url('https://fonts.cdnfonts.com/s/14905/UbuntuMono-B.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

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

/* ===== BASE VARIABLES ===== */
:root {
    --font-mono: 'CaskaydiaCove Nerd Font', 'Cascadia Code', 'Consolas', 'SF Mono', Monaco, 'Liberation Mono', Courier, monospace;
    --font-size: 14px;
    --line-height: 1.5;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ===== THEME: MIDNIGHT (Factory Design System) ===== */
.theme-midnight {
    --bg-primary: #161413;
    --bg-secondary: #1D1B1A;
    --bg-tertiary: #282523;
    --bg-hover: #342F2D;
    
    --text-primary: #F2F0F0;
    --text-secondary: #A89895;
    --text-muted: #80756F;
    
    --accent: #D56A26;
    --accent-hover: #EE6018;
    
    --border: #342F2D;
    --border-strong: #403A37;
    
    --success: #5B8E63;
    --error: #D9363E;
    --warning: #E3992A;
    --link: #50ACF2;
    
    --title-btn-close: #ff5f56;
    --title-btn-min: #ffbd2e;
    --title-btn-max: #27c93f;
}

/* ===== THEME: PHOSPHOR (Classic Green CRT) ===== */
.theme-phosphor {
    --bg-primary: #0a0a0a;
    --bg-secondary: #0f0f0f;
    --bg-tertiary: #141414;
    --bg-hover: #1a1a1a;
    
    --text-primary: #33ff33;
    --text-secondary: #22cc22;
    --text-muted: #118811;
    
    --accent: #00ff00;
    --accent-hover: #44ff44;
    
    --border: #1a3a1a;
    --border-strong: #225522;
    
    --success: #00ff00;
    --error: #ff3333;
    --warning: #ffff33;
    --link: #33ffff;
    
    --title-btn-close: #ff3333;
    --title-btn-min: #ffff33;
    --title-btn-max: #33ff33;
}

/* ===== THEME: AMBER (Warm Retro) ===== */
.theme-amber {
    --bg-primary: #1a1200;
    --bg-secondary: #1f1600;
    --bg-tertiary: #261c00;
    --bg-hover: #332600;
    
    --text-primary: #ffb000;
    --text-secondary: #cc8c00;
    --text-muted: #805800;
    
    --accent: #ff8c00;
    --accent-hover: #ffaa33;
    
    --border: #403000;
    --border-strong: #4d3a00;
    
    --success: #88cc00;
    --error: #ff4400;
    --warning: #ffcc00;
    --link: #ffdd66;
    
    --title-btn-close: #ff4400;
    --title-btn-min: #ffcc00;
    --title-btn-max: #88cc00;
}

/* ===== THEME: MATRIX ===== */
.theme-matrix {
    --bg-primary: #0d0d0d;
    --bg-secondary: #0a0f0a;
    --bg-tertiary: #0f140f;
    --bg-hover: #141f14;
    
    --text-primary: #00ff41;
    --text-secondary: #00cc33;
    --text-muted: #008f11;
    
    --accent: #00ff41;
    --accent-hover: #33ff66;
    
    --border: #003300;
    --border-strong: #004400;
    
    --success: #00ff41;
    --error: #ff0040;
    --warning: #ffff00;
    --link: #00ffff;
    
    --title-btn-close: #ff0040;
    --title-btn-min: #ffff00;
    --title-btn-max: #00ff41;
}

/* ===== THEME: HIGH CONTRAST ===== */
.theme-contrast {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --bg-hover: #1a1a1a;

    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;

    --accent: #ffffff;
    --accent-hover: #ffffff;

    --border: #333333;
    --border-strong: #444444;

    --success: #00ff00;
    --error: #ff0000;
    --warning: #ffff00;
    --link: #00ffff;

    --title-btn-close: #ff0000;
    --title-btn-min: #ffff00;
    --title-btn-max: #00ff00;
}

/* ===== THEME: COPENHAGEN (Cool Nordic Winter) ===== */
.theme-copenhagen {
    --bg-primary: #0f1419;
    --bg-secondary: #141a21;
    --bg-tertiary: #1a222b;
    --bg-hover: #232d3a;

    --text-primary: #d8dee9;
    --text-secondary: #9aa5b5;
    --text-muted: #5c6773;

    --accent: #81a1c1;
    --accent-hover: #88c0d0;

    --border: #2e3845;
    --border-strong: #3b4754;

    --success: #a3be8c;
    --error: #bf616a;
    --warning: #ebcb8b;
    --link: #88c0d0;

    --title-btn-close: #bf616a;
    --title-btn-min: #ebcb8b;
    --title-btn-max: #a3be8c;
}

/* ===== THEME: UBUNTU (Classic Aubergine) ===== */
.theme-ubuntu {
    /* Aubergine purple palette */
    --bg-primary: #2c001e;
    --bg-secondary: #300a24;
    --bg-tertiary: #3c1130;
    --bg-hover: #4a1a3d;

    /* Warm grey text */
    --text-primary: #eeeeec;
    --text-secondary: #d3d7cf;
    --text-muted: #8f8b88;

    /* Teal green accent (Ubuntu terminal style) */
    --accent: #2eb398;
    --accent-hover: #3fcaa8;

    --border: #4a1a3d;
    --border-strong: #5c2249;

    /* Ubuntu orange for links/success */
    --success: #e95420;
    --error: #ef2929;
    --warning: #f5c211;
    --link: #e95420;

    --title-btn-close: #ef2929;
    --title-btn-min: #f5c211;
    --title-btn-max: #e95420;

    /* Ubuntu Mono font */
    --font-mono: 'Ubuntu Mono', 'Consolas', 'Monaco', monospace;
}

/* ===== THEME: RETRO-CRT (Cool-Retro-Term Amber) ===== */
.theme-retro-crt {
    /* Base colors from cool-retro-term amber profile */
    --bg-primary: #0a0600;
    --bg-secondary: #0d0800;
    --bg-tertiary: #110a00;
    --bg-hover: #1a1000;

    --text-primary: #ff8100;
    --text-secondary: #cc6700;
    --text-muted: #804000;

    --accent: #ff9020;
    --accent-hover: #ffaa44;

    --border: #2a1800;
    --border-strong: #3d2400;

    --success: #ff8100;
    --error: #ff4400;
    --warning: #ffaa00;
    --link: #ffbb55;

    --title-btn-close: #ff4400;
    --title-btn-min: #ffaa00;
    --title-btn-max: #ff8100;

    /* CRT-specific variables */
    --crt-glow-color: #ff8100;
    --crt-glow-intensity: 0.55;
    --crt-scanline-opacity: 0.08;
    --crt-flicker-intensity: 0.03;
    --crt-curvature: 2px;
    --crt-vignette-opacity: 0.4;

    /* Use Terminus font for authentic CRT look */
    --font-mono: 'Terminus', 'Consolas', 'Monaco', monospace;
    --font-size: 16px;
}

/* ===== THEME: RETRO-GREEN (Classic P1 Green Phosphor) ===== */
.theme-retro-green {
    /* Classic green phosphor colors */
    --bg-primary: #001100;
    --bg-secondary: #001a00;
    --bg-tertiary: #002200;
    --bg-hover: #003300;

    --text-primary: #33ff33;
    --text-secondary: #22cc22;
    --text-muted: #118811;

    --accent: #44ff44;
    --accent-hover: #66ff66;

    --border: #004400;
    --border-strong: #006600;

    --success: #33ff33;
    --error: #ff4444;
    --warning: #ffff33;
    --link: #66ff99;

    --title-btn-close: #ff4444;
    --title-btn-min: #ffff33;
    --title-btn-max: #33ff33;

    /* CRT-specific variables */
    --crt-glow-color: #33ff33;
    --crt-glow-intensity: 0.55;
    --crt-scanline-opacity: 0.08;
    --crt-flicker-intensity: 0.03;
    --crt-curvature: 2px;
    --crt-vignette-opacity: 0.4;

    /* Use Terminus font for authentic CRT look */
    --font-mono: 'Terminus', 'Consolas', 'Monaco', monospace;
    --font-size: 16px;
}

/* ===== THEME: RETRO-PC (IBM PC/DOS Style) ===== */
.theme-retro-pc {
    /* Classic IBM PC blue screen colors */
    --bg-primary: #0000aa;
    --bg-secondary: #0000aa;
    --bg-tertiary: #000088;
    --bg-hover: #0000cc;

    --text-primary: #aaaaaa;
    --text-secondary: #888888;
    --text-muted: #555588;

    --accent: #ffffff;
    --accent-hover: #ffff55;

    --border: #000066;
    --border-strong: #0000cc;

    --success: #55ff55;
    --error: #ff5555;
    --warning: #ffff55;
    --link: #55ffff;

    --title-btn-close: #ff5555;
    --title-btn-min: #ffff55;
    --title-btn-max: #55ff55;

    /* CRT-specific variables */
    --crt-glow-color: #aaaaaa;
    --crt-glow-intensity: 0.3;
    --crt-scanline-opacity: 0.06;
    --crt-flicker-intensity: 0.02;
    --crt-curvature: 2px;
    --crt-vignette-opacity: 0.3;

    /* Use Perfect DOS VGA 437 for authentic IBM PC look */
    --font-mono: 'Perfect DOS VGA 437', 'Consolas', 'Monaco', monospace;
    --font-size: 16px;
}

/* ===== BASE STYLES ===== */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-mono);
    font-size: var(--font-size);
    line-height: var(--line-height);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* ===== TERMINAL CONTAINER ===== */
.terminal-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-lg);
    background: var(--bg-primary);
    position: relative;
}

.terminal-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/helicopter.jpg') center bottom / cover no-repeat;
    opacity: 0.06;
    filter: grayscale(100%) blur(1px);
    pointer-events: none;
    z-index: 0;
}

.terminal-wrapper > * {
    position: relative;
    z-index: 1;
}

.terminal {
    width: 100%;
    max-width: 1000px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-secondary);
    box-shadow:
        0 0 0 1px var(--border),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* ===== TITLE BAR (Windows Terminal Style) ===== */
.terminal-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    user-select: none;
    font-size: 12px;
}

.title-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-left: var(--space-sm);
    color: var(--text-secondary);
}

.title-icon {
    font-size: 14px;
    opacity: 0.7;
}

.title-text {
    color: var(--text-secondary);
    display: none;
}

/* Windows Terminal Tabs */
.title-tabs {
    display: flex;
    align-items: center;
    flex: 1;
    height: 100%;
    padding-left: var(--space-sm);
}

.title-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
    padding: 0 var(--space-sm);
    background: var(--bg-secondary);
    border: none;
    border-top: 2px solid var(--accent);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: default;
    position: relative;
}

.title-tab .tab-icon {
    font-size: 12px;
    opacity: 0.8;
}

.title-tab .tab-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-tab .tab-close {
    opacity: 0;
    font-size: 14px;
    color: var(--text-muted);
    transition: opacity 0.15s ease;
}

.title-tab:hover .tab-close {
    opacity: 1;
}

.title-tab-new {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.title-tab-new:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Windows Control Buttons */
.title-controls {
    display: flex;
    height: 100%;
}

.win-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-family: 'Segoe MDL2 Assets', var(--font-mono);
    cursor: pointer;
    transition: background 0.1s ease;
}

.win-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.win-btn.win-close:hover {
    background: #c42b1c;
    color: white;
}

/* ===== TERMINAL BODY ===== */
.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    background: var(--bg-secondary);
}

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

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

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== OUTPUT ===== */
#output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

#output .prompt {
    color: var(--accent);
    font-weight: 600;
}

#output .cmd {
    color: var(--accent);
}

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

#output .muted {
    color: var(--text-muted);
}

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

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

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

#output .bold {
    font-weight: 600;
}

#output .white {
    color: var(--text-primary);
}

#output .bold.white {
    font-weight: 600;
    color: var(--text-primary);
}

#output a {
    color: var(--link);
}

#output a:hover {
    color: var(--accent-hover);
}

.ascii-art {
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: -0.5px;
    white-space: pre;
    overflow-x: auto;
    display: block;
}

/* ===== INPUT LINE ===== */
.terminal-input {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
}

.input-prompt {
    color: var(--accent);
    font-weight: 600;
    margin-right: var(--space-sm);
    user-select: none;
}

#command-form {
    flex: 1;
    display: flex;
}

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

#command-input::placeholder {
    color: var(--text-muted);
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--accent);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

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

/* ===== TERMINAL STATUS BAR ===== */
.terminal-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    user-select: none;
}

.status-left,
.status-center,
.status-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-center {
    color: var(--text-muted);
}

.status-hint {
    opacity: 0.7;
}

.status-sep {
    color: var(--border-strong);
}

.status-credits {
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: inherit;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.status-credits:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.status-easter-egg {
    opacity: 0.3;
    cursor: help;
    font-size: 10px;
    transition: opacity 0.2s ease;
}

.status-easter-egg:hover {
    opacity: 1;
}

/* ===== COMMAND SHORTCUTS ===== */
.command-shortcuts {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.cmd-shortcut {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cmd-shortcut:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.cmd-shortcut:active,
.cmd-shortcut.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

/* ===== MUSIC PLAYER ===== */
.music-player {
    position: fixed;
    right: var(--space-lg);
    bottom: var(--space-lg);
    z-index: 1100;
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    min-width: 200px;
}

.music-player.visible {
    display: flex;
}

.music-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.music-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.music-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.music-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.music-btn svg {
    width: 14px;
    height: 14px;
}

.music-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.music-btn.playing {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.music-btn .icon {
    display: none;
}

.music-btn.playing .icon-pause {
    display: block;
}

.music-btn:not(.playing) .icon-play {
    display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .terminal-wrapper {
        padding: var(--space-md);
    }

    .terminal {
        height: 85vh;
        max-height: none;
        border-radius: var(--radius-sm);
    }

    .ascii-art {
        font-size: 8px;
        white-space: pre;
        overflow-x: auto;
    }

    .command-shortcuts {
        flex-wrap: wrap;
    }

    .terminal-status {
        font-size: 10px;
    }

    .status-center {
        display: none;
    }

    .music-player {
        right: var(--space-md);
        bottom: var(--space-md);
    }

    .title-tabs {
        display: none;
    }

    .title-text {
        display: block;
    }

    .win-btn {
        width: 40px;
    }
}

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

    .terminal-wrapper {
        padding: var(--space-sm);
    }

    .terminal {
        height: 90vh;
        border-radius: 2px;
    }

    .title-left {
        flex: 1;
    }

    .title-text {
        display: block;
        font-size: 11px;
    }

    .ascii-art {
        font-size: 5px;
        letter-spacing: -1px;
        white-space: pre;
        overflow-x: auto;
    }

    .cmd-shortcut {
        padding: var(--space-xs) var(--space-sm);
        font-size: 11px;
    }

    .terminal-status {
        font-size: 9px;
        padding: var(--space-xs) var(--space-sm);
    }

    .status-left {
        display: none;
    }

    .win-btn {
        width: 36px;
    }
}

/* ===== CRT EFFECTS (for retro-crt theme) ===== */

/* Scanlines overlay */
.theme-retro-crt .terminal::after,
.theme-retro-green .terminal::after,
.theme-retro-pc .terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, var(--crt-scanline-opacity)) 0px,
        rgba(0, 0, 0, var(--crt-scanline-opacity)) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
    border-radius: inherit;
}

/* Secondary scanline for more authentic look */
.theme-retro-crt .terminal::before,
.theme-retro-green .terminal::before,
.theme-retro-pc .terminal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.02) 0px,
        rgba(0, 0, 0, 0.02) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 99;
    border-radius: inherit;
}

/* Vignette effect */
.theme-retro-crt .terminal-body::after,
.theme-retro-green .terminal-body::after,
.theme-retro-pc .terminal-body::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, var(--crt-vignette-opacity)) 100%
    );
    pointer-events: none;
    z-index: 50;
}

/* Screen curvature via subtle border-radius and perspective */
.theme-retro-crt .terminal,
.theme-retro-green .terminal,
.theme-retro-pc .terminal {
    border-radius: 8px / 12px;
    box-shadow:
        0 0 0 1px var(--border),
        0 0 80px rgba(255, 129, 0, 0.15),
        inset 0 0 60px rgba(0, 0, 0, 0.4),
        0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: crt-flicker 0.15s infinite;
}

/* Phosphor glow on text */
.theme-retro-crt #output,
.theme-retro-crt .ascii-art,
.theme-retro-green #output,
.theme-retro-green .ascii-art,
.theme-retro-pc #output,
.theme-retro-pc .ascii-art {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px var(--crt-glow-color),
        0 0 4px rgba(255, 129, 0, 0.5),
        0 0 8px rgba(255, 129, 0, 0.3),
        0 0 16px rgba(255, 129, 0, 0.15);
}

/* Glow only on the input prompt, not the input field */
.theme-retro-crt .input-prompt,
.theme-retro-green .input-prompt,
.theme-retro-pc .input-prompt {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px var(--crt-glow-color),
        0 0 4px rgba(255, 129, 0, 0.5);
}

/* Extra glow on accent text */
.theme-retro-crt #output .accent,
.theme-retro-crt #output .cmd,
.theme-retro-crt #output .prompt,
.theme-retro-green #output .accent,
.theme-retro-green #output .cmd,
.theme-retro-green #output .prompt,
.theme-retro-pc #output .accent,
.theme-retro-pc #output .cmd,
.theme-retro-pc #output .prompt {
    text-shadow:
        0 0 2px var(--crt-glow-color),
        0 0 4px var(--crt-glow-color),
        0 0 8px rgba(255, 129, 0, 0.6),
        0 0 16px rgba(255, 129, 0, 0.4),
        0 0 32px rgba(255, 129, 0, 0.2);
}

/* Flicker animation - subtle brightness variation */
@keyframes crt-flicker {
    0% { opacity: 1; }
    5% { opacity: 0.98; }
    10% { opacity: 1; }
    15% { opacity: 0.97; }
    20% { opacity: 1; }
    50% { opacity: 0.99; }
    55% { opacity: 1; }
    70% { opacity: 0.98; }
    80% { opacity: 1; }
    90% { opacity: 0.99; }
    100% { opacity: 1; }
}

/* Jitter animation for slight screen instability */
@keyframes crt-jitter {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-0.5px, 0); }
    20% { transform: translate(0.5px, 0); }
    30% { transform: translate(0, 0.5px); }
    40% { transform: translate(0, -0.5px); }
    50% { transform: translate(-0.5px, 0.5px); }
    60% { transform: translate(0.5px, -0.5px); }
    70% { transform: translate(0, 0); }
    80% { transform: translate(-0.5px, 0); }
    90% { transform: translate(0, 0); }
    100% { transform: translate(0, 0); }
}

/* Apply jitter to terminal content - disabled for readability */
.theme-retro-crt .terminal-body,
.theme-retro-green .terminal-body,
.theme-retro-pc .terminal-body {
    position: relative;
}

/* CRT screen "glass" reflection */
.theme-retro-crt .terminal-body::before,
.theme-retro-green .terminal-body::before,
.theme-retro-pc .terminal-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 51;
}

/* Brighter cursor for CRT - minimal glow on input, none on placeholder */
.theme-retro-crt #command-input,
.theme-retro-green #command-input,
.theme-retro-pc #command-input {
    caret-color: var(--crt-glow-color);
    text-shadow: 0 0 2px var(--crt-glow-color);
}

.theme-retro-crt #command-input::placeholder,
.theme-retro-green #command-input::placeholder,
.theme-retro-pc #command-input::placeholder {
    text-shadow: none;
    opacity: 0.5;
}

/* CRT bezel effect on the frame */
.theme-retro-crt .terminal-title,
.theme-retro-crt .terminal-status,
.theme-retro-crt .terminal-input,
.theme-retro-green .terminal-title,
.theme-retro-green .terminal-status,
.theme-retro-green .terminal-input,
.theme-retro-pc .terminal-title,
.theme-retro-pc .terminal-status,
.theme-retro-pc .terminal-input {
    background: linear-gradient(
        180deg,
        var(--bg-tertiary) 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

/* Glow on links */
.theme-retro-crt a,
.theme-retro-green a,
.theme-retro-pc a {
    text-shadow:
        0 0 2px var(--link),
        0 0 4px rgba(255, 187, 85, 0.4);
}

/* Green phosphor glow overrides */
.theme-retro-green .terminal {
    box-shadow:
        0 0 0 1px var(--border),
        0 0 80px rgba(51, 255, 51, 0.15),
        inset 0 0 60px rgba(0, 0, 0, 0.4),
        0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.theme-retro-green #output,
.theme-retro-green .ascii-art {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px var(--crt-glow-color),
        0 0 4px rgba(51, 255, 51, 0.5),
        0 0 8px rgba(51, 255, 51, 0.3),
        0 0 16px rgba(51, 255, 51, 0.15);
}

.theme-retro-green .input-prompt {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px var(--crt-glow-color),
        0 0 4px rgba(51, 255, 51, 0.5);
}

.theme-retro-green #output .accent,
.theme-retro-green #output .cmd,
.theme-retro-green #output .prompt {
    text-shadow:
        0 0 2px var(--crt-glow-color),
        0 0 4px var(--crt-glow-color),
        0 0 8px rgba(51, 255, 51, 0.6),
        0 0 16px rgba(51, 255, 51, 0.4),
        0 0 32px rgba(51, 255, 51, 0.2);
}

.theme-retro-green a {
    text-shadow:
        0 0 2px var(--link),
        0 0 4px rgba(102, 255, 153, 0.4);
}

/* IBM PC blue glow overrides */
.theme-retro-pc .terminal {
    box-shadow:
        0 0 0 1px var(--border),
        0 0 60px rgba(0, 0, 170, 0.3),
        inset 0 0 80px rgba(0, 0, 0, 0.3),
        0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.theme-retro-pc #output,
.theme-retro-pc .ascii-art {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px rgba(170, 170, 170, 0.6),
        0 0 4px rgba(170, 170, 170, 0.3);
}

.theme-retro-pc .input-prompt {
    text-shadow:
        0 0 1px var(--crt-glow-color),
        0 0 2px rgba(255, 255, 255, 0.5);
}

.theme-retro-pc #output .accent,
.theme-retro-pc #output .cmd,
.theme-retro-pc #output .prompt {
    text-shadow:
        0 0 2px var(--crt-glow-color),
        0 0 4px rgba(255, 255, 255, 0.5),
        0 0 8px rgba(255, 255, 255, 0.3);
}

.theme-retro-pc a {
    text-shadow:
        0 0 2px var(--link),
        0 0 4px rgba(85, 255, 255, 0.4);
}

/* Subtle glow on muted/secondary text for retro themes */
.theme-retro-crt #output .muted,
.theme-retro-crt .status-hint,
.theme-retro-crt .terminal-status {
    text-shadow: 0 0 2px rgba(255, 129, 0, 0.3);
}

.theme-retro-green #output .muted,
.theme-retro-green .status-hint,
.theme-retro-green .terminal-status {
    text-shadow: 0 0 2px rgba(51, 255, 51, 0.3);
}

.theme-retro-pc #output .muted,
.theme-retro-pc .status-hint,
.theme-retro-pc .terminal-status {
    text-shadow: 0 0 2px rgba(170, 170, 170, 0.3);
}

/* Static noise overlay - optional, uses CSS pattern */
.theme-retro-crt .terminal {
    position: relative;
}

/* Subtle contrast boost - noise filter removed for better readability */
.theme-retro-crt .terminal-body {
    contrast: 1.05;
}

/* Turn off some effects for better performance if needed */
@media (prefers-reduced-motion: reduce) {
    .theme-retro-crt .terminal {
        animation: none;
    }
    .theme-retro-crt .terminal-body {
        animation: none;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
        opacity: 1;
    }
}

#command-input:focus {
    outline: none;
}

.cmd-shortcut:focus-visible,
.win-btn:focus-visible,
.title-tab:focus-visible,
.title-tab-new:focus-visible,
.music-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
