html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Prevent horizontal page-pan on mobile (Webamp chrome can push body wider
       than 100vw, which lets the browser pan leftward and clip the player). */
    width: 100%;
    max-width: 100vw;
    overscroll-behavior: none;
    height: 100%;
}

/* Stop the browser from treating Webamp drags as page-pan gestures.
   Webamp renders its own chrome (with class "window") inside #webamp-mount;
   these selectors target both the mount point and every child window panel. */
#webamp-mount,
#webamp-mount * {
    touch-action: none;
}


#desktop {
    width: 100vw;
    height: 100vh;
    background-color: #008080;
    position: relative;
    overflow: hidden;
}

.icon-grid {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    padding: 16px;
    max-height: calc(100vh - 40px);
}

.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 2px 4px;
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    box-shadow: inset 0 1px 0 0 #dfdfdf;
}
.start-button {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
    min-width: 80px;
    white-space: nowrap;
}
.taskbar-windows {
    flex: 1;
    display: flex;
    gap: 2px;
    overflow: hidden;
}
.taskbar-window-btn {
    min-width: 120px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.taskbar-clock {
    white-space: nowrap;
    padding: 2px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    border: 1px inset #808080;
}
.tray-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    min-width: 40px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}
.tray-icon-btn.active {
    box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #ffffff;
}
.tray-icon-img {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    display: block;
}

.game-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    width: 72px;
    text-align: center;
}

.game-icon img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}

.game-icon-label {
    color: white;
    font-size: 11px;
    text-shadow: 1px 1px 1px black;
    word-break: break-word;
}

.game-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Window positioning — win95.css provides .window, .title-bar, etc. chrome */
.window {
    position: absolute;
    min-height: 300px;
}

.window .title-bar {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.window .title-bar:active {
    cursor: grabbing;
}

.clippy-widget {
    /* The icon is the sole normal-flow child; the bubble is absolutely
       positioned above it so bubble width changes never shift the icon. */
    position: fixed;
    bottom: 100px;
    right: 100px;
    z-index: 10;
}
.clippy-bubble {
    background: white;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 200px;
    max-width: 280px;
    font-size: 11px;
    /* Float above the icon without affecting the widget's layout box */
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    box-shadow: 2px 2px 0 #808080;
    color: #000000;
    cursor: pointer;
}
.clippy-bubble p {
    margin: 0;
}
.clippy-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    /* Align tail with the icon, which sits at the right edge of the widget */
    right: 12px;
    border: 5px solid transparent;
    border-top-color: #000;
}
.clippy-icon {
    font-size: 32px;
    line-height: 1;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.clippy-icon:active {
    cursor: grabbing;
}
.clippy-modal {
    min-width: 300px;
    max-width: 400px;
}

/* Game window content */
.game-window-content {
    padding: 12px;
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.game-window-left {
    flex: 1;
    min-width: 0;
}

.game-window-content h2 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.contributors {
    margin: 4px 0;
    color: #555;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.tech-item img {
    width: 16px;
    height: 16px;
}

.description {
    margin: 8px 0;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.game-demo {
    display: block;
    max-width: 240px;
    max-height: 200px;
    flex-shrink: 0;
    background: #808080;
}

.game-demo-placeholder {
    width: 180px;
    height: 150px;
    flex-shrink: 0;
    background: #808080;
}

.launch-row {
    margin-top: 12px;
}

/* Start menu */
.start-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}
.start-menu.window {
    position: fixed;
    bottom: 40px;
    left: 0;
    z-index: 1000;
    min-width: 180px;
    min-height: unset;
    padding: 4px;
}
.start-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.start-menu-item {
    width: 100%;
    text-align: left;
    padding: 12px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.start-menu-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
.start-menu-item:hover {
    background: #000080;
    color: white;
}
.start-menu-shutdown { color: inherit; }

.game-icon-emoji {
    font-size: 36px;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tech-icon-emoji {
    font-size: 14px;
    line-height: 1;
}

@media (max-width: 768px) {
    .window {
        position: fixed !important;
        left: 18vw !important;
        top: 8px !important;
        width: 80vw !important;
        min-width: unset !important;
        min-height: unset !important;
        z-index: 500;
        transform: translateX(var(--jitter-x, 0px)) translateY(var(--jitter-y, 0px));
    }

    .window .window-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100vh - 100px);
    }

    /* Clippy modal: restore centered positioning overridden by .window rule */
    .clippy-modal.window {
        left: 50% !important;
        top: 50% !important;
        width: auto !important;
        transform: translate(-50%, -50%) !important;
    }

    /* Start menu overrides the general window rule above */
    .start-menu.window {
        width: auto !important;
        left: 0 !important;
        top: auto !important;
        bottom: 56px !important;
        min-width: 220px;
    }

    .icon-grid {
        gap: 12px;
        padding: 16px;
    }

    .game-icon {
        width: 80px;
        padding: 8px;
    }

    .game-icon img {
        width: 56px;
        height: 56px;
    }

    .game-icon-emoji {
        font-size: 48px;
        width: 56px;
        height: 56px;
    }

    .game-icon-label {
        font-size: 13px;
    }

    .taskbar {
        height: 56px;
        padding: 4px 6px;
    }

    .start-button {
        min-width: 100px;
        font-size: 14px;
    }

    .taskbar-clock {
        font-size: 14px;
        padding: 4px 10px;
    }

    .taskbar-window-btn {
        min-width: 100px;
        font-size: 13px;
    }

    .icon-grid {
        max-height: calc(100vh - 56px);
    }

    .game-window-content {
        flex-direction: column;
        font-size: 15px;
        padding: 16px;
        gap: 16px;
    }

    .game-window-content h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .game-demo {
        max-width: 240px;
        width: auto;
        max-height: 180px;
        align-self: center;
    }

    .tech-item {
        font-size: 14px;
    }

    .tech-item img {
        width: 20px;
        height: 20px;
    }

    .tech-icon-emoji {
        font-size: 18px;
    }

    .launch-row button {
        font-size: 15px;
        padding: 6px 16px;
    }

    .start-menu-item {
        font-size: 16px;
        padding: 14px 16px;
    }

    .start-menu-icon {
        width: 24px;
        height: 24px;
    }

    .clippy-widget {
        bottom: 10vh;
        right: 5vw;
    }
}
