:root {
    --win-bg: #000000;
    --win-surface: #2b2b2b;
    --win-text: #bdbdbd;
    --win-highlight: #4d4d4d;
    --win-shadow: #000000;
    --win-dark-shadow: #000000;
    --win-light: #5e5e5e;
}

body {
    background-color: var(--win-bg);
    margin: 0;
    padding: 0;
    font-family: "MS Sans Serif", "Segoe UI", sans-serif;
    color: var(--win-text);
    overflow: hidden;
    cursor: default;
    user-select: none;
}

/* Desktop */
#desktop {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #000000 url('../images/clouds_black_metal.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Removed flex to allow dragging */
    padding: 0;
    overflow: hidden;
}

/* Icons */
.desktop-icon {
    width: 64px;
    height: 64px;
    /* Fixed height for dragging bounding box */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    text-align: center;
    position: absolute;
    /* Enable dragging */
}

/* Initial Positions (can be overridden by JS dragging) */
#icon-void {
    top: 10px;
    left: 10px;
}

#icon-dungeon {
    top: 90px;
    left: 10px;
}

#icon-grimoire {
    top: 170px;
    left: 10px;
}

#icon-cemetery {
    top: 250px;
    left: 10px;
}

/* Start Menu */
#start-menu {
    position: fixed;
    bottom: 30px;
    /* Above taskbar */
    left: 2px;
    width: 180px;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    border-left: 2px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    box-shadow: 2px 2px 5px #000;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    z-index: 2000;
    padding: 2px;
}

.start-header {
    background: linear-gradient(90deg, #000080, #1084d0);
    /* Classic blue or maybe black metal? */
    background: linear-gradient(90deg, #000, #333);
    /* Black Metal style */
    color: white;
    padding: 4px 5px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}

.start-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    color: var(--win-text);
    cursor: pointer;
    gap: 10px;
}

.start-item:hover {
    background: var(--win-highlight);
    /* Or legacy blue selection */
    background: #000080;
    color: white;
}

.start-item svg {
    width: 24px;
    height: 24px;
}

.start-divider {
    height: 1px;
    background: var(--win-shadow);
    border-bottom: 1px solid var(--win-highlight);
    margin: 2px 0;
}

.icon-img {
    width: 32px;
    height: 32px;
    /* Invert for white on black aesthetics if needed */
    filter: grayscale(100%) brightness(1.5);
}

/* Taskbar */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 1000;
}

.start-btn {
    height: 22px;
    padding: 2px 6px;
    background: var(--win-surface);
    border-top: 1px solid var(--win-highlight);
    border-left: 1px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    color: var(--win-text);
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: inset 1px 1px 0px var(--win-light);
    cursor: pointer;
}

.start-btn:active {
    border-top: 2px solid var(--win-shadow);
    border-left: 2px solid var(--win-shadow);
    border-right: 1px solid var(--win-highlight);
    border-bottom: 1px solid var(--win-highlight);
    box-shadow: none;
    transform: translate(1px, 1px);
}

/* Standard W95 Window */
.window {
    position: absolute;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    border-left: 2px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    box-shadow: 1px 1px 0px var(--win-dark-shadow);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    min-width: 200px;
    min-height: 100px;
    /* Default game window styling */
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    z-index: 100;
}

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

.title-bar-controls button {
    width: 16px;
    height: 14px;
    font-size: 8px;
    background: var(--win-surface);
    border: 1px outset var(--win-highlight);
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.title-bar-controls button:active {
    border-style: inset;
}

.window-content {
    flex-grow: 1;
    padding: 10px;
    overflow: hidden;
    position: relative;
    background: black;
    color: white;
}

/* Game Canvas */
#game-canvas {
    width: 100%;
    height: 100%;
    background: #111;
    cursor: crosshair;
}

/* Utility for toggling visibility */
.visible {
    display: flex !important;
}

/* SVG icon styles */
.tree-icon-svg {
    fill: #808080;
}

/* Taskbar Tray */
.tray-area {
    margin-left: auto;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--win-shadow);
    border-left: 1px solid var(--win-shadow);
    border-right: 1px solid var(--win-highlight);
    border-bottom: 1px solid var(--win-highlight);
    background: var(--win-surface);
    padding: 2px 5px;
    height: 18px;
    gap: 5px;
    box-shadow: inset 1px 1px 0px black;
}

.tray-icon {
    display: flex;
    align-items: center;
    color: var(--win-text);
}

#clock {
    font-size: 11px;
    color: var(--win-text);
}

.taskbar-divider {
    width: 2px;
    height: 20px;
    border-left: 1px solid var(--win-shadow);
    border-right: 1px solid var(--win-highlight);
    margin: 0 5px;
}

#score-counter {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 64px;
    font-weight: bold;
    color: #333;
    z-index: 10;
    pointer-events: none;
    font-family: "Courier New", monospace;
    opacity: 0.5;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    backdrop-filter: blur(2px);
}

#game-over-screen.hidden {
    display: none;
}

.game-over-title {
    font-size: 32px;
    color: red;
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
}

.high-scores-box {
    width: 300px;
    background: var(--win-surface);
    border: 2px solid var(--win-shadow);
    border-top-color: var(--win-highlight);
    /* Inset look? actually button style inverse */
    border-left-color: var(--win-highlight);
    border-right-color: var(--win-shadow);
    border-bottom-color: var(--win-shadow);
    padding: 10px;
    box-shadow: inset 1px 1px 0px #000;
}

.high-score-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--win-text);
    padding-bottom: 5px;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--win-text);
    font-family: inherit;
}

#high-score-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: "Courier New", monospace;
    color: #ffffff;
}

#high-score-list li {
    display: flex !important;
    justify-content: space-between !important;
    padding: 2px 0;
}

#btn-play-again {
    font-family: "MS Sans Serif", "Segoe UI", sans-serif;
    font-weight: bold;
    padding: 5px 20px;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    border-left: 2px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    cursor: pointer;
    box-shadow: 1px 1px 0px #000;
}

#btn-play-again:active {
    border-top: 2px solid var(--win-shadow);
    border-left: 2px solid var(--win-shadow);
    border-right: 2px solid var(--win-highlight);
    border-bottom: 2px solid var(--win-highlight);
    transform: translate(1px, 1px);
}

/* Super Cut Visuals */
#game-message {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Courier New", monospace;
    font-size: 32px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 50;
    text-align: center;
    width: 100%;
}

#game-message.visible {
    opacity: 1;
    animation: pulseMsg 0.2s infinite alternate;
}

@keyframes pulseMsg {
    from {
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.super-cut-active {
    box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.4) !important;
    border-color: #ff0000 !important;
}

.super-cut-active #game-canvas {
    cursor: crosshair;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    backdrop-filter: blur(5px);
}

#start-screen.hidden {
    display: none;
}

.start-title {
    font-size: 48px;
    color: #fff;
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-shadow: 0 0 10px #fff;
    letter-spacing: 2px;
}

.start-info {
    font-size: 14px;
    background: var(--win-surface);
    border: 2px solid var(--win-shadow);
    border-top-color: var(--win-highlight);
    border-left-color: var(--win-highlight);
    padding: 15px;
    max-width: 400px;
    color: #bdbdbd;
    box-shadow: inset 1px 1px 0 #000;
}

.start-info p {
    margin: 8px 0;
    line-height: 1.4;
}

.start-info strong {
    color: #fff;
}

#btn-start-game,
#btn-start-balls {
    font-family: "MS Sans Serif", "Segoe UI", sans-serif;
    font-weight: bold;
    font-size: 18px;
    padding: 10px 30px;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    border-left: 2px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    cursor: pointer;
    box-shadow: 1px 1px 0px #000;
    color: var(--win-text);
}

#btn-start-game:active,
#btn-start-balls:active {
    border-top: 2px solid var(--win-shadow);
    border-left: 2px solid var(--win-shadow);
    border-right: 2px solid var(--win-highlight);
    border-bottom: 2px solid var(--win-highlight);
    transform: translate(1px, 1px);
}

.stats-bar {
    background: #2b2b2b;
    border-bottom: 2px solid #5e5e5e;
    padding: 5px 10px;
    display: flex;
    gap: 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #bdbdbd;
    align-items: center;
    box-shadow: inset 1px 1px 0 #000;
}#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    backdrop-filter: blur(2px);
}

#game-over-screen.hidden {
    display: none;
}

.game-over-title {
    font-size: 32px;
    color: red;
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
}

.high-scores-box {
    width: 300px;
    background: var(--win-surface);
    border: 2px solid var(--win-shadow);
    border-top-color: var(--win-highlight);
    /* Inset look? actually button style inverse */
    border-left-color: var(--win-highlight);
    border-right-color: var(--win-shadow);
    border-bottom-color: var(--win-shadow);
    padding: 10px;
    box-shadow: inset 1px 1px 0px #000;
}

.high-score-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--win-text);
    padding-bottom: 5px;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--win-text);
    font-family: inherit;
}

#high-score-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: "Courier New", monospace;
    color: var(--win-text);
}

#high-score-list li {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

#btn-play-again {
    font-family: "MS Sans Serif", "Segoe UI", sans-serif;
    font-weight: bold;
    padding: 5px 20px;
    background: var(--win-surface);
    border-top: 2px solid var(--win-highlight);
    border-left: 2px solid var(--win-highlight);
    border-right: 2px solid var(--win-shadow);
    border-bottom: 2px solid var(--win-shadow);
    cursor: pointer;
    box-shadow: 1px 1px 0px #000;
}

#btn-play-again:active {
    border-top: 2px solid var(--win-shadow);
    border-left: 2px solid var(--win-shadow);
    border-right: 2px solid var(--win-highlight);
    border-bottom: 2px solid var(--win-highlight);
    transform: translate(1px, 1px);
}
/* Responsive Adjustments */
@media (max-width: 600px) {
    .stats-bar {
        font-size: 11px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 4px;
    }

    /* Shrink the gap labels to prevent overflow */
    .cost-label {
        margin-left: 0 !important; /* Force override if any inline remains */
    }

    #balls-moves-counter, #balls-balance-counter, #balls-cost-counter {
        margin-right: 5px;
    }
    
    /* Ensure windows fit nicely on mobile */
    .window {
        width: 95% !important;
        height: 90% !important;
        top: 5% !important;
        left: 2.5% !important;
    }
}
