/* =============================================================================
   WRM LIVING STUDIO OS: SHELL & DESKTOP ENVIRONMENT
   Desktop, Opening Statement, Icons, Dock, Menus
   ============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
  font-family: var(--font-ui);
  background-color: var(--bg-deep);
  color: var(--ink-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* CRT Scanlines Overlay */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-crt);
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 3px;
  opacity: 0.45;
}

/* Desktop Workspace Container */
.os-desktop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: var(--z-desktop);
  background-color: #5c9e31;
  background-image: url('../assets/wrm-xp/wallpapers/green-hills-desktop.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

@media (max-width: 768px) {
  .os-desktop {
    background-image: url('../assets/wrm-xp/wallpapers/green-hills-mobile.png');
  }
}

/* Living Canvas Wallpaper */
.os-wallpaper-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-wallpaper);
  pointer-events: auto;
  display: block;
}

/* Foreground Contrast Veil */
.os-contrast-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-veil);
  background: transparent;
}

/* Semantic Opening Statement */
.os-opening-statement {
  position: absolute;
  top: 14px;
  right: 20px;
  z-index: var(--z-icons);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 340px;
  text-align: right;
  opacity: 0.9;
}

.statement-eyebrow {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.statement-headline {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.01em;
}

/* Desktop Destination Icons Grid */
.desktop-icons {
  position: absolute;
  top: 14px;
  left: 14px;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px 14px;
  z-index: var(--z-icons);
  pointer-events: none;
}

.desktop-icon-node,
.desktop-shortcut {
  width: 78px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  outline: none;
  border-radius: 4px;
  pointer-events: auto;
  border: 1px dotted transparent;
  position: relative;
  user-select: none;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.desktop-icon-node:hover,
.desktop-shortcut:hover {
  background: rgba(49, 106, 197, 0.2);
  border-color: rgba(49, 106, 197, 0.5);
  transform: translateY(-1px);
}

.desktop-icon-node:focus-visible,
.desktop-shortcut:focus-visible {
  border-color: #ffffff;
}

.desktop-icon-node.selected,
.desktop-shortcut.selected {
  background: #0b61ff;
  border-color: #ffffff;
  border-style: dotted;
}

.d-icon-graphic,
.shortcut-icon-graphic {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.shortcut-icon {
  width: 48px;
  height: 48px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.d-icon-graphic svg {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.d-icon-tag {
  position: absolute;
  bottom: -3px;
  right: -3px;
  font-family: Tahoma, sans-serif;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #ffffff;
}

.d-icon-tag.edition-badge {
  background: #f59e0b;
  color: #000000;
  border-color: #ffffff;
}

.d-icon-label-wrap,
.shortcut-label-wrap {
  display: inline-block;
  padding: 1px 3px;
  border-radius: 2px;
  max-width: 100%;
}

.desktop-shortcut.selected .shortcut-label-wrap,
.desktop-icon-node.selected .d-icon-label-wrap {
  background: #0b61ff;
}

.shortcut-title,
.d-icon-label {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.85);
}

/* Selection Marquee Box */
.selection-marquee {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: var(--z-marquee);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-xs);
}

/* Luna Blue Taskbar */
.os-taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(180deg, #245edc 0%, #3f8cf3 9%, #245edc 18%, #245edc 92%, #1941a5 100%);
  border-top: 1px solid #3f8cf3;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  padding: 0;
  gap: 0;
  z-index: var(--z-dock);
}

@media (max-width: 768px) {
  .os-taskbar {
    height: 40px;
  }
}

.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 0 10px;
  height: 100%;
  background: linear-gradient(180deg, #388e3c 0%, #4caf50 15%, #388e3c 85%, #2e7d32 100%);
  border: none;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  cursor: pointer;
  color: #ffffff;
  outline: none;
  box-shadow: inset 1px 1px 1px rgba(255, 255, 255, 0.4), 1px 0 2px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  transition: filter var(--duration-fast) ease;
}

.start-btn:hover, .start-btn.active {
  filter: brightness(1.1);
}

.start-btn:active {
  background: linear-gradient(180deg, #2e7d32 0%, #388e3c 100%);
  box-shadow: inset 1px 2px 3px rgba(0, 0, 0, 0.6);
}

.start-btn:focus-visible {
  box-shadow: inset 0 0 0 2px #ffffff;
}

.start-logo-svg {
  width: 15px;
  height: 15px;
  color: #ffffff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}

.taskbar-windows {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  height: 100%;
  align-items: center;
  padding: 0 6px;
}

.taskbar-tab {
  max-width: 170px;
  min-width: 90px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: linear-gradient(180deg, #3882f6 0%, #2054c4 100%);
  border: 1px solid #1d4ed8;
  border-radius: 3px;
  font-size: 11px;
  font-family: Tahoma, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  outline: none;
}

.taskbar-tab:hover {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.taskbar-tab.active {
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.taskbar-tab:focus-visible {
  box-shadow: 0 0 0 2px #ffffff;
}

.taskbar-tab-icon svg {
  width: 13px;
  height: 13px;
  display: block;
}

.taskbar-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* System Tray */
.system-tray {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
  background: linear-gradient(180deg, #0f52ba 0%, #1249b3 100%);
  border-left: 1px solid #103c8e;
  box-shadow: inset 1px 0 1px rgba(255, 255, 255, 0.2);
  gap: 8px;
  font-size: 11px;
  font-family: Tahoma, sans-serif;
  color: #ffffff;
}

.tray-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-family: inherit;
  min-height: 22px;
  padding: 1px 4px;
  border-radius: 2px;
  outline: none;
}

.tray-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.tray-btn:focus-visible {
  box-shadow: 0 0 0 2px #ffffff;
}

.tray-icon-svg {
  width: 13px;
  height: 13px;
}

.tray-theme-label {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.crt-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.tray-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.2);
}

.tray-clock {
  font-size: 11px;
  color: #ffffff;
  letter-spacing: 0.02em;
}

/* Start Menu Popup */
.start-menu {
  display: none;
  position: absolute;
  bottom: 30px;
  left: 0;
  width: 270px;
  background: #ffffff;
  border: 1px solid #003c74;
  border-radius: 6px 6px 0 0;
  z-index: var(--z-menu);
  box-shadow: 2px -4px 16px rgba(0, 0, 0, 0.5);
  overflow: visible;
}

@media (max-width: 768px) {
  .start-menu {
    bottom: 40px;
  }
}

.start-menu.open {
  display: flex;
}

.start-menu-sidebar {
  width: 32px;
  background: linear-gradient(180deg, #185bdd 0%, #154fb5 100%);
  display: flex;
  align-items: flex-end;
  padding-bottom: 14px;
  padding-left: 6px;
  border-radius: 5px 0 0 0;
}

.start-sidebar-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #a4c7f8;
}

.start-sidebar-text strong {
  color: #ffffff;
  font-weight: 700;
}

.start-menu-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: #ffffff;
}

.start-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  cursor: pointer;
  position: relative;
  color: #000000;
  outline: none;
}

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

.start-item:hover .start-icon-svg svg,
.start-item:hover .start-arrow {
  color: #ffffff;
}

.start-item:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-cyan);
}

.start-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.start-icon-svg svg {
  width: 16px;
  height: 16px;
  display: block;
  color: var(--ink-secondary);
}

.start-arrow {
  font-size: 14px;
  color: var(--ink-dim);
}

.start-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 6px;
}

.start-submenu {
  display: none;
  position: absolute;
  left: 100%;
  bottom: 0;
  background: #ffffff;
  border: 1px solid #003c74;
  border-radius: 3px;
  min-width: 220px;
  box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.4);
  z-index: calc(var(--z-menu) + 10);
  padding: 4px;
}

.start-item.has-sub:hover > .start-submenu,
.start-item.has-sub.open > .start-submenu {
  display: flex;
  flex-direction: column;
}

.start-menu-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 2px;
  font-size: 11px;
  cursor: pointer;
  color: #000000;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  transition: background var(--duration-fast) ease;
}

.start-menu-subitem:hover {
  background: #316ac5;
  color: #ffffff;
}

.start-menu-subitem:hover .sm-dot,
.start-menu-subitem:hover .sm-text {
  color: #ffffff;
}

.sm-dot {
  font-size: 9px;
  color: #316ac5;
}

/* Desktop Context Menu */
.desktop-context-menu {
  display: none;
  position: absolute;
  width: 210px;
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-glass-highlight);
  border-radius: var(--radius-md);
  z-index: var(--z-menu);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  padding: 6px;
}

.desktop-context-menu.open {
  display: block;
}

.ctx-item {
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  transition: background var(--duration-fast) ease;
}

.ctx-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ctx-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctx-icon {
  width: 14px;
  height: 14px;
  color: var(--ink-secondary);
}

.ctx-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 6px;
}

.ctx-submenu {
  display: none;
  position: absolute;
  left: calc(100% + 4px);
  top: 0;
  width: 220px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass-highlight);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  padding: 6px;
}

.ctx-has-submenu:hover .ctx-submenu {
  display: block;
}

.ctx-bullet {
  font-size: 9px;
  color: var(--ink-dim);
  margin-right: 6px;
}

.ctx-bullet.active {
  color: var(--accent-cyan);
}

/* =============================================================================
   WRM XP: Boot Screen & Onboarding Tour
   ============================================================================= */

/* Boot Screen */
.wrm-xp-boot {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: opacity 0.35s ease;
}

.xp-boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.xp-boot-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.xp-boot-wrm {
  font-size: 34px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.xp-boot-xp {
  font-size: 26px;
  color: #ff8800;
  font-style: italic;
  font-weight: 800;
}

.xp-boot-progress-bar {
  width: 170px;
  height: 14px;
  background: #000000;
  border: 1.5px solid #6b7280;
  border-radius: 4px;
  padding: 1.5px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

.xp-boot-stepper {
  width: 42px;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    #2563eb 0px,
    #3b82f6 6px,
    #60a5fa 9px,
    transparent 9px,
    transparent 12px
  );
  border-radius: 2px;
  position: absolute;
  top: 1.5px;
  left: -44px;
  animation: xp-boot-move 1.4s infinite linear;
}

@keyframes xp-boot-move {
  0% { left: -44px; }
  100% { left: 172px; }
}

/* Tour Coach Marks */
.wrm-xp-tour {
  position: fixed;
  z-index: 80000;
  width: 320px;
  background: #ffffe1;
  border: 1px solid #000000;
  border-radius: 6px;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.4);
  font-family: Tahoma, "Segoe UI", sans-serif;
  color: #000000;
  padding: 14px 16px;
  box-sizing: border-box;
  animation: xp-tour-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes xp-tour-pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 13px;
  color: #1e3a8a;
}

.tour-step-badge {
  font-size: 10px;
  background: #3b82f6;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.tour-body {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
  color: #1f2937;
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tour-btn {
  font-family: Tahoma, "Segoe UI", sans-serif;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 3px;
  cursor: pointer;
}

.tour-btn-link {
  background: none;
  border: none;
  color: #2563eb;
  text-decoration: underline;
  padding: 2px 4px;
}

.tour-btn-link:hover {
  color: #1d4ed8;
}

.tour-btn-primary {
  background: linear-gradient(180deg, #ffffff 0%, #ece9d8 100%);
  border: 1px solid #003c74;
  color: #000000;
  font-weight: 600;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.tour-btn-primary:hover {
  background: linear-gradient(180deg, #e0f2fe 0%, #bfdbfe 100%);
}

.tour-btn-primary:active {
  background: #93c5fd;
}
