/* ===========================================
   LEGO THEME - Core Styles
   PVP.NZ Game Launcher
   =========================================== */

/* CSS Custom Properties - Lego Color Palette */
:root {
    /* Primary Lego Colors */
    --lego-red: #D01012;
    --lego-red-dark: #A00D0F;
    --lego-red-light: #E83335;
    --lego-yellow: #FFD500;
    --lego-yellow-dark: #D4B100;
    --lego-yellow-light: #FFE44D;
    --lego-blue: #0055BF;
    --lego-blue-dark: #003D8A;
    --lego-blue-light: #1A6FD4;
    --lego-green: #00852B;
    --lego-green-dark: #006321;
    --lego-green-light: #00A735;
    
    /* Neutral Colors */
    --lego-black: #1B1B1B;
    --lego-white: #FFFFFF;
    --lego-gray: #9C9C9C;
    --lego-gray-light: #D4D4D4;
    --lego-gray-dark: #6D6D6D;
    --lego-tan: #E4CD9E;
    --lego-orange: #FE8A18;
    
    /* UI Colors */
    --lego-surface: #F2F2F2;
    --lego-surface-dark: #E5E5E5;
    --lego-border: #1B1B1B;
    --lego-shadow: rgba(0, 0, 0, 0.25);
    
    /* Stud dimensions */
    --stud-size: 24px;
    --stud-gap: 32px;
    
    /* Border radius for brick feel */
    --brick-radius: 8px;
    --brick-radius-small: 4px;
    
    /* Typography */
    --font-family: 'Nunito', 'Segoe UI', sans-serif;
    --font-size-base: 13px;
    --font-size-small: 11px;
    --font-size-large: 16px;
}

/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

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

body {
    font-family: var(--font-family);
    font-weight: 600;
    background: var(--lego-green);
    /* Lego baseplate stud pattern */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%2300852B"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="%23005a1d" opacity="0.5"/><circle cx="16" cy="16" r="9" fill="%23006820"/><circle cx="16" cy="14.5" r="8" fill="%23009030"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="%2300a838" stroke-width="1" opacity="0.5"/><circle cx="16" cy="14.5" r="3" fill="%23007828" opacity="0.4"/></svg>');
    background-size: 32px 32px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

/* Desktop - The Baseplate */
.desktop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 48px;
    overflow: hidden;
}

/* Desktop Icons - LEGO Tile Style */
.desktop-icon {
    position: absolute;
    /* 
     * Tile is slightly smaller than grid cell (3x2 studs = 96x64)
     * to leave authentic LEGO tolerance gap between adjacent tiles
     */
    width: 93px;
    height: 61px;
    cursor: pointer;
    text-align: center;
    user-select: none;
    /* Tile top surface with subtle plastic sheen */
    background: linear-gradient(160deg, 
        rgba(255, 255, 255, 0.15) 0%,
        transparent 40%),
        var(--lego-yellow);
    /* No black border - LEGO doesn't have outlines */
    border: none;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    gap: 2px;
    /* 
     * 3D tile effect:
     * - Inner highlight = top edge bevel catching light
     * - Right/bottom borders = the actual sides of the tile (darker because in shadow)
     * - Soft shadow = cast shadow on the baseplate
     */
    box-shadow: 
        /* Top-left edge highlight (mold bevel catching light) */
        inset 1px 1px 0 rgba(255, 255, 255, 0.5),
        /* Bottom side of tile (the actual plastic edge, in shadow) */
        0 3px 0 0 #C4A000,
        /* Right side of tile (the actual plastic edge, in shadow) */
        3px 0 0 0 #C4A000,
        /* Corner where sides meet */
        3px 3px 0 0 #B89500,
        /* Soft cast shadow on baseplate */
        2px 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.desktop-icon:active {
    transform: translate(1px, 1px);
    box-shadow: 
        inset 1px 1px 0 rgba(255, 255, 255, 0.3),
        0 2px 0 0 #C4A000,
        2px 0 0 0 #C4A000,
        2px 2px 0 0 #B89500,
        1px 2px 4px rgba(0, 0, 0, 0.25);
}

.desktop-icon.selected {
    background: linear-gradient(160deg, 
        rgba(255, 255, 255, 0.25) 0%,
        transparent 40%),
        var(--lego-yellow-light);
}

.desktop-icon-img {
    font-size: 24px;
    line-height: 1;
}

.desktop-icon-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--lego-black);
    line-height: 1.1;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ===========================================
   LEGO WINDOW - Build Plate Style
   =========================================== */
.lego-window {
    position: absolute;
    background: var(--lego-surface);
    border: 4px solid var(--lego-black);
    border-radius: var(--brick-radius);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    min-height: 150px;
    z-index: 1;
    user-select: none;
    box-shadow: 
        0 8px 0 rgba(0, 0, 0, 0.15),
        0 12px 24px var(--lego-shadow);
    animation: windowSnapIn 0.2s ease-out;
}

@keyframes windowSnapIn {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.lego-window.active {
    z-index: 100;
}

.lego-window.minimized {
    display: none;
}

/* Title Bar - Brick Header with Studs */
.lego-title-bar {
    height: 24px;
    display: flex;
    align-items: center;
    padding: 0 3px 0 2px;
    font-size: var(--font-size-base);
    font-weight: 800;
    cursor: move;
    user-select: none;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
    position: relative;
    background-size: 32px 32px;
    background-position: -4px -4px;
}

.lego-title-bar.active {
    color: var(--lego-white);
    /* 3D stud pattern - red (--lego-red, --lego-red-dark, --lego-red-light) */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%23D01012"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.3)"/><circle cx="16" cy="16" r="9" fill="%23A00D0F"/><circle cx="16" cy="14.5" r="8" fill="%23E83335"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23A00D0F" opacity="0.4"/></svg>');
}

.lego-title-bar.inactive {
    color: var(--lego-black);
    /* 3D stud pattern - light gray, low contrast for text legibility */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%23D4D4D4"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.06)"/><circle cx="16" cy="16" r="9" fill="%23C4C4C4"/><circle cx="16" cy="14.5" r="8" fill="%23E8E8E8"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.15)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23C4C4C4" opacity="0.15"/></svg>');
}

.lego-title-bar-icon {
    width: 20px;
    height: 20px;
    margin: 0 0px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 14px;
}

.lego-title-bar-text {
    flex: 1;
    margin-left: 6px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

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

.lego-title-bar-button {
    width: 18px;
    height: 18px;
    border: 2px solid var(--lego-black);
    background: var(--lego-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--lego-black);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 0 var(--lego-yellow-dark);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.lego-title-bar-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 0 var(--lego-yellow-dark);
}

.lego-title-bar-button:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--lego-yellow-dark);
}

/* Menu Bar */
.lego-menu-bar {
    background: var(--lego-surface-dark);
    border-bottom: 2px solid var(--lego-gray);
    height: 32px;
    display: flex;
    padding: 0 4px;
    font-size: var(--font-size-small);
    font-weight: 600;
    align-items: center;
}

.lego-menu-item {
    padding: 6px 12px;
    cursor: default;
    user-select: none;
    border-radius: var(--brick-radius-small);
    margin: 2px;
    transition: background 0.1s ease;
}

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

.lego-menu-item.open {
    background: var(--lego-blue);
    color: var(--lego-white);
}

/* Dropdown Menu */
.lego-dropdown {
    position: absolute;
    background: var(--lego-white);
    border: 3px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    min-width: 160px;
    z-index: 10003;
    box-shadow: 4px 4px 0 var(--lego-shadow);
    overflow: hidden;
}

.lego-menu-option {
    padding: 8px 20px 8px 32px;
    cursor: default;
    font-size: var(--font-size-small);
    font-weight: 600;
    position: relative;
    transition: background 0.1s ease;
}

.lego-menu-option:hover {
    background: var(--lego-blue);
    color: var(--lego-white);
}

.lego-menu-option-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.lego-menu-option.has-submenu::after {
    content: '▶';
    position: absolute;
    right: 8px;
    font-size: 10px;
}

.lego-submenu {
    position: absolute;
    background: var(--lego-white);
    border: 3px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    min-width: 160px;
    z-index: 10004;
    box-shadow: 4px 4px 0 var(--lego-shadow);
    left: 100%;
    top: 0;
    margin-left: -3px;
    overflow: visible;
}

.lego-submenu .lego-menu-option {
    color: var(--lego-black);
}

.lego-submenu .lego-menu-option:hover {
    background: var(--lego-blue);
    color: var(--lego-white);
}

.lego-menu-separator {
    height: 2px;
    background: var(--lego-gray-light);
    margin: 4px 8px;
}

/* ===========================================
   BUILD MENU (Start Menu) Styles
   =========================================== */
.lego-start-menu {
    position: absolute;
    background: var(--lego-white);
    border: 4px solid var(--lego-black);
    border-radius: var(--brick-radius);
    box-shadow: 8px 8px 0 var(--lego-shadow);
    z-index: 10003;
    display: flex;
    min-width: 240px;
    overflow: visible;
}

.lego-start-menu-sidebar {
    width: 32px;
    background: linear-gradient(to top, var(--lego-red), var(--lego-yellow));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    /* Stud pattern */
    background-image: 
        linear-gradient(to top, var(--lego-red), var(--lego-yellow)),
        url('data:image/svg+xml,<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="3" fill="rgba(255,255,255,0.2)"/></svg>');
    background-size: 100% 100%, 16px 16px;
}

.lego-start-menu-sidebar-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: var(--lego-white);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 var(--lego-black);
}

.lego-start-menu-sidebar-text span {
    color: var(--lego-yellow);
}

.lego-start-menu-items {
    flex: 1;
    padding: 8px 0;
}

.lego-start-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 24px 8px 8px;
    cursor: default;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--lego-black);
    position: relative;
    gap: 8px;
    transition: background 0.1s ease;
}

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

.lego-start-menu-item.has-submenu::after {
    content: '▶';
    position: absolute;
    right: 8px;
    font-size: 10px;
}

.lego-start-menu-icon {
    width: 24px;
    height: 24px;
    background: var(--lego-yellow);
    border: 2px solid var(--lego-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.lego-start-menu-text {
    flex: 1;
}

.lego-start-menu-separator {
    height: 2px;
    background: var(--lego-gray-light);
    margin: 6px 8px;
}

/* Client Area */
.lego-client {
    background: var(--lego-white);
    padding: 12px;
    flex: 1;
    overflow: auto;
    border: 3px solid var(--lego-gray);
    border-radius: 0 0 var(--brick-radius-small) var(--brick-radius-small);
    margin: 0 4px 4px 4px;
}

/* ===========================================
   LEGO BUTTON - Stud Style
   =========================================== */
.lego-button {
    border: 3px solid var(--lego-black);
    background: var(--lego-red);
    color: var(--lego-white);
    padding: 6px 16px;
    font-size: var(--font-size-small);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--brick-radius-small);
    box-shadow: 
        0 4px 0 var(--lego-red-dark),
        0 6px 8px var(--lego-shadow);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.lego-button:hover {
    background: var(--lego-red-light);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 0 var(--lego-red-dark),
        0 8px 12px var(--lego-shadow);
}

.lego-button:active {
    transform: translateY(4px);
    box-shadow: 
        0 0 0 var(--lego-red-dark),
        0 2px 4px var(--lego-shadow);
}

/* Secondary button style */
.lego-button.secondary {
    background: var(--lego-gray-light);
    color: var(--lego-black);
    box-shadow: 
        0 4px 0 var(--lego-gray),
        0 6px 8px var(--lego-shadow);
    text-shadow: none;
}

.lego-button.secondary:hover {
    background: var(--lego-white);
    box-shadow: 
        0 6px 0 var(--lego-gray),
        0 8px 12px var(--lego-shadow);
}

.lego-button.secondary:active {
    box-shadow: 
        0 0 0 var(--lego-gray),
        0 2px 4px var(--lego-shadow);
}

/* ===========================================
   GAME CARDS - Brick Style
   =========================================== */
.lego-game-card {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--brick-radius);
    box-shadow: 0 4px 0 var(--lego-gray);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.lego-game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--lego-gray);
    background: var(--lego-yellow-light);
}

.lego-game-icon {
    width: 40px;
    height: 40px;
    border: 2px solid var(--lego-black);
    background: var(--lego-yellow);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 0 var(--lego-yellow-dark);
}

.lego-game-info {
    flex: 1;
}

.lego-game-title {
    font-weight: 700;
    font-size: var(--font-size-base);
    margin-bottom: 4px;
    color: var(--lego-black);
}

.lego-game-desc {
    font-size: var(--font-size-small);
    color: var(--lego-gray-dark);
    line-height: 1.4;
}

/* List Box */
.lego-list-box {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 8px;
    max-height: 500px;
    overflow-y: auto;
    border-radius: var(--brick-radius-small);
}

/* Grid */
.lego-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

/* View Modes */
/* Large Icons View */
.lego-view-large-icons .lego-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

.lego-view-large-icons .lego-game-card {
    flex-direction: column;
    text-align: center;
    min-height: 120px;
    padding: 16px;
    margin-bottom: 0;
}

.lego-view-large-icons .lego-game-icon {
    width: 56px;
    height: 56px;
    font-size: 32px;
    margin: 0 auto 12px;
}

.lego-view-large-icons .lego-game-title {
    text-align: center;
    margin-bottom: 0;
}

.lego-view-large-icons .lego-game-info {
    display: none;
}

/* Small Icons View */
.lego-view-small-icons .lego-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.lego-view-small-icons .lego-game-card {
    flex-direction: column;
    text-align: center;
    min-height: 80px;
    padding: 8px;
    margin-bottom: 0;
}

.lego-view-small-icons .lego-game-icon {
    width: 36px;
    height: 36px;
    font-size: 20px;
    margin: 0 auto 6px;
}

.lego-view-small-icons .lego-game-title {
    text-align: center;
    margin-bottom: 0;
    font-size: var(--font-size-small);
}

.lego-view-small-icons .lego-game-info {
    display: none;
}

/* List View */
.lego-view-list .lego-list-box {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 4px;
}

.lego-view-list .lego-game-card {
    flex-direction: row;
    text-align: left;
    padding: 8px 12px;
    margin-bottom: 4px;
    min-height: auto;
}

.lego-view-list .lego-game-icon {
    width: 24px;
    height: 24px;
    font-size: 14px;
    margin: 0;
}

.lego-view-list .lego-game-title {
    margin-bottom: 0;
    font-size: var(--font-size-small);
}

.lego-view-list .lego-game-info {
    display: block;
}

.lego-view-list .lego-game-desc {
    display: none;
}

/* Details View (default) */
.lego-view-details .lego-list-box {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 8px;
}

.lego-view-details .lego-game-card {
    flex-direction: row;
    text-align: left;
    padding: 12px;
    margin-bottom: 8px;
    min-height: auto;
}

.lego-view-details .lego-game-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
    margin: 0;
}

.lego-view-details .lego-game-info {
    display: block;
}

/* Menu option with checkmark */
.lego-menu-option.selected::before {
    content: '✓';
    position: absolute;
    left: 12px;
    font-weight: 800;
}

/* Resize Handles */
.lego-resize-handle {
    position: absolute;
    background: transparent;
    z-index: 101;
    pointer-events: auto;
}

.lego-resize-nw { cursor: nw-resize; top: 0; left: 0; width: 12px; height: 12px; }
.lego-resize-ne { cursor: ne-resize; top: 0; right: 0; width: 12px; height: 12px; }
.lego-resize-sw { cursor: sw-resize; bottom: 0; left: 0; width: 12px; height: 12px; }
.lego-resize-se { cursor: se-resize; bottom: 0; right: 0; width: 12px; height: 12px; }
.lego-resize-n { cursor: n-resize; top: 0; left: 12px; right: 12px; height: 6px; }
.lego-resize-s { cursor: s-resize; bottom: 0; left: 12px; right: 12px; height: 6px; }
.lego-resize-e { cursor: e-resize; top: 12px; bottom: 12px; right: 0; width: 6px; }
.lego-resize-w { cursor: w-resize; top: 12px; bottom: 12px; left: 0; width: 6px; }

/* ===========================================
   BRICK STRIP (Taskbar)
   =========================================== */
.lego-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    /* 3D stud pattern - red (--lego-red, --lego-red-dark, --lego-red-light) */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%23D01012"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.3)"/><circle cx="16" cy="16" r="9" fill="%23A00D0F"/><circle cx="16" cy="14.5" r="8" fill="%23E83335"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23A00D0F" opacity="0.4"/></svg>');
    background-size: 32px 32px;
    border-top: 4px solid var(--lego-black);
    display: flex;
    align-items: center;
    z-index: 10000;
    box-shadow: 0 -4px 8px var(--lego-shadow);
}

.lego-start-button {
    height: 32px;
    padding: 4px 8px;
    background: var(--lego-yellow);
    border: 3px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-base);
    font-weight: 800;
    font-family: var(--font-family);
    color: var(--lego-black);
    margin-left: 4px;
    box-shadow: 0 3px 0 var(--lego-yellow-dark);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.lego-start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--lego-yellow-dark);
}

.lego-start-button:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--lego-yellow-dark);
}

.lego-start-logo {
    width: 24px;
    height: 24px;
    background-image: url('data:image/svg+xml,<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="6" width="20" height="12" fill="%23D01012" stroke="%231B1B1B" stroke-width="1"/><circle cx="8" cy="12" r="3" fill="%23E83335"/><circle cx="16" cy="12" r="3" fill="%23E83335"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.lego-taskbar-windows {
    flex: 1;
    display: flex;
    gap: 4px;
    margin: 4px 8px;
    overflow-x: auto;
}

.lego-taskbar-window-button {
    padding: 6px 16px;
    background: var(--lego-surface);
    border: 2px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    cursor: pointer;
    font-size: var(--font-size-small);
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--lego-black);
    display: flex;
    align-items: center;
    min-width: 120px;
    max-width: 200px;
    box-shadow: 0 2px 0 var(--lego-gray);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.lego-taskbar-window-button:hover {
    background: var(--lego-white);
    transform: translateY(-1px);
    box-shadow: 0 3px 0 var(--lego-gray);
}

.lego-taskbar-window-button.active {
    background: var(--lego-blue);
    color: var(--lego-white);
    box-shadow: 0 0 0 var(--lego-blue-dark);
}

.lego-system-tray {
    height: 24px;
    padding: 2px 8px;
    background: var(--lego-surface);
    border: 2px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    margin-right: 2px;
    display: flex;
    align-items: center;
    font-size: var(--font-size-small);
    font-weight: 700;
    color: var(--lego-black);
}

/* Tooltip - Instruction Style */
.lego-tooltip {
    position: absolute;
    background: var(--lego-yellow);
    border: 2px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    padding: 6px 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    z-index: 10001;
    pointer-events: none;
    max-width: 200px;
    box-shadow: 2px 2px 0 var(--lego-shadow);
}

/* Context Menu */
.lego-context-menu {
    position: absolute;
    background: var(--lego-white);
    border: 3px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
    min-width: 160px;
    z-index: 10002;
    box-shadow: 4px 4px 0 var(--lego-shadow);
    overflow: hidden;
}

.lego-context-menu-item {
    padding: 8px 20px;
    cursor: default;
    font-size: var(--font-size-small);
    font-weight: 600;
    transition: background 0.1s ease;
}

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

/* Progress Bar - Brick Fill */
.lego-progress-bar {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    height: 24px;
    position: relative;
    width: 100%;
    border-radius: var(--brick-radius-small);
    overflow: hidden;
}

.lego-progress-fill {
    background: var(--lego-green);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
    /* Stud pattern */
    background-image: url('data:image/svg+xml,<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="3" fill="rgba(255,255,255,0.2)"/></svg>');
    background-size: 16px 16px;
}

/* Scrollbar - Brick Style */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: var(--lego-surface-dark);
    border-radius: var(--brick-radius-small);
}

::-webkit-scrollbar-thumb {
    background: var(--lego-gray);
    border: 2px solid var(--lego-black);
    border-radius: var(--brick-radius-small);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lego-gray-dark);
}

/* Hidden */
.hidden {
    display: none !important;
}

/* ===========================================
   DIALOG - Instruction Card Style
   =========================================== */
.lego-dialog {
    position: absolute;
    border: 4px solid var(--lego-black);
    background: var(--lego-surface);
    border-radius: var(--brick-radius);
    box-shadow: 8px 8px 0 var(--lego-shadow);
    z-index: 1000;
    min-width: 320px;
}

.lego-dialog-title {
    color: var(--lego-white);
    height: 32px;
    padding: 4px 12px;
    font-size: var(--font-size-base);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
    /* 3D stud pattern - blue (--lego-blue, --lego-blue-dark, --lego-blue-light) */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%230055BF"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.3)"/><circle cx="16" cy="16" r="9" fill="%23003D8A"/><circle cx="16" cy="14.5" r="8" fill="%231A6FD4"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23003D8A" opacity="0.4"/></svg>');
    background-size: 32px 32px;
}

.lego-dialog-close {
    width: 24px;
    height: 24px;
    border: 2px solid var(--lego-black);
    background: var(--lego-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    color: var(--lego-white);
    padding: 0;
    box-shadow: 0 2px 0 var(--lego-red-dark);
    transition: transform 0.1s ease;
}

.lego-dialog-close:hover {
    transform: scale(1.1);
}

.lego-dialog-content {
    padding: 16px;
    background: var(--lego-white);
    border: 2px solid var(--lego-gray);
    margin: 8px;
    border-radius: var(--brick-radius-small);
}

/* Run Dialog Styles */
.lego-run-dialog {
    position: absolute;
    border: 4px solid var(--lego-black);
    background: var(--lego-surface);
    border-radius: var(--brick-radius);
    box-shadow: 8px 8px 0 var(--lego-shadow);
    z-index: 1001;
    width: 420px;
}

.lego-run-dialog-title {
    color: var(--lego-white);
    height: 32px;
    padding: 4px 12px;
    font-size: var(--font-size-base);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
    /* 3D stud pattern - blue (--lego-blue, --lego-blue-dark, --lego-blue-light) */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%230055BF"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.3)"/><circle cx="16" cy="16" r="9" fill="%23003D8A"/><circle cx="16" cy="14.5" r="8" fill="%231A6FD4"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23003D8A" opacity="0.4"/></svg>');
    background-size: 32px 32px;
}

.lego-run-dialog-content {
    padding: 16px;
    background: var(--lego-white);
    border: 2px solid var(--lego-gray);
    margin: 8px;
    border-radius: var(--brick-radius-small);
}

.lego-run-instruction {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--lego-black);
}

.lego-run-instruction-icon {
    width: 32px;
    height: 32px;
    background: var(--lego-yellow);
    border: 2px solid var(--lego-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.lego-run-input-container {
    position: relative;
    margin-bottom: 20px;
}

.lego-run-label {
    font-size: var(--font-size-small);
    font-weight: 700;
    color: var(--lego-black);
    margin-bottom: 6px;
    display: block;
}

.lego-run-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lego-run-input {
    flex: 1;
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 8px 12px;
    font-size: var(--font-size-small);
    font-family: var(--font-family);
    font-weight: 600;
    color: var(--lego-black);
    height: 36px;
    box-sizing: border-box;
    border-radius: var(--brick-radius-small);
}

.lego-run-input:focus {
    outline: none;
    border-color: var(--lego-blue);
}

.lego-run-dropdown-button {
    width: 36px;
    height: 36px;
    border: 3px solid var(--lego-black);
    background: var(--lego-yellow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    padding: 0;
    margin-left: -3px;
    flex-shrink: 0;
    border-radius: 0 var(--brick-radius-small) var(--brick-radius-small) 0;
    transition: background 0.1s ease;
}

.lego-run-dropdown-button:hover {
    background: var(--lego-yellow-light);
}

.lego-run-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--lego-white);
    border: 3px solid var(--lego-black);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 4px 4px 0 var(--lego-shadow);
    display: none;
    border-radius: 0 0 var(--brick-radius-small) var(--brick-radius-small);
}

.lego-run-dropdown-list.show {
    display: block;
}

.lego-run-dropdown-item {
    padding: 8px 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    cursor: pointer;
    color: var(--lego-black);
    transition: background 0.1s ease;
}

.lego-run-dropdown-item:hover {
    background: var(--lego-blue);
    color: var(--lego-white);
}

.lego-run-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Properties Dialog Styles */
.lego-properties-dialog {
    position: absolute;
    border: 4px solid var(--lego-black);
    background: var(--lego-surface);
    border-radius: var(--brick-radius);
    box-shadow: 8px 8px 0 var(--lego-shadow);
    z-index: 1002;
    width: 520px;
    height: auto;
}

.lego-properties-dialog-title {
    color: var(--lego-white);
    height: 32px;
    padding: 4px 12px;
    font-size: var(--font-size-base);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
    /* 3D stud pattern - blue (--lego-blue, --lego-blue-dark, --lego-blue-light) */
    background-image: url('data:image/svg+xml,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" fill="%230055BF"/><ellipse cx="16" cy="18" rx="9" ry="2.5" fill="rgba(0,0,0,0.3)"/><circle cx="16" cy="16" r="9" fill="%23003D8A"/><circle cx="16" cy="14.5" r="8" fill="%231A6FD4"/><circle cx="16" cy="14.5" r="7" fill="none" stroke="rgba(255,255,255,0.2)" stroke-width="1"/><circle cx="16" cy="14.5" r="3" fill="%23003D8A" opacity="0.4"/></svg>');
    background-size: 32px 32px;
}

.lego-properties-tabs {
    background: var(--lego-surface);
    border-bottom: 2px solid var(--lego-gray);
    display: flex;
    padding: 8px 8px 0 8px;
    margin: 0;
}

.lego-properties-tab {
    padding: 8px 16px;
    background: var(--lego-surface-dark);
    border: 2px solid var(--lego-black);
    border-bottom: none;
    cursor: pointer;
    font-size: var(--font-size-small);
    font-weight: 700;
    color: var(--lego-black);
    margin-right: 4px;
    user-select: none;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
    transition: background 0.1s ease;
}

.lego-properties-tab:hover {
    background: var(--lego-white);
}

.lego-properties-tab.active {
    background: var(--lego-white);
    border-bottom: 2px solid var(--lego-white);
    position: relative;
    top: 2px;
}

.lego-properties-content {
    padding: 20px;
    background: var(--lego-white);
    border: 2px solid var(--lego-gray);
    margin: 8px;
    border-radius: var(--brick-radius-small);
}

.lego-properties-about {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lego-properties-about-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lego-properties-about-icon {
    width: 64px;
    height: 64px;
    border: 3px solid var(--lego-black);
    background: var(--lego-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
    box-shadow: 0 4px 0 var(--lego-yellow-dark);
}

.lego-properties-about-title {
    font-size: var(--font-size-large);
    font-weight: 800;
    color: var(--lego-black);
    margin-bottom: 4px;
}

.lego-properties-about-version {
    font-size: var(--font-size-small);
    color: var(--lego-gray-dark);
    font-weight: 600;
}

.lego-properties-about-description {
    font-size: var(--font-size-small);
    color: var(--lego-black);
    line-height: 1.6;
    margin-top: 8px;
    font-weight: 600;
}

.lego-properties-about-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.lego-properties-about-link {
    font-size: var(--font-size-small);
    color: var(--lego-blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 700;
}

.lego-properties-about-link:hover {
    color: var(--lego-blue-light);
}

.lego-properties-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid var(--lego-gray-light);
}

/* Shutdown Dialog Styles */
.lego-shutdown-dialog {
    position: fixed;
    border: 4px solid var(--lego-black);
    background: var(--lego-surface);
    border-radius: var(--brick-radius);
    box-shadow: 8px 8px 0 var(--lego-shadow);
    z-index: 10010;
    width: 360px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.lego-shutdown-dialog-title {
    background: linear-gradient(to right, var(--lego-red), var(--lego-orange));
    color: var(--lego-white);
    height: 32px;
    padding: 4px 12px;
    font-size: var(--font-size-base);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--brick-radius-small) var(--brick-radius-small) 0 0;
}

.lego-shutdown-dialog-content {
    padding: 20px;
    display: flex;
    gap: 20px;
}

.lego-shutdown-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
}

.lego-shutdown-icon-square {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--lego-black);
}

.lego-shutdown-icon-square.red { background: var(--lego-red); }
.lego-shutdown-icon-square.green { background: var(--lego-green); }
.lego-shutdown-icon-square.blue { background: var(--lego-blue); }
.lego-shutdown-icon-square.yellow { background: var(--lego-yellow); }

.lego-shutdown-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lego-shutdown-question {
    font-size: var(--font-size-small);
    font-weight: 700;
    color: var(--lego-black);
    margin-bottom: 4px;
}

.lego-shutdown-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lego-shutdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--lego-black);
    cursor: pointer;
}

.lego-shutdown-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.lego-shutdown-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 2px solid var(--lego-gray-light);
}

/* Fullscreen Shutdown Screens */
.lego-shutdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--lego-black);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lego-shutdown-message {
    color: var(--lego-white);
    font-size: 28px;
    font-family: var(--font-family);
    font-weight: 800;
    text-align: center;
}

.lego-safe-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--lego-black);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lego-safe-message {
    color: var(--lego-yellow);
    font-size: 36px;
    font-family: var(--font-family);
    font-weight: 800;
    text-align: center;
    line-height: 1.4;
    text-shadow: 4px 4px 0 var(--lego-orange);
}

/* ===========================================
   INPUT STYLES
   =========================================== */
input[type="text"], 
input[type="password"], 
input[type="email"],
textarea {
    border: 3px solid var(--lego-black);
    background: var(--lego-white);
    padding: 8px 12px;
    font-size: var(--font-size-small);
    font-family: var(--font-family);
    font-weight: 600;
    color: var(--lego-black);
    border-radius: var(--brick-radius-small);
}

input[type="text"]:focus, 
input[type="password"]:focus, 
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--lego-blue);
}
