/* ═══════════════════════════════════════════════════════
   FAUX OS V2.1 - FAUX32 System File + Crash / BSOD
   Easter egg: drag FAUX32_DO_NOT_DELETE.exe → trash
   ═══════════════════════════════════════════════════════ */

/* ── Desktop system file icon ── */
.desktop-sysfile {
  position: absolute;
  bottom: var(--sp-8);
  right: var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2);
  cursor: grab;
  user-select: none;
  z-index: var(--z-content);
  border-radius: var(--r-lg);
  transition: background var(--dur-fast) var(--ease-smooth);

  &:hover {
    background: rgba(255, 255, 255, 0.04);
  }

  &:active {
    cursor: grabbing;
  }
}

.desktop-sysfile__icon {
  font-size: 28px;
  opacity: 0.5;
  filter: grayscale(1) brightness(1.4);
  transition: filter 0.3s, opacity 0.3s, transform 0.2s;

  .desktop-sysfile:hover & {
    opacity: 0.8;
    filter: grayscale(0.5) brightness(1.2);
    transform: rotate(-3deg);
  }
}

.desktop-sysfile__label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: var(--tracking-wide);
  text-align: center;
  line-height: 1.3;
  max-width: 110px;
  word-break: break-all;
}

.desktop-sysfile__warn {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--accent);
  letter-spacing: 0.15em;
  opacity: 0;
  transition: opacity 0.3s;

  .desktop-sysfile:hover & {
    opacity: 0.7;
  }
}

/* Dragging state */
.desktop-sysfile.is-dragging {
  opacity: 0.4;
  transform: scale(0.9);
}

/* Trash drop highlight */
.desktop-trash__btn.is-drop-target {
  background: rgba(232, 93, 48, 0.15) !important;
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  transform: scale(1.08);
  transition: all 0.15s var(--ease-spring);
}

/* ── BSOD / Crash Overlay ── */
.faux-bsod {
  position: fixed;
  inset: 0;
  z-index: var(--z-crash);
  background: #0a0aff;
  color: #fff;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;

  &.is-active {
    opacity: 1;
    pointer-events: all;
  }
}

.faux-bsod__glitch {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
  animation: bsod-scanlines 0.08s steps(2) infinite;
}

@keyframes bsod-scanlines {
  0%   { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

.faux-bsod__title {
  font-family: var(--font-pixel);
  font-size: clamp(12px, 3vw, 24px);
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: var(--sp-8);
  background: #fff;
  color: #0a0aff;
  padding: 4px 16px;
}

.faux-bsod__body {
  font-size: clamp(10px, 1.8vw, 14px);
  line-height: 1.8;
  max-width: 640px;
  text-align: left;
  white-space: pre-wrap;
  opacity: 0.9;
}

.faux-bsod__cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #fff;
  vertical-align: middle;
  animation: bsod-blink 0.6s steps(1) infinite;
}

@keyframes bsod-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.faux-bsod__progress {
  margin-top: var(--sp-8);
  font-family: var(--font-pixel);
  font-size: clamp(8px, 1.5vw, 12px);
  letter-spacing: 0.15em;
  opacity: 0.7;
}

.faux-bsod__bar {
  width: min(300px, 60vw);
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  margin-top: var(--sp-2);
  overflow: hidden;

  & > div {
    height: 100%;
    width: 0%;
    background: #aaa;
    transition: width 0.3s linear;
  }
}

.faux-bsod__restart {
  margin-top: var(--sp-6);
  font-size: clamp(9px, 1.4vw, 12px);
  opacity: 0;
  transition: opacity 0.5s;

  &.is-visible {
    opacity: 0.6;
  }
}

/* ── Pre-crash screen shake ── */
@keyframes crash-shake {
  0%, 100% { transform: translate(0); }
  10% { transform: translate(-8px, 4px); }
  20% { transform: translate(6px, -6px); }
  30% { transform: translate(-4px, 8px); }
  40% { transform: translate(10px, -2px); }
  50% { transform: translate(-6px, -8px); }
  60% { transform: translate(8px, 6px); }
  70% { transform: translate(-10px, 2px); }
  80% { transform: translate(4px, -10px); }
  90% { transform: translate(-2px, 6px); }
}

.workspace.is-crashing {
  animation: crash-shake 0.4s ease-in-out;
}

/* ── Screen tear flash ── */
.crash-flash {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-crash) - 1);
  background: #fff;
  opacity: 0;
  pointer-events: none;

  &.is-active {
    animation: crash-flash-pulse 0.15s ease-out 3;
  }
}

@keyframes crash-flash-pulse {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ── Hide sysfile on mobile ── */
@media (max-width: 768px) {
  .desktop-sysfile { display: none; }
}
