/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Pixelated MS Sans Serif", "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  user-select: none;
}

/* ===== DESKTOP — Floral Shoppe / Macintosh Plus inspired ===== */
#desktop {
  width: 100vw;
  height: calc(100vh - 36px);
  position: relative;
  overflow: hidden;
  /* Dreamy pastel sky — soft pinks, lavenders, peach */
  background:
    /* Faint VHS scanlines */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.015) 2px,
      rgba(255, 255, 255, 0.015) 3px
    ),
    /* Warm sun haze low on horizon */
    radial-gradient(
      ellipse 50% 30% at 50% 58%,
      rgba(255, 180, 160, 0.4) 0%,
      rgba(255, 140, 200, 0.15) 40%,
      transparent 70%
    ),
    /* Pastel sky gradient */
    linear-gradient(
      180deg,
      #e8c8e0 0%,
      #dab0d0 8%,
      #d0a0c8 16%,
      #c8a0d0 24%,
      #b898c8 32%,
      #c0a0c0 40%,
      #d8a8b8 48%,
      #e8b0a8 55%,
      #f0c0a0 62%,
      #e8a8a0 68%,
      #d098a8 74%,
      #b888b0 80%,
      #a080a8 88%,
      #8870a0 100%
    );
}

/* Checkerboard marble floor in perspective — Floral Shoppe tiles */
#desktop::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 400%;
  height: 50%;
  background:
    repeating-conic-gradient(
      rgba(200, 180, 200, 0.35) 0% 25%,
      rgba(240, 220, 230, 0.35) 25% 50%
    ) 0 0 / 80px 80px;
  transform: perspective(300px) rotateX(50deg);
  transform-origin: center top;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 15%, rgba(0,0,0,0.6) 50%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 15%, rgba(0,0,0,0.6) 50%, black 100%);
}

/* Faint grid lines over the checkerboard for depth */
#desktop::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 400%;
  height: 50%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(180, 140, 180, 0.12) 39px,
      rgba(180, 140, 180, 0.12) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 79px,
      rgba(180, 140, 180, 0.1) 79px,
      rgba(180, 140, 180, 0.1) 80px
    );
  transform: perspective(300px) rotateX(50deg);
  transform-origin: center top;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
}

/* ===== DESKTOP ICONS ===== */
#desktop-icons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  padding: 4px;
  cursor: default;
  text-align: center;
}

.desktop-icon:hover {
  background: none;
}

.desktop-icon.selected .desktop-icon-label {
  background: #000080;
  color: #fff;
}

.desktop-icon.selected .desktop-icon-img {
  filter: brightness(0.8) saturate(1.5);
}

.desktop-icon:active .desktop-icon-label {
  background: #000080;
  color: #fff;
}

.desktop-icon-img {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 4px;
  pointer-events: none;
}

.desktop-icon-label {
  font-size: 11px;
  color: #fff;
  text-shadow: 1px 1px 1px #000;
  padding: 1px 3px;
  word-wrap: break-word;
  max-width: 72px;
  pointer-events: none;
}

/* ===== NOTEBOOK WINDOW ===== */
#notebook-window {
  position: absolute;
  top: 40px;
  left: 120px;
  width: calc(100vw - 160px);
  height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  z-index: 10;
  min-width: 400px;
  min-height: 300px;
}

#notebook-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 36px) !important;
}

#notebook-window.minimized {
  display: none;
}

/* ===== MENU BAR ===== */
.menu-bar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 2px 0;
}

.menu-bar ul {
  list-style: none;
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
}

.menu-bar li {
  padding: 2px 8px;
  font-size: 11px;
  cursor: default;
}

.menu-bar li:hover {
  background: #000080;
  color: #fff;
}

/* ===== WINDOW BODY / IFRAME ===== */
#notebook-body {
  flex: 1;
  padding: 0;
  overflow: hidden;
}

#notebook-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ===== STATUS BAR ===== */
#notebook-window .status-bar {
  flex-shrink: 0;
}

/* ===== TASKBAR ===== */
#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  gap: 4px;
  z-index: 9999;
}

#start-button {
  font-weight: bold;
  min-width: 60px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 11px;
}

#start-logo {
  font-size: 16px;
}

/* ===== QUICK LAUNCH ===== */
#quick-launch {
  display: flex;
  align-items: center;
  gap: 2px;
}

.quick-launch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
}

.quick-launch-btn:hover {
  border: 1px outset #fff;
  background: #dfdfdf;
}

.quick-launch-btn:active {
  border: 1px inset #808080;
}

.taskbar-divider {
  width: 2px;
  height: 24px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  margin: 0 2px;
}

.taskbar-window-btn {
  height: 28px;
  min-width: 140px;
  text-align: left;
  padding: 0 8px;
  font-size: 11px;
  font-weight: normal;
}

.taskbar-window-btn.active {
  font-weight: bold;
  box-shadow: inset 1px 1px 1px #808080;
  background: #dfdfdf;
}

.taskbar-spacer {
  flex: 1;
}

#system-tray {
  height: 24px;
  border: 1px solid #808080;
  border-right-color: #fff;
  border-bottom-color: #fff;
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-size: 11px;
}

#clock {
  font-size: 11px;
}

/* ===== WINDOW DRAGGING ===== */
#notebook-title-bar {
  cursor: default;
}

#notebook-window:not(.maximized) #notebook-title-bar {
  cursor: move;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Window takes full width on mobile, auto-maximized */
  #notebook-window {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 36px) !important;
    min-width: unset;
    min-height: unset;
  }

  /* Title bar — shorter text, no drag cursor */
  #notebook-title-bar {
    cursor: default;
  }

  .title-bar-text {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Menu bar — scrollable horizontally */
  .menu-bar ul {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .menu-bar li {
    flex-shrink: 0;
  }

  /* iframe — iOS scroll fix */
  #notebook-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Desktop icons — row layout at top when window is minimized */
  #desktop-icons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
  }

  .desktop-icon {
    width: 64px;
  }

  .desktop-icon-img {
    font-size: 28px;
  }

  .desktop-icon-label {
    font-size: 9px;
    max-width: 60px;
  }

  /* Taskbar — compact */
  #taskbar {
    gap: 2px;
    padding: 2px;
  }

  #start-button {
    min-width: 50px;
    padding: 0 4px;
    font-size: 10px;
  }

  #start-logo {
    font-size: 14px;
  }

  .taskbar-window-btn {
    min-width: unset;
    max-width: 120px;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #system-tray {
    padding: 0 4px;
  }

  #clock {
    font-size: 10px;
  }

  /* Status bar — compact */
  .status-bar {
    font-size: 10px;
  }

  .status-bar-field {
    font-size: 10px;
    padding: 0 4px;
  }
}

/* ===== MOBILE DIALOG ===== */
@media (max-width: 480px) {
  #joke-dialog {
    min-width: unset !important;
    max-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
  }
}
