:root {
    /* Windows 95 theme colors */
    --win95-gray: #c0c0c0;
    --win95-dark-gray: #808080;
    --win95-light-gray: #dfdfdf;
    --win95-blue: #000080;
    --win95-teal: #008080;
    --win95-white: #ffffff;
    --win95-black: #000000;
    --win95-red: #ff0000;
    
    /* Dark theme (default) */
    --bg-color: #282a36;
    --text-color: #f8f8f2;
    --prompt-color: #50fa7b;
    --header-bg: #44475a;
    --border-color: #6272a4;
    --page-bg: #1e1e1e;
}

/* Light theme */
:root.light-theme {
    --bg-color: #f5f5f5;
    --text-color: #333333;
    --prompt-color: #28a745;
    --header-bg: #e9ecef;
    --border-color: #adb5bd;
    --page-bg: #ffffff;
}

/* Internet Explorer Style Window */
.ie-address-bar {
    background: var(--win95-gray);
    border-bottom: 1px solid var(--win95-dark-gray);
    padding: 4px;
    border-top: 1px solid var(--win95-light-gray);
    box-shadow: inset 0 0 0 1px var(--win95-white);
}

.ie-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 11px;
}

.ie-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid var(--win95-dark-gray);
    border-top-color: var(--win95-light-gray);
    border-left-color: var(--win95-light-gray);
    background: var(--win95-gray);
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ie-btn:active {
    border: 1px solid var(--win95-light-gray);
    border-top-color: var(--win95-dark-gray);
    border-left-color: var(--win95-dark-gray);
}

.ie-address-label {
    font-weight: normal;
    color: var(--win95-black);
    margin-left: 6px;
}

.ie-address-input {
    flex: 1;
    padding: 2px 4px;
    border: 1px inset var(--win95-gray);
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 11px;
    background: var(--win95-white);
    color: var(--win95-black);
}

.ie-content {
    padding: 16px;
    background: var(--win95-white);
    color: var(--win95-black);
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    overflow-y: auto;
    height: calc(100% - 32px);
}

.ie-content h2 {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: var(--win95-black);
}

.ie-project h3 {
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 4px 0;
    color: var(--win95-black);
}

.ie-project p {
    margin: 0 0 4px 0;
    color: var(--win95-black);
}

.ie-content a {
    color: var(--win95-blue);
    text-decoration: underline;
}

.ie-content a:hover {
    color: var(--win95-red);
}

.ie-content a:visited {
    color: #800080;
}

/* Mobile responsiveness for IE window */
@media (max-width: 600px) {
    .ie-content {
        padding: 12px;
        font-size: 14px;
    }
    
    .ie-toolbar {
        font-size: 12px;
    }
    
    .ie-address-input {
        font-size: 12px;
    }
}

/* Windows 95 Desktop Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MS Sans Serif', sans-serif;
    background: var(--win95-teal);
    background-image: 
        linear-gradient(45deg, rgba(0,0,0,0.05) 25%, transparent 25%), 
        linear-gradient(-45deg, rgba(0,0,0,0.05) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.05) 75%), 
        linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.05) 75%);
    background-size: 4px 4px;
    background-position: 0 0, 0 2px, 2px -2px, -2px 0px;
    height: 100vh;
    height: var(--viewport-height, 100vh); /* Fallback for older browsers */
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    user-select: none;
}

/* Desktop override - keep original behavior */
@media (min-width: 601px) {
    body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }
}

.desktop {
    width: 100%;
    height: 100vh;
    height: var(--viewport-height, 100vh); /* Fallback for older browsers */
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Desktop Icons */
.desktop-icons {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 2px;
    transition: background-color 0.1s;
}

.desktop-icon:hover {
    background-color: rgba(0, 0, 128, 0.3);
}

.desktop-icon:focus {
    outline: 1px dotted var(--win95-white);
    background-color: rgba(0, 0, 128, 0.5);
}

.desktop-icon.selected {
    background-color: rgba(0, 0, 128, 0.5);
}

.icon-image {
    font-size: 32px;
    line-height: 32px;
    text-align: center;
}

.icon-label {
    color: var(--win95-white);
    font-size: 11px;
    text-align: center;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.8);
    word-wrap: break-word;
    max-width: 70px;
    margin-top: 4px;
}

.sysinfo-icon {
    /* No background needed for info icon */
}

/* De-prioritise game icons – they always appear last */
.desktop-icon.games-icon {
    order: 99;
}

/* Taskbar */
.taskbar {
    height: 40px;
    background: var(--win95-gray);
    border-top: 2px solid var(--win95-light-gray);
    border-left: 2px solid var(--win95-light-gray);
    border-right: 2px solid var(--win95-dark-gray);
    border-bottom: 2px solid var(--win95-dark-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    /* Ensure taskbar stays above mobile browser UI */
    margin-bottom: env(safe-area-inset-bottom, 0);
}

.start-button {
    height: 32px;
    padding: 0 8px;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.start-button:active {
    border: 2px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
}

.start-logo {
    font-size: 16px;
}

.lang-toggle {
    height: 28px;
    padding: 0 6px;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    margin-right: 8px;
}

.lang-toggle:hover {
    background: var(--win95-light-gray);
}

.lang-toggle:active {
    border: 2px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
}

.taskbar-clock {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    padding: 4px 8px;
    border: 1px inset var(--win95-gray);
    background: var(--win95-gray);
    min-width: 60px;
    text-align: center;
}

.start-button.active {
    border: 2px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
    background: var(--win95-dark-gray);
}

/* Start Menu */
.start-menu {
    position: fixed;
    bottom: 42px;
    left: 2px;
    width: 200px;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    z-index: 1001;
    display: none;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.start-menu.show {
    display: block;
}

.start-menu-list {
    list-style: none;
    margin: 0;
    padding: 2px;
}

.start-menu-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    position: relative;
    color: var(--win95-black);
}

.start-menu-item:hover {
    background: var(--win95-blue);
    color: var(--win95-white);
}

/* Submenu visibility is now controlled by JavaScript */

.menu-icon {
    width: 16px;
    margin-right: 8px;
    font-size: 12px;
}

.menu-text {
    flex: 1;
}

.menu-arrow {
    font-size: 8px;
    margin-left: 4px;
}

.start-menu-separator {
    height: 1px;
    background: var(--win95-dark-gray);
    margin: 2px 8px;
    border-bottom: 1px solid var(--win95-light-gray);
}

/* Submenus */
.submenu {
    position: absolute;
    left: 100%;
    top: -2px;
    width: 180px;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    list-style: none;
    margin: 0;
    padding: 2px;
    display: none;
    z-index: 1002;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--win95-black);
}

.submenu-item:hover {
    background: var(--win95-blue);
    color: var(--win95-white);
}

.submenu-icon {
    width: 16px;
    margin-right: 8px;
    font-size: 12px;
}

.submenu-text {
    flex: 1;
}

.submenu-separator {
    height: 1px;
    background: var(--win95-dark-gray);
    margin: 2px 8px;
    border-bottom: 1px solid var(--win95-light-gray);
}

/* Windows */
.win95-window {
    position: absolute;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    min-width: 200px;
    min-height: 100px;
    z-index: 1;
}

.win95-window.active {
    z-index: 1000;
}

.window-titlebar {
    height: 18px;
    background: var(--win95-blue);
    color: var(--win95-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0 2px;
    font-size: 11px;
    font-weight: bold;
    cursor: move;
}

.window-titlebar.inactive {
    background: var(--win95-dark-gray);
}

.window-title {
    flex: 1;
    text-align: left;
    padding-left: 2px;
    padding-right: 2px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.window-controls {
    display: flex;
    gap: 1px;
    flex-shrink: 0;
    margin-left: auto;
}

.window-control-btn {
    width: 20px;
    height: 18px;
    background: var(--win95-gray);
    border: 1px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'MS Sans Serif', sans-serif;
    font-weight: bold;
}

.window-control-btn:active {
    border: 1px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
}

.window-content {
    padding: 8px;
    height: calc(100% - 18px);
    overflow: auto;
}

/* Dialog content styling */
.dialog-content {
    padding: 4px;
    line-height: 1.4;
}

.dialog-content h3 {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: var(--win95-black);
}

.dialog-content p {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    color: var(--win95-black);
}

.dialog-content ul {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    color: var(--win95-black);
}

.dialog-content ol {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    color: var(--win95-black);
}

/* Logo ASCII styling in dialogs */
.logo-ascii {
    font-family: 'Courier New', monospace !important;
    font-size: 10px;
    line-height: 1.1;
    color: var(--win95-black);
    background: transparent;
    border: none;
    padding: 10px;
    margin: 0 auto;
    display: block;
    text-align: left;
    white-space: pre;
    overflow-x: auto;
    max-width: fit-content;
    letter-spacing: 0;
    word-spacing: 0;
}

/* Terminal styles adapted for windows */
.terminal {
    width: 100%;
    background-color: var(--win95-black);
    color: var(--win95-white);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', monospace;
    border: 2px inset var(--win95-gray);
}

.terminal-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    background-color: var(--win95-black);
    color: var(--win95-white);
}

.terminal-input-line {
    display: flex;
    padding: 4px 8px;
    background-color: var(--win95-black);
    align-items: baseline;
    line-height: 1.2;
}

.prompt {
    color: var(--win95-white);
    margin-right: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: nowrap;
    line-height: 1.2;
}

.terminal-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.input-display {
    font-size: 14px;
    font-family: 'Courier New', monospace;
    color: var(--win95-white);
    line-height: 1.2;
    min-height: 16px;
}

.terminal-input:focus {
    background: transparent;
    border: none;
    outline: none;
    caret-color: transparent;
}

/* DOS-style blinking cursor animation */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Custom cursor for DOS feel - always visible and blinking */
.dos-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background-color: var(--win95-white);
    margin-left: 0;
    margin-right: 0;
    vertical-align: baseline;
    position: relative;
    top: 2px;
    animation: blink 1s infinite;
}

/* Contact Form Styles */
.contact-form {
    font-family: 'MS Sans Serif', sans-serif;
    padding: 16px;
}

.contact-form h2 {
    font-size: 14px;
    margin-bottom: 16px;
    color: var(--win95-black);
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
    color: var(--win95-black);
}

.form-group .required {
    color: #cc0000;
    font-weight: normal;
    font-size: 10px;
    margin-left: 4px;
}

.form-group .optional {
    color: #666666;
    font-weight: normal;
    font-style: italic;
    font-size: 10px;
    margin-left: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 4px;
    border: 2px inset var(--win95-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    background: var(--win95-white);
}

.form-group textarea {
    height: 80px;
    resize: none;
}

.form-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-win95 {
    padding: 4px 16px;
    background: var(--win95-gray);
    border: 2px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    cursor: pointer;
    min-width: 60px;
}

.btn-win95:active {
    border: 2px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    /* Prevent zoom on double tap and ensure fast taps */
    * {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Ensure buttons and interactive elements respond quickly */
    button, .desktop-icon, .start-menu-item, .submenu-item, .lang-toggle {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }
    
    /* Ensure interactive elements support pointer events */
    .desktop-icon, .start-menu-item, .submenu-item, .lang-toggle, .start-button {
        pointer-events: auto;
    }
    
    /* Smooth scrolling for better keyboard handling */
    html {
        scroll-behavior: smooth;
    }
    
    body {
        /* Ensure body can scroll */
        overflow-x: hidden;
        overflow-y: auto;
        /* Remove any height restrictions that could prevent scrolling */
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    /* Better touch targets */
    .desktop-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    .start-button {
        height: 36px;
        min-height: 36px;
        min-width: 40px;
        padding: 0 6px;
        justify-content: center;
    }
    
    /* Keep window control buttons small to fit titlebar */
    .window-control-btn {
        min-height: 18px !important;
        min-width: 20px !important;
        height: 18px !important;
        width: 20px !important;
        font-size: 10px !important;
    }
    .desktop-icons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
        padding: calc(env(safe-area-inset-top, 0) + 10px) 10px 10px 10px;
        gap: 10px;
        /* Prevent icons from expanding beyond their content */
        align-content: flex-start;
        /* Ensure icons area doesn't overlap with fixed taskbar */
        margin-bottom: 50px;
    }
    
    .desktop-icon {
        width: 70px;
        height: auto;
        flex-shrink: 0;
        /* Ensure the clickable area matches the visual size */
        max-height: 90px;
        overflow: hidden;
    }
    
    /* Mobile view keeps same priority; rule repeats only for clarity */
    .desktop-icon.games-icon {
        order: 99;
    }
    
    .win95-window {
        top: 50px !important; /* Fallback for browsers that don't support max() */
        top: max(50px, env(safe-area-inset-top, 0) + 30px) !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - 150px) !important; /* Basic fallback - more conservative height */
        height: calc(100vh - 150px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important; /* Fallback */
        height: calc(100dvh - 150px - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0)) !important;
        max-height: 70vh !important; /* Ensure window never takes more than 70% of viewport */
        border-radius: 0;
        border: none;
        border-bottom: 2px solid var(--win95-dark-gray);
    }
    
    .taskbar {
        height: 40px;
        position: fixed;
        bottom: env(safe-area-inset-bottom, 0);
        left: 0;
        right: 0;
        z-index: 9999;
    }
    
        .start-text {
        display: none;
    }
    
    .start-logo {
        font-size: 12px;
    }

    .icon-label {
        font-size: 10px;
        max-width: 70px;
        line-height: 1.2;
        overflow-wrap: break-word;
        hyphens: auto;
        margin-top: 4px;
    }
    
    /* Start Menu Mobile Styles */
    .start-menu {
        width: 280px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        bottom: 40px;
        left: 2px;
        z-index: 1001;
    }
    
    .submenu {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 40px;
        width: 280px;
        height: calc(100vh - 40px);
        overflow-y: auto;
        z-index: 1003;
        background: var(--win95-gray);
        border: 2px solid var(--win95-light-gray);
        border-right-color: var(--win95-dark-gray);
        border-bottom-color: var(--win95-dark-gray);
        box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    }
    
    .start-menu-item,
    .submenu-item {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 128, 0.3);
        user-select: none;
    }
    
    .start-menu-item:active,
    .submenu-item:active,
    .start-menu-item:hover,
    .submenu-item:hover {
        background: var(--win95-blue) !important;
        color: var(--win95-white) !important;
    }
    
    /* Better touch feedback */
    .start-menu-item:focus,
    .submenu-item:focus {
        background: var(--win95-blue) !important;
        color: var(--win95-white) !important;
        outline: none;
    }
    
    .menu-icon,
    .submenu-icon {
        font-size: 16px;
        margin-right: 12px;
        width: 20px;
    }
    
    .menu-arrow {
        font-size: 12px;
        margin-left: auto;
    }
    
    .back-button {
        border-bottom: 1px solid var(--win95-dark-gray);
        margin-bottom: 4px;
        font-weight: bold;
    }
    
    .back-button:hover,
    .back-button:active {
        background: var(--win95-blue) !important;
        color: var(--win95-white) !important;
    }
    
    /* Mobile submenu copy styles */
    .mobile-submenu {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 40px !important;
        width: 280px !important;
        height: calc(100vh - 40px) !important;
        overflow-y: auto !important;
        z-index: 1003 !important;
        background: var(--win95-gray) !important;
        border: 2px solid var(--win95-light-gray) !important;
        border-right-color: var(--win95-dark-gray) !important;
        border-bottom-color: var(--win95-dark-gray) !important;
        box-shadow: 2px 2px 4px rgba(0,0,0,0.3) !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 2px !important;
        display: none !important;
    }
    
    .mobile-submenu.show {
        display: block !important;
    }
}

/* Terminal output styling */
.command-output {
    margin-bottom: 8px;
    line-height: 1.4;
    font-family: 'Courier New', monospace;
    color: var(--win95-white);
    white-space: pre-wrap;
}

.command-line {
    display: flex;
    margin-bottom: 2px;
    font-family: 'Courier New', monospace;
    color: var(--win95-white);
}

.command-text {
    margin-left: 4px;
    color: var(--win95-white);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 16px;
}

::-webkit-scrollbar-track {
    background: var(--win95-gray);
    border: 1px inset var(--win95-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--win95-gray);
    border: 1px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--win95-light-gray);
}

::-webkit-scrollbar-button {
    background: var(--win95-gray);
    border: 1px solid var(--win95-light-gray);
    border-right-color: var(--win95-dark-gray);
    border-bottom-color: var(--win95-dark-gray);
    height: 16px;
}

::-webkit-scrollbar-button:active {
    border: 1px solid var(--win95-dark-gray);
    border-right-color: var(--win95-light-gray);
    border-bottom-color: var(--win95-light-gray);
}

/* Responsive styles */
@media (max-width: 600px) {
    .terminal {
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        /* Ensure terminal input area is visible */
        padding-bottom: 20px;
    }
    
    body {
        padding: 0;
    }
    

    
    /* Adjust font size for mobile to ensure ASCII art displays correctly */
    .terminal-content {
        font-size: 14px;
        letter-spacing: -0.5px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Ensure terminal input line is visible and accessible */
    .terminal-input-line {
        padding: 8px;
        margin-bottom: 5px;
        background-color: var(--win95-black);
        position: sticky;
        bottom: 0;
        /* Add subtle border to make it more visible during scroll */
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        /* Ensure it stays above other content */
        z-index: 10;
    }
    
    /* Force monospace display for ASCII art with proper text wrapping */
    .terminal-content pre,
    .command-output {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        overflow-x: hidden;
        font-family: monospace;
    }
    
    /* Exception for ASCII art - preserve exact formatting */
    .command-output.ascii-art {
        white-space: pre;
        word-wrap: normal;
        overflow-wrap: normal;
        overflow-x: auto;
        font-size: 12px;
        letter-spacing: -0.5px;
        line-height: 1.1;
    }
    
    /* Ensure command text wraps properly on mobile */
    .command-text {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
    
    /* Mobile Snake game adjustments */
    .snake-grid {
        touch-action: none; /* Prevent browser handling of swipes */
    }
    
    /* Style for mobile game controls */
    .game-controls-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 20px;
    }
    
    /* Fixed overlay controls for mobile Snake game */
    .overlay-controls {
        position: fixed;
        bottom: 60px;          /* above taskbar */
        left: 50%;
        transform: translateX(-50%);
        z-index: 10000;
        opacity: 0.85;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        background: rgba(192, 192, 192, 0.2);
        padding: 8px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(2px);
    }
    
    .control-row {
        display: flex;
        margin: 5px 0;
    }
    
    .control-button {
        width: 50px;
        height: 50px;
        margin: 0 5px;
        background: var(--win95-gray);
        border: 2px solid var(--win95-light-gray);
        border-right-color: var(--win95-dark-gray);
        border-bottom-color: var(--win95-dark-gray);
        color: var(--win95-black);
        font-size: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        user-select: none;
        font-family: 'MS Sans Serif', sans-serif;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 128, 0.3);
    }
    
    .control-button:active,
    .control-button:focus {
        border: 2px solid var(--win95-dark-gray);
        border-right-color: var(--win95-light-gray);
        border-bottom-color: var(--win95-light-gray);
        background: var(--win95-dark-gray);
    }
    
    /* Enhanced styling for overlay controls */
    .overlay-controls .control-button {
        background: rgba(192, 192, 192, 0.9);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .overlay-controls .control-button:active,
    .overlay-controls .control-button:focus {
        background: rgba(128, 128, 128, 0.9);
        transform: translateY(1px);
    }
    
    /* Style for game exit button */
    .exit-game-button {
        display: block;
        margin: 15px auto;
        padding: 8px 16px;
        background: var(--win95-gray);
        border: 2px solid var(--win95-light-gray);
        border-right-color: var(--win95-dark-gray);
        border-bottom-color: var(--win95-dark-gray);
        color: var(--win95-black);
        font-family: 'MS Sans Serif', sans-serif;
        font-size: 11px;
        cursor: pointer;
    }
    
    /* Game over buttons styling */
    .game-over-buttons {
        margin: 20px 0;
    }
    
    .game-over-button {
        padding: 8px 16px;
        margin: 0 5px;
        background: var(--win95-gray);
        border: 2px solid var(--win95-light-gray);
        border-right-color: var(--win95-dark-gray);
        border-bottom-color: var(--win95-dark-gray);
        color: var(--win95-black);
        font-family: 'MS Sans Serif', sans-serif;
        font-size: 11px;
        cursor: pointer;
        min-width: 80px;
        touch-action: manipulation;
    }
    
    .game-over-button:active,
    .game-over-button:focus {
        border: 2px solid var(--win95-dark-gray);
        border-right-color: var(--win95-light-gray);
        border-bottom-color: var(--win95-light-gray);
        background: var(--win95-dark-gray);
    }
    
    .game-over-button:hover {
        background: var(--win95-light-gray);
    }
    
    .exit-game-button:active {
        border: 2px solid var(--win95-dark-gray);
        border-right-color: var(--win95-light-gray);
        border-bottom-color: var(--win95-light-gray);
    }
}



/* Matrix mode styling */
.matrix-mode {
    background-color: #000 !important;
    color: #00ff41 !important;
    text-shadow: 0 0 5px #00ff41;
    font-family: 'Courier New', monospace;
}

.matrix-mode .terminal-content {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="black" /><text x="5" y="30" fill="rgba(0,255,65,0.2)" font-family="monospace" font-size="20">10110</text><text x="30" y="15" fill="rgba(0,255,65,0.1)" font-family="monospace" font-size="15">01001</text><text x="60" y="50" fill="rgba(0,255,65,0.15)" font-family="monospace" font-size="25">0110</text><text x="15" y="70" fill="rgba(0,255,65,0.12)" font-family="monospace" font-size="18">1010</text><text x="40" y="85" fill="rgba(0,255,65,0.18)" font-family="monospace" font-size="22">0101</text></svg>');
    background-repeat: repeat;
}

.matrix-mode .command-output,
.matrix-mode .command-text,
.matrix-mode .input-display {
    color: #00ff41 !important;
    text-shadow: 0 0 5px #00ff41;
}

.matrix-mode .prompt {
    color: #00ff41 !important;
    text-shadow: 0 0 8px #00ff41;
}

/* Matrix mode - better visibility for logo and UI elements */
.matrix-mode .logo-ascii {
    color: #00ff41 !important;
    text-shadow: 0 0 3px #00ff41;
    font-weight: bold;
}

.matrix-mode .taskbar-clock {
    color: #00ff41 !important;
    background-color: #000 !important;
    border-color: #00ff41 !important;
    text-shadow: 0 0 3px #00ff41;
}

.matrix-mode .taskbar {
    background-color: #001100 !important;
    border-color: #00ff41 !important;
}

.matrix-mode .start-button {
    background-color: #001100 !important;
    color: #00ff41 !important;
    border-color: #00ff41 !important;
    text-shadow: 0 0 3px #00ff41;
}

.matrix-mode .dialog-content h3,
.matrix-mode .dialog-content p,
.matrix-mode .dialog-content ul,
.matrix-mode .dialog-content ol {
    color: #00ff41 !important;
    text-shadow: 0 0 2px #00ff41;
}

.matrix-mode .win95-window {
    background-color: #000 !important;
    border-color: #00ff41 !important;
}

.matrix-mode .window-titlebar {
    background-color: #003300 !important;
    color: #00ff41 !important;
    border-color: #00ff41 !important;
}

.matrix-mode .window-content {
    background-color: #000 !important;
}

/* Minesweeper Game Styles */
:root {
    --ms-cell-size: clamp(22px, 8.5vw, 38px);
}

.ms-game {
    padding: 12px;
    background: var(--win95-gray);
    font-family: 'MS Sans Serif', sans-serif;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: calc(9 * var(--ms-cell-size));
    padding: 8px;
    background: var(--win95-gray);
    border: 2px inset var(--win95-gray);
}

.ms-counter {
    display: flex;
    background: var(--win95-black);
    border: 1px inset var(--win95-gray);
    padding: 2px 4px;
    min-width: 48px;
    justify-content: center;
}

.ms-digit {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 1px 1px 0px #800000;
    background: var(--win95-black);
    width: 14px;
    text-align: center;
    line-height: 1.2;
}

.ms-face {
    font-size: 24px;
    width: 36px;
    height: 36px;
    border: 2px outset var(--win95-gray);
    background: var(--win95-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
}

.ms-face:active {
    border: 2px inset var(--win95-gray);
}

.ms-board {
    display: grid;
    gap: 0;
    border: 3px inset var(--win95-gray);
    background: var(--win95-gray);
    padding: 2px;
}

.ms-cell {
    width: var(--ms-cell-size);
    height: var(--ms-cell-size);
    border: none;
    background: var(--win95-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: calc(var(--ms-cell-size) * 0.6);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.ms-cell-hidden {
    border: 2px outset var(--win95-gray);
}

.ms-cell-hidden:active {
    border: 1px inset var(--win95-gray);
}

.ms-cell-revealed {
    border: 1px inset var(--win95-gray);
    background: var(--win95-light-gray);
}

.ms-cell-mine {
    border: 1px inset var(--win95-gray);
    background: var(--win95-red);
    color: var(--win95-black);
}

.ms-cell-mine-undetonated {
    border: 1px inset var(--win95-gray);
    background: var(--win95-light-gray);
    color: var(--win95-black);
}

.ms-cell-flagged {
    border: 2px outset var(--win95-gray);
}

/* Number colors like classic Minesweeper */
.ms-cell-1 { color: #0000ff; }
.ms-cell-2 { color: #008000; }
.ms-cell-3 { color: #ff0000; }
.ms-cell-4 { color: #000080; }
.ms-cell-5 { color: #800000; }
.ms-cell-6 { color: #008080; }
.ms-cell-7 { color: #000000; }
.ms-cell-8 { color: #808080; }

.ms-mobile-controls {
    display: none;
    width: 100%;
    max-width: calc(9 * var(--ms-cell-size));
    margin-top: 8px;
}

.ms-mode-toggle {
    width: 100%;
    height: 40px;
    background: var(--win95-gray);
    border: 2px outset var(--win95-gray);
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ms-mode-toggle:active {
    border: 2px inset var(--win95-gray);
}

.ms-mode-toggle.active {
    background: var(--win95-dark-gray);
    border: 2px inset var(--win95-gray);
}

.mode-icon {
    font-size: 16px;
}

.mode-text {
    font-weight: bold;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    .ms-game {
        --ms-cell-size: clamp(28px, 9vw, 42px);
        padding: 8px;
        gap: 6px;
    }
    
    .ms-mobile-controls {
        display: block;
    }
    
    .ms-header {
        padding: 6px;
    }
    
    .ms-digit {
        font-size: 16px;
        width: 12px;
    }
    
    .ms-face {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }
    
    .ms-cell {
        font-size: calc(var(--ms-cell-size) * 0.5);
    }
    
    /* Prevent zoom on touch */
    .ms-board {
        touch-action: manipulation;
    }
    
    .ms-cell {
        touch-action: manipulation;
    }
}



