/* Fonts */
@font-face {
    font-family: 'retro1980';
    src: url('fonts/ARCADECLASSIC.TTF') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'console1980';
    src: url('fonts/lunchds.ttf') format('truetype');
    font-display: swap;
}

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

body, html {
    height: 100%;
    overflow: hidden;
    font-family: 'console1980', monospace; 
    color: #33ff00; 
    background-color: #000;
    background-image: 
        radial-gradient(circle at center, #001a00 0%, #000000 100%),
        repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(51, 255, 0, 0.05) 2px, rgba(51, 255, 0, 0.05) 4px);
}

/* CRT STROBE / FLICKER ANIMATIONS */
@keyframes crt-flicker {
    0% { opacity: 0.95; }
    5% { opacity: 0.85; }
    10% { opacity: 0.95; }
    15% { opacity: 1; }
    50% { opacity: 0.9; }
    100% { opacity: 0.95; }
}

@keyframes crt-roll {
    0% { transform: translateY(-100vh); }
    100% { transform: translateY(100vh); }
}

body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 999999; 
    background-size: 100% 3px, 3px 100%;
    pointer-events: none; 
    animation: crt-flicker 0.15s infinite; 
}

body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    background: linear-gradient(to bottom, transparent 0%, rgba(51, 255, 0, 0.08) 50%, transparent 100%);
    z-index: 1000000; 
    pointer-events: none;
    animation: crt-roll 8s linear infinite; 
}

/* TOP TASKBAR */
#top-taskbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-color: #000;
    border-bottom: 2px solid #33ff00;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9998; 
    box-shadow: 0 2px 10px rgba(51, 255, 0, 0.2);
}

#minimized-windows {
    display: flex;
    gap: 5px;
    padding-left: 10px;
}

#minimized-windows button {
    font-family: 'console1980', sans-serif;
    font-size: 14px;
    background: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    padding: 2px 10px;
    cursor: pointer;
    text-transform: uppercase;
}
#minimized-windows button:hover {
    background: #33ff00;
    color: #000;
}

#system-tray {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-right: 15px;
}

#lang-btn {
    font-family: 'console1980', sans-serif;
    font-size: 14px;
    background: transparent;
    color: #33ff00;
    border: 1px solid #33ff00;
    padding: 2px 8px;
    cursor: pointer;

}
#lang-btn:hover {
    background: #33ff00;
    color: #000;
}

#mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'console1980', sans-serif;
    font-size: 14px;
    line-height: 1;
    background: transparent;
    color: #33ff00;
    border: 1px solid #33ff00;
    padding: 4px 8px 2px; /* nudges the text down slightly inside the border */
    margin-right: 6px;
    vertical-align: middle;
    cursor: pointer;
}

#mobile-btn:hover {
    background: #33ff00;
    color: #000;
}

#clock {
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 18px;
    text-shadow: 0 0 5px rgba(51, 255, 0, 0.5);
}

/* Desktop Area */
#desktop {
    position: relative;
    width: 100%;
    height: calc(100% - 80px); 
    margin-top: 30px; 
}

/* Desktop Icons */
#desktop-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.desktop-icon {
    position: absolute;
    background: none;
    border: none;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    min-width: 90px;
    pointer-events: auto;
}

.desktop-icon:active { cursor: grabbing; }

/* UPDATED: Adjusted vertical spacing to fit all 8 icons perfectly */
.desktop-icon:nth-child(1) { top: 10px; right: 20px; }
.desktop-icon:nth-child(2) { top: 100px; right: 20px; }
.desktop-icon:nth-child(3) { top: 190px; right: 20px; }
.desktop-icon:nth-child(4) { top: 280px; right: 20px; }
.desktop-icon:nth-child(5) { top: 370px; right: 20px; }
.desktop-icon:nth-child(6) { top: 460px; right: 20px; }
.desktop-icon:nth-child(7) { top: 550px; right: 20px; }
.desktop-icon:nth-child(8) { top: 640px; right: 20px; } /* Trash Bin fixed */

.desktop-icon img {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    margin-bottom: 4px;
    pointer-events: none;
    filter: sepia(100%) hue-rotate(60deg) saturate(500%) contrast(200%);
}

.desktop-icon span {
    background-color: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    padding: 2px 6px;
    font-family: 'console1980', sans-serif;
    font-size: 13px;
    text-align: center;
    pointer-events: none;
    white-space: nowrap; 
    display: inline-block; 
}

.desktop-icon:hover span {
    background-color: #33ff00;
    color: #000;
}

/* Windows */
.window {
    position: absolute;
    width: 500px;
    height: 450px; 
    background-color: #000;
    border: 2px solid #33ff00;
    box-shadow: 0 0 10px rgba(51, 255, 0, 0.4), inset 0 0 10px rgba(51, 255, 0, 0.2); 
    display: flex;
    flex-direction: column;
    z-index: 10;
    min-width: 250px; 
    min-height: 200px;
}

.window.maximized {
    top: 0 !important; 
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: none;
}

.title-bar {
    background-color: #33ff00; 
    color: #000;
    border-bottom: 2px solid #33ff00;
    padding: 2px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'console1980', sans-serif;
    font-size: 18px;
    cursor: move; 
    user-select: none;
}

.window-controls {
    display: flex;
    gap: 2px;
}

.window-controls button {
    font-family: 'console1980', sans-serif;
    font-size: 14px;
    line-height: 1; 
    background: #000;
    color: #33ff00;
    border: 1px solid #000;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}
.window-controls button:hover {
    background: #fff;
    color: #000;
}

.window-content {
    background-color: #000;
    color: #33ff00;
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    font-family: 'console1980', monospace;
    font-size: 18px;
    text-shadow: 0 0 2px rgba(51, 255, 0, 0.5); 
    scrollbar-width: thin;
    scrollbar-color: #33ff00 #000;
}

.window-content::-webkit-scrollbar {
    width: 8px;
}
.window-content::-webkit-scrollbar-track {
    background: #000;
}
.window-content::-webkit-scrollbar-thumb {
    background-color: #33ff00;
}

/* THE FIX FOR EMPTY LINES */
#terminal-output div {
    min-height: 1.2em;
}

/* RESIZE GRIP STYLING */
.resize-grip {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize; 
    z-index: 20;
    background: linear-gradient(135deg, 
        transparent 50%, 
        #33ff00 50%, #33ff00 60%, 
        transparent 60%, transparent 70%, 
        #33ff00 70%, #33ff00 80%, 
        transparent 80%);
}

.window.maximized .resize-grip {
    display: none;
}

/* BOTTOM TASKBAR */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #000;
    border-top: 2px solid #33ff00;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(51, 255, 0, 0.2);
}

#taskbar button {
    font-family: 'console1980', sans-serif;
    font-size: 20px;
    background: none;
    border: none;
    padding: 10px 0; 
    cursor: pointer;
    color: #33ff00;
    width: 140px; 
    text-align: center;
}

#taskbar button:hover {
    background: #33ff00;
    color: #000;
}

/* BOOT SEQUENCE STYLES */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #050505;
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 20px;
    padding: 30px;
    z-index: 100000; 
    overflow: hidden;
    cursor: pointer;
    transition: opacity 1s ease; 
    text-shadow: 0 0 5px rgba(51, 255, 0, 0.7); 
}

.blinking-cursor {
    animation: blink 1s step-end infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}

#desktop {
    opacity: 0;
    transition: opacity 1s ease;
}

/* THE CRT GLASS CURVE & GLARE */
#crt-glass {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; 
    z-index: 9999999; 
    border-radius: 2vw; 
    box-shadow: inset 0 0 80px 20px rgba(0, 0, 0, 0.8);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
}

/* TERMINAL INPUT */
#terminal-input {
    background: transparent;
    border: none;
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 18px;
    outline: none;
    text-shadow: 0 0 2px rgba(51, 255, 0, 0.5);
    white-space: pre-wrap;
}

/* TERMINAL LINKS */
.terminal-link {
    cursor: pointer;
    display: block; 
    width: fit-content;
    padding: 0;
    margin: 0;
}

.terminal-link:hover {
    background-color: #33ff00;
    color: #000;
    text-shadow: none;
}

/* TERMINAL IMAGES */
.terminal-img {
    display: block;
    width: 150px;       
    height: 150px;      
    object-fit: fill;   
    margin: 15px 0;
    border: 2px solid #33ff00;
    image-rendering: pixelated; 
    filter: sepia(100%) hue-rotate(60deg) saturate(500%) contrast(200%) brightness(0.8);
    box-shadow: 0 0 10px rgba(51, 255, 0, 0.3);
}

/* BLINKING EMAIL */
.blinking-email {
    color: #33ff00;
    text-decoration: none;
    animation: blink 1s step-end infinite;
    display: inline-block;
    padding: 0 2px;
}

.blinking-email:hover {
    background-color: #33ff00;
    color: #000 !important; 
    animation: none; 
}



/* PAINTER APP STYLES */
#painter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background-color: #000;
    border-bottom: 2px solid #33ff00;
    font-family: 'console1980', monospace;
    font-size: 14px;
    color: #33ff00;
    align-items: center;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tool-label {
    margin-right: 5px;
}

.color-btn {
    width: 20px;
    height: 20px;
    border: 2px solid #33ff00;
    cursor: pointer;
    padding: 0;
}

.color-btn.active {
    border: 2px solid #ffffff; 
    box-shadow: 0 0 5px #fff;
}

.size-btn, .pattern-btn, .action-btn {
    background-color: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    font-family: 'console1980', monospace;
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
}

.size-btn:hover, .pattern-btn:hover, .action-btn:hover,
.size-btn.active, .pattern-btn.active {
    background-color: #33ff00;
    color: #000;
}

/* REPLACED ACTION-BTN WITH NEW SPECIFIC CLASSES */
.btn-print {
    background-color: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    font-family: 'console1980', monospace;
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
    font-weight: bold;
}

.btn-print:hover {
    background-color: #33ff00;
    color: #000;
}

.btn-danger {
    background-color: #000;
    color: #ff0000;
    border: 1px solid #ff0000;
    font-family: 'console1980', monospace;
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
    font-weight: bold;
}

.btn-danger:hover {
    background-color: #ff0000;
    color: #000;
}

#canvas-container {
    flex: 1;
    overflow: auto;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

#paint-canvas {
    background-color: #ffffff; 
    cursor: crosshair;
    box-shadow: 0 0 10px rgba(51, 255, 0, 0.2);
}

/* WRITER APP STYLES */
#writer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background-color: #000;
    border-bottom: 2px solid #33ff00;
    font-family: 'console1980', monospace;
    font-size: 14px;
    color: #33ff00;
    align-items: center;
}

#writer-toolbar button {
    background-color: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    font-family: 'console1980', monospace;
    font-size: 14px;
    padding: 4px 8px;
    cursor: pointer;
}

#writer-toolbar button:hover {
    background-color: #33ff00;
    color: #000;
}

/* ACTIVE STATE FOR WRITER BUTTONS */
#writer-toolbar button.active {
    background-color: #33ff00;
    color: #000;
    box-shadow: 0 0 5px rgba(51, 255, 0, 0.5);
}

#writer-editor {
    flex: 1;
    background-color: #000;
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 18px;
    padding: 20px;
    outline: none;
    overflow-y: auto;
    text-shadow: 0 0 2px rgba(51, 255, 0, 0.5); 
    line-height: 1.5;
}

#writer-editor p {
    margin-bottom: 10px;
}

/* --- CHAD GAME WINDOW & FOLDER ICON FIXES --- */
#window-games .desktop-icon {
    position: relative !important;
    top: 0 !important;
    right: 0 !important;
}

#window-chad-game iframe {
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* --- FOLDER DRAGGING FIX --- */
#window-games .window-content {
    position: relative !important;
}

/* --- FOLDER ICON STYLING --- */
.folder-icon {
    position: absolute;
    background: none;
    border: none;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    min-width: 90px;
}

.folder-icon:active { 
    cursor: grabbing; 
}

.folder-icon img {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    margin-bottom: 4px;
    pointer-events: none;
    filter: sepia(100%) hue-rotate(60deg) saturate(500%) contrast(200%);
}

.folder-icon span {
    background-color: #000;
    color: #33ff00;
    border: 1px solid #33ff00;
    padding: 2px 6px;
    font-family: 'console1980', sans-serif;
    font-size: 13px;
    text-align: center;
    pointer-events: none;
    white-space: nowrap; 
    display: inline-block; 
}

.folder-icon:hover span {
    background-color: #33ff00;
    color: #000;
}

#images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 12px;
    padding: 6px;
}

.gallery-thumb-btn {
    background: #000;
    border: 1px solid #33ff00;
    color: #33ff00;
    font-family: 'console1980', monospace;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gallery-thumb-btn:hover,
.gallery-thumb-btn.active {
    background: #33ff00;
    color: #000;
}

.gallery-thumb-btn img {
    width: 76px;
    height: 58px;
    object-fit: cover;
    border: 1px solid #33ff00;
    image-rendering: pixelated;
    filter: sepia(100%) hue-rotate(60deg) saturate(400%) contrast(150%);
}

.gallery-thumb-btn span {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 92px;
}

#autodestroy-dot {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    margin-top: -5px;
    border-radius: 50%;
    background-color: #33ff00;
    box-shadow: 0 0 12px #33ff00;
    z-index: 2147483647;
}

@keyframes autodestroy-glitch {
    0%   { transform: translate(0, 0) skewX(0deg); filter: hue-rotate(0deg) contrast(1); }
    20%  { transform: translate(-6px, 3px) skewX(-4deg); filter: hue-rotate(45deg) contrast(1.8); }
    40%  { transform: translate(6px, -4px) skewX(5deg); filter: invert(0.15) contrast(2.2); }
    60%  { transform: translate(-4px, -2px) skewX(-2deg); filter: brightness(1.5) contrast(2); }
    80%  { transform: translate(4px, 2px) skewX(3deg); filter: brightness(0.7) contrast(2.5); }
    100% { transform: translate(0, 0) skewX(0deg); filter: brightness(0.2) contrast(1); }
}

.autodestroy-active {
    animation: autodestroy-glitch 0.22s infinite;
    transition: opacity 1.8s ease-in !important;
    opacity: 0 !important;
    pointer-events: none;
}

#autodestroy-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity 1.8s ease-in;
    z-index: 2147483645;
    pointer-events: none;
}

#autodestroy-overlay.fading {
    opacity: 1;
}

#autodestroy-dot {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    margin-top: -5px;
    border-radius: 50%;
    background-color: #33ff00;
    box-shadow: 0 0 14px #33ff00, 0 0 28px rgba(51, 255, 0, 0.6);
    z-index: 2147483647;
}

/* MY COMPUTER DIRECTORY STYLES */
#mycomp-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #33ff00;
    padding-bottom: 6px;
    font-size: 15px;
}

#mycomp-status {
    border: 1px solid #33ff00;
    padding: 6px 8px;
    font-size: 14px;
    min-height: 30px;
    background-color: #000;
}

#mycomp-status.denied {
    color: #000;
    background-color: #33ff00;
    font-weight: bold;
}

#mycomp-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 4px;
}

.mycomp-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 15px;
    text-align: left;
    padding: 4px 8px;
    cursor: pointer;
}

.mycomp-entry:hover {
    border: 1px solid #33ff00;
    background-color: rgba(51, 255, 0, 0.12);
}

.mycomp-entry.denied-flash {
    background-color: #33ff00;
    color: #000;
}

/* TRASH BIN STYLES */
#trash-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #33ff00;
    padding-bottom: 6px;
    font-size: 14px;
}

#trash-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

#trash-status {
    border: 1px solid #33ff00;
    padding: 6px 8px;
    font-size: 14px;
    min-height: 30px;
    background-color: #000;
}

#trash-status.corrupted {
    background-color: #33ff00;
    color: #000;
    font-weight: bold;
}

#trash-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: 1px solid transparent;
    color: #33ff00;
    font-family: 'console1980', monospace;
    font-size: 15px;
    padding: 5px 8px;
    cursor: pointer;
    text-align: left;
}

.trash-item:hover {
    border: 1px solid #33ff00;
    background-color: rgba(51, 255, 0, 0.12);
}

.trash-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trash-item-left img {
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    filter: sepia(100%) hue-rotate(60deg) saturate(500%) contrast(200%);
}

#trash-empty-msg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    font-size: 16px;
}