.xp-desktop {
  background: linear-gradient(180deg, #245edc 0%, #3a6ea5 50%, #245edc 100%);
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080"><defs><linearGradient id="sky" x1="0%25" y1="0%25" x2="0%25" y2="100%25"><stop offset="0%25" style="stop-color:%23245EDC"/><stop offset="50%25" style="stop-color:%233A6EA5"/><stop offset="100%25" style="stop-color:%23245EDC"/></linearGradient><linearGradient id="grass" x1="0%25" y1="0%25" x2="0%25" y2="100%25"><stop offset="0%25" style="stop-color:%234CAF50"/><stop offset="100%25" style="stop-color:%232E7D32"/></linearGradient></defs><rect fill="url(%23sky)" width="1920" height="1080"/><ellipse cx="960" cy="1200" rx="1400" ry="600" fill="url(%23grass)"/><ellipse cx="300" cy="200" rx="80" ry="50" fill="white" opacity="0.8"/><ellipse cx="350" cy="190" rx="60" ry="40" fill="white" opacity="0.8"/><ellipse cx="280" cy="210" rx="50" ry="35" fill="white" opacity="0.8"/></svg>');
  background-size: cover;
  background-position: center;
}

/* CRT mode: scanlines + a tiny bit of "old monitor" vibe */
#crt-overlay {
  background:
    /* Scanlines */
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.55) 0px,
      rgba(0, 0, 0, 0.55) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 4px
    ),
    /* Subpixel mask (very visible) */
    repeating-linear-gradient(
      to right,
      rgba(255, 0, 0, 0.09) 0px,
      rgba(0, 255, 0, 0.09) 1px,
      rgba(0, 120, 255, 0.09) 2px,
      rgba(0, 0, 0, 0) 3px
    ),
    /* Vignette */
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.65) 100%);
  mix-blend-mode: multiply;
  animation: crt-flicker 3.2s infinite linear;
}

body.crt-mode #xpContainer {
  filter: saturate(1.22) contrast(1.22) brightness(0.92);
}

@keyframes crt-flicker {
  0%, 100% { opacity: 0.92; }
  45% { opacity: 0.97; }
  50% { opacity: 0.88; }
  55% { opacity: 0.98; }
}

.desktop-icon {
  cursor: pointer;
  user-select: none;
  transition: all 0.08s ease;
  touch-action: manipulation;
}

.desktop-icon:hover {
  background: rgba(11, 97, 255, 0.25);
  border: 1px dotted rgba(255, 255, 255, 0.55);
}

.desktop-icon.selected {
  background: rgba(11, 97, 255, 0.5);
  border: 1px dotted rgba(255, 255, 255, 0.85);
}

.dragging {
  opacity: 0.75;
  z-index: 1000 !important;
}

.xp-window {
  box-shadow: 2px 2px 10px rgba(0,0,0,0.55);
  border: 1px solid var(--xp-border);
}

.xp-titlebar {
  background: linear-gradient(180deg, var(--xp-titlebar) 0%, var(--xp-primary) 8%, var(--xp-titlebar) 40%, var(--xp-primary) 88%, var(--xp-border) 93%, var(--xp-border) 100%);
  border-radius: 8px 8px 0 0;
}

.xp-btn-close {
  background: linear-gradient(180deg, #e04343 0%, #c92a2a 50%, #b82020 100%);
  border: 1px solid #3d0000;
}

.xp-btn-close:hover {
  background: linear-gradient(180deg, #ff6b6b 0%, #e04343 50%, #c92a2a 100%);
}

.xp-btn-min, .xp-btn-max {
  background: linear-gradient(180deg, var(--xp-taskbar-2) 0%, var(--xp-primary) 50%, var(--xp-titlebar) 100%);
  border: 1px solid var(--xp-border);
}

.xp-btn-min:hover, .xp-btn-max:hover {
  background: linear-gradient(180deg, #5ba3ff 0%, var(--xp-taskbar-2) 50%, var(--xp-primary) 100%);
}

.xp-taskbar {
  background: linear-gradient(180deg, var(--xp-taskbar-1) 0%, var(--xp-primary) 3%, var(--xp-taskbar-2) 6%, var(--xp-taskbar-2) 94%, var(--xp-primary) 97%, var(--xp-taskbar-1) 100%);
  border-top: 1px solid var(--xp-border);
}

.start-button {
  background: linear-gradient(180deg, var(--xp-green-1) 0%, var(--xp-green-2) 50%, var(--xp-green-3) 100%);
  border-radius: 0 12px 12px 0;
  border: 1px solid #1b4f1b;
}

.start-button:hover {
  background: linear-gradient(180deg, #4bb84b 0%, var(--xp-green-1) 50%, var(--xp-green-2) 100%);
}

.start-menu {
  background: linear-gradient(180deg, #3b82f6 0%, #1e40af 100%);
  box-shadow: 2px 2px 10px rgba(0,0,0,0.55);
}

.start-menu-left {
  background: linear-gradient(180deg, #ffffff 0%, #d4e4ff 100%);
}

.start-menu-right {
  background: linear-gradient(180deg, #5b9bd5 0%, #3570b5 100%);
}

.taskbar-item {
  background: linear-gradient(180deg, var(--xp-taskbar-2) 0%, var(--xp-primary) 50%, var(--xp-taskbar-1) 100%);
  border: 1px solid var(--xp-border);
}

.taskbar-item:hover {
  background: linear-gradient(180deg, #5ba3ff 0%, var(--xp-taskbar-2) 50%, var(--xp-primary) 100%);
}

@keyframes taskbar-attention-blink {
  0%, 49% {
    filter: saturate(1.2) brightness(1.05);
  }
  50%, 100% {
    filter: saturate(1.6) brightness(1.2);
  }
}

/* MSN-style: orange-ish flashing taskbar button for unread/attention windows */
.taskbar-item.taskbar-item-attention {
  background: linear-gradient(180deg, #f59e0b 0%, #f97316 55%, #ea580c 100%);
  border: 1px solid #7c2d12;
  animation: taskbar-attention-blink 0.8s steps(2, jump-none) infinite;
}

.xp-menubar span {
  cursor: default;
}

.xp-menubar span:hover {
  text-decoration: underline;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.nudge {
  animation: shake 0.08s infinite;
}

/* Window resize handles */
.resize-handle {
  position: absolute;
  background: transparent;
}

.resize-n, .resize-s {
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
}

.resize-e, .resize-w {
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
}

.resize-n { top: -4px; }
.resize-s { bottom: -4px; }
.resize-e { right: -4px; }
.resize-w { left: -4px; }

.resize-nw, .resize-ne, .resize-sw, .resize-se {
  width: 12px;
  height: 12px;
}

.resize-nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-se { bottom: -4px; right: -4px; cursor: se-resize; }

/* Mobile-specific styles */
@media (max-width: 768px) {
  /* Hide sidebar on mobile */
  #sidebar {
    display: none !important;
  }
  
  #sidebarToggle {
    display: none !important;
  }
  
  /* Make app container full screen */
  #app {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
  }
  
  /* Make xpContainer take full screen */
  #xpContainer {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
  }
  
  /* Desktop with wallpaper - full viewport */
  #desktop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* The wallpaper background itself - mobile version with non-preserving aspect ratio SVG */
  .xp-desktop {
    min-height: 100vh !important;
    min-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(180deg, #245edc 0%, #3a6ea5 50%, #245edc 100%) !important;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080" preserveAspectRatio="none"><defs><linearGradient id="sky-mobile" x1="0%25" y1="0%25" x2="0%25" y2="100%25"><stop offset="0%25" style="stop-color:%23245EDC"/><stop offset="50%25" style="stop-color:%233A6EA5"/><stop offset="100%25" style="stop-color:%23245EDC"/></linearGradient><linearGradient id="grass-mobile" x1="0%25" y1="0%25" x2="0%25" y2="100%25"><stop offset="0%25" style="stop-color:%234CAF50"/><stop offset="100%25" style="stop-color:%232E7D32"/></linearGradient></defs><rect fill="url(%23sky-mobile)" width="1920" height="1080"/><ellipse cx="960" cy="1200" rx="1400" ry="600" fill="url(%23grass-mobile)"/><ellipse cx="300" cy="200" rx="80" ry="50" fill="white" opacity="0.8"/><ellipse cx="350" cy="190" rx="60" ry="40" fill="white" opacity="0.8"/><ellipse cx="280" cy="210" rx="50" ry="35" fill="white" opacity="0.8"/></svg>') !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll !important;
  }
  
  /* Taskbar fixed at bottom */
  .xp-taskbar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    z-index: 9999 !important;
  }
  
  /* Make all windows 20% larger than 50% size on mobile (0.5 × 1.2 = 0.6) */
  .xp-window {
    transform: scale(0.6) !important;
    transform-origin: top left !important;
  }
  
  body {
    overflow: hidden !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(180deg, #245edc 0%, #3a6ea5 50%, #245edc 100%) !important;
  }
}
