@font-face {
    font-family: 'VT323';
    src: url('fonts/VT323.woff2') format('woff2'),
         local('VT323');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CourierNew';
    src: url('fonts/CourierNew.woff') format('woff'),
         local('Courier New');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

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

.font-courier {
    font-family: 'CourierNew', 'Courier New', monospace !important;
}

:root {
    --terminal-green: #41ff00;
    --terminal-green-dim: #30bb00;
    --terminal-green-dark: #0a2200;
    --terminal-glow: rgba(65, 255, 0, 0.6);
    --screen-bg: #0a1a00;
    --bezel-color: #2a2a28;
    --bezel-dark: #1a1a18;
    --bezel-highlight: #3a3a38;
}

html {
    height: 100%;
    background-color: #050505;
}

body {
    min-height: 100%;
    overflow: hidden;
    /* Padding mit Safe Area Support */
    padding: 10px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
    box-sizing: border-box;
    /* Solid background color for Safari toolbar detection */
    background-color: #050505;
    background-image:
        /* Subtiler grüner Schein vom Monitor */
        radial-gradient(ellipse 80% 60% at 50% 45%, rgba(65, 255, 0, 0.03) 0%, transparent 50%),
        /* Vignette an den Rändern */
        radial-gradient(ellipse at center, #151515 0%, #0a0a0a 60%, #050505 100%);
    /* Safari gradient banding fix */
    -webkit-transform: translateZ(0);
    -webkit-background-clip: padding-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'VT323', 'Courier New', monospace;
    position: relative;
    overflow: hidden;
}

/* Subtile Noise-Textur für den Hintergrund */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
}

/* CRT Container */
.crt-container {
    width: 900px;
    max-width: 100%;
    perspective: 1000px;
    z-index: 2;
}

.crt-frame {
    position: relative;
    transform: rotateX(2deg);
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.8));
}

/* Bezel - worn/rusted look */
.crt-bezel {
    background:
        /* Rust spots */
        radial-gradient(ellipse 8px 6px at 15% 40%, rgba(139, 90, 43, 0.4) 0%, transparent 70%),
        radial-gradient(ellipse 12px 8px at 85% 60%, rgba(139, 90, 43, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse 6px 4px at 25% 80%, rgba(160, 82, 45, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 10px 6px at 70% 30%, rgba(139, 90, 43, 0.25) 0%, transparent 70%),
        /* Scratches/wear */
        linear-gradient(95deg, transparent 20%, rgba(60, 60, 55, 0.3) 21%, transparent 22%),
        linear-gradient(87deg, transparent 60%, rgba(50, 50, 45, 0.25) 61%, transparent 62%),
        linear-gradient(92deg, transparent 40%, rgba(70, 70, 65, 0.2) 41%, transparent 42%),
        /* Base gradient */
        linear-gradient(180deg, var(--bezel-highlight) 0%, var(--bezel-color) 10%, var(--bezel-dark) 90%, var(--bezel-color) 100%);
    padding: 8px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #3d3d3b;
    border-bottom: none;
    position: relative;
}

.bezel-label {
    font-family: 'CourierNew', 'Courier New', monospace;
    color: #888;
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 -1px 0 #000;
}

.bezel-screws {
    display: flex;
    gap: 20px;
}

.screw {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle at 30% 30%, #555, #222);
    border-radius: 50%;
    border: 1px solid #1a1a1a;
    position: relative;
}

.screw::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 2px;
    background: #1a1a1a;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* CRT Screen */
.crt-screen {
    width: 100%;
    max-width: 900px;
    height: 70vh;
    max-height: 600px;
    min-height: 300px;
    background: var(--screen-bg);
    border: 15px solid;
    border-color: var(--bezel-dark) var(--bezel-color) var(--bezel-highlight) var(--bezel-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow:
        /* Outer shadow around bezel for depth */
        0 0 0 3px rgba(0, 0, 0, 0.5),
        0 0 0 6px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.8),
        /* Deep inset shadow for CRT tube depth effect */
        inset 0 0 80px 30px rgba(0, 0, 0, 0.95),
        inset 0 0 100px rgba(65, 255, 0, 0.1),
        inset 0 0 30px rgba(0, 0, 0, 0.9),
        /* Stronger inner edge shadows for deeper 3D tube effect */
        inset 0 12px 25px -4px rgba(0, 0, 0, 0.9),
        inset 0 -10px 20px -4px rgba(0, 0, 0, 0.8),
        inset 12px 0 25px -4px rgba(0, 0, 0, 0.85),
        inset -12px 0 25px -4px rgba(0, 0, 0, 0.85),
        /* Rust/wear on border edges */
        inset 3px 0 8px -2px rgba(139, 90, 43, 0.3),
        inset -5px 0 10px -3px rgba(139, 90, 43, 0.25),
        inset 0 5px 8px -3px rgba(100, 70, 40, 0.2),
        inset 0 -3px 6px -2px rgba(139, 90, 43, 0.15);
}

/* Screen curvature effect + bezel inner shadow */
.crt-screen::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 85%, rgba(0, 0, 0, 0.6) 95%);
    box-shadow:
        /* Inner shadow on gray bezel - creates 3D tube depth */
        inset 0 0 25px 8px rgba(0, 0, 0, 0.7),
        inset 0 0 15px 5px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
}

/* Screen reflection - light source reflection on glass */
.crt-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        /* Upper horizontal reflection band (at menu area) */
        radial-gradient(
            ellipse 85% 22% at 68% 15%,
            rgba(255, 255, 255, 0.17) 0%,
            rgba(255, 255, 255, 0.11) 25%,
            rgba(255, 255, 255, 0.06) 50%,
            rgba(255, 255, 255, 0.02) 75%,
            transparent 100%
        ),
        /* Vertical reflection on right side (rotated 90deg, brighter) */
        radial-gradient(
            ellipse 28% 50% at 85% 25%,
            rgba(255, 255, 255, 0.14) 0%,
            rgba(255, 255, 255, 0.10) 25%,
            rgba(255, 255, 255, 0.07) 50%,
            rgba(255, 255, 255, 0.03) 75%,
            transparent 100%
        );
    pointer-events: none;
    z-index: 11;
}

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

/* Flicker effect */
.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(65, 255, 0, 0.02);
    pointer-events: none;
    z-index: 4;
    animation: flicker 0.1s infinite;
}

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

/* Screen content */
.screen-content {
    position: relative;
    z-index: 2;
    padding: 30px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--terminal-green);
    font-size: clamp(18px, 2.5vw, 22px);
    line-height: 1.3;
    text-shadow: 0 0 3px var(--terminal-glow);
}

.screen-content::-webkit-scrollbar {
    width: 8px;
}

.screen-content::-webkit-scrollbar-track {
    background: var(--terminal-green-dark);
}

.screen-content::-webkit-scrollbar-thumb {
    background: var(--terminal-green-dim);
    border-radius: 4px;
}

/* Output area */
#output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

#output .line {
    display: block;
    min-height: 1.3em;
}

/* Header with clock */
#output .line.header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-weight: bold;
    text-shadow: none;
}

.header-clock-container {
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-size: 0.85em;
}

.header-time {
    color: var(--terminal-green);
    text-shadow: 0 0 2px var(--terminal-glow);
}

.header-bar {
    color: var(--terminal-green);
    text-shadow: 0 0 2px var(--terminal-glow);
    letter-spacing: -1px;
    font-size: 0.9em;
}

#output .line.matrix-text {
    color: #00ff41;
    text-shadow: 0 0 2px #00ff41;
    letter-spacing: 2px;
}

/* Hacking game styles */
.hack-word {
    cursor: pointer;
    padding: 2px 0;
    transition: background 0.1s ease;
}

.hack-word:hover {
    background: rgba(65, 255, 0, 0.15);
}

.hack-word.selected {
    background: var(--terminal-green);
    color: var(--screen-bg);
}

.hack-word.selected .hack-addr {
    color: var(--screen-bg);
}

.hack-word.selected .hack-word-text {
    color: var(--screen-bg);
    font-weight: bold;
}

.hack-addr {
    color: var(--terminal-green-dim);
    opacity: 0.7;
}

/* Highlight/Selection style */
.highlight {
    background: var(--terminal-green);
    color: var(--screen-bg);
    padding: 0 2px;
}

/* Menu items */
.menu-item {
    cursor: pointer;
    display: block;
    padding: 2px 0;
    transition: background 0.1s ease;
}

.menu-item:hover {
    background: rgba(65, 255, 0, 0.15);
}

.menu-item.selected {
    background: var(--terminal-green);
    color: var(--screen-bg);
    text-shadow: none;
}

.menu-item.selected .menu-bracket,
.menu-item.selected .menu-label,
.menu-item.selected .menu-arrow {
    color: var(--screen-bg);
}

/* Brackets for menu items */
.menu-bracket {
    color: var(--terminal-green-dim);
}

.menu-arrow {
    color: var(--terminal-green);
    font-weight: bold;
}

.menu-label {
    color: var(--terminal-green);
}

/* Inline menu items (side by side) */
.menu-row-inline {
    display: flex;
    gap: 8px;
}

.menu-item-inline {
    cursor: pointer;
    padding: 2px 4px;
    transition: background 0.1s ease;
    flex: 1;
    text-align: center;
}

.menu-item-inline:hover {
    background: rgba(65, 255, 0, 0.15);
}

.menu-item-inline.selected {
    background: var(--terminal-green);
    color: var(--screen-bg);
    text-shadow: none;
}

.menu-item-inline.selected .menu-bracket,
.menu-item-inline.selected .menu-label,
.menu-item-inline.selected .menu-arrow {
    color: var(--screen-bg);
}

/* Typing cursor - visible block that draws text */
.typing-cursor {
    color: var(--terminal-green);
}

/* Input line - hidden by default, shown for contact form */
.input-line {
    display: none;
    align-items: center;
    margin-top: 10px;
}

.input-line.active {
    display: flex;
}

.prompt {
    margin-right: 8px;
    color: var(--terminal-green);
}

#current-input {
    color: var(--terminal-green);
}

/* Cursor */
.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background: var(--terminal-green);
    animation: blink 0.8s step-end infinite;
    vertical-align: text-bottom;
    box-shadow: 0 0 10px var(--terminal-glow);
}

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

/* Bottom bezel - worn/rusted look */
.crt-bottom {
    background:
        /* Rust spots */
        radial-gradient(ellipse 15px 10px at 20% 50%, rgba(139, 90, 43, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 10px 8px at 75% 40%, rgba(139, 90, 43, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse 8px 6px at 50% 70%, rgba(160, 82, 45, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 12px 8px at 90% 60%, rgba(139, 90, 43, 0.3) 0%, transparent 70%),
        /* Scratches */
        linear-gradient(88deg, transparent 30%, rgba(60, 60, 55, 0.25) 31%, transparent 32%),
        linear-gradient(93deg, transparent 70%, rgba(50, 50, 45, 0.2) 71%, transparent 72%),
        /* Base gradient */
        linear-gradient(180deg, var(--bezel-color) 0%, var(--bezel-dark) 50%, var(--bezel-color) 100%);
    padding: 15px;
    border-radius: 0 0 8px 8px;
    border: 2px solid #3d3d3b;
    border-top: none;
}

.vent-slots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.vent-slots span {
    width: 40px;
    height: 4px;
    background: linear-gradient(180deg, #1a1a18, #0a0a08, #1a1a18);
    border-radius: 2px;
}

/* Typing animation for bootup */
.typing {
    overflow: hidden;
    border-right: none;
    white-space: nowrap;
    animation: typing 0.5s steps(40, end);
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* Glitch effect for errors */
.glitch {
    animation: glitch 0.3s ease;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* ASCII Art styling */
.ascii-art {
    font-family: 'CourierNew', 'Courier New', monospace;
    font-size: clamp(8px, 1.2vw, 12px);
    line-height: 1.2;
    letter-spacing: 0;
    text-shadow: 0 0 8px var(--terminal-glow), 0 0 15px rgba(65, 255, 0, 0.4);
}

/* Dim text */
.dim {
    color: var(--terminal-green-dim);
    text-shadow: 0 0 3px rgba(65, 255, 0, 0.3);
}

/* Warning/Error text */
.warning {
    color: #ffaa00;
    text-shadow: 0 0 5px rgba(255, 170, 0, 0.6);
}

.error {
    color: var(--terminal-green);
}

/* Boot screen animation */
.boot-line {
    opacity: 0;
    animation: fadeIn 0.1s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Power on effect */
.power-on {
    animation: powerOn 1s ease-out;
}

@keyframes powerOn {
    0% {
        filter: brightness(0);
        transform: scaleY(0.01);
    }
    50% {
        filter: brightness(2);
        transform: scaleY(0.01);
    }
    60% {
        transform: scaleY(1);
    }
    100% {
        filter: brightness(1);
        transform: scaleY(1);
    }
}

/* Horizontal line effect */
.hline {
    color: var(--terminal-green-dim);
}

/* Link styling */
a {
    color: var(--terminal-green);
    text-decoration: none;
}

a:hover {
    background: var(--terminal-green);
    color: var(--screen-bg);
    text-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
    .crt-container {
        width: 100%;
        perspective: none;
    }

    .crt-frame {
        transform: none;
        width: 100%;
        filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6));
    }

    .crt-screen {
        height: 72vh;
        min-height: 280px;
        border-width: 8px;
        border-radius: 12px;
    }

    .screen-content {
        padding: 12px;
        font-size: 16px;
    }

    .crt-bezel {
        padding: 4px 8px;
    }

    .bezel-label {
        font-size: 9px;
        letter-spacing: 2px;
    }

    .screw {
        width: 6px;
        height: 6px;
    }

    .bezel-screws {
        gap: 12px;
    }

    .crt-bottom {
        padding: 10px;
    }

    .vent-slots span {
        width: 25px;
        height: 3px;
    }
}

/* Medium-small screens (iPhone Pro, etc.) */
@media (max-width: 600px) {
    .crt-screen {
        border-width: 6px;
        border-radius: 10px;
    }

    .screen-content {
        padding: 10px;
        font-size: 15px;
    }

    .crt-bezel {
        padding: 3px 6px;
    }

    .bezel-label {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .screw {
        width: 5px;
        height: 5px;
    }

    .bezel-screws {
        gap: 10px;
    }

    .crt-bottom {
        padding: 8px;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 480px) {
    body {
        padding: 6px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        padding-left: calc(6px + env(safe-area-inset-left, 0px));
        padding-right: calc(6px + env(safe-area-inset-right, 0px));
    }

    .crt-screen {
        height: 68vh;
        min-height: 250px;
        border-width: 6px;
        border-radius: 10px;
    }

    .screen-content {
        padding: 10px;
        font-size: 14px;
    }

    .crt-bezel {
        padding: 3px 6px;
    }

    .bezel-label {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .screw {
        width: 5px;
        height: 5px;
    }

    .bezel-screws {
        gap: 8px;
    }

    .crt-bottom {
        padding: 8px;
    }

    .vent-slots span {
        width: 20px;
        height: 2px;
    }

    .vent-slots {
        gap: 5px;
    }
}

/* ==========================================
   FALLOUT-STYLE KEYBOARD
   ========================================== */
.fallout-keyboard-container {
    display: none;
    background: linear-gradient(180deg,
        var(--bezel-highlight) 0%,
        var(--bezel-color) 5%,
        var(--bezel-dark) 95%,
        var(--bezel-color) 100%
    );
    padding: 8px 4px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid #3d3d3b;
    position: relative;
}

/* Rust effect on keyboard container */
.fallout-keyboard-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 10px 8px at 10% 30%, rgba(139, 90, 43, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse 8px 6px at 85% 60%, rgba(139, 90, 43, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 12px 8px at 50% 80%, rgba(160, 82, 45, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.fallout-keyboard {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 3px;
}

.kb-key {
    min-width: 32px;
    height: 44px;
    background: linear-gradient(180deg,
        #2a2a28 0%,
        #1a1a18 50%,
        #0a0a08 100%
    );
    border: 1px solid #3a3a38;
    border-bottom: 2px solid #0a0a08;
    border-radius: 4px;
    color: var(--terminal-green);
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 2px 4px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.05s ease;
}

.kb-key:active {
    background: linear-gradient(180deg,
        #1a1a18 0%,
        #0a0a08 50%,
        #050505 100%
    );
    border-bottom-width: 1px;
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.02),
        0 1px 2px rgba(0,0,0,0.5);
}

.kb-key.active {
    background: var(--terminal-green);
    color: var(--screen-bg);
    text-shadow: none;
}

/* Special keys */
.kb-key.key-space {
    flex: 1;
    max-width: 200px;
}

.kb-key.key-backspace,
.kb-key.key-enter {
    min-width: 56px;
    font-size: 13px;
}

.kb-key.key-shift {
    min-width: 48px;
    font-size: 13px;
}

.kb-key.key-special {
    min-width: 40px;
    font-size: 16px;
    color: var(--terminal-green-dim);
}

/* Abort button in keyboard */
.kb-key.contact-abort-btn {
    display: none;
    background: linear-gradient(180deg,
        #3a2a28 0%,
        #2a1a18 50%,
        #1a0a08 100%
    );
    border: 1px solid #4a3a38;
    color: #ff6644;
    text-shadow: 0 0 5px rgba(255, 102, 68, 0.6);
    min-width: 50px;
}

.kb-key.contact-abort-btn:active {
    background: linear-gradient(180deg,
        #2a1a18 0%,
        #1a0a08 50%,
        #0a0000 100%
    );
}

.kb-key.contact-abort-btn.visible {
    display: flex;
}

/* ==========================================
   GAME CONTROLS (D-PAD) FOR MOBILE
   ========================================== */
.game-controls-container {
    display: none;
    background: linear-gradient(180deg,
        var(--bezel-highlight) 0%,
        var(--bezel-color) 5%,
        var(--bezel-dark) 95%,
        var(--bezel-color) 100%
    );
    padding: 12px 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid #3d3d3b;
    position: relative;
}

.game-controls-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 10px 8px at 10% 30%, rgba(139, 90, 43, 0.3) 0%, transparent 70%),
        radial-gradient(ellipse 8px 6px at 85% 60%, rgba(139, 90, 43, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 0 10px;
}

/* D-Pad Container */
.dpad-container {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 2px;
}

.dpad-btn {
    background: linear-gradient(180deg,
        #2a2a28 0%,
        #1a1a18 50%,
        #0a0a08 100%
    );
    border: 1px solid #3a3a38;
    border-radius: 4px;
    color: var(--terminal-green);
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.dpad-btn:active,
.dpad-btn.active {
    background: var(--terminal-green);
    color: var(--screen-bg);
}

/* D-Pad arrows */
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-center { grid-column: 2; grid-row: 2; background: #1a1a18; pointer-events: none; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.dpad-up::after { content: '\25B2'; }
.dpad-down::after { content: '\25BC'; }
.dpad-left::after { content: '\25C0'; }
.dpad-right::after { content: '\25B6'; }

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    width: 70px;
    height: 50px;
    background: linear-gradient(180deg,
        #2a2a28 0%,
        #1a1a18 50%,
        #0a0a08 100%
    );
    border: 1px solid #3a3a38;
    border-bottom: 2px solid #0a0a08;
    border-radius: 8px;
    color: var(--terminal-green);
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active,
.action-btn.active {
    background: var(--terminal-green);
    color: var(--screen-bg);
    text-shadow: none;
}

.action-btn.esc-btn {
    background: linear-gradient(180deg,
        #3a2a28 0%,
        #2a1a18 50%,
        #1a0a08 100%
    );
    border-color: #4a3a38;
    color: #ff6644;
}

.action-btn.esc-btn:active,
.action-btn.esc-btn.active {
    background: #ff6644;
    color: var(--screen-bg);
    text-shadow: none;
}

/* Screen noise overlay */
.crt-screen .noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 3;
}

/* ==========================================
   LANDSCAPE BLOCK OVERLAY FOR MOBILE
   ========================================== */
.landscape-block {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.landscape-message {
    text-align: center;
    color: var(--terminal-green);
    font-family: 'VT323', 'Courier New', monospace;
}

.rotate-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotateHint 2s ease-in-out infinite;
    text-shadow: 0 0 20px var(--terminal-glow);
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-20deg); }
    75% { transform: rotate(20deg); }
}

.rotate-text {
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--terminal-glow);
}

.rotate-subtext {
    font-size: 16px;
    color: var(--terminal-green-dim);
}

/* Show landscape block on mobile landscape */
@media (max-width: 900px) and (orientation: landscape) {
    .landscape-block {
        display: flex;
    }

    .crt-container {
        display: none !important;
    }
}

/* ==========================================
   MOBILE PORTRAIT FULLSCREEN MODE
   ========================================== */
@media (max-width: 480px) and (orientation: portrait) {
    html, body {
        height: 100%;
        overflow: hidden;
    }

    body {
        padding: 0;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: 0;
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .crt-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        max-width: 100%;
        min-height: 0;
    }

    .crt-frame {
        flex: 1;
        display: flex;
        flex-direction: column;
        filter: none;
        min-height: 0;
    }

    .crt-bezel {
        border-radius: 0;
        border: none;
        flex-shrink: 0;
    }

    .crt-screen {
        flex: 1;
        height: auto;
        max-height: none;
        min-height: 0;
        border-radius: 0;
        border-width: 4px;
    }

    .screen-content {
        font-size: 16px;
        font-weight: bold;
        line-height: 1.3;
        text-shadow: none;
    }

    /* Ensure no glow on header elements in mobile */
    .header-title,
    .header-time,
    .header-bar,
    .header-line {
        text-shadow: none !important;
    }

    /* Full-width separator lines for mobile portrait */
    #output .line.separator[data-char] {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
        /* Hide original text and use pseudo-element for full-width */
        font-size: 0;
        line-height: 0;
        min-height: 1em;
    }

    #output .line.separator[data-char]::before {
        font-size: 16px;
        font-weight: bold;
        line-height: 1.3;
        display: block;
        width: 100%;
        overflow: hidden;
    }

    /* Detect separator type and repeat the character */
    #output .line.separator[data-char="="]::before {
        content: "=========================================================================================================";
    }

    #output .line.separator[data-char="-"]::before {
        content: "---------------------------------------------------------------------------------------------------------";
    }

    .menu-item {
        padding: 4px 0;
    }

    .crt-bottom {
        border-radius: 0;
        border: none;
        flex-shrink: 0;
        padding: 6px;
    }

    /* Keyboard container in portrait mode - controlled by JS */
    .fallout-keyboard-container.visible {
        display: block;
        flex-shrink: 0;
    }

    /* Game controls in portrait mode - controlled by JS */
    .game-controls-container.visible {
        display: block;
        flex-shrink: 0;
    }
}

