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

:root {
  --sky-1: #d6f4ff;
  --sky-2: #c4ebf5;
  --mint: #bde9db;
  --lilac: #e1c4FF;
  --cloud: #f5fdff;
  --line: #111;
  --surface: #edf7f4;
  --surface-2: #d5ebe4;
  --title-a: #2f5f95;
  --title-b: #4f87c6;
  --shadow: #111;
  --taskbar: #dbeff7;
  --taskbar-edge: #98b7c8;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
  font-family: "IBM Plex Mono", monospace;
  color: #122;
  background: #b8dde9;
}

.desktop {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100svh;
  min-height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-1), var(--mint));
  image-rendering: pixelated;
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.24) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.35;
  pointer-events: none;
}

.desktop-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  width: 140px;
  height: 46px;
  background: var(--cloud);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: var(--cloud);
  border: 2px solid var(--line);
}

.cloud::before {
  width: 44px;
  height: 24px;
  left: 12px;
  top: -18px;
}

.cloud::after {
  width: 54px;
  height: 28px;
  right: 12px;
  top: -22px;
}

.cloud-a {
  top: 50px;
  left: 120px;
}

.cloud-b {
  top: 110px;
  right: 170px;
}

.cloud-c {
  top: 210px;
  left: 42%;
}

.icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.folder {
  width: 92px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
  user-select: none;
}

.icons .folder img {
  width: 64px !important;
  height: auto;
  display: block;
}

/* Solo los iconos del escritorio son absolute */
.icons .folder {
  position: absolute;
  pointer-events: auto;
}

.folder:hover,
.folder:focus-visible {
  transform: scale(1.06);
  filter: brightness(1.08);
  outline: none;
}

.icons .folder.is-selected {
  outline: 1px dashed #1b4c66;
  outline-offset: 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.icons .folder.is-selected span {
  background: rgba(17, 56, 82, 0.18);
  border-radius: 3px;
  padding: 1px 3px;
}

.folder-icon {
  width: 56px;
  height: 44px;
  image-rendering: pixelated;
  border: 2px solid #111;
  background: #fff;
  box-shadow: 3px 3px 0 #111;
}

.folder span {
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  line-height: 1.35;
  color: #113;
  text-shadow: 1px 1px 0 #f8ffff;
  text-align: center;
}

.trash-icon img {
  filter: hue-rotate(-15deg) brightness(0.85);
  opacity: 0.9;
}

.trash-icon span {
  color: #8b4513;
}

.desktop-gifs {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(420px, 42vw);
  max-width: 420px;
  z-index: 2;
  pointer-events: none;
}

.desktop-gif {
  width: 52px;
  height: 52px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.28));
}

.window-area {
  position: absolute;
  inset: 0;
  padding-bottom: calc(42px + env(safe-area-inset-bottom));
  z-index: 3;
  pointer-events: none;
}

.window {
  position: absolute;
  background: var(--surface);
  border: 2px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow);
  display: none;
  flex-direction: column;
  min-width: 360px;
  min-height: 260px;
  max-width: min(94vw, 820px);
  max-height: min(78dvh, 700px);
  overflow: auto;
  pointer-events: auto;
  resize: both;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #7ea9c8 #d7e8ef;
}

.window.active {
  display: flex;
  animation: window-open 260ms ease-out;
}

.window.closing {
  display: flex;
  animation: window-close 210ms ease-in forwards;
}

.window.active.is-minimized {
  display: none;
}

.profile-window {
  display: flex;
}

.titlebar {
  height: 34px;
  min-height: 34px;
  background: linear-gradient(180deg, var(--title-b), var(--title-a));
  color: #f6ffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px;
  user-select: none;
  cursor: grab;
  position: sticky;
  top: 0;
  z-index: 2;
}

.titlebar:active {
  cursor: grabbing;
}

.titlebar h2 {
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.titlebar-buttons {
  display: flex;
  gap: 4px;
}

.tb-btn {
  width: 22px;
  height: 20px;
  border: 2px solid #0d2133;
  background: #d6ebf5;
  color: #10253a;
  font-family: "Silkscreen", monospace;
  font-size: 8px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding-top: 1px;
}

button.tb-btn {
  cursor: pointer;
}

.tb-btn-close {
  background: #ffd2d2;
}

.window-content {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  padding: 12px 14px 14px;
  flex: 1;
}

.text-file-wrap {
  padding: 0;
}

.txt-file {
  margin: 0;
  width: 100%;
  min-height: 360px;
  overflow: visible;
  border: none;
  background: #f5fffb;
  padding: 14px 16px 18px;
  color: #17323a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.txt-heading {
  display: inline-block;
  color: #0f3f58;
  background: #d5ecf9;
  border: 1px solid #8cb6cc;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 0;
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.file-list-wrap {
  padding: 0;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 18px;
  padding: 16px 18px;
  background: var(--surface);
  min-height: 200px;
  overflow-y: auto;
}

.folder-inside {
  width: 80px !important;
}

.folder-inside span {
  font-size: 9px;
  max-width: 80px;
  word-break: break-word;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.folder-inside.selected {
  filter: brightness(0.75) saturate(1.2);
  outline: 1px dashed #17323a;
  border-radius: 4px;
}

.pdf-wrap {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.pdf-viewer {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.window::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.window::-webkit-scrollbar-track {
  background:
    linear-gradient(90deg, #f8ffff 0 2px, #d8ebf0 2px 100%);
  border-left: 2px solid #7ca0ae;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9fb8c4;
}

.window::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c6dce9, #89aec5);
  border: 2px solid #204461;
  box-shadow: inset 1px 1px 0 #f9feff, inset -1px -1px 0 #557c92;
}

.window::-webkit-scrollbar-corner {
  background: #d8ebf0;
}

.window::-webkit-scrollbar-button:single-button {
  display: block;
  width: 14px;
  height: 14px;
  background: linear-gradient(180deg, #eff9ff, #bad5e3);
  border-left: 2px solid #7ca0ae;
  border-top: 2px solid #f8ffff;
  border-right: 2px solid #557c92;
  border-bottom: 2px solid #557c92;
}

.window::-webkit-scrollbar-button:single-button:vertical:decrement {
  background:
    linear-gradient(135deg, transparent 46%, #274b67 46% 54%, transparent 54%),
    linear-gradient(225deg, transparent 46%, #274b67 46% 54%, transparent 54%),
    linear-gradient(180deg, #eff9ff, #bad5e3);
  background-position: center 4px, center 4px, center;
  background-size: 6px 6px, 6px 6px, auto;
  background-repeat: no-repeat;
}

.window::-webkit-scrollbar-button:single-button:vertical:increment {
  background:
    linear-gradient(315deg, transparent 46%, #274b67 46% 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, #274b67 46% 54%, transparent 54%),
    linear-gradient(180deg, #eff9ff, #bad5e3);
  background-position: center 6px, center 6px, center;
  background-size: 6px 6px, 6px 6px, auto;
  background-repeat: no-repeat;
}

.window-content h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  margin-bottom: 12px;
}

.window-content ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: square inside;
  font-size: 30px;
}

.window-content li {
  font-size: 30px;
  line-height: 1.2;
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.avatar {
  width: 150px;
  height: 150px;
  /* border: 2px solid #111;
  box-shadow: 3px 3px 0 #111;
  background:
    linear-gradient(45deg, #9ad6ff 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(-45deg, #9ad6ff 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(45deg, transparent 75%, #78bfef 75%) -8px 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, #78bfef 75%) -8px 0/16px 16px,
    #bce3ff; */
  color: #113;
  font-family: "Silkscreen", monospace;
  font-size: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.profile-content p {
  font-size: 16px;
  line-height: 1.45;
  max-width: 30ch;
  margin: 0 auto;
}

.profile-meta {
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  color: #1a4560;
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed #5f90aa;
  padding: 4px 8px;
  border-radius: 999px;
  max-width: 100%;
}

.profile-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Silkscreen", monospace;
  font-size: 11px;
}

.profile-socials a {
  color: #1a4560;
  text-decoration: none;
}

.profile-socials a:hover,
.profile-socials a:focus-visible {
  text-decoration: underline;
}

.muted {
  color: #2b4c54;
}

.taskbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(42px + env(safe-area-inset-bottom));
  min-height: 42px;
  border-top: 2px solid var(--line);
  background: var(--taskbar);
  box-shadow: inset 0 2px 0 #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}

.start-btn {
  min-width: 90px;
  height: 30px;
  border: 2px solid #111;
  box-shadow: 3px 3px 0 #111;
  background: #bce5ce;
  font-family: "Silkscreen", monospace;
  font-size: 9px;
  cursor: pointer;
}

.taskbar-windows {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.taskbar-window-btn {
  height: 30px;
  min-width: 140px;
  max-width: 220px;
  padding: 0 10px;
  border: 2px solid #111;
  background: #eef8ff;
  box-shadow: 3px 3px 0 #111;
  color: #183747;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.taskbar-window-btn.is-active {
  background: #cfe6f6;
}

.taskbar-window-btn.is-minimized {
  background: #dfe8ec;
  color: #4d6068;
}

.taskbar-label {
  border: 2px solid var(--taskbar-edge);
  border-style: inset;
  background: #edf8ff;
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  font-size: 24px;
  color: #1d3d44;
}

.clock {
  min-width: 86px;
  height: 28px;
  border: 2px solid var(--taskbar-edge);
  border-style: inset;
  background: #edf8ff;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #1d3d44;
}

.window.is-maximized {
  resize: none;
}

@keyframes window-open {
  0% {
    opacity: 0;
    transform: scale(0.86);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes window-close {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.88);
  }
}

@media (max-width: 900px) {
  .desktop {
    overflow: hidden;
  }

  .icons {
    inset: 12px 12px auto 12px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    pointer-events: auto;
    max-width: min(92vw, 520px);
  }

  .icons .folder {
    position: static;
    right: auto !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
  }

  .folder {
    width: 74px;
  }

  .icons .folder img {
    width: 52px !important;
  }

  .window {
    width: min(94vw, 560px) !important;
    min-width: 0;
    max-width: 94vw;
    max-height: calc(100dvh - 180px);
    min-height: 220px;
    resize: none;
  }

  .profile-window {
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 50px !important;
    width: auto !important;
    height: auto !important;
    min-height: 180px;
    max-height: 44vh;
    resize: none;
  }

  .profile-window .titlebar {
    cursor: default;
  }

  .profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
  }

  .titlebar h2 {
    font-size: 9px;
  }

  .txt-file {
    min-height: 260px;
    font-size: 15px;
    line-height: 1.5;
    padding: 12px 12px 16px;
  }

  .file-list {
    gap: 12px;
    padding: 12px;
  }

  .folder-inside {
    width: 72px !important;
  }

  .taskbar-windows {
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .taskbar-window-btn {
    min-width: 100px;
    font-size: 12px;
  }

  .start-btn {
    min-width: 74px;
  }

  .clock {
    min-width: 70px;
    font-size: 14px;
  }

  .desktop-gifs {
    display: none;
  }
}

@media (max-width: 640px) {
  .cloud-a {
    left: 24px;
  }

  .cloud-b {
    right: 36px;
  }

  .cloud-c {
    left: 30%;
    top: 180px;
  }

  .icons {
    inset: 10px 10px auto 10px;
    gap: 8px;
  }

  .folder {
    width: 66px;
  }

  .icons .folder img {
    width: 46px !important;
  }

  .folder span {
    font-size: 8px;
  }

  .window {
    max-height: calc(100dvh - 228px);
  }

  .profile-window {
    left: 10px !important;
    right: 10px !important;
    bottom: 48px !important;
    width: auto !important;
    height: auto !important;
    min-height: 168px;
    max-height: 48vh;
  }

  .profile-content {
    gap: 6px;
  }

  .profile-content .avatar {
    width: 68px;
    height: 68px;
    font-size: 13px;
  }

  .profile-content p {
    font-size: 13px;
    line-height: 1.3;
    max-width: 32ch;
  }

  .profile-meta {
    font-size: 8px;
    padding: 3px 6px;
  }

  .profile-socials {
    font-size: 8px;
    gap: 5px;
  }

  .taskbar {
    gap: 6px;
    padding: 0 6px;
  }

  .taskbar-window-btn {
    min-width: 86px;
    max-width: 120px;
    font-size: 11px;
    padding: 0 8px;
  }
}
