:root {
    --bg: #0f1115;
    --desktop-wallpaper: radial-gradient(1200px 600px at 70% 20%, #1b2440 0, transparent 60%),
    radial-gradient(1200px 600px at 20% 70%, #321b40 0, transparent 60%),
    #0b0d12;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-2: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.15);
    --text: #e6e9ef;
    --muted: #aab2c0;
    --accent: #6ea8fe;
    --red: #ff6b6b;
    --yellow: #ffd166;
    --green: #51cf66;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --radius: 12px;
    --dock-height: 72px;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    user-select: none;
    overflow: hidden;
}

/* Desktop */
#desktop {
    position: fixed;
    inset: 0;
    background: var(--desktop-wallpaper);

    /* Dock */
    #dock {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 16px;
        height: var(--dock-height);
        background: var(--panel);
        backdrop-filter: blur(10px);
        border: 1px solid var(--border);
        border-radius: 16px;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 10px 14px;
        box-shadow: var(--shadow);
        z-index: 9999;

        .dock-item {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            cursor: pointer;
            background: var(--panel-2);
            border: 1px solid var(--border);
            color: var(--text);
            font-weight: 600;
            transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);

            &:hover {
                transform: translateY(-2px) scale(1.03);
            }

            &:active {
                transform: translateY(0) scale(0.98);
            }
        }

        .dock-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--accent);
            margin-top: 6px;
            opacity: .9;
        }
    }

    /* Window */
    .os-window {
        position: absolute;
        top: 10%;
        left: 10%;
        width: 800px;
        height: 520px;
        display: flex;
        flex-direction: column;
        background: rgba(20, 24, 32, 0.9);
        backdrop-filter: blur(6px);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        overflow: hidden;
        resize: both; /* native resize */
        min-width: 360px;
        min-height: 260px;
        z-index: 10;

        @media (max-width: 768px) {
            & {
                width: 95vw;
                height: 70vh;
                left: 2.5vw;
                top: 6vh;
            }
        }

        &.maximized {
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: calc(100% - var(--dock-height) - 24px) !important;
            border-radius: 0;
            resize: none;
        }

        /* Focus ring */
        &.active {
            outline: 2px solid rgba(110, 168, 254, 0.5);
            outline-offset: -2px;
        }

        .titlebar {
            height: 38px;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 0 10px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
            border-bottom: 1px solid var(--border);
            cursor: grab;

            &:active {
                cursor: grabbing;
            }

            .traffic {
                display: flex;
                gap: 8px;
                align-items: center;

                .btn-circle {
                    width: 12px;
                    height: 12px;
                    border-radius: 50%;
                    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
                }

                .btn-close {
                    background: var(--red);
                }

                .btn-min {
                    background: var(--yellow);
                }

                .btn-max {
                    background: var(--green);
                }
            }

            .title {
                font-weight: 600;
                color: var(--muted);
                letter-spacing: .2px;
            }

            .spacer {
                flex: 1;
            }
        }

        /* Performance fix */
        &.dragging iframe {
            pointer-events: none;
        }

        /* Performance fix: Semi-transparent overlay */
        &.dragging::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: transparent;
            z-index: 9999;
            pointer-events: none;
        }

        .content {
            flex: 1;
            background: #0b0e14;

            iframe {
                width: 100%;
                height: 100%;
                border: 0;
                background: white;
            }
        }
    }
}

