/* Base reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

/* ==========================
   DaxxyOS Desktop (scoped)
   ========================== */
/* New: global no-text-selection (Ctrl/Cmd+A also blocked in JS) */
.desktop-app,
.desktop-app * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Desktop fills viewport, grid starts at top-left (remove centered card look) */
.desktop-app .desktop {
    position: fixed;
    inset: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    padding: 24px 24px 24px 48px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, max-content));
    justify-content: start;
    align-content: start;
    gap: 18px;
    overflow: auto;
    user-select: none;
    animation: dx-fade-in 420ms ease-out both;
}

/* Donut ring remains centered but behind icons */
.desktop-app .desktop::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(180px, 42vmin, 360px);
    height: clamp(180px, 42vmin, 360px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle closest-side,
            transparent calc(50% - 14px),
            rgba(255, 255, 255, 0.16) calc(50% - 14px) 50%,
            transparent 52%);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, .35);
}

/* Free layout (align to grid OFF) */
.desktop-app .desktop.free-layout {
    display: block;
}

.desktop-app .desktop.free-layout .icon {
    position: absolute;
}

/* Icon and tile visual (square tile card you can size/center) */
.desktop-app .icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    outline: none;
    opacity: 0;
    transform: translateY(6px) scale(.98);
    animation: dx-rise-in 520ms cubic-bezier(.22, .87, .32, 1) both;
    -webkit-user-drag: none;
    touch-action: none;
    position: relative;
    z-index: 1;
}

.desktop-app .icon:active {
    cursor: grabbing;
}

.desktop-app .icon.dragging {
    z-index: 9999;
    will-change: transform;
}

.desktop-app .icon.dragging .tile {
    transform: translateY(-2px) scale(1.06);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(99, 102, 241, .35);
}

/* Ensure drag proxy remains visible and unaffected by initial icon animation */
.desktop-app .icon.drag-proxy {
    opacity: 1 !important;
    animation: none !important;
}

/* The “square card” for each app icon */
.desktop-app .tile {
    --size: 72px;
    --radius: 18px;
    width: var(--size);
    height: var(--size);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    box-shadow: var(--dx-tile-shadow);
    transition: transform 160ms ease, box-shadow 160ms ease, background 200ms ease;
    background: var(--dx-tile-bg);
    border: 1px solid var(--dx-tile-br);
    backdrop-filter: blur(6px);
    position: relative;
    overflow: hidden;
    -webkit-user-drag: none;
    touch-action: none;
}

/* Taskbar (the top widget). It’s centered and has high z-index. */
.desktop-app .taskbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    height: auto;
    top: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(15, 23, 42, 1);
    border: 1px solid var(--dx-taskbar-border);
    border-radius: 14px;
    backdrop-filter: blur(12px) saturate(120%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
    z-index: 20;
    cursor: pointer;
}

.desktop-app .taskbar.pos-top {
    top: 10px;
    bottom: auto;
    transform: translateX(-50%);
}

.desktop-app .taskbar.pos-bottom {
    top: auto;
    bottom: 10px;
    transform: translateX(-50%);
}

/* Context menu styling (shown on right-click) */
.desktop-app .context-menu {
    position: fixed;
    min-width: 200px;
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    padding: 6px;
    display: none;
    z-index: 1000;
}

.desktop-app .context-menu.show {
    display: block;
}

/* Avoid visible selection highlight inside the app */
.desktop-app ::selection {
    background: transparent;
}

.desktop-app {
    --dx-bg1: #000000;
    --dx-bg2: #0032d6;
    --dx-bg3: #000000;
    --dx-bg4: #c0c0c0;
    --dx-taskbar-bg: rgba(15, 23, 42, 0.65);
    --dx-taskbar-border: rgba(255, 255, 255, 0.08);
    --dx-label: rgba(255, 255, 255, 0.92);
    --dx-tile-bg: rgba(255, 255, 255, 0.06);
    --dx-tile-br: rgba(255, 255, 255, 0.08);
    --dx-tile-shadow: 0 8px 24px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
    --dx-accent: #000291;
    --dx-selection: rgba(99, 102, 241, 0.35);
    color: #fff;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
    background: linear-gradient(135deg,
            var(--dx-bg1) 0%,
            var(--dx-bg2) 35%,
            var(--dx-bg3) 70%,
            var(--dx-bg4) 100%);
    background-size: 200% 200%;
    animation: dx-bg-pan-1 30s ease-in-out infinite;
    overflow: hidden;
    position: relative;
}

.desktop-app::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: 0;
    pointer-events: none;
    background: conic-gradient(from 0deg at 50% 50%, rgba(99, 102, 241, .25), rgba(177, 2, 247, 0.18), rgba(212, 6, 202, 0.18), rgba(244, 63, 94, .18), rgba(99, 102, 241, .25));
    filter: blur(80px) saturate(120%);
    animation: dx-orbit 42s linear infinite;
}

/* Ensure desktop content sits above animated overlay */
.desktop-app .desktop,
.desktop-app .taskbar,
.desktop-app .context-menu {
    z-index: 1;
    position: relative;
}

/* Desktop surface */
.desktop-app .desktop {
    position: fixed;
    inset: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    padding: 24px 24px 24px 24px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, max-content));
    justify-content: start;
    align-content: start;
    gap: 18px;
    overflow: auto;
    user-select: none;
    animation: dx-fade-in 420ms ease-out both;
}

/* Free layout (align to grid OFF) */
.desktop-app .desktop.free-layout {
    display: block;
}

.desktop-app .desktop.free-layout .icon {
    position: absolute;
}

/* Icons */
.desktop-app .icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    outline: none;
    opacity: 0;
    transform: translateY(6px) scale(.98);
    animation: dx-rise-in 520ms cubic-bezier(.22, .87, .32, 1) both;
    -webkit-user-drag: none;
    touch-action: none;
    position: relative;
    z-index: 1;
}

.desktop-app .icon:active {
    cursor: grabbing;
}

.desktop-app .icon.dragging {
    z-index: 9999;
    will-change: transform;
}

.desktop-app .icon.dragging .tile {
    transform: translateY(-2px) scale(1.06);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(99, 102, 241, .35);
}

/* When user repositions an icon into a new grid slot */
.desktop-app .icon.free {
    position: static;
}

.desktop-app .icon:focus-visible .tile {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.65), var(--dx-tile-shadow);
}

.desktop-app .icon.selected .tile {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: -2px;
}

.desktop-app .tile {
    --size: 72px;
    --radius: 18px;
    width: var(--size);
    height: var(--size);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    box-shadow: var(--dx-tile-shadow);
    transition: transform 160ms ease, box-shadow 160ms ease, background 200ms ease;
    background: var(--dx-tile-bg);
    border: 1px solid var(--dx-tile-br);
    backdrop-filter: blur(6px);
    position: relative;
    overflow: hidden;
    -webkit-user-drag: none;
    touch-action: none;
}

.desktop-app .tile::before {
    content: "";
    position: absolute;
    top: -150%;
    bottom: -150%;
    left: -60%;
    right: -60%;
    background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.42) 50%, transparent 65%);
    transform: translateX(-120%) rotate(20deg);
    transition: transform 600ms ease;
    pointer-events: none;
}

.desktop-app .icon:hover .tile::before {
    transform: translateX(120%) rotate(20deg);
}

.desktop-app .icon:hover .tile {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    transform: translateY(-3px) scale(1.05);
}

.desktop-app .label {
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: var(--dx-label);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
    max-width: 110px;
    word-wrap: break-word;
}

/* Brand tiles */
.desktop-app .linkedin {
    background: #0a66c2;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .github {
    background: #0b0b0b;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .credly {
    background: #ff6f00;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .behance,
.desktop-app .facebook {
    background: #1769ff;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .instagram {
    background: radial-gradient(circle at 30% 107%,
            #fdf497 0%,
            #fdf497 5%,
            #fd5949 45%,
            #d6249f 60%,
            #285AEB 90%);
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .leetcode,
.desktop-app .tryhackme {
    background: #FFFFFF;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .hackerrank,
.desktop-app .hackthebox {
    background: #111927;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .youtube {
    background: #ff1100;
    border-color: rgba(255, 255, 255, .16);
}

.desktop-app .vercel {
    background: #000;
    border-color: rgba(255, 255, 255, .2);
}

.desktop-app .vercel svg {
    display: block;
    width: 28px;
    height: 28px;
}

/* Top/Bottom Menubar (repositionable) */
.desktop-app .taskbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    height: auto;
    top: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(15, 23, 42, 1);
    border: 1px solid var(--dx-taskbar-border);
    border-radius: 14px;
    backdrop-filter: blur(12px) saturate(120%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
    z-index: 20;
    cursor: pointer;
}

/* Digital watch styling for clock */
.desktop-app .taskbar .clock {
    font-family: 'Orbitron', 'Share Tech Mono', ui-monospace, monospace;
    font-size: 36px;
    letter-spacing: 1px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    opacity: .95;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .06);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

/* Center clock placed over the donut hole */
.desktop-app .clock-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    font-family: 'Orbitron', 'Share Tech Mono', ui-monospace, monospace;
    font-size: clamp(28px, 6vmin, 48px);
    letter-spacing: 1px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    pointer-events: none;
}

@media (max-width: 640px) {
    .desktop-app .clock-center {
        font-size: clamp(22px, 7vmin, 34px);
        padding: 8px 12px;
    }
}

@media (max-width: 640px) {
    .desktop-app .taskbar .clock {
        font-size: 26px;
        padding: 6px 10px;
    }
}

.desktop-app .taskbar.pos-top {
    top: 10px;
    bottom: auto;
    transform: translateX(-50%);
}

.desktop-app .taskbar.pos-bottom {
    top: auto;
    bottom: 10px;
    transform: translateX(-50%);
}

.desktop-app .taskbar .brand {
    font-weight: 800;
    font-size: 14px;
    opacity: .95;
    letter-spacing: .4px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Order flip: at top, clock above brand; at bottom, brand above clock */
.desktop-app .taskbar.pos-top .clock {
    order: 0;
}

.desktop-app .taskbar.pos-top .brand {
    order: 1;
}

.desktop-app .taskbar.pos-bottom .brand {
    order: 0;
}

.desktop-app .taskbar.pos-bottom .clock {
    order: 1;
}

/* Background clock and brand behind icons */
.desktop-app .brand {
    position: absolute;
    left: 50%;
    top: calc(50% + 56px);
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
    font-weight: 800;
    font-size: clamp(12px, 2.2vmin, 16px);
    opacity: .95;
    letter-spacing: .4px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

.desktop-app .brand.top-counter {
    top: calc(50% + 28px);
}

@media (max-width: 640px) {
    .desktop-app .brand.top-counter {
        top: calc(50% + 23px);
    }
}

/* Custom context menu */
.desktop-app .context-menu {
    position: fixed;
    min-width: 200px;
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    padding: 6px;
    display: none;
    z-index: 1000;
}

.desktop-app .context-menu.show {
    display: block;
}

.desktop-app .context-menu .ctx-item {
    width: 100%;
    text-align: left;
    padding: 9px 11px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #e5e7eb;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    /*OG pointer*/
}

.desktop-app .context-menu .ctx-item:hover {
    background: rgba(99, 102, 241, .18);
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .desktop-app .desktop {
        padding: 18px;
        gap: 14px;
    }

    .desktop-app .label {
        font-size: 11px;
        max-width: 92px;
    }

    .desktop-app .taskbar {
        min-width: 180px;
        padding: 10px 12px;
    }

    .desktop-app .tile {
        --size: 64px;
        --radius: 16px;
    }

    .desktop-app .clock-center {
        font-size: clamp(22px, 7vmin, 34px);
        padding: 8px 12px;
    }

    .desktop-app .brand {
        top: calc(50% + 46px);
    }
}

@media (max-width: 380px) {
    .desktop-app .desktop {
        padding: 14px;
        gap: 12px;
    }

    .desktop-app .tile {
        --size: 56px;
        --radius: 14px;
    }
}

/* Animations */
@keyframes dx-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes dx-rise-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dx-bg-pan {
    0% {
        background-position: 0% 0%, 100% 0%, 50% 0%;
    }

    50% {
        background-position: 100% 100%, 0% 50%, 50% 100%;
    }

    100% {
        background-position: 0% 0%, 100% 0%, 50% 0%;
    }
}

@keyframes dx-bg-pan-1 {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes dx-orbit {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.05);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Removed unused modal and button styles */

.power-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s cubic-bezier(.4, 0, .2, 1);
    opacity: 1;
    pointer-events: auto;
}

.power-overlay[aria-hidden="true"] {
    opacity: 0;
    pointer-events: none;
}

/* Hide desktop when powerOverlay is visible */
.power-overlay[aria-hidden="false"] ~ .desktop {
    display: none !important;
}

.power-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 32px 8px #b50003, 0 0 0 0 #ff2222;
    border-radius: 50%;
    animation: glow-pulse 1.2s infinite alternate;
    transition: box-shadow 0.3s;
}

.power-btn svg {
    display: block;
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 32px 8px #b50003, 0 0 0 0 #ff2222;
    }

    100% {
        box-shadow: 0 0 48px 16px #ff2222, 0 0 0 0 #b50003;
    }
}

/* Modal window styles for Terminal and Recycle Bin */
.modal.window-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 320px;
    max-width: 96vw;
    min-height: 180px;
    max-height: 80vh;
    background: rgba(17, 24, 39, 0.98);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 1.5px 0 rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: dx-fade-in 420ms ease-out both;
}

.modal.window-modal[aria-hidden="false"] {
    display: flex;
}

.window-bar {
    background: linear-gradient(90deg, #222 0%, #2a2a2a 100%);
    color: #fff;
    font-weight: 700;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.window-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.window-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.window-content {
    padding: 18px 20px;
    overflow-y: auto;
    background: transparent;
    flex: 1;
    color: #e5e7eb;
    font-size: 15px;
}

.terminal-content {
    background: #18181b;
    color: #00ea65;
    font-family: 'Share Tech Mono', 'Orbitron', ui-monospace, monospace;
    font-size: 15px;
    border-radius: 0 0 16px 16px;
    padding: 18px 20px 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.terminal-output {
    background: #18181b;
    color: #e5e7eb;
    font-family: 'Share Tech Mono', 'Orbitron', ui-monospace, monospace;
    font-size: 15px;
    border-radius: 8px;
    padding: 10px;
    min-height: 80px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.terminal-input {
    background: #222;
    color: #00ea65;
    font-family: 'Share Tech Mono', 'Orbitron', ui-monospace, monospace;
    font-size: 15px;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 7px 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 2px;
}

.terminal-input:focus {
    border-color: #00ea65;
}

.recyclebin-item {
    background: #222;
    color: #e5e7eb;
    border-radius: 7px;
    padding: 8px 12px;
    margin-bottom: 7px;
    font-size: 14px;
    transition: background 0.2s;
    cursor: pointer;
}

.recyclebin-item:hover {
    background: #3b82f6;
    color: #fff;
}

@media (max-width: 640px) {
    .modal.window-modal {
        min-width: 220px;
        max-width: 99vw;
        min-height: 120px;
        max-height: 90vh;
        border-radius: 10px;
    }

    .window-bar {
        padding: 8px 10px;
        font-size: 15px;
        border-radius: 10px 10px 0 0;
    }

    .window-content {
        padding: 12px 10px;
        font-size: 13px;
    }

    .terminal-content {
        padding: 12px 10px 8px 10px;
        font-size: 13px;
    }
}