/* ==========================================================================
   Desktop Environment & Desktop Icons (Windows XP Style with bg.jpg)
   ========================================================================== */

.desktop-container {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile: excludes the browser's address bar */
  z-index: var(--z-desktop);
  overflow: hidden;
  background-color: #3a6ea5;
  /* First layer: soft shade behind the icon column so icons stand out from the wallpaper */
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0, rgba(0, 0, 0, 0.12) 150px, transparent 260px),
    url('../assets/backgrounds/bg.jpg'),
    radial-gradient(ellipse at 50% 100%, #6ba545 0%, #3e8824 35%, transparent 65%),
    linear-gradient(180deg, #1b58b8 0%, #4a8ee8 55%, #76b1f4 75%, #a6d0fa 100%);
  background-size: cover;
  /* Wide screens crop the 3:2 wallpaper: crop the sky, keep the foxes at the bottom */
  background-position: center 80%;
  background-repeat: no-repeat;
  transition: filter 0.4s ease, opacity 0.2s ease;
}

/* Grayscale Desaturation when Shutting Down */
.desktop-container.desktop-desaturated {
  filter: grayscale(100%) brightness(0.65) contrast(0.9);
}



/* Watermark */
.desktop-watermark {
  position: absolute;
  right: 24px;
  bottom: calc(var(--taskbar-height) + 16px);
  pointer-events: none;
  text-align: right;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-system);
  line-height: 1.3;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.desktop-watermark-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
}

.desktop-watermark-sub {
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Desktop Icons Grid */
.desktop-icons-area {
  position: absolute;
  inset: 0;
  bottom: var(--taskbar-height);
  pointer-events: none;
  z-index: 5;
}

/* Individual Desktop Icon */
.desktop-icon {
  position: absolute;
  pointer-events: auto;
  width: 82px;
  height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 4px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.desktop-icon:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.desktop-icon.selected {
  background-color: rgba(11, 95, 215, 0.45);
  border: 1px dotted rgba(255, 255, 255, 0.8);
}

.desktop-icon-img {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  pointer-events: none;
}

.desktop-icon-img-file {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.desktop-icon-label {
  color: #ffffff;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  /* Break after "_" or "." (desktop.js adds <wbr>), not in the middle of a word */
  word-break: normal;
  overflow-wrap: break-word;
  /* Tight dark halo (XP style) keeps white text readable on clouds, grass and foxes */
  text-shadow: 1px 1px 1px #000, 0 0 2px #000, 0 0 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.5);
  max-width: 78px;
  padding: 1px 3px;
  border-radius: 2px;
  pointer-events: none;
}

.desktop-icon.selected .desktop-icon-label {
  background-color: #0b5fd7;
}

/* Special Highlighting for JOIN_MPC.exe */
.desktop-icon.featured-join {
  position: relative;
}

.desktop-icon.featured-join::after {
  content: "HOT";
  position: absolute;
  top: 2px;
  right: 6px;
  background: #ff3300;
  color: #fff;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 3px;
  animation: bounceBadge 1.2s infinite;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

@keyframes bounceBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Rubber-band Marquee Selection Box */
.desktop-selection-box {
  position: absolute;
  border: 1px dotted #0055ea;
  background-color: rgba(0, 85, 234, 0.2);
  pointer-events: none;
  z-index: 10;
  display: none;
}

/* ==========================================================================
   Desktop Right-Click Context Menu (Classic XP Menu)
   ========================================================================== */

.desktop-context-menu {
  position: fixed;
  width: 170px;
  background-color: #ffffff;
  border: 1px solid #716f64;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
  padding: 2px;
  z-index: 9500;
  font-family: var(--font-system);
  font-size: 11px;
}

.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 2px;
  color: #000000;
}

.ctx-item:hover {
  background-color: #316ac5;
  color: #ffffff;
}

.ctx-item.disabled {
  color: #a0a0a0;
  cursor: default;
}

.ctx-item.disabled:hover {
  background-color: transparent;
  color: #a0a0a0;
}

.ctx-divider {
  height: 1px;
  background-color: #dcdcdc;
  margin: 3px 2px;
}

/* Sleep Overlay */
.xp-sleep-overlay {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Font-glyph icons (Calculator, Minesweeper): dark blue glyphs vanish on the wallpaper,
   so on the desktop they sit on a glossy XP-style tile with a white glyph. */
.desktop-icon-img > i.bi {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22%;
  background: linear-gradient(180deg, #6aa8ff 0%, #2a6ee0 55%, #1a4fb8 100%);
  color: #fff !important;
  font-size: var(--icon-glyph, 26px) !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.desktop-icon[data-app-id="winmine.exe"] .desktop-icon-img > i.bi {
  background: linear-gradient(180deg, #7fd36b 0%, #3a9a2c 55%, #26731c 100%);
}

/* Drag & Swap Hover Feedback */
.desktop-icon.drag-swap-hover {
  background-color: rgba(255, 170, 0, 0.35) !important;
  border-color: #ffaa00 !important;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.7);
  transform: scale(1.08);
  transition: transform 0.15s, background-color 0.15s;
}
