:root {
    /* XP Colors */
    --xp-blue-title-top: #0058EE;
    --xp-blue-title-bottom: #026AFE;
    --xp-blue-border: #00138C;
    --xp-bg: #ECE9D8;
    --xp-btn-bg: #F3F3F3;
    --xp-desktop: #3B6EA5;
    /* Fallback */
    --xp-green-start: #388E3C;
}

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

body {
    font-family: 'Tahoma', sans-serif;
    color: black;
    /* Bliss Wallpaper Simulation */
    background: linear-gradient(to bottom, #7CA3DC 0%, #1F69C8 50%, #689E08 50%, #90C318 100%);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 40px;
    /* Space for taskbar */
    cursor: default;
}

/* Desktop Icons */
.desktop-icon {
    position: absolute;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.icon-img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    background-size: cover;
}

.my-computer {
    background-image: url('https://win98icons.alexmeub.com/icons/png/computer_explorer-4.png');
}

.recycle-bin {
    background-image: url('https://win98icons.alexmeub.com/icons/png/recycle_bin_empty-4.png');
}

.icon-text {
    color: white;
    text-shadow: 1px 1px 2px black;
    font-size: 13px;
    padding: 2px 4px;
}

.desktop-icon:active .icon-img {
    filter: brightness(0.7);
}

.desktop-icon:active .icon-text {
    background-color: #0b246a;
}

/* XP Window Styles */
.xp-window {
    background-color: var(--xp-bg);
    border: 3px solid #0055EA;
    /* XP Blue Border */
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
    width: 450px;
    display: flex;
    flex-direction: column;
}

.wide-window {
    width: 700px;
    height: 600px;
}

.title-bar {
    background: linear-gradient(to bottom, #245EDC 0%, #3582F7 12%, #0E48CD 100%);
    height: 30px;
    padding: 0 5px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.title-bar-text {
    color: white;
    font-weight: bold;
    font-size: 13px;
    text-shadow: 1px 1px 1px black;
    letter-spacing: 0.5px;
}

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

.title-bar-controls button {
    width: 21px;
    height: 21px;
    border: 1px solid white;
    border-radius: 3px;
    background-color: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.title-bar-controls button[aria-label="Minimize"] {
    background: #2669F0 url('https://win98icons.alexmeub.com/icons/png/minimize-0.png') no-repeat center;
    background-size: 10px;
}

.title-bar-controls button[aria-label="Maximize"] {
    background: #2669F0 url('https://win98icons.alexmeub.com/icons/png/maximize-0.png') no-repeat center;
    background-size: 10px;
}

.title-bar-controls button[aria-label="Close"] {
    background: #DC3E30;
    /* XP Red */
    border-color: #FFF;
}

.title-bar-controls button[aria-label="Close"]:after {
    content: "×";
    color: white;
    font-weight: bold;
    font-size: 16px;
    position: absolute;
    top: -2px;
    left: 4px;
}

.title-bar-controls button:hover {
    filter: brightness(1.2);
}

.window-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 12px;
}

/* Screens */
.container {
    padding: 0;
    width: auto;
    max-width: none;
    min-height: 0;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: popIn 0.2s;
}

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Start Content */
.start-content {
    text-align: center;
    padding: 20px;
}

.app-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

.start-content h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.instruction {
    background: white;
    border: 1px inset #ddd;
    padding: 10px;
    margin: 15px 0;
    text-align: left;
    height: 80px;
    overflow-y: auto;
}

.sep {
    height: 2px;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid white;
    margin: 10px 0;
}

/* XP Buttons */
.xp-btn {
    font-family: 'Tahoma';
    font-size: 12px;
    padding: 6px 20px;
    background: #EBEBEB;
    /* Standard grey button */
    border: 1px solid #888;
    border-radius: 3px;
    /* Slightly rounded */
    box-shadow: inset 1px 1px 0 white, inset -1px -1px 0 #ccc;
    cursor: pointer;
    min-width: 80px;
}

.xp-btn:hover {
    box-shadow: inset 1px 1px 0 #FFF6D8, inset -1px -1px 0 #E3C268, 0 0 0 1px #F1CF5F;
    /* The yellow glow */
}

.xp-btn:active {
    background: #E3E3E3;
    box-shadow: inset 1px 1px 2px #888;
}

/* Quiz Styles */
.game-header {
    background: white;
    border: 1px solid #7F9DB9;
    padding: 10px;
    margin-bottom: 10px;
}

.status-bar-xp {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: bold;
}

.progress-bar-xp {
    height: 15px;
    background: white;
    border: 1px solid #7F9DB9;
    padding: 1px;
}

.progress-fill-xp {
    height: 100%;
    background: url('https://upload.wikimedia.org/wikipedia/commons/2/29/Windows_XP_Progress_Bar.gif') repeat-x;
    /* Classic green chunks if possible, or simple green */
    background: linear-gradient(to bottom, #8BD580 0%, #3FCE4F 50%, #2DB03C 100%);
    width: 50%;
}

.question-area-xp {
    background: white;
    border: 1px solid #7F9DB9;
    padding: 20px;
    flex: 1;
    margin-bottom: 10px;
    position: relative;
    overflow-y: auto;
}

#question-text {
    font-size: 16px;
    font-weight: normal;
}

.difficulty-tag {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    background: #FFFFCA;
    border: 1px solid #DAB459;
    padding: 2px 5px;
    color: black;
}

.topics-grid.xp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.topic-btn {
    background: linear-gradient(to bottom, #F9F9F9 0%, #E3E3E3 100%);
    border: 1px solid #003C74;
    border-radius: 3px;
    padding: 8px;
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
}

.topic-btn:hover {
    background: linear-gradient(to bottom, #FFF0CF 0%, #F8D68E 100%);
    border-color: #E29924;
}

.topic-btn.selected {
    background: #C4E2FF;
    border-color: #0054E3;
    font-weight: bold;
}

.topic-btn.correct {
    background: #DFFFE0;
    border-color: green;
}

.topic-btn.wrong {
    background: #FFE0E0;
    border-color: red;
}

.topic-btn.missed {
    border: 1px dashed green;
    background: #EEFFEE;
}


.button-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.feedback {
    margin-bottom: 10px;
    font-size: 12px;
}

.feedback.correct {
    color: green;
    font-weight: bold;
}

.feedback.incorrect {
    color: red;
    font-weight: bold;
}

.explanation-text {
    background: #FFFFE1;
    /* Tooltip yellow */
    border: 1px solid black;
    padding: 5px;
    margin-top: 5px;
    color: black;
    font-weight: normal;
}

.status-bar-bottom {
    background: #ECE9D8;
    border-top: 1px solid #FFF;
    height: 20px;
    display: flex;
    align-items: center;
    padding: 0 5px;
    gap: 10px;
    font-size: 11px;
}

.status-item {
    border: 1px inset #ddd;
    padding: 2px 5px;
    background: #ECE9D8;
    min-width: 50px;
}

/* Result Styles */
.result-body {
    align-items: center;
    text-align: center;
}

.result-icon {
    width: 64px;
    margin-bottom: 10px;
}

.score-box-xp {
    background: white;
    border: 2px inset #ddd;
    padding: 10px 40px;
    margin: 10px 0;
}

.score-box-xp h1 {
    font-size: 32px;
    color: blue;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, #245EDC 0%, #3E87F8 10%, #245EDC 100%);
    border-top: 1px solid #3F8CF3;
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 9999;
}

.start-button {
    height: 30px;
    width: 100px;
    background: radial-gradient(circle at center, #5DCC59 0%, #3B9538 100%);
    border: none;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    color: white;
    font-style: italic;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    text-shadow: 1px 1px 1px #333;
}

.start-button:hover {
    filter: brightness(1.1);
}

.divider {
    width: 5px;
    background: rgba(0, 0, 0, 0.2);
    height: 100%;
    margin: 0 5px;
}

.task-item {
    width: 160px;
    height: 26px;
    background: #1E52B7;
    border-radius: 3px;
    margin-left: 5px;
    display: flex;
    align-items: center;
    color: white;
    font-size: 11px;
    padding: 0 5px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.4);
    cursor: default;
}

.task-item.active {
    background: #174296;
    background: linear-gradient(to bottom, #173876 0%, #1D4C9E 100%);
    box-shadow: inset 1px 1px 2px black;
}

.task-item img {
    margin-right: 5px;
    width: 16px;
    height: 16px;
}

.tray {
    margin-left: auto;
    background: #0B79E0;
    height: 30px;
    border-left: 1px solid #104184;
    padding: 0 10px;
    display: flex;
    align-items: center;
    color: white;
    font-size: 11px;
    box-shadow: inset 2px 2px 2px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 40px;
        /* Space for taskbar */
        align-items: flex-start;
        /* Align to top to avoid cutting off tall content */
        overflow-y: auto;
        /* Allow scrolling on body */
    }

    .desktop-icon {
        display: none;
        /* Hide icons on mobile to save space */
    }

    .xp-window {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 80vh;
        /* Take up most of the screen */
        margin-top: 20px;
    }

    .wide-window {
        width: 100%;
        height: auto;
    }

    .window-body {
        padding: 10px;
        flex: 1;
    }

    .topics-grid.xp-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 cols on mobile */
        max-height: none;
        /* Let it grow */
    }

    .question-area-xp {
        padding: 15px;
        max-height: 200px;
        /* Limit height but allow scroll */
    }

    #question-text {
        font-size: 1.1rem;
    }

    .topic-btn {
        padding: 12px;
        /* Larger touch target */
        font-size: 13px;
    }

    .xp-btn {
        padding: 10px 15px;
        /* Larger touch target */
        font-size: 14px;
    }

    .taskbar {
        position: fixed;
        /* Ensure it sticks */
        z-index: 10000;
    }

    .start-button {
        width: 70px;
        /* Smaller start button */
        font-size: 14px;
    }

    .task-item {
        width: auto;
        flex: 1;
        /* Flexible width */
        max-width: 120px;
    }

    .tray {
        padding: 0 5px;
    }
}