:root {
    --win98-grey: #c0c0c0;
    --win98-white: #ffffff;
    --win98-dark-grey: #808080;
    --win98-black: #000000;
    --win98-blue: #000080;
    --win98-teal: #008080;
}

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

body {
    background: var(--win98-teal) url('assets/win98wallpaper.jpg');
    background-size: cover;
    font-family: 'Tahoma', 'Verdana', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Desktop --- */
.desktop {
    flex: 1;
    position: relative;
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 12px 16px;
    max-height: calc(100vh - 28px);
    overflow: hidden;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
    text-decoration: none;
    font-size: 11px;
    cursor: default;
    width: 85px;
    user-select: none;
}

.desktop-icon img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    object-fit: contain;
}

.desktop-icon:hover span {
    background-color: var(--win98-blue);
}

.desktop-icon span {
    padding: 2px 4px;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.2;
}

/* --- Windows --- */
.window {
    position: absolute;
    background-color: var(--win98-grey);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: 1px 1px 0 0 var(--win98-black);
    min-width: 400px;
    padding: 2px;
    z-index: 10;
}

.window.main-window {
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
}

.title-bar {
    background: linear-gradient(90deg, var(--win98-blue), #1084d0);
    padding: 3px 2px 3px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.title-bar-text {
    display: flex;
    align-items: center;
    gap: 5px;
}

.title-bar-text h1 {
    font-size: 12px;
    font-weight: bold;
    color: inherit;
    margin: 0;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
    align-items: center;
}

.win-btn {
    position: relative;
    width: 16px;
    height: 14px;
    background-color: var(--win98-grey);
    border: 1px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: inset 1px 1px 0 0 rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: black;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
}

/* Touch Target Compliance (Axe / WCAG 2.5.5 & 2.5.8):
   Touch screens get enlarged 24x22px buttons with 4px gap without breaking retro feel */
@media (pointer: coarse), (max-width: 768px) {
    .title-bar-controls {
        gap: 6px;
    }
    .win-btn {
        width: 24px;
        height: 22px;
        font-size: 11px;
    }
}

.win-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    pointer-events: auto;
}

.win-btn:active {
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    box-shadow: none;
    padding: 1px 0 0 1px;
}

.window-content {
    padding: 20px;
    background-color: var(--win98-grey);
    color: black;
}

.welcome-text {
    font-size: 14px;
    margin-bottom: 20px;
}

/* --- Taskbar --- */
.taskbar {
    height: 28px;
    background-color: var(--win98-grey);
    border-top: 2px solid var(--win98-white);
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 100;
}

.start-button {
    height: 22px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: 1px 1px 0 0 var(--win98-black);
    cursor: default;
}

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

.start-button:active {
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    box-shadow: none;
    padding: 1px 4px 0 6px;
}

.taskbar-divider {
    width: 2px;
    height: 20px;
    background-color: var(--win98-dark-grey);
    border-right: 1px solid var(--win98-white);
    margin: 0 5px;
}

.task-item {
    height: 22px;
    background-color: var(--win98-grey);
    border: 2px solid;
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-size: 11px;
    min-width: 100px;
}

.systray {
    margin-left: auto;
    height: 22px;
    border: 2px solid;
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 11px;
    gap: 10px;
}

/* --- Buttons --- */
.classic-btn {
    padding: 5px 20px;
    background-color: var(--win98-grey);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: 1px 1px 0 0 var(--win98-black);
    font-family: inherit;
    font-size: 12px;
    cursor: default;
}

.classic-btn:active {
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    box-shadow: none;
}

/* Scrollbar retro */
::-webkit-scrollbar {
    width: 16px;
}
::-webkit-scrollbar-track {
    background: url('assets/win98wallpaper.jpg');
}
::-webkit-scrollbar-thumb {
    background: var(--win98-grey);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: 1px 1px 0 0 var(--win98-black);
}

/* --- Notepad Window --- */
.notepad-window {
    width: 350px;
    height: 300px;
    top: 35%;
    left: 55%;
    display: none;
    flex-direction: column;
}

.notepad-content {
    background: white;
    flex: 1;
    border: 1px solid var(--win98-dark-grey);
    padding: 2px;
    display: flex;
    flex-direction: column;
}

.notepad-menu {
    display: flex;
    gap: 10px;
    padding: 2px 5px;
    font-size: 11px;
    border-bottom: 1px solid var(--win98-dark-grey);
    background: var(--win98-grey);
}

/* --- Secret Stats Window (Easter Egg) --- */
.stats-window {
    width: 320px;
    top: 25%;
    left: 45%;
    display: none;
    flex-direction: column;
}

.stats-content {
    background: var(--win98-grey);
    padding: 6px;
    font-size: 11px;
}

.stats-box {
    background: white;
    border: 2px solid;
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    box-shadow: inset 1px 1px 0 0 var(--win98-black);
    padding: 10px;
    font-family: 'Tahoma', sans-serif;
}

.stats-header {
    font-weight: bold;
    color: var(--win98-blue);
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 10px;
    font-size: 11px;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #eee;
    padding-bottom: 3px;
}

.stat-label {
    color: #222;
    font-size: 11px;
}

.stat-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 12px;
    color: #000080;
    background: #e8e8e8;
    padding: 1px 5px;
    border: 1px solid #aaa;
    min-width: 45px;
    text-align: right;
}

.stats-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid #ccc;
    font-size: 10px;
    color: #555;
}

/* --- Start Menu Retro Style --- */
.start-menu {
    position: fixed;
    bottom: 28px;
    left: 2px;
    width: 200px;
    background: var(--win98-grey);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-grey) var(--win98-dark-grey) var(--win98-white);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
    display: flex;
    z-index: 1000;
}

.start-menu-sidebar {
    width: 24px;
    background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
    color: white;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 8px 4px;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.start-menu-sidebar b {
    font-weight: 900;
}

.start-menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2px;
}

.start-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 11px;
    cursor: default;
    user-select: none;
}

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

.start-menu-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.start-menu-divider {
    height: 1px;
    background: var(--win98-dark-grey);
    border-bottom: 1px solid var(--win98-white);
    margin: 3px 2px;
}

/* --- Password Auth Modal --- */
.auth-modal {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    z-index: 2000;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
}

.classic-input {
    background: white;
    border: 2px solid;
    border-color: var(--win98-dark-grey) var(--win98-white) var(--win98-white) var(--win98-dark-grey);
    outline: none;
    box-shadow: inset 1px 1px 0px #000;
}

/* --- Responsive rules --- */
@media (max-width: 768px) {
    .desktop {
        flex-direction: row;
        align-content: flex-start;
        overflow-y: auto;
        max-height: calc(100vh - 28px);
        padding: 10px;
        gap: 12px 8px;
    }
    .desktop-icon {
        width: 70px;
        font-size: 10px;
    }
    .window.main-window {
        min-width: 90%;
        max-width: 95%;
        top: 15%;
    }
}

