@import url('https://fonts.cdnfonts.com/css/digital-7-mono');

/* Structural Mobile Layout Fixes */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: #008080;
    font-family: 'Pixelated MS Sans Serif', Arial;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    
    /* THE TEXT RENDERING FIX */
    -webkit-font-smoothing: none;
    font-smooth: never;
    font-size: 14px;
}

/* Global Input & Textarea Readability Bump */
input[type="text"], textarea, button {
    font-size: 14px !important;
    font-family: 'Pixelated MS Sans Serif', Arial !important;
}

.window-body {
    font-size: 14px;
}

/* Scrollable Desktop Area */
.desktop {
    padding: 20px;
    height: calc(100% - 35px); 
    overflow-y: auto; 
    display: flex;
    flex-direction: column;
    gap: 20px; 
    align-items: flex-start;
    box-sizing: border-box;
}

.desktop-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; 
}

/* Category Headers - Updated Font */
.desktop-section-title {
    color: white;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-weight: normal;
    font-size: 24px;
    margin-top: 10px;
    margin-bottom: -10px; 
    text-shadow: 1px 1px 0 #000;
    width: 100%;
    padding-bottom: 5px;
}

.bg-cutout {
    position: absolute;
    bottom: 35px;
    right: 0;
    width: 60%;
    height: 80%;
    background-image: url('ts-background.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom right;
    z-index: -1;
    opacity: 0.8;
}

.icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    cursor: pointer;
    color: white;
    text-align: center;
}

.icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px dotted white;
}

.icon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 5px;
    image-rendering: pixelated;
}

.icon.selected span {
    background-color: #000080;
    color: white;
    outline: 1px dotted white;
}

.icon span {
    font-size: 14px; /* BUMPED from 12px */
    background-color: transparent;
    color: white;
    padding: 4px 6px; /* BUMPED padding */
    line-height: 1.2;
}

.icon span.dark-text {
    color: black;
}
.icon.selected span.dark-text {
    color: white; 
}

.icon.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

/* BULLETPROOF MODAL POSITIONING */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}

.submit-row {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

/* --- Taskbar --- */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35px;
    background-color: #c0c0c0;
    border-top: 2px solid #dfdfdf;
    display: flex;
    align-items: center;
    padding: 0 4px;
    box-sizing: border-box;
    z-index: 1000;
}

.start-button {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 28px;
}

.start-button img {
    height: 16px;
    width: 16px;
}

.taskbar-time {
    margin-left: auto;
    border: 2px inset #dfdfdf;
    padding: 2px 8px;
    height: 24px;
    display: flex;
    align-items: center;
    font-size: 14px; /* BUMPED */
}

/* --- Start Menu & Dropdowns --- */
.start-menu {
    position: fixed;
    bottom: 35px;
    left: 0;
    width: 200px;
    min-height: 240px;
    display: flex;
    flex-direction: row;
    z-index: 1001;
    padding: 2px;
}

.start-menu-sidebar {
    background: linear-gradient(to bottom, #000080, #1084d0);
    width: 30px;
    color: white;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding-bottom: 10px;
}

.start-menu-sidebar span {
    transform: rotate(-90deg);
    transform-origin: left bottom;
    position: absolute;
    bottom: 10px;
    left: 20px;
    font-weight: bold;
    white-space: nowrap;
    font-size: 16px; /* BUMPED */
}

.start-menu-items {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.menu-item {
    padding: 8px 12px; /* BUMPED */
    font-size: 14px; /* BUMPED */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    position: relative;
}

.menu-item:hover {
    background-color: #000080;
    color: white;
}

.submenu {
    position: absolute;
    left: 100%;
    bottom: 0;
    width: 200px;
    padding: 2px;
    z-index: 1002;
}

.solid-submenu {
    background-color: #c0c0c0 !important;
    border: 2px outset #dfdfdf !important;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5) !important;
    z-index: 10000 !important;
    padding: 2px !important;
}

.solid-submenu .menu-item {
    background-color: #c0c0c0 !important; 
    color: black !important;
}

.solid-submenu .menu-item:hover {
    background-color: #000080 !important; 
    color: white !important; 
}

/* --- ARCADE INPUT STYLING --- */
.arcade-input {
    width: 100%;
    background: black !important;
    border: 1px solid #00ff00;
    color: #00ff00 !important;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 4px;
    margin-bottom: 8px;
    box-sizing: border-box;
    outline: none;
}
.arcade-input::placeholder { color: #005500; }
.arcade-input:focus { border: 1px solid white; color: white !important; }

/* --- BROWSER AUTOFILL HIJACK DEFEAT --- */
.arcade-input:-webkit-autofill,
.arcade-input:-webkit-autofill:hover, 
.arcade-input:-webkit-autofill:focus, 
.arcade-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px black inset !important;
    -webkit-text-fill-color: #00ff00 !important;
    transition: background-color 5000s ease-in-out 0s;
}


/* --- Toolbars --- */
.browser-toolbar {
    display: flex;
    align-items: center;
    padding: 4px;
    background-color: #c0c0c0;
    border-bottom: 2px groove #dfdfdf;
    margin-bottom: 2px;
}

.browser-toolbar span {
    margin-right: 15px;
    cursor: default;
    font-size: 14px; /* BUMPED */
}

/* --- PAINT APP UI UPGRADE --- */
.paint-layout {
    display: flex;
    flex-direction: column;
    background-color: #c0c0c0;
    padding: 2px;
    box-sizing: border-box;
}

.paint-workspace {
    display: flex;
    flex-direction: row;
    border-bottom: 2px groove #dfdfdf;
    width: 100%;
    box-sizing: border-box;
}

.paint-toolbar-side {
    width: 36px;
    flex-shrink: 0; 
    padding: 4px 0; /* Changed to 0 horizontal padding, relying on center alignment instead */
    display: flex;
    flex-direction: column;
    align-items: center; /* CRITICAL FIX: Stops the buttons from stretching sideways */
    gap: 4px;
    background: #c0c0c0;
    border-right: 2px inset #dfdfdf;
    box-sizing: border-box;
    z-index: 2; 
}

.tool-btn {
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
    height: 26px !important;
    flex-shrink: 0;
    border: 2px outset #dfdfdf;
    background: #c0c0c0;
    padding: 0 !important; /* Strips all hidden global button padding */
    margin: 0 !important; /* Strips all hidden global button margins */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box; 
}

.tool-btn.active {
    border: 2px inset #dfdfdf;
    background: #dfdfdf;
}

.tool-btn img {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
}

.paint-canvas-area {
    flex: 1; /* Takes up remaining space */
    min-width: 0; /* CRITICAL: Allows the box to shrink below 400px on mobile without breaking the layout */
    padding: 4px;
    background: #808080;
    display: flex;
    align-items: flex-start; /* Removed center-alignment to prevent the left-bleed overlap */
    overflow: hidden;
    box-sizing: border-box;
}

#paint-canvas {
    border: 2px inset #dfdfdf;
    max-width: 100%;
    height: auto; /* Keeps proportions perfect if it scales down on mobile */
    object-fit: contain;
    cursor: crosshair;
    margin: 0 auto; /* Safely centers the canvas horizontally without overlapping the left toolbar */
    display: block; 
}

.paint-palette-area {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #c0c0c0;
}

.active-color-wrapper {
    width: 36px;
    height: 36px;
    border: 2px inset #dfdfdf;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #c0c0c0;
    flex-shrink: 0;
}

#active-color-swatch {
    width: 18px;
    height: 18px;
    border: 1px solid #808080;
    background: #000000;
}

/* 14 columns, 2 rows exactly like original Win95 */
.color-grid {
    display: grid;
    grid-template-columns: repeat(14, 16px);
    grid-template-rows: repeat(2, 16px);
    border: 2px inset #dfdfdf;
    background: white;
}

.color-swatch {
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border-right: 1px solid #c0c0c0;
    border-bottom: 1px solid #c0c0c0;
    cursor: pointer;
}

.color-swatch:hover {
    border: 1px solid white;
}

/* Paint Toolbar */
.color-btn {
    width: 16px;
    height: 16px;
    border: 2px outset #dfdfdf;
    padding: 0;
    cursor: pointer;
}
.color-btn:active {
    border: 2px inset #dfdfdf;
}

/* --- Windows Media Player --- */
.player-body {
    background-color: #c0c0c0;
    padding: 10px;
}

.wmp-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.wmp-logo-img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.wmp-header-text {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.wmp-screen {
    background-color: black;
    border: 2px inset #dfdfdf;
    height: 120px;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #00ff00;
}

.wmp-branding {
    font-size: 12px; /* BUMPED */
    color: gray;
}

.wmp-track-info {
    font-weight: bold;
    margin-top: 10px;
    text-align: center;
    padding: 0 10px;
    font-size: 14px; /* BUMPED */
}

.wmp-time-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 32px; /* Bumped up to fit the 7-segment proportions */
    margin-top: 5px;
    font-family: 'Digital-7 Mono', monospace; /* The true 7-segment font */
    color: #00ff00;
    text-shadow: 0px 0px 4px rgba(0, 255, 0, 0.5); 
    line-height: 1;
}

/* --- FLAT FILL PROGRESS BAR OVERRIDE (PHANTOM LINE FIX) --- */
input[type=range]#seek-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 14px;
    background: #808080; 
    border: 2px inset #dfdfdf;
    cursor: pointer;
    outline: none;
}

/* 1. Annihilate the native WebKit track groove (Fixes the black line) */
input[type=range]#seek-bar::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    background: transparent;
    border: none;
    height: 100%;
}

/* 2. Crush the WebKit thumb to absolute zero */
input[type=range]#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 0px;
    height: 0px;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* 3. Annihilate the native Mozilla track groove */
input[type=range]#seek-bar::-moz-range-track {
    background: transparent;
    border: none;
    height: 100%;
}

/* 4. Crush the Mozilla thumb to absolute zero */
input[type=range]#seek-bar::-moz-range-thumb {
    width: 0px;
    height: 0px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.wmp-controls {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.wmp-controls button {
    width: 45px;
    height: 30px;
    font-size: 18px; /* BUMPED */
}


/* --- Boot / Shutdown Screen --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 100000; /* Absolute Top Level */
    display: flex;
    justify-content: center;
    align-items: center;
}

.boot-logo {
    text-align: left;
}

.ms-logo {
    color: white;
    font-style: italic;
    font-family: 'Times New Roman', serif;
    font-size: 24px;
    margin: 0;
    font-weight: normal;
}

.win-logo {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 50px;
    margin: 0;
    letter-spacing: -2px;
}

#shutdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: black;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shutdown-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.shutdown-content h1 {
    color: #ff8c00;
    font-family: Arial, sans-serif;
    font-size: 24px;
    text-align: center;
    margin: 0 20px;
}

.shutdown-content button {
    font-family: 'Pixelated MS Sans Serif', Arial;
    font-size: 16px;
    padding: 8px 20px;
    cursor: pointer;
}

/* --- THE GLITCH ENGINE --- */
.glitch-clone {
    position: absolute !important;
    pointer-events: none; /* Crucial: Prevents the artifacts from blocking real clicks */
    z-index: 50; /* Spawns above desktop, but safely below windows and taskbar */
}

/* --- CUSTOM WIN95 SEARCHABLE COMBOBOX --- */
.combo-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}
.combo-input {
    width: 100%;
    border: 2px inset #dfdfdf;
    padding: 2px 20px 2px 4px; /* Leaves room for the arrow */
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    background: #ffffff;
}
.combo-arrow {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 16px;
    background: #dfdfdf url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='100%25'%3E%3Crect width='16' height='100%25' fill='%23dfdfdf' /%3E%3Cpath d='M-1,0 L-1,100%25 L0,100%25 L0,0 Z' fill='%23808080'/%3E%3Cpolygon points='4,8 12,8 8,13' fill='black' /%3E%3C/svg%3E") no-repeat center;
    border: 1px outset #fff;
    cursor: pointer;
}
.combo-arrow:active {
    border: 1px inset #fff;
}
.combo-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 150px; /* Forces a scrollbar if the list is too long */
    overflow-y: auto;
    background: #fff;
    border: 1px solid #000;
    z-index: 100000;
    display: none;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}
.combo-item {
    padding: 2px 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: #000;
}
.combo-item:hover {
    background: #0000aa;
    color: #fff;
}

/* --- JUMP SCARE 30FPS SHAKE ENGINE --- */
@keyframes hardcore-shake {
    0% { transform: translateX(-25px) translateY(15px) scale(1.05); }
    25% { transform: translateX(25px) translateY(-15px) scale(1.05); }
    50% { transform: translateX(-25px) translateY(-15px) scale(1.05); }
    75% { transform: translateX(25px) translateY(15px) scale(1.05); }
    100% { transform: translateX(-25px) translateY(15px) scale(1.05); }
}

.shake-active {
    /* 0.133s duration = exactly 7.5 cycles per second. 
       7.5 cycles × 4 frames per cycle = a flawless 30 frames per second. */
    animation: hardcore-shake 0.133s infinite step-end;
}

/* --- CUSTOM SEARCHABLE DROPDOWN --- */
.arcade-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: black;
    border: 1px solid #00ff00;
    border-top: none;
    max-height: 140px;
    overflow-y: auto;
    z-index: 1000;
    font-family: 'VT323', monospace;
    color: #00ff00;
    box-shadow: 0px 5px 15px rgba(0,0,0,0.9);
}

.arcade-dropdown-item {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 16px;
    text-transform: uppercase;
}

.arcade-dropdown-item:hover, .arcade-dropdown-item.active-selection {
    background: #00ff00;
    color: black;
}

/* Retro Scrollbar for the Dropdown */
.arcade-dropdown-list::-webkit-scrollbar {
    width: 10px;
}
.arcade-dropdown-list::-webkit-scrollbar-track {
    background: black;
    border-left: 1px solid #005500;
}
.arcade-dropdown-list::-webkit-scrollbar-thumb {
    background: #00ff00;
}

/* --- CUSTOM SEARCHABLE DROPDOWN --- */
.arcade-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: black;
    border: 1px solid #00ff00;
    border-top: none;
    max-height: 140px;
    overflow-y: auto;
    z-index: 1000;
    font-family: 'VT323', monospace;
    color: #00ff00;
    box-shadow: 0px 5px 15px rgba(0,0,0,0.9);
}

.arcade-dropdown-item {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 16px;
    text-transform: uppercase;
}

.arcade-dropdown-item:hover, .arcade-dropdown-item.active-selection {
    background: #00ff00;
    color: black;
}

/* Retro Scrollbar for the Dropdown */
.arcade-dropdown-list::-webkit-scrollbar {
    width: 10px;
}
.arcade-dropdown-list::-webkit-scrollbar-track {
    background: black;
    border-left: 1px solid #005500;
}
.arcade-dropdown-list::-webkit-scrollbar-thumb {
    background: #00ff00;
}

/* --- BULLETPROOF ARCADE CHECKBOX (PROXY METHOD) --- */

/* 1. Shrink and completely hide the native browser checkbox */
.arcade-hidden-check {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

/* 2. Build an indestructible HTML element to act as our visual box */
.arcade-custom-box {
    width: 18px;
    height: 18px;
    min-width: 18px;
    background-color: black;
    border: 2px solid #00ff00;
    flex-shrink: 0; /* Immune to flexbox crushing */
    transition: background-color 0.1s ease;
}

/* 3. The Math: When the invisible checkbox is checked, paint the proxy box solid green */
.arcade-hidden-check:checked + .arcade-custom-box {
    background-color: #00ff00;
}



