/* ── VOID Desktop — variables globales + reset + escritorio ─ */
:root {
  --void-bg:         #0b0f14;
  --void-panel:      #111720;
  --void-taskbar:    #0d1219e8;
  --void-border:     #1e2d3d;
  --void-fg:         #d7dde6;
  --void-muted:      #6b7a90;
  --void-accent:     #7ee787;
  --void-accent-dim: rgba(126,231,135,.35);
  --void-blue:       #58a6ff;
  --void-titlebar:   #141c27;
  --void-active:     #1a2840;
  --void-mono:       ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                     "Liberation Mono", "Courier New", monospace;
  --taskbar-h:       36px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--void-bg);
  color: var(--void-fg);
  font-family: var(--void-mono);
}

/* ── Desktop area ────────────────────────────────────────── */
#desktop {
  position: fixed;
  inset: 0;
  bottom: var(--taskbar-h);
  /* Retro wallpaper: dark gradient + subtle grid */
  background:
    linear-gradient(rgba(30,45,61,.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,45,61,.25) 1px, transparent 1px),
    radial-gradient(ellipse 120% 80% at 20% 10%, rgba(88,166,255,.06), transparent 60%),
    radial-gradient(ellipse 100% 90% at 80% 80%, rgba(126,231,135,.04), transparent 55%),
    var(--void-bg);
  background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%, 100% 100%;
  overflow: hidden;
}

/* ── Desktop icons ────────────────────────────────────────── */
#desktop-icons {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 72px;
  padding: 8px 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  user-select: none;
}

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

.desktop-icon.selected {
  background: rgba(126,231,135,.10);
  border-color: var(--void-accent-dim);
}

.icon-glyph {
  font-size: 28px;
  line-height: 1;
}

.icon-label {
  font-size: 10px;
  color: var(--void-fg);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  line-height: 1.3;
  word-break: break-word;
}

/* ── Mobile: iconos y contexto táctil ───────────────────────── */
@media (pointer: coarse) {
  #desktop-icons {
    top: 12px;
    left: 12px;
    gap: 10px;
  }

  .desktop-icon {
    width: 80px;
    padding: 12px 6px 10px;
  }

  .icon-glyph {
    font-size: 34px;
  }

  .icon-label {
    font-size: 11px;
  }

  /* El menú contextual necesita más espacio para el dedo */
  .ctx-item {
    padding: 12px 20px;
    font-size: 14px;
  }

  #context-menu {
    min-width: 180px;
  }
}

/* ── Context menu ─────────────────────────────────────────── */
#context-menu {
  position: fixed;
  background: var(--void-panel);
  border: 1px solid var(--void-border);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  padding: 4px 0;
  z-index: 9999;
  min-width: 140px;
  font-size: 12px;
}

#context-menu.hidden { display: none; }

.ctx-item {
  padding: 6px 16px;
  color: var(--void-fg);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.ctx-sep {
  height: 1px;
  background: var(--void-border);
  margin: 4px 0;
}

/* ── Boot overlay ─────────────────────────────────────────── */
#boot-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 24px 32px;
  font-family: var(--void-mono);
  font-size: 13px;
  color: #aaa;
  line-height: 1.6;
  transition: opacity .5s ease;
}

#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#boot-overlay.gone { display: none; }

.boot-line { display: block; }

/* ── Shutdown notify (fallback si window.close() falla) ──────── */
#shutdown-notify {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: #111720;
  border: 1px solid #2a3a50;
  border-radius: 6px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--void-mono);
  font-size: 12px;
  color: #aaa;
  z-index: 100000;
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  white-space: nowrap;
}
#shutdown-notify.hidden { display: none; }
#shutdown-notify-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
#shutdown-notify-close:hover { color: #ccc; }
.boot-ok   { color: var(--void-accent); }
.boot-warn { color: #ffbd2e; }
.boot-dim  { color: #444; }
