/* ============================================================
   desktop.css — OS components: menubar, wallpaper, desktop icons,
   windows (with traffic lights), dock, app launcher, terminal.
   Pairs with Tailwind utilities used in the HTML/JS.
   ============================================================ */

/* ----------------------------------------------------------
   Layout shell
   ---------------------------------------------------------- */
.os-root {
  position: fixed; inset: 0;
  overflow: hidden;
  isolation: isolate;
}

/* ----------------------------------------------------------
   1. Menubar (top bar, h-7)
   ---------------------------------------------------------- */
.menubar {
  position: fixed;
  top: var(--safe-top); left: 0; right: 0;
  height: var(--menubar-h);
  z-index: var(--z-menubar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  color: #fff;
  font-size: var(--fs-xs);
  background: var(--menubar-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  user-select: none;
}
.menubar-left  { display: flex; align-items: center; gap: 0.5rem; }
.menubar-right { display: flex; align-items: center; gap: 0.75rem; }
/* Marca del menubar: replica la tipografía del logo "resolve®"
   (grotesca bold, minúscula). Se usa Inter Bold (ya cargada). El ® va
   como superíndice vía ::after (el texto en content.js es solo 'resolve'). */
.menubar-brand {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-style: normal;
  letter-spacing: -0.015em;
  text-transform: none;        /* minúsculas, como el logo */
  font-size: 0.9375rem;
  line-height: 1;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit;
  transition: opacity var(--dur-fast);
}
.menubar-brand::after {
  content: '®';
  font-size: 0.5em;
  font-weight: 600;
  vertical-align: 0.55em;      /* superíndice, como en el logo */
  margin-left: 0.06em;
  letter-spacing: 0;
}
.menubar-brand:hover { opacity: 0.8; }
.menubar-btn {
  background: none; border: 0; padding: 0.375rem;
  color: rgba(255,255,255,0.9);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color var(--dur-fast);
  display: inline-flex; align-items: center; justify-content: center;
}
.menubar-btn:hover { background: rgba(255,255,255,0.20); }

/* Buscador con forma de óvalo (barra): lupa + "buscar" dentro de un pill. */
.menubar-btn.menubar-search {
  gap: 0.4rem;
  padding: 0.2rem 0.75rem 0.2rem 0.6rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
}
.menubar-btn.menubar-search:hover { background: rgba(255,255,255,0.26); }
.menubar-search-label {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  line-height: 1;
}
.menubar-time { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------
   2. Wallpaper layer (full-bleed)
   Supports single image (.wallpaper-single) or split (.wallpaper-split)
   ---------------------------------------------------------- */
.wallpaper {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden;
}
.wallpaper-single img,
.wallpaper-single video,
.wallpaper-fallback {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
/* Fondo en video: el poster (imagen) queda debajo; el video aparece con
   fade cuando puede reproducir. */
.wallpaper-video { opacity: 0; transition: opacity 700ms var(--ease-out-soft); }
.wallpaper-video.is-ready { opacity: 1; }
.wallpaper-scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.05);
}

/* Split wallpaper — half / half */
.wallpaper-split {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: row;       /* horizontal: left | right */
}
.wallpaper-split.is-vertical {
  flex-direction: column;    /* vertical: top / bottom */
}
.wallpaper-half {
  position: relative;
  flex: 1 1 50%;
  min-width: 0; min-height: 0;
  overflow: hidden;
}
.wallpaper-half img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* On small screens optionally switch orientation via class added by JS */
@media (max-width: 639px) {
  .wallpaper-split.mobile-vertical   { flex-direction: column; }
  .wallpaper-split.mobile-horizontal { flex-direction: row; }
}

/* Missing-image placeholder — shown when an image file is absent */
.wallpaper-missing {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0 12px, rgba(0,0,0,0.10) 12px 24px),
    #1f2937;
  color: #fff;
  padding: 1rem;
}
.wallpaper-missing-card {
  text-align: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.15);
  max-width: 320px;
  display: flex; flex-direction: column; gap: 0.4rem;
  font-family: var(--font-sans);
}
.wallpaper-missing-card strong { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: #fca5a5; }
.wallpaper-missing-card code   { font-family: var(--font-mono); font-size: 0.75rem; word-break: break-all; color: #e5e7eb; }
.wallpaper-missing-card small  { font-size: 0.75rem; color: rgba(255,255,255,0.7); }

/* ----------------------------------------------------------
   3. Desktop surface (where icons + windows live)
   ---------------------------------------------------------- */
.desktop {
  position: absolute;
  top: var(--menubar-h);
  left: 0; right: 0; bottom: 0;
  padding-bottom: 6rem;   /* leave room for the dock */
  z-index: var(--z-icons);
}
@media (max-width: 639px) {
  .desktop {
    /* mobile dock is on the left, so push icon area right */
    padding-left: calc(6rem + 1.5rem);
    padding-bottom: 1rem;
  }
}

/* ----------------------------------------------------------
   4. Desktop icon (file on the desktop)
   ---------------------------------------------------------- */
.desktop-icon {
  position: absolute;
  display: flex; flex-direction: column;
  align-items: center; gap: 0.25rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: grab;
  touch-action: none;
  outline: none;
  /* stagger entrance — JS sets animation-delay per icon */
  animation: desktop-item-enter 450ms var(--ease-out-soft) both;
}
.desktop-icon:focus-visible {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}
.desktop-icon.is-dragging {
  cursor: grabbing;
  z-index: var(--z-window-active);
}
.desktop-icon.is-selected .desktop-icon-thumb-wrap::before {
  opacity: 1;
}
.desktop-icon.is-selected .desktop-icon-label {
  background: var(--icon-select-bg);
  padding: 0 0.25rem;
  color: #fff;
}

/* Thumbnail wrapper — hosts hover overlay + image */
.desktop-icon-thumb-wrap {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.55);
  z-index: 1;
}
.desktop-icon-thumb-wrap::before {
  /* hover/selection overlay */
  content: '';
  position: absolute; inset: 0;
  background: var(--icon-hover-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--dur-fast);
  z-index: 2;
}
.desktop-icon:hover .desktop-icon-thumb-wrap::before,
.desktop-icon:active .desktop-icon-thumb-wrap::before { opacity: 1; }

/* Gradient fallback — always rendered underneath, absolute so media overlays it */
.desktop-icon-thumb {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

/* Active media (img or video) — shows entire resource without cropping */
.thumb-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;         /* preserve aspect, never crop the recurso */
  display: block;
  z-index: 1;
  border-radius: 0.5rem;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));   /* shadow follows the image, not the wrap */
  transition: filter var(--dur-fast);
}

/* Hide the gradient fallback while media is showing — only reveal it
   if the image/video failed to load (onerror adds .is-fallback) */
.desktop-icon-thumb-wrap:not(.is-fallback) .desktop-icon-thumb { display: none; }
.desktop-icon-thumb-wrap.is-fallback      .thumb-media          { display: none; }

/* When media is present, strip the wrap's own framing so the resource
   appears clean — no background, no shadow, no rounded box overlap. */
.desktop-icon-thumb-wrap:not(.is-fallback) {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;           /* allow drop-shadow to render outside */
}
/* And disable the rectangular hover overlay — it would extend past the
   image into the empty (transparent) area. Hover feedback uses filter below. */
.desktop-icon-thumb-wrap:not(.is-fallback)::before { display: none; }

/* Hover/active feedback on media-bearing icons — slight dim + lift shadow */
.desktop-icon:hover  .thumb-media,
.desktop-icon:active .thumb-media {
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.55)) brightness(0.92);
}

/* ----------------------------------------------------------
   4b. Thumb orientation variants (applied by JS from thumb.orientation)
   Bumped ~25% from previous values for better visual presence.
   ---------------------------------------------------------- */
.desktop-icon-thumb-wrap.is-square    { width: 108px; height: 108px; }
.desktop-icon-thumb-wrap.is-landscape { width: 192px; height: 108px; }
.desktop-icon-thumb-wrap.is-portrait  { width: 96px;  height: 192px; }
.desktop-icon-thumb-wrap.is-narrow    { width: 54px;  height: 192px; }

.desktop-icon-label {
  position: relative; z-index: 1;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: #fff;
  text-align: center;
  max-width: 88px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  border-radius: 0.25rem;
  transition: background-color var(--dur-fast), padding var(--dur-fast);
  word-break: break-word;
}
.desktop-icon:hover .desktop-icon-label,
.desktop-icon:active .desktop-icon-label {
  background: var(--icon-select-bg);
  padding: 0 0.25rem;
  color: #fff;
}

/* Stagger entrance */
@keyframes desktop-item-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------
   5. Window (modal app surface)
   ---------------------------------------------------------- */
.window {
  position: absolute;
  background: var(--win-bg);
  color: #18181b;
  border-radius: var(--win-radius);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55), 0 8px 24px -8px rgba(0,0,0,0.35);
  border: 1px solid var(--win-border);
  overflow: hidden;
  z-index: var(--z-window);
  min-width: 280px; min-height: 200px;
  display: flex; flex-direction: column;
  animation: window-open 220ms var(--ease-spring) both;
  will-change: transform, opacity;
}
.window.is-active { z-index: var(--z-window-active); }
.window.is-minimizing { animation: window-minimize 280ms var(--ease-out-soft) forwards; }
.window.is-closing   { animation: window-close 180ms var(--ease-out-soft) forwards; }
.window.is-maximized {
  top: var(--menubar-h) !important; left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--menubar-h) - 6.5rem) !important;
  border-radius: 0;
}

@keyframes window-open {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes window-close {
  to   { opacity: 0; transform: scale(0.94); }
}
@keyframes window-minimize {
  to {
    opacity: 0;
    transform: translateY(60vh) scale(0.4);
  }
}

/* Title bar */
.window-titlebar {
  display: flex; align-items: center;
  height: 32px;
  padding: 0 0.75rem;
  background: var(--win-titlebar);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  cursor: grab;
  user-select: none;
}
.window-titlebar:active { cursor: grabbing; }

.traffic-lights {
  display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
}
.traffic-light {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: filter var(--dur-fast);
}
.traffic-light.red    { background: var(--tl-red); }
.traffic-light.yellow { background: var(--tl-yellow); }
.traffic-light.green  { background: var(--tl-green); }
.traffic-lights:hover .traffic-light::after {
  content: '';
  position: absolute; inset: 2px;
  border-radius: 50%;
  opacity: 0.6;
  background: rgba(0,0,0,0.35);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 7px 7px;
}
.window:not(.is-active) .traffic-light { background: #c9cdd1; }

.window-title {
  flex: 1;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--win-titlebar-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 0.5rem;
}
.window-title-spacer {
  width: 52px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: flex-end;
}

/* ℹ️ info-toggle button — injected by JS into .window-title-spacer */
.info-btn {
  background: none; border: 0; padding: 0.2rem 0.3rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem; line-height: 1;
  color: #a1a1aa;
  cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast);
  touch-action: manipulation;
}
.info-btn:hover { background: rgba(0,0,0,0.07); color: #3f3f46; }
.info-btn.is-active { color: #2563eb; background: rgba(37,99,235,0.09); }

/* Body */
.window-body {
  flex: 1; min-height: 0;
  overflow: auto;
  background: var(--win-bg);
}
.window-body.is-padded { padding: 1.25rem 1.5rem; }
.window-body p { line-height: 1.65; }

/* ----------------------------------------------------------
   5b. Media-first modal layout (desktop-item windows)
       .is-media-window → flex column: media zone fills top,
       info panel slides up from bottom.
   ---------------------------------------------------------- */
.window-body.is-media-window {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Fills remaining height, centers the image/video */
.modal-media-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #f4f4f5;   /* gray-100 — neutral canvas for any media */
  overflow: hidden;
}

.modal-media-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity var(--dur-base);
}

/* Info panel — shown by default when a description exists; toggled by ℹ️ */
.modal-info-panel {
  flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,0.07);
  background: var(--win-bg);
  animation: modal-info-in 200ms var(--ease-out-soft) both;
}
@keyframes modal-info-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.modal-info-scroll {
  padding: 0.875rem 1.25rem 1rem;
  max-height: 9rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-info-text {
  margin: 0;
  font-size: 0.875rem;
  color: #3f3f46;
  line-height: 1.65;
}

/* External link row */
.modal-info-link-row {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.modal-info-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
  transition: color var(--dur-fast);
}
.modal-info-link:hover { color: #1d4ed8; text-decoration: underline; }

/* ----------------------------------------------------------
   6. Dock (bottom on ≥sm, vertical-left on <sm)
   ---------------------------------------------------------- */
.dock {
  position: fixed;
  z-index: var(--z-dock);
  pointer-events: none;
}
.dock-inner {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.55);
  pointer-events: auto;
  padding: 0.5rem;
}
/* Desktop: bottom-center horizontal */
@media (min-width: 640px) {
  .dock {
    left: 0; right: 0; bottom: 1rem;
    display: flex; justify-content: center;
  }
  .dock-row { display: flex; flex-direction: row; align-items: center; gap: 0.375rem; }
  .dock-divider { width: 1px; height: 40px; background: rgba(255,255,255,0.4); margin: 0 0.25rem; }
}
/* Mobile: left-center vertical */
@media (max-width: 639px) {
  .dock {
    left: 0.5rem; top: 50%; transform: translateY(-50%);   /* separación reducida */
    display: flex;
  }
  /* El "resolve" está centrado en el video (horizontal) y en vertical el dock
     le tapaba el lado izquierdo. Desplazamos el fondo a la derecha (mostramos
     más del lado izquierdo de la escena) para que el nombre salga de detrás
     del dock. Solo en celular. */
  /* El video vertical de celular trae el wordmark "resolve" horneado al
     centro → se muestra centrado (el dock queda a su izquierda, sin taparlo). */
  .wallpaper-single img,
  .wallpaper-single video { object-position: center; }
  /* Espaciado reducido: con el dock vertical y varias apps, el gap normal
     alargaba la columna hasta salirse y rozar el logo. */
  .dock-row { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
  .dock-divider { height: 1px; width: 32px; background: rgba(255,255,255,0.4); margin: 0.15rem 0; }
}

.dock-app {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 1rem;
  border: 0; padding: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.125rem;
  transition: transform 200ms var(--ease-out-soft);
  will-change: transform;
}
.dock-app:hover   { transform: scale(1.18); }
.dock-app:active  { transform: scale(0.94); }
.dock-app:focus-visible { outline: 2px solid rgba(255,255,255,0.7); outline-offset: 2px; }
/* Papelera: se agranda y resalta cuando un icono se arrastra encima. */
.dock-app.is-drop-target {
  transform: scale(1.32);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 0 18px rgba(255,255,255,0.35);
}
/* Icono del escritorio desvaneciéndose al ir a la papelera. */
@keyframes icon-trash { to { transform: scale(0.18); opacity: 0; } }
.desktop-icon.is-trashing {
  animation: icon-trash 260ms var(--ease-out-soft) forwards;
  pointer-events: none;
}

.dock-app img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  padding: 0;
  border-radius: 0;
}

/* featured.png no trae las esquinas redondeadas horneadas como los .icns,
   así que se redondea acá. Lo usa Lookbook (heredó la apariencia de Store);
   se deja también el selector de 'featured' por si vuelve al dock. */
.dock-app[data-app-id="lookbook"] img,
.dock-app[data-app-id="featured"] img {
  border-radius: 22%;   /* macOS "squircle" feel */
  overflow: hidden;
}

/* Open-indicator dot (macOS-style "app running") */
.dock-app[data-open="1"]::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 50%;
  width: 4px; height: 4px;
}
@media (min-width: 640px) { .dock-app[data-open="1"]::after { left: 50%; bottom: -8px; transform: translateX(-50%); } }
@media (max-width: 639px) { .dock-app[data-open="1"]::after { right: -8px; top: 50%; transform: translateY(-50%); } }

/* Tooltip on hover */
.dock-app[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  font-size: 0.6875rem;
  white-space: nowrap;
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  font-weight: 500;
}
@media (min-width: 640px) { .dock-app[data-tooltip]:hover::before { left: 50%; transform: translateX(-50%); bottom: 60px; } }
@media (max-width: 639px) { .dock-app[data-tooltip]:hover::before { left: 60px; top: 50%; transform: translateY(-50%); } }

/* ----------------------------------------------------------
   7. App-specific styles
   ---------------------------------------------------------- */

/* Finder */
.app-finder { display: grid; grid-template-columns: 200px 1fr; height: 100%; font-size: var(--fs-sm); }
.app-finder .finder-sidebar { background: #f4f4f6; border-right: 1px solid var(--win-border); padding: 0.5rem 0.5rem 0.75rem; overflow: auto; }
.app-finder .finder-sidebar h4 { font-size: 0.6875rem; font-weight: 600; color: #71717a; letter-spacing: 0.04em; margin: 0.5rem 0.5rem 0.25rem; text-transform: uppercase; }
.app-finder .finder-sidebar a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 0.5rem; border-radius: 6px;
  color: #27272a; text-decoration: none;
}
.app-finder .finder-sidebar a:hover  { background: rgba(0,0,0,0.06); }
.app-finder .finder-sidebar a.active { background: var(--color-accent); color: #fff; }

.app-finder .finder-side-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex-shrink: 0;
}
.app-finder .finder-side-ico svg { width: 100%; height: 100%; }
.app-finder .finder-side-text { flex: 1; min-width: 0; }

/* Hamburger toggle button on top of sidebar */
.app-finder .finder-side-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 32px;
  background: rgba(0,0,0,0.04); border: 0; border-radius: 8px;
  color: #52525b; cursor: pointer;
  margin: 0 0 0.5rem;
  transition: background-color var(--dur-fast);
}
.app-finder .finder-side-toggle:hover { background: rgba(0,0,0,0.08); }
.app-finder .finder-side-toggle svg { width: 16px; height: 16px; }
.app-finder .finder-main { overflow: auto; }
.app-finder .finder-toolbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--win-border); background: #fafafa; position: sticky; top: 0; }
.app-finder table { width: 100%; border-collapse: collapse; }
.app-finder th, .app-finder td { text-align: left; padding: 0.4rem 0.75rem; font-size: var(--fs-sm); border-bottom: 1px solid rgba(0,0,0,0.05); }
.app-finder th { color: #71717a; font-weight: 500; background: #fafafa; position: sticky; top: 37px; }
.app-finder tbody tr:hover { background: rgba(59,130,246,0.08); }
.app-finder tbody tr.active { background: var(--color-accent); color: #fff; }

/* Mail */
.app-mail { padding: 1.25rem; }
.app-mail .row { display: flex; align-items: baseline; gap: 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.08); padding: 0.625rem 0; }
.app-mail .row label { width: 96px; color: #52525b; font-size: var(--fs-sm); font-weight: 500; }
.app-mail .row input, .app-mail .row textarea, .app-mail .row select { flex: 1; border: 0; outline: none; background: transparent; font: inherit; padding: 0.25rem 0; min-width: 0; resize: vertical; color: #18181b; }
.app-mail .row input::placeholder, .app-mail .row textarea::placeholder { color: #a1a1aa; }
/* Subject como dropdown: se ve como un input pero con chevron */
.app-mail .row select {
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  padding-right: 1.25rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 5 5 9 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
}
.app-mail .row select:invalid { color: #a1a1aa; }        /* placeholder look cuando no eligió */
.app-mail .row.textarea { align-items: flex-start; }
.app-mail .row.textarea textarea { min-height: 140px; }
.app-mail .send-row { display: flex; justify-content: flex-end; padding-top: 1rem; }
.app-mail .send-btn { background: var(--color-accent); color: #fff; border: 0; padding: 0.5rem 1.25rem; border-radius: 8px; font-weight: 600; cursor: pointer; }
.app-mail .send-btn:hover { background: #2563eb; }

/* Notes */
.app-notes { display: grid; grid-template-columns: 160px 220px 1fr; height: 100%; }
.app-notes .col { overflow: auto; }
.app-notes .col-1 { background: #f4f4f6; padding: 0.75rem 0.5rem; border-right: 1px solid var(--win-border); }
.app-notes .col-2 { background: #fafafa; border-right: 1px solid var(--win-border); }
.app-notes .col-3 { background: #fff; padding: 1.25rem 1.5rem; }
.app-notes .folder { display: flex; align-items: center; justify-content: space-between; padding: 0.375rem 0.5rem; border-radius: 6px; cursor: pointer; font-size: var(--fs-sm); }
.app-notes .folder:hover { background: rgba(0,0,0,0.06); }
.app-notes .folder.active { background: #f59e0b; color: #fff; }
.app-notes .folder .count { font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.8); font-size: 0.6875rem; }
.app-notes .folder:not(.active) .count { color: #71717a; }
.app-notes .note-item { padding: 0.625rem 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.05); cursor: pointer; }
.app-notes .note-item:hover { background: rgba(0,0,0,0.04); }
.app-notes .note-item.active { background: #fff5e6; }
.app-notes .note-item .title { font-weight: 600; font-size: var(--fs-sm); }
.app-notes .note-item .meta { color: #71717a; font-size: 0.6875rem; margin-top: 2px; }
.app-notes .col-3 .date { color: #71717a; font-size: var(--fs-xs); margin-bottom: 0.5rem; }
.app-notes .col-3 h2 { font-family: var(--font-display); font-size: var(--fs-xl); margin: 0 0 0.75rem; }
.app-notes .note-item .note-lock { font-size: 0.6875rem; opacity: 0.75; }

/* Cuerpo de la nota — respeta los saltos de línea del texto en content.js */
.app-notes .note-body {
  color: #3f3f46;
  font-size: var(--fs-sm);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Nota bloqueada — imita el aviso de macOS cuando no puede abrir la nota */
.app-notes .note-locked {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 0.5rem;
  margin: 2.5rem auto 0; max-width: 340px;
  color: #71717a;
}
.app-notes .note-locked-icon { color: #a1a1aa; margin-bottom: 0.25rem; }
.app-notes .note-locked-title { margin: 0; font-weight: 600; color: #3f3f46; font-size: var(--fs-sm); }
.app-notes .note-locked-body  { margin: 0; font-size: var(--fs-xs); line-height: 1.6; }

/* Botón "volver" — solo se usa en el drill-down móvil */
.app-notes .note-back {
  display: none;
  align-items: center; gap: 0.25rem;
  background: none; border: 0; padding: 0;
  margin: 0 0 0.5rem;
  color: #f59e0b; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer;
}
/* Encabezado de la lista (‹ Carpetas + nombre) — oculto en escritorio,
   donde las carpetas ya viven en su columna; en móvil se muestra (flex). */
.app-notes .notes-list-head {
  display: none;
  align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.625rem 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.06);
}
.app-notes .notes-list-head .note-back { margin: 0; }
.app-notes .notes-list-title {
  font-weight: 700; font-size: var(--fs-sm); color: #18181b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Photos */
.app-photos { display: grid; grid-template-columns: 200px 1fr; height: 100%; }
.app-photos .photos-sidebar { background: #f4f4f6; border-right: 1px solid var(--win-border); padding: 0.75rem; overflow: auto; }
.app-photos .photos-grid { overflow: auto; padding: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; }
.app-photos .photo-tile { aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: #ddd; }
.app-photos .photo-tile > * { width: 100%; height: 100%; }

/* Music */
.app-music { display: grid; grid-template-columns: 200px 1fr; height: 100%; }
.app-music .music-sidebar { background: #f4f4f6; border-right: 1px solid var(--win-border); padding: 0.75rem; overflow: auto; font-size: var(--fs-sm); }
.app-music .music-main { overflow: auto; padding: 1.5rem; }
.app-music .albums-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.25rem; }
.app-music .album { cursor: pointer; }
.app-music .album-cover { aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 16px -8px rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-weight: 700; }
.app-music .album-cover img { width: 100%; height: 100%; object-fit: cover; }
.app-music .album-title { margin-top: 0.5rem; font-weight: 600; font-size: var(--fs-sm); }
.app-music .album-artist { color: #71717a; font-size: var(--fs-xs); }

/* Terminal */
.app-terminal { background: #0d0d10; color: #e8e8e8; font-family: var(--font-mono); font-size: 13px; padding: 1rem; overflow: auto; height: 100%; line-height: 1.5; }
.app-terminal .prompt { color: #a3e635; }
.app-terminal .cursor { display: inline-block; width: 8px; height: 14px; background: #e8e8e8; vertical-align: middle; margin-left: 4px; animation: cursor-blink 1s steps(2) infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }

/* README.md window — monospace plain text */
.app-readme { font-family: var(--font-mono); font-size: 13px; line-height: 1.7; padding: 1.5rem 1.75rem; white-space: pre-wrap; color: #18181b; }

/* Apps launcher */
.app-launcher { padding: 1.25rem; }
.app-launcher .search { width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--win-border); border-radius: 10px; font-size: var(--fs-sm); margin-bottom: 1rem; outline: none; }
.app-launcher .search:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.app-launcher .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 1rem; }
.app-launcher .tile { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.5rem; border-radius: 10px; cursor: pointer; transition: background var(--dur-fast); border: 0; background: transparent; }
.app-launcher .tile:hover { background: rgba(0,0,0,0.05); }
.app-launcher .tile-icon { width: 64px; height: 64px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.25rem; box-shadow: 0 6px 12px -6px rgba(0,0,0,0.3); }
.app-launcher .tile-name { font-size: 0.6875rem; text-align: center; color: #27272a; max-width: 80px; line-height: 1.2; }

/* Tiles con icono real (PNG de .icns). Los .icns ya traen sus propias
   esquinas redondeadas y su sombra, así que el contenedor no debe
   aportar ni fondo ni recorte — si no, se ve un cuadro detrás. */
.app-launcher .tile-icon.has-img {
  background: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.app-launcher .tile-icon.has-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.28));
}
/* Para imágenes planas (logo de marca, featured) que NO traen esquinas
   redondeadas horneadas. Se marcan con `rounded: true` en content.js.
   No se aplica a todos porque los .icns ya traen su propia silueta y
   redondearlos les recortaría las esquinas. */
.app-launcher .tile-icon.is-rounded img { border-radius: 22%; }

/* Si la imagen falla, vuelve el tile de gradiente + glifo */
.app-launcher .tile-icon.is-fallback {
  background: linear-gradient(135deg, #52525b, #27272a);
  border-radius: 14px;
  box-shadow: 0 6px 12px -6px rgba(0,0,0,0.3);
}

/* ----------------------------------------------------------
   8. Splash
   ---------------------------------------------------------- */
.splash {
  position: fixed; inset: 0;
  z-index: var(--z-splash);
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 500ms var(--ease-out-soft);
}
.splash.is-hidden { opacity: 0; pointer-events: none; }
.splash-mark { width: 56px; height: 56px; border-radius: 14px; background: #fff; color: #000; font-family: var(--font-display); font-weight: 800; display: grid; place-items: center; font-size: 1.5rem; box-shadow: 0 8px 24px -6px rgba(255,255,255,0.4); }
/* Logo del splash (wordmark blanco sobre fondo transparente → se integra
   en el fondo negro de la splash). Reemplaza la vieja "R". */
.splash-logo { width: 200px; height: auto; display: block; }
.splash-progress { width: 300px; height: 4px; background: rgba(255,255,255,0.20); border-radius: 9999px; overflow: hidden; margin-top: 2rem; }
.splash-progress > span { display: block; height: 100%; background: #fff; width: 0%; border-radius: 9999px; transition: width 250ms var(--ease-out-soft); }

/* ----------------------------------------------------------
   9. Scrollbars (subtle, macOS-feel)
   ---------------------------------------------------------- */
.window-body::-webkit-scrollbar,
.app-finder ::-webkit-scrollbar,
.app-notes ::-webkit-scrollbar,
.app-photos ::-webkit-scrollbar,
.app-music ::-webkit-scrollbar { width: 10px; height: 10px; }
.window-body::-webkit-scrollbar-thumb,
.app-finder ::-webkit-scrollbar-thumb,
.app-notes ::-webkit-scrollbar-thumb,
.app-photos ::-webkit-scrollbar-thumb,
.app-music ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.25); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.app-terminal::-webkit-scrollbar { width: 10px; }
.app-terminal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 999px; }

/* ----------------------------------------------------------
   8. Store (Featured app — t-shirt collection)
   ---------------------------------------------------------- */
.app-store {
  height: 100%;
  overflow-y: auto;
  background: #fafafa;
  padding: 1.5rem 1.25rem 2rem;
}

.store-header {
  margin: 0 0 1.25rem;
  text-align: left;
}
.store-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #18181b;
  margin: 0;
  letter-spacing: -0.01em;
}
.store-subtitle {
  font-size: 0.8125rem;
  color: #71717a;
  margin: 0.25rem 0 0;
}

/* 2-column grid, always 2 cols (even on mobile per user choice) */
.store-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.store-card {
  background: #ffffff;
  border: 1px solid var(--win-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-fast) var(--ease-out-soft),
              box-shadow var(--dur-fast),
              border-color var(--dur-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.store-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.18);
  border-color: rgba(0,0,0,0.18);
}
.store-card:active { transform: translateY(0); }
.store-card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.store-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;          /* cuadrado: acomoda tees y manga larga por igual */
  background: #fff;
  overflow: hidden;
}
.store-card-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;          /* muestra la prenda COMPLETA, sin recortar */
  display: block;
  transition: opacity var(--dur-base) var(--ease-out-soft);
}
/* Default: show front, hide back */
.store-card-img.is-front { opacity: 1; z-index: 2; }
.store-card-img.is-back  { opacity: 0; z-index: 1; }
/* Hover (desktop): cross-fade to back */
@media (hover: hover) and (pointer: fine) {
  .store-card:hover .store-card-img.is-front { opacity: 0; }
  .store-card:hover .store-card-img.is-back  { opacity: 1; }
}
.store-card-thumb.is-fallback {
  background:
    repeating-linear-gradient(45deg, #e4e4e7 0 8px, #d4d4d8 8px 16px);
}

.store-card-meta {
  padding: 0.625rem 0.75rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.125rem;
}
.store-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #18181b;
}
.store-card-price {
  font-size: 0.8125rem;
  color: #52525b;
  font-variant-numeric: tabular-nums;
}

/* ── Detail view (single product) ── */
.app-store-detail { padding: 1rem 1.25rem 2rem; }

.store-back {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: transparent; border: 0; padding: 0.375rem 0.5rem 0.375rem 0.25rem;
  border-radius: 8px;
  font-size: 0.8125rem; color: #2563eb; cursor: pointer;
  margin-bottom: 0.75rem;
  transition: background-color var(--dur-fast);
}
.store-back:hover { background: rgba(37,99,235,0.08); }
.store-back svg { width: 16px; height: 16px; }

.store-detail-body {
  display: grid;
  grid-template-columns: 1.3fr 1fr;     /* gallery wider than info column */
  gap: 1.5rem;
  align-items: start;
}
/* Gallery shows front + back side by side */
.store-detail-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.store-detail-shot {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.store-detail-shot figcaption {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}
.store-detail-media {
  position: relative;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  /* ahora es <button> clickeable para ampliar */
  display: block; width: 100%; padding: 0; border: 0;
  cursor: zoom-in; font: inherit;
}
.store-detail-media img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform 300ms var(--ease-out-soft);
}
.store-detail-media:hover img { transform: scale(1.04); }
/* Pista de zoom (lupa +) abajo a la derecha */
.store-zoom-cue {
  position: absolute; right: 8px; bottom: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(24,24,27,0.6); color: #fff;
  opacity: 0; transform: translateY(3px);
  transition: opacity 160ms var(--ease-out-soft), transform 160ms var(--ease-out-soft);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.store-zoom-cue svg { width: 15px; height: 15px; }
.store-detail-media:hover .store-zoom-cue,
.store-detail-media:focus-visible .store-zoom-cue { opacity: 1; transform: none; }
@media (hover: none) { .store-zoom-cue { opacity: 1; transform: none; } }  /* táctil: siempre visible */

/* ── Lightbox (imagen ampliada) ── */
.os-lightbox {
  position: fixed; inset: 0; z-index: 800;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-out-soft);
}
.os-lightbox.is-open { opacity: 1; pointer-events: auto; }
.os-lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(9,9,11,0.86);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.os-lightbox-inner {
  position: relative;
  display: flex; align-items: center; gap: 0.5rem;
  width: min(94vw, 900px);
  transform: scale(0.97); transition: transform 200ms var(--ease-out-soft);
}
.os-lightbox.is-open .os-lightbox-inner { transform: none; }
.os-lightbox-fig {
  margin: 0; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.os-lightbox-img {
  max-width: 100%; max-height: 80vh;
  width: auto; height: auto; object-fit: contain;
  border-radius: 14px; background: #fff;
  box-shadow: 0 30px 90px -20px rgba(0,0,0,0.7);
}
.os-lightbox-img.is-in { animation: lb-in 260ms var(--ease-out-soft); }
@keyframes lb-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.os-lightbox-cap {
  color: rgba(255,255,255,0.82); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.os-lightbox-x {
  position: absolute; top: -44px; right: 0;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,0.12); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 150ms;
}
.os-lightbox-x:hover { background: rgba(255,255,255,0.24); }
.os-lightbox-x svg { width: 18px; height: 18px; }
.os-lightbox-nav {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,0.12); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 150ms;
}
.os-lightbox-nav:hover { background: rgba(255,255,255,0.24); }
.os-lightbox-nav svg { width: 20px; height: 20px; }
@media (max-width: 640px) {
  .os-lightbox-x { top: -40px; }
  .os-lightbox-nav { width: 34px; height: 34px; }
  .os-lightbox-img { max-height: 72vh; }
}

.store-detail-info { display: flex; flex-direction: column; gap: 0.875rem; }
.store-detail-name {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700; margin: 0;
  color: #18181b; letter-spacing: -0.01em;
}
.store-detail-price {
  font-size: 1.125rem; font-weight: 600;
  color: #18181b; font-variant-numeric: tabular-nums;
}
.store-detail-desc {
  font-size: 0.875rem; line-height: 1.65; color: #3f3f46; margin: 0;
}

.store-sizes-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.375rem;
}
.store-sizes-label {
  font-size: 0.75rem; font-weight: 600;
  color: #71717a; text-transform: uppercase; letter-spacing: 0.04em;
}
.store-sizeguide-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.75rem; font-weight: 600; color: #18181b;
  padding: 2px 0; border-bottom: 1px solid currentColor;
}
.store-sizeguide-btn svg { width: 15px; height: 15px; }
.store-sizeguide-btn:hover { color: #52525b; }
.store-sizes-row { display: flex; flex-wrap: wrap; gap: 0.375rem; }

/* ── Guía de tallas (modal) ── */
.os-sizeguide {
  position: fixed; inset: 0; z-index: 820;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-out-soft);
}
.os-sizeguide.is-open { opacity: 1; pointer-events: auto; }
.os-sg-backdrop {
  position: absolute; inset: 0;
  background: rgba(9,9,11,0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.os-sg-panel {
  position: relative;
  width: min(720px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55);
  transform: translateY(-8px) scale(0.985);
  transition: transform 200ms var(--ease-out-soft);
}
.os-sizeguide.is-open .os-sg-panel { transform: none; }
.os-sg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--win-border);
}
.os-sg-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #18181b; display: inline; }
.os-sg-tag {
  margin-left: 0.5rem; font-size: 0.7rem; font-weight: 600; color: #71717a;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.os-sg-x {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: #f4f4f5; color: #52525b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.os-sg-x:hover { background: #e4e4e7; }
.os-sg-x svg { width: 16px; height: 16px; }
.os-sg-body { overflow-y: auto; padding: 1.15rem; }
.os-sg-intro { margin: 0 0 0.85rem; font-size: 0.875rem; color: #3f3f46; }
.os-sg-tablewrap {
  overflow: auto; max-height: 58vh;
  border: 1px solid var(--win-border); border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.os-sg-table { border-collapse: collapse; width: 100%; font-size: 0.8rem; white-space: nowrap; }
.os-sg-table th, .os-sg-table td {
  padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid #f1f1f3;
  color: #3f3f46;   /* explícito: el root del desktop usa texto blanco */
}
.os-sg-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #fafafa; color: #52525b; font-weight: 700;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.os-sg-table tbody th { font-weight: 700; color: #18181b; }
.os-sg-table tbody tr:hover td, .os-sg-table tbody tr:hover th { background: #fafafa; }
.os-sg-table .is-sticky {
  position: sticky; left: 0; z-index: 2; background: #fff;
  border-right: 1px solid #f1f1f3;
}
.os-sg-table thead .is-sticky { z-index: 3; background: #fafafa; }
.os-sg-note { margin: 0.75rem 0 0; font-size: 0.75rem; color: #71717a; line-height: 1.5; }
.os-sg-hint { color: #a1a1aa; }
@media (min-width: 640px) { .os-sg-hint { display: none; } }   /* solo sugerir scroll en móvil */
.os-sg-sec { margin-top: 1.35rem; }
.os-sg-sec h3 {
  margin: 0 0 0.5rem; font-size: 0.7rem; font-weight: 700; color: #a1a1aa;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.os-sg-sec ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.os-sg-sec li { font-size: 0.8125rem; line-height: 1.55; color: #3f3f46; }
.os-sg-measure strong { color: #18181b; }

/* La guía dentro de una nota: anula el pre-wrap del note-body (que haría
   visibles los saltos del HTML) y evita padding doble. Doble clase para
   ganarle en especificidad a `.app-notes .note-body`. */
.note-body.note-sizeguide {
  white-space: normal;
  padding: 0;
}
.note-sizeguide .os-sg-intro { font-size: 0.875rem; }
.note-sizeguide .os-sg-tablewrap { margin-top: 0.25rem; }
.store-size {
  min-width: 44px; height: 36px;
  padding: 0 0.75rem;
  border: 1px solid #d4d4d8; background: #fff;
  border-radius: 8px;
  font-size: 0.8125rem; font-weight: 500;
  color: #27272a; cursor: pointer;
  transition: all var(--dur-fast);
}
.store-size:hover { border-color: #18181b; }
.store-size.is-selected {
  background: #18181b; color: #fff; border-color: #18181b;
}

.store-cta {
  margin-top: 0.5rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem; font-weight: 600;
  cursor: pointer;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.store-cta:hover  { opacity: 0.88; }
.store-cta:active { transform: scale(0.98); }

/* ============================================================
   PDP — ficha de producto (wireframe estilo tienda de ropa)
   ============================================================ */
.app-store-detail.pdp { padding: 0; }
.pdp > .store-back { position: sticky; top: 0; z-index: 3; margin: 0; padding: 0.75rem 1rem;
  width: 100%; background: rgba(255,255,255,0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--win-border); border-radius: 0; }
.pdp-scroll { width: 100%; max-width: 600px; margin: 0 auto; }
.pdp-block { padding: 1.15rem 1.25rem; border-bottom: 1px solid #ececed; }
.pdp-block:last-child { border-bottom: 0; }

/* Encabezado */
.pdp-material { display: inline-block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: #6b7280; background: #f4f4f5; border-radius: 9999px;
  padding: 0.2rem 0.6rem; margin-bottom: 0.65rem; }
.pdp-name { margin: 0 0 0.15rem; font-size: 1.45rem; font-weight: 800; color: #18181b; line-height: 1.15; }
.pdp-category { margin: 0 0 0.65rem; font-size: 0.88rem; color: #6b7280; line-height: 1.5; }
.pdp-price { font-size: 1.1rem; font-weight: 700; color: #18181b; }

/* Galería */
.pdp-rated { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem;
  font-weight: 600; color: #b45309; margin-bottom: 0.8rem; }
.pdp-rated svg { width: 15px; height: 15px; color: #f59e0b; }
.pdp-main { background: #fff; border: 1px solid var(--win-border); border-radius: 14px;
  overflow: hidden; aspect-ratio: 1 / 1; }
.pdp-main-media { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.pdp-main-media img { width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform 300ms var(--ease-out-soft); }
.pdp-main-media:hover img { transform: scale(1.03); }
.pdp-main-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: #a1a1aa; font-size: 0.85rem; }
.pdp-dots { display: flex; justify-content: center; gap: 0.4rem; margin: 0.85rem 0; }
.pdp-dot { width: 7px; height: 7px; border-radius: 50%; border: 0; background: #d4d4d8; cursor: pointer; padding: 0; transition: background var(--dur-fast); }
.pdp-dot.is-active { background: #18181b; }
.pdp-thumbs { display: flex; gap: 0.5rem; }
.pdp-thumb { flex: 1; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--win-border); background: #fff; padding: 0; cursor: pointer; }
.pdp-thumb.is-active { border-color: #18181b; box-shadow: 0 0 0 1px #18181b; }
.pdp-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Acciones */
.pdp-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.pdp-add { width: 100%; margin: 0; border-radius: 9999px; padding: 0.9rem; font-size: 0.95rem; }
.pdp-fav { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  background: #fff; color: #18181b; border: 1px solid #d4d4d8; border-radius: 9999px;
  padding: 0.85rem; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
.pdp-fav:hover { background: #fafafa; }
.pdp-fav svg { width: 18px; height: 18px; }
.pdp-fav.is-fav { border-color: #e11d48; color: #e11d48; }
.pdp-fav.is-fav svg { fill: #e11d48; stroke: #e11d48; }

/* Envío */
.pdp-h { margin: 0 0 0.35rem; font-size: 0.95rem; font-weight: 700; color: #18181b; }
.pdp-ast { color: #e11d48; }
.pdp-muted { margin: 0; font-size: 0.85rem; color: #6b7280; line-height: 1.55; }

/* Datos del producto */
.pdp-specs { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.pdp-specs li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; }
.pdp-specs li span { color: #6b7280; }
.pdp-specs li span::before { content: '• '; color: #cbd5e1; }
.pdp-specs li b { color: #18181b; font-weight: 600; text-align: right; }
.pdp-link { background: none; border: 0; padding: 0; color: #18181b; font: inherit; font-size: 0.85rem;
  font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pdp-more { margin-top: 0.6rem; font-size: 0.85rem; color: #3f3f46; line-height: 1.6; }

/* Acordeones */
.pdp-acc { padding: 0; }
.pdp-acc > summary { list-style: none; cursor: pointer; padding: 1.15rem 1.25rem;
  display: flex; align-items: center; gap: 0.55rem; font-size: 0.95rem; font-weight: 600; color: #18181b; }
.pdp-acc > summary::-webkit-details-marker { display: none; }
.pdp-acc > summary::before { content: '▾'; color: #6b7280; font-size: 0.8rem;
  transition: transform var(--dur-fast); display: inline-block; }
.pdp-acc[open] > summary::before { transform: rotate(180deg); }
.pdp-acc .pdp-stars { margin-left: auto; color: #f59e0b; letter-spacing: 0.05em; font-size: 0.9rem; }
.pdp-acc-body { padding: 0 1.25rem 1.15rem; font-size: 0.85rem; color: #3f3f46; line-height: 1.6; }

/* ============================================================
   MOBILE OPTIMIZATIONS  (< 640px)
   Mobile-first refinement layer. Desktop styles above remain intact.
   - Dock stays on the left (already configured)
   - Desktop icons switch from absolute → CSS grid
   - Windows go near-full-screen, drag disabled
   - Hover effects swapped for active feedback
   ============================================================ */
@media (max-width: 639px) {

  /* ── Menubar — tighter and slightly smaller ── */
  .menubar {
    height: 1.625rem;
    padding: 0 0.625rem;
    font-size: 0.6875rem;
  }
  .menubar-brand { font-size: 0.875rem; letter-spacing: -0.01em; }
  .menubar-right { gap: 0.5rem; }
  .menubar-btn  { padding: 0.25rem; }

  /* ── Desktop surface — KEEP absolute positioning like desktop.
       JS (renderDesktopIcons) normalizes the x/y so items fit
       inside the mobile viewport, while preserving the scattered
       gucduck-style layout (no grid). Items remain draggable. ── */
  main.desktop[data-desktop] {
    /* default .desktop styles already apply (position: absolute; inset:0)
       — just override the mobile padding rule defined earlier */
    padding: 0 !important;
    overflow: hidden;
  }
  /* Icons keep absolute positioning + drag */
  main.desktop[data-desktop] .desktop-icon {
    padding: 0.375rem 0.25rem;
    cursor: grab;
  }
  main.desktop[data-desktop] .desktop-icon.is-dragging { cursor: grabbing; }

  /* ── Miniaturas más chicas en móvil: proporcionadas al ancho del teléfono
       (antes el landscape ocupaba ~46% de la pantalla y alguno se salía). ── */
  .desktop-icon-thumb-wrap.is-square    { width: 72px;  height: 72px;  }
  .desktop-icon-thumb-wrap.is-landscape { width: 124px; height: 70px;  }
  .desktop-icon-thumb-wrap.is-portrait  { width: 64px;  height: 128px; }
  .desktop-icon-thumb-wrap.is-narrow    { width: 36px;  height: 128px; }
  .desktop-icon-label { font-size: 0.6875rem; max-width: 92px; }

  /* ── Windows — proporcional al dispositivo.
       El tamaño y la posición los calcula el JS (_usableBox) según el
       viewport, dejándolos centrados y sin tapar menubar ni dock. Acá solo
       va un fallback SIN !important (para que el inline del JS gane) por si
       el script no llegó a correr. ── */
  .window {
    max-width: 100vw;
    border-radius: 1.5rem;                       /* rounded corners */
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.45);
    width:  calc(100vw - 80px);                  /* fallback no-JS */
    height: calc(100dvh - var(--menubar-h) - 2.25rem);
  }
  .window.is-maximized {
    border-radius: 1.25rem;
    width:  calc(100vw - 80px) !important;
    height: calc(100dvh - var(--menubar-h) - 1rem) !important;
  }
  /* Drag is meaningful on mobile too — keep grab cursor */
  .window-titlebar { cursor: grab; }
  .window-titlebar:active { cursor: grabbing; }

  /* ── Modal info panel — tighter copy on small screens ── */
  .modal-info-scroll  { max-height: 7rem; padding: 0.75rem 0.875rem; gap: 0.375rem; }
  .modal-info-text    { font-size: 0.8125rem; }
  .modal-info-link    { font-size: 0.8125rem; }

  /* ── Dock — keep left-vertical, comfortable touch sizes ── */
  .dock-inner { padding: 0.375rem; border-radius: 1.125rem; }
  .dock-app   { width: 44px; height: 44px; border-radius: 0.875rem; }
  .dock-app:hover  { transform: none; }     /* hover has no meaning on touch */
  .dock-app:active { transform: scale(0.92); }
  /* Hide dock tooltip on touch (annoying & sticky on tap) */
  .dock-app[data-tooltip]:hover::before { display: none; }

  /* ── Disable hover overlay on icons; rely on selected/active state ── */
  .desktop-icon:hover .desktop-icon-thumb-wrap::before { opacity: 0; }
  .desktop-icon:hover .desktop-icon-label {
    background: transparent; padding: 0; color: #fff;
  }
  .desktop-icon:active .desktop-icon-thumb-wrap::before { opacity: 1; }

  /* ── App-specific layouts: sidebars become icon-only rails ── */
  /* Finder: narrow icon rail (matches gucduck reference) */
  .app-finder { grid-template-columns: 60px 1fr; }
  .app-finder .finder-sidebar {
    padding: 0.5rem 0.375rem;
    background: #fafafa;
  }
  .app-finder .finder-sidebar h4 { display: none; }
  .app-finder .finder-sidebar a {
    justify-content: center;
    gap: 0;
    padding: 0.625rem 0;
    margin: 0.125rem 0;
    border-radius: 10px;
    color: #71717a;
  }
  .app-finder .finder-sidebar a:hover { background: rgba(0,0,0,0.05); }
  .app-finder .finder-sidebar a.active {
    background: var(--color-accent);
    color: #fff;
  }
  .app-finder .finder-side-ico { width: 20px; height: 20px; }
  .app-finder .finder-side-text { display: none; }
  /* Hamburger sits centered at top */
  .app-finder .finder-side-toggle {
    width: 100%; height: 36px;
    margin: 0 0 0.375rem;
    background: rgba(0,0,0,0.05);
  }
  .app-finder .finder-side-toggle svg { width: 18px; height: 18px; }

  /* Notes en móvil: drill-down de 3 niveles.
       Nivel 0 (por defecto): LISTA de notas de la carpeta activa.
       .is-folders  → nivel CARPETAS (para cambiar de carpeta).
       .is-viewing  → nivel DETALLE de la nota.
     Botones "‹ Carpetas" (en la lista) y "‹ Notas" (en el detalle). */
  .app-notes  { grid-template-columns: 1fr; }
  .app-notes .col-1 { display: none; border-right: 0; }
  .app-notes .col-2 { display: block; border-right: 0; }
  .app-notes .col-3 { display: none; padding: 1rem 1.125rem; }
  .app-notes.is-folders .col-1 { display: block; }
  .app-notes.is-folders .col-2 { display: none; }
  .app-notes.is-viewing .col-1 { display: none; }
  .app-notes.is-viewing .col-2 { display: none; }
  .app-notes.is-viewing .col-3 { display: block; }
  .app-notes .note-back { display: inline-flex; }
  .app-notes .notes-list-head { display: flex; }   /* header con "‹ Carpetas" */

  .app-photos { grid-template-columns: 1fr; }
  .app-photos .photos-sidebar { display: none; }
  .app-photos .photos-grid    { padding: 0.5rem; }

  .app-music  { grid-template-columns: 1fr; }
  .app-music .music-sidebar { display: none; }

  /* Mail form: stack label above field for narrow screens */
  .app-mail .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
    padding: 0.5rem 0;
  }
  .app-mail .row label { width: auto; }

  /* Launcher: tighter grid */
  .app-launcher .grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
    gap: 0.625rem !important;
  }

  /* Store: keep 2 cols on mobile (user choice), tighten paddings */
  .app-store { padding: 1rem 0.75rem 1.5rem; }
  .store-title { font-size: 1.25rem; }
  .store-grid  { gap: 0.625rem; }
  .store-card-meta { padding: 0.5rem 0.625rem 0.625rem; }
  .store-card-name { font-size: 0.8125rem; }
  .store-card-price { font-size: 0.75rem; }

  /* Detail: stack gallery + info, keep front/back side by side on top */
  .app-store-detail { padding: 0.75rem 0.875rem 1.5rem; }
  .store-detail-body { grid-template-columns: 1fr; gap: 1rem; }
  .store-detail-gallery { gap: 0.5rem; }
  .store-detail-media { border-radius: 10px; }
  .store-detail-name { font-size: 1.25rem; }

  /* ── Splash mark — slightly smaller progress bar on mobile ── */
  .splash-progress { width: 220px; }

  /* ── Scrollbars: hairline on touch ── */
  .window-body::-webkit-scrollbar { width: 4px; height: 4px; }
}

/* ============================================================
   POINTER-AGNOSTIC: disable hover effects on coarse pointers
   (covers tablets and any touch-primary device, not just <640px)
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .dock-app:hover { transform: none; }
  .desktop-icon:hover .desktop-icon-thumb-wrap::before { opacity: 0; }
  .dock-app[data-tooltip]:hover::before { display: none; }
}

/* ============================================================
   LOOKBOOK app — animated garment gallery (Anime.js Layout).
   Lives in an app window like every other app. The .lookbook-grid
   is the Layout container; garments flow between grid ⇄ fan.
   Behavior: assets/js/apps.js (OS_APPS.lookbook).
   ============================================================ */
.app-lookbook {
  height: 100%;
  overflow-y: auto;
  background: #fafafa;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
}
.lookbook-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin: 0 0 1.25rem;
}
.lookbook-title {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700;
  color: #18181b; margin: 0; letter-spacing: -0.01em;
}
.lookbook-subtitle { font-size: 0.8125rem; color: #71717a; margin: 0.25rem 0 0; }
.lookbook-toggle {
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  background: #fff; color: #3f3f46;
  border-radius: 9999px; padding: 0.4rem 0.9rem;
  font-size: 0.8125rem; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.lookbook-toggle:hover { background: #f4f4f5; border-color: #d4d4d8; }

/* Point 3: centered container */
.lookbook-grid {
  display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center;
  gap: 0.875rem;
}

/* Each garment = a Layout child */
.lookbook-item {
  flex: 0 0 auto;
  width: clamp(112px, 22%, 150px);
  aspect-ratio: 3 / 4;
  margin: 0; padding: 0;
  border-radius: 14px; overflow: hidden;
  background: #fff;
  border: 1px solid var(--win-border);
  cursor: pointer;
  box-shadow: 0 6px 20px -10px rgba(0,0,0,0.35);
  transition: transform var(--dur-fast) var(--ease-out-soft),
              box-shadow var(--dur-fast), border-color var(--dur-fast);
}
.lookbook-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lookbook-item.is-fallback { background: linear-gradient(135deg, #e4e4e7, #a1a1aa); }
.lookbook-item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (hover: hover) {
  .lookbook-item:hover {
    transform: translateY(-5px) scale(1.04);
    border-color: #d4d4d8;
    box-shadow: 0 16px 34px -12px rgba(0,0,0,0.45);
  }
}

/* "Fan" state — overlapping single row (entrance start + toggle target).
   Anime.js Layout animates the FLIP between this and the wrapped grid. */
.lookbook-grid.is-fan { flex-wrap: nowrap; gap: 0; }
.lookbook-grid.is-fan .lookbook-item {
  width: clamp(78px, 13%, 108px);
  margin-left: -34px;
  box-shadow: 0 10px 26px -10px rgba(0,0,0,0.42);
}
.lookbook-grid.is-fan .lookbook-item:first-child { margin-left: 0; }

/* Mobile: tighter grid + fan that still fits the narrow window */
@media (max-width: 639px) {
  .app-lookbook { padding: 1rem 0.75rem 1.5rem; }
  .lookbook-header { flex-direction: column; gap: 0.625rem; }
  .lookbook-title { font-size: 1.25rem; }
  .lookbook-grid { gap: 0.5rem; }
  .lookbook-item { width: clamp(88px, 30%, 120px); }
  .lookbook-grid.is-fan .lookbook-item {
    width: clamp(58px, 18vw, 92px);
    margin-left: clamp(-40px, -9vw, -22px);
  }
}

/* ============================================================
   DOOM — portada + iframe del juego embebido.
   Comportamiento en assets/js/apps.js (OS_APPS.doom).
   ============================================================ */
.app-doom {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #0a0a0c;
}

/* Portada: lo único que se pinta al abrir la app. El juego (y sus
   ~6.7 MB) no se piden hasta que se toca "Jugar". */
.doom-gate {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, #2a0d0d 0%, #0a0a0c 65%);
}
.doom-logo {
  font-family: var(--font-brand);
  font-style: italic; font-weight: 900; font-stretch: 125%;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  letter-spacing: 0.06em;
  color: #ef4444;
  text-shadow: 0 0 28px rgba(239,68,68,0.45);
  line-height: 1;
}
.doom-lede { margin: 0; color: #e4e4e7; font-size: var(--fs-sm); }
.doom-play {
  margin-top: 0.5rem;
  border: 1px solid rgba(239,68,68,0.55);
  background: rgba(239,68,68,0.14);
  color: #fff;
  border-radius: 9999px;
  padding: 0.6rem 1.6rem;
  font-family: var(--font-display);
  font-size: var(--fs-base); font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.doom-play:hover { background: rgba(239,68,68,0.3); border-color: #ef4444; transform: translateY(-1px); }
.doom-play:active { transform: translateY(0); }
.doom-note { margin: 0.25rem 0 0; color: #a1a1aa; font-size: var(--fs-xs); }
.doom-hint { margin: 0.75rem 0 0; color: #71717a; font-size: var(--fs-xs); line-height: 1.6; max-width: 34ch; }

/* El iframe del juego. En ventanas angostas apps.js le aplica un
   transform: scale() para que entre completo (ver fitDoomFrame). */
.doom-frame {
  display: block;
  width: 100%; height: 100%;
  border: 0;
  background: #000;
}

/* ============================================================
   DESKTOP WIDGET — live Anime.js Layout collage on the desktop.
   4 garments continuously re-flow between 3 grid arrangements.
   Draggable like an icon; a click opens the Store.
   Behavior: assets/js/apps.js (renderDesktopWidget).
   ============================================================ */
.desktop-widget {
  position: absolute;
  /* Última capa: detrás de los iconos del escritorio (que van en z-index
     auto dentro de .desktop) pero por encima del wallpaper. Las ventanas
     (capa [data-windows], z-index 20) también quedan por delante. */
  z-index: -1;
  /* Size is overridable from content.js → desktopWidget.width / .height,
     which JS applies as these custom properties. */
  width:  var(--widget-w, 340px);
  height: var(--widget-h, 440px);
  padding: 12px 12px 30px;
  border-radius: 20px;
  background: rgba(10,10,12,0.34);
  border: 1px solid rgba(255,255,255,0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 54px -22px rgba(0,0,0,0.75);
  cursor: grab;
  touch-action: none;           /* let pointer events drive the drag on touch */
  user-select: none;
  transition: box-shadow var(--dur-fast) var(--ease-out-soft),
              border-color var(--dur-fast) var(--ease-out-soft);
}
.desktop-widget:hover { border-color: rgba(255,255,255,0.32); box-shadow: 0 28px 60px -22px rgba(0,0,0,0.85); }
.desktop-widget.is-dragging { cursor: grabbing; }
.desktop-widget:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 3px; }

.desktop-widget-tag {
  position: absolute; left: 12px; bottom: 8px;
  font-family: var(--font-brand);
  font-style: italic; font-weight: 800; font-stretch: 125%;
  font-size: 0.6875rem; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.82);
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* The Layout container = a 2×3 grid the items re-flow within */
.desktop-widget .grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 10px;
  width: 100%; height: 100%;
}
.desktop-widget .item {
  border-radius: 13px;
  overflow: hidden;
  background: #141416;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,0.6);
}
.desktop-widget .item.is-fallback { background: linear-gradient(135deg, #3f3f46, #18181b); }
.desktop-widget .item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* grid-1 */
.desktop-widget [data-grid="1"] .item:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
.desktop-widget [data-grid="1"] .item:nth-child(2) { grid-column: 2; grid-row: 1; }
.desktop-widget [data-grid="1"] .item:nth-child(3) { grid-column: 1; grid-row: 3; }
.desktop-widget [data-grid="1"] .item:nth-child(4) { grid-column: 2; grid-row: 2 / 4; }

/* grid-2 */
.desktop-widget [data-grid="2"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.desktop-widget [data-grid="2"] .item:nth-child(1),
.desktop-widget [data-grid="2"] .item:nth-child(4) { grid-row: 1 / 3; }

/* grid-3 */
.desktop-widget [data-grid="3"] .item:nth-child(4) { grid-column: 1; grid-row: 1; }
.desktop-widget [data-grid="3"] .item:nth-child(3) { grid-column: 2; grid-row: 1 / 3; }
.desktop-widget [data-grid="3"] .item:nth-child(2) { grid-column: 1; grid-row: 2 / 4; }
.desktop-widget [data-grid="3"] .item:nth-child(1) { grid-column: 2; grid-row: 3; }

@media (max-width: 639px) {
  .desktop-widget {
    width:  var(--widget-w-m, 244px);
    height: var(--widget-h-m, 316px);
    padding: 9px 9px 25px;
    /* En celular va ARRIBA y por ENCIMA de los iconos (nada lo tapa).
       En escritorio queda detrás (z-index:-1, capa de fondo). */
    z-index: 3;
  }
  .desktop-widget .grid-layout { gap: 7px; }
  .desktop-widget .item { border-radius: 11px; }
}

/* ============================================================
   E-COMMERCE (Shopify) — skeleton, agotado, badge, carrito.
   Comportamiento en assets/js/shopify.js + apps.js.
   ============================================================ */

/* Skeleton de carga del catálogo */
.store-skel {
  border-radius: 14px;
  aspect-ratio: 3 / 4;
  background: linear-gradient(100deg, #f4f4f5 30%, #e9e9ec 50%, #f4f4f5 70%);
  background-size: 200% 100%;
  animation: store-skel 1.2s ease-in-out infinite;
}
@keyframes store-skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Producto agotado */
.store-card.is-soldout { opacity: 0.7; }
.store-soldout {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  background: rgba(24,24,27,0.85); color: #fff;
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 9999px; text-transform: uppercase;
}

/* Talla sin stock */
.store-size.is-disabled {
  opacity: 0.35; cursor: not-allowed; text-decoration: line-through;
}

/* Nota bajo el CTA (validaciones/errores) */
.store-cta-note { margin: 0.5rem 0 0; font-size: var(--fs-xs); color: #b91c1c; }
.store-cta:disabled { opacity: 0.7; cursor: default; }

/* Badge de cantidad en el dock (carrito) */
.dock-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444; color: #fff;
  font-size: 0.625rem; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* ---- Ventana Carrito ---- */
.app-cart {
  height: 100%;
  display: flex; flex-direction: column;
  background: #fafafa;
}
.cart-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.75rem;
  color: #71717a; text-align: center; padding: 2rem;
}
.cart-empty-ico { font-size: 2.5rem; }
.cart-shop {
  border: 1px solid var(--win-border); background: #fff; color: #18181b;
  border-radius: 9999px; padding: 0.5rem 1.1rem; font-size: var(--fs-sm);
  font-weight: 600; cursor: pointer;
}
.cart-shop:hover { background: #f4f4f5; }

.cart-lines { flex: 1; overflow-y: auto; padding: 0.75rem; }
.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.cart-line-img {
  width: 56px; height: 72px; border-radius: 8px; overflow: hidden;
  background: #fff; border: 1px solid var(--win-border);
}
.cart-line-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line-name { font-weight: 600; font-size: var(--fs-sm); color: #18181b; }
.cart-line-variant { font-size: 0.6875rem; color: #71717a; margin-top: 1px; }
.cart-line-price { font-size: 0.8125rem; color: #3f3f46; margin-top: 3px; }
.cart-line-qty { display: flex; align-items: center; gap: 0.375rem; }
.cart-qty-btn {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid var(--win-border); background: #fff; color: #18181b;
  font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.cart-qty-btn:hover { background: #f4f4f5; }
.cart-qty-val { min-width: 18px; text-align: center; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.cart-line-rm {
  border: 0; background: none; color: #a1a1aa; cursor: pointer;
  font-size: 0.8rem; padding: 4px;
}
.cart-line-rm:hover { color: #ef4444; }

.cart-foot {
  border-top: 1px solid var(--win-border);
  background: #fff; padding: 0.875rem 1rem 1rem;
}
.cart-subtotal {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: var(--fs-sm); color: #3f3f46;
}
.cart-subtotal strong { font-size: var(--fs-lg); color: #18181b; }
.cart-note { margin: 0.25rem 0 0.75rem; font-size: var(--fs-xs); color: #71717a; }
.cart-checkout {
  width: 100%;
  border: 0; border-radius: 10px;
  background: #18181b; color: #fff;
  padding: 0.75rem; font-size: var(--fs-base); font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.cart-checkout:hover { background: #000; }

/* Móvil: el carrito ocupa toda la ventana */
@media (max-width: 639px) {
  .cart-line { grid-template-columns: 48px 1fr auto auto; gap: 0.5rem; }
  .cart-line-img { width: 48px; height: 62px; }
}

/* ---- Pulido del carrito: badge pop, toast, cabecera ---- */

/* Animación "pop" del badge cuando cambia la cantidad */
.dock-badge.is-bump { animation: badge-pop 0.42s var(--ease-spring); }
@keyframes badge-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.55); }
  100% { transform: scale(1); }
}

/* Toast (feedback "agregado al carrito") */
.os-toast {
  position: fixed;
  left: 50%; bottom: 5.5rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 500;                 /* sobre ventanas y dock, bajo el splash */
  max-width: min(88vw, 420px);
  padding: 0.6rem 1rem;
  border-radius: 9999px;
  background: rgba(20,20,24,0.92);
  color: #fff;
  font-size: var(--fs-sm); font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  opacity: 0; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 220ms var(--ease-out-soft), transform 220ms var(--ease-out-soft);
}
.os-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* En móvil el dock está a la izquierda: centramos el toast un poco más arriba */
@media (max-width: 639px) {
  .os-toast { bottom: 1.25rem; max-width: 90vw; white-space: normal; text-align: center; }
}

/* Cabecera del carrito: "Seguir comprando" + contador */
.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--win-border);
  background: #fff;
}
.cart-continue {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border: 0; background: none; padding: 0;
  color: #18181b; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
}
.cart-continue svg { width: 15px; height: 15px; }
.cart-continue:hover { color: #000; }
.cart-count { font-size: 0.6875rem; color: #71717a; font-variant-numeric: tabular-nums; }

/* ============================================================
   BUSCADOR (Spotlight de la tienda) — abre desde la lupa del menubar.
   Comportamiento en apps.js (openSearch / renderSearch*).
   ============================================================ */
.os-search {
  position: fixed; inset: 0; z-index: 600;
  display: flex; justify-content: center; align-items: flex-start;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-out-soft);
}
.os-search.is-open { opacity: 1; pointer-events: auto; }
.os-search-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.38);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.os-search-panel {
  position: relative;
  margin-top: 10vh;
  width: min(560px, 92vw); max-height: 72vh;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.55);
  overflow: hidden;
  transform: translateY(-10px) scale(0.985);
  transition: transform 200ms var(--ease-out-soft);
}
.os-search.is-open .os-search-panel { transform: none; }

.os-search-bar {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--win-border);
}
.os-search-ico { width: 20px; height: 20px; color: #71717a; flex: 0 0 auto; }
.os-search-input {
  flex: 1; border: 0; outline: 0; background: none;
  font-size: 1.05rem; color: #18181b; font-family: inherit;
}
.os-search-input::placeholder { color: #a1a1aa; }
.os-search-x {
  border: 1px solid var(--win-border); background: #f4f4f5; color: #71717a;
  border-radius: 6px; padding: 2px 7px; font-size: 0.6875rem; cursor: pointer;
}
.os-search-x:hover { background: #e4e4e7; }

.os-search-body { overflow-y: auto; padding: 0.75rem; }
.os-search-sec { margin-bottom: 0.75rem; }
.os-search-sec h4 {
  margin: 0.25rem 0.25rem 0.5rem; font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: #a1a1aa;
}
.os-search-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 0.25rem; }
.os-search-chip {
  border: 1px solid var(--win-border); background: #fff; color: #27272a;
  border-radius: 9999px; padding: 0.4rem 0.85rem; font-size: var(--fs-sm);
  cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.os-search-chip:hover { background: #f4f4f5; border-color: #d4d4d8; }
.os-search-chip.is-pop::before { content: "↗"; color: #a1a1aa; margin-right: 0.3rem; }

.os-search-results { display: flex; flex-direction: column; }
.os-search-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem; border: 0; background: none; border-radius: 10px;
  cursor: pointer; text-align: left; width: 100%;
}
.os-search-row:hover { background: #f4f4f5; }
.os-search-thumb {
  width: 44px; height: 56px; border-radius: 8px; overflow: hidden;
  background: #fff; border: 1px solid var(--win-border); flex: 0 0 auto;
}
.os-search-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.os-search-info { flex: 1; min-width: 0; }
.os-search-name { font-weight: 600; font-size: var(--fs-sm); color: #18181b; }
.os-search-price { font-size: 0.75rem; color: #71717a; margin-top: 1px; }
.os-search-go { width: 16px; height: 16px; color: #d4d4d8; flex: 0 0 auto; }
.os-search-empty { padding: 2rem; text-align: center; color: #a1a1aa; font-size: var(--fs-sm); }

@media (max-width: 639px) {
  .os-search-panel { margin-top: 5vh; max-height: 82vh; width: 94vw; }
}

/* ============================================================
   CELULAR HORIZONTAL (landscape + poco alto) — solo ajustes de tamaño
   No afecta escritorio ni tablet (más altos) ni celular vertical.
   ============================================================ */
@media (orientation: landscape) and (max-height: 500px) {
  /* Iconos compactos para que entren en una fila horizontal */
  .desktop-icon-thumb-wrap.is-square    { width: 54px;  height: 54px;  }
  .desktop-icon-thumb-wrap.is-landscape { width: 92px;  height: 52px;  }
  .desktop-icon-thumb-wrap.is-portrait  { width: 48px;  height: 96px;  }
  .desktop-icon-thumb-wrap.is-narrow    { width: 28px;  height: 96px;  }
  .desktop-icon-label { font-size: 0.6rem; max-width: 92px; }
  .desktop-icon { padding: 0.2rem 0.15rem; }

  /* Dock un poco más chico → gana alto para la franja de apps */
  .dock-inner { padding: 0.3rem; }
  .dock-app   { width: 42px; height: 42px; }
  .dock-divider { height: 34px; }

  /* Ventanas: respaldo para que quepan en el alto corto (el JS ya las
     dimensiona con _usableBox). */
  .window { min-height: 0; }
  .window-body { min-height: 0; }
}

/* DOOM en celular: la ventana llena el viewport para jugar en grande
   (la página interna hace el fullscreen nativo en Android + los controles). */
.window.doom-mobile-fill {
  position: fixed !important;
  left: 0 !important; top: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  max-width: none !important;
  border-radius: 0 !important;
  transform: none !important;   /* anula el scale residual para llenar de verdad */
  z-index: 400 !important;
}
