/* ===== Desktop Background ===== */
#desktop {
    position: fixed;
    inset: 0;
    background: var(--hx-bg);
    font-family: var(--hx-font);
    overflow: hidden;
}

#desktop-bg {
    position: absolute;
    inset: 0;
    background-image: url('assets/images/LOGOMARK DARK@4x-100.jpg');
    background-size: 40%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.04;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* ===== CRT Overlay ===== */
#desktop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 10000;
}

#desktop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 10000;
}

/* ===== Screen Flicker ===== */
@keyframes screenFlicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.96; }
    97% { opacity: 1; }
    98% { opacity: 0.97; }
}

#desktop {
    animation: screenFlicker 8s infinite;
}

/* ===== Desktop Icons ===== */
#desktop-icons {
    position: absolute;
    inset: 0;
    bottom: 40px;
    z-index: 10;
    pointer-events: none;
}

.desktop-icon {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    width: 110px;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, opacity 0.3s, transform 0.3s;
    background: none;
    font-family: var(--hx-font);
    color: var(--hx-green);
    pointer-events: auto;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(151, 240, 29, 0.06);
    border-color: rgba(151, 240, 29, 0.15);
}

.desktop-icon:focus {
    outline: none;
    background: rgba(151, 240, 29, 0.1);
    border-color: rgba(151, 240, 29, 0.3);
}

.desktop-icon img {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    border: 1px solid rgba(151, 240, 29, 0.25);
    box-shadow: 0 0 8px rgba(151, 240, 29, 0.15);
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.05) brightness(0.95);
}

.desktop-icon span {
    font-size: 16px;
    text-align: center;
    color: var(--hx-green);
    text-shadow: 0 0 4px rgba(151, 240, 29, 0.3);
    line-height: 1.2;
    white-space: nowrap;
}

/* ===== Window Area ===== */
#window-area {
    position: absolute;
    inset: 0;
    bottom: 40px;
    z-index: 100;
    pointer-events: none;
}

/* ===== Taskbar ===== */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(151, 240, 29, 0.15);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 10001;
    font-family: var(--hx-font);
}

#taskbar-logo {
    height: 24px;
    opacity: 0.7;
    margin-right: 4px;
    flex-shrink: 0;
}

#taskbar-os {
    font-size: 14px;
    color: var(--hx-green);
    opacity: 0.7;
    margin-right: 16px;
    flex-shrink: 0;
    font-weight: 500;
}

#taskbar-windows {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    align-items: center;
}

.taskbar-btn {
    background: rgba(151, 240, 29, 0.08);
    border: 1px solid rgba(151, 240, 29, 0.2);
    color: var(--hx-green);
    font-family: var(--hx-font);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}

.taskbar-btn:hover {
    background: rgba(151, 240, 29, 0.15);
}

.taskbar-btn.active {
    background: rgba(151, 240, 29, 0.2);
    border-color: rgba(151, 240, 29, 0.4);
}

#taskbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

#sound-toggle {
    background: none;
    border: none;
    color: var(--hx-green);
    font-family: var(--hx-font);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    transition: opacity 0.15s;
}

#sound-toggle:hover {
    opacity: 1;
}

#sound-toggle.on {
    opacity: 1;
}

#taskbar-clock {
    font-size: 18px;
    color: var(--hx-green);
    text-shadow: 0 0 4px rgba(151, 240, 29, 0.3);
    min-width: 80px;
    text-align: right;
}

/* ===== Context Menu ===== */
#context-menu {
    display: none;
    position: fixed;
    background: rgba(10, 14, 18, 0.95);
    border: 1px solid rgba(151, 240, 29, 0.3);
    border-radius: 6px;
    padding: 4px 0;
    min-width: 180px;
    z-index: 20000;
    font-family: var(--hx-font);
    font-size: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

#context-menu.visible {
    display: block;
}

.ctx-item {
    padding: 8px 16px;
    color: var(--hx-green);
    cursor: pointer;
    transition: background 0.1s;
}

.ctx-item:hover {
    background: rgba(151, 240, 29, 0.12);
}

.ctx-separator {
    height: 1px;
    background: rgba(151, 240, 29, 0.15);
    margin: 4px 0;
}

/* ===== Recycle Bin ===== */
#recycle-bin {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 110px;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    z-index: 50;
    transition: background 0.15s, border-color 0.15s, transform 0.2s, box-shadow 0.2s;
    cursor: default;
    user-select: none;
}

#recycle-bin img {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    border: 1px solid rgba(151, 240, 29, 0.25);
    box-shadow: 0 0 8px rgba(151, 240, 29, 0.15);
    object-fit: cover;
}

#recycle-bin span {
    font-family: var(--hx-font);
    font-size: 16px;
    text-align: center;
    color: var(--hx-green);
    text-shadow: 0 0 4px rgba(151, 240, 29, 0.3);
    line-height: 1.2;
    white-space: nowrap;
}

#recycle-bin.drag-hover {
    transform: scale(1.1);
    background: rgba(151, 240, 29, 0.06);
    border-color: rgba(151, 240, 29, 0.4);
    box-shadow: 0 0 24px rgba(151, 240, 29, 0.3);
}

/* ===== Delete Confirmation Modal ===== */
#delete-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 30000;
    align-items: center;
    justify-content: center;
}

#delete-modal.visible {
    display: flex;
}

#delete-modal-content {
    background: rgba(10, 14, 18, 0.95);
    border: 1px solid rgba(151, 240, 29, 0.4);
    border-radius: 8px;
    padding: 24px 32px;
    font-family: var(--hx-font);
    color: var(--hx-green);
    text-align: center;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(151, 240, 29, 0.15);
}

#delete-modal-text {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
}

#delete-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#delete-modal-buttons button {
    font-family: var(--hx-font);
    font-size: 13px;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

#delete-confirm {
    background: rgba(151, 240, 29, 0.15);
    border: 1px solid rgba(151, 240, 29, 0.4);
    color: var(--hx-green);
}

#delete-confirm:hover {
    background: rgba(151, 240, 29, 0.25);
}

#delete-cancel {
    background: rgba(255, 95, 87, 0.1);
    border: 1px solid rgba(255, 95, 87, 0.3);
    color: #ff5f57;
}

#delete-cancel:hover {
    background: rgba(255, 95, 87, 0.2);
}

/* ===== Privacy Error Prompt ===== */
#privacy-error {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 30000;
    align-items: center;
    justify-content: center;
}

#privacy-error.visible {
    display: flex;
}

#privacy-error-window {
    background: rgba(10, 14, 18, 0.97);
    border: 1px solid #ff5f57;
    border-radius: 8px;
    min-width: 360px;
    max-width: 420px;
    box-shadow: 0 0 30px rgba(255, 95, 87, 0.2), 0 8px 40px rgba(0, 0, 0, 0.6);
    font-family: var(--hx-font);
    overflow: hidden;
}

#privacy-error-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 10px;
    background: rgba(255, 95, 87, 0.15);
    border-bottom: 1px solid rgba(255, 95, 87, 0.3);
}

#privacy-error-title {
    font-size: 13px;
    color: #ff5f57;
    font-weight: 700;
}

#privacy-error-close {
    background: none;
    border: none;
    color: #ff5f57;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

#privacy-error-close:hover {
    opacity: 1;
}

#privacy-error-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

#privacy-error-icon {
    font-size: 36px;
    color: #ff5f57;
    flex-shrink: 0;
    text-shadow: 0 0 12px rgba(255, 95, 87, 0.4);
}

#privacy-error-msg {
    margin: 0;
    font-size: 16px;
    color: #ff5f57;
    text-shadow: 0 0 6px rgba(255, 95, 87, 0.3);
    font-weight: 700;
}

#privacy-error-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 24px 16px;
}

#privacy-error-ok {
    font-family: var(--hx-font);
    font-size: 13px;
    padding: 6px 28px;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255, 95, 87, 0.15);
    border: 1px solid rgba(255, 95, 87, 0.4);
    color: #ff5f57;
    transition: background 0.15s;
}

#privacy-error-ok:hover {
    background: rgba(255, 95, 87, 0.25);
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    #desktop-icons {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-content: flex-start;
        gap: 8px;
        width: calc(100% - 24px);
        max-width: 460px;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        pointer-events: auto;
    }

    .desktop-icon {
        position: static;
        width: 80px;
    }

    .desktop-icon img {
        width: 64px;
        height: 64px;
    }

    .desktop-icon span {
        font-size: 13px;
    }

    #recycle-bin {
        top: auto;
        right: auto;
        bottom: 44px;
        left: 50%;
        transform: translateX(-50%);
        width: 80px;
    }

    #recycle-bin.drag-hover {
        transform: translateX(-50%) scale(1.1);
    }

    #recycle-bin img {
        width: 64px;
        height: 64px;
    }

    #recycle-bin span {
        font-size: 13px;
    }

    #taskbar {
        height: 36px;
        padding: 0 8px;
    }

    #taskbar-windows {
        display: none;
    }

    #sound-toggle {
        font-size: 20px;
    }

    #boot-screen {
        padding: 20px;
        font-size: 11px;
    }
}
