/* ── Mobile Adaptation (< 768px) ── */
/* The XP experience adapts to touch: single-tap opens, windows go fullscreen,
   taskbar becomes touch-friendly, icons form a grid */

@media (max-width: 768px) {

  /* Boot screen — scale down */
  #boot-screen .xp-logo {
    width: 200px;
    margin-bottom: 24px;
  }

  #boot-screen .boot-wordmark {
    width: 280px;
  }

  /* Login screen */
  #login-screen .user-avatar {
    width: 110px;
    height: 110px;
  }

  #login-screen .user-name {
    font-size: 18px;
  }

  #login-screen .login-hint {
    font-size: 13px;
  }

  /* ── Desktop Icons — compact grid ── */
  #desktop-icons {
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 6px 12px;
  }

  .desktop-icon {
    width: 75px;
    padding: 6px 4px;
  }

  .desktop-icon img {
    width: 36px;
    height: 36px;
  }

  .desktop-icon span {
    font-size: 10px;
  }

  /* ── Windows — fullscreen on mobile ── */
  .xp-window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 40px) !important;
    height: calc(100dvh - 40px) !important;
    min-width: unset;
    min-height: unset;
    border-radius: 0 !important;
    border-width: 0 !important;
    border-top: none !important;
    box-shadow: none !important;
  }

  .xp-window .title-bar {
    border-radius: 0;
    height: 36px;
    padding: 0 6px;
  }

  .xp-window .title-bar .title-text {
    font-size: 13px;
  }

  .xp-window .title-bar .window-controls button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* Hide maximize and minimize on mobile — windows are always fullscreen */
  .xp-window .title-bar .btn-maximize,
  .xp-window .title-bar .btn-minimize {
    display: none;
  }

  .xp-window .window-body {
    padding: 12px;
    -webkit-overflow-scrolling: touch;
  }

  /* Games — remove window body padding, prevent overflow */
  .xp-window .window-body:has(.pb-game),
  .xp-window .window-body:has(.ms-game),
  .xp-window .window-body:has(.snake-game) {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Disable resize on mobile */
  .xp-window .resize-handle {
    display: none;
  }

  /* ── Taskbar — taller for touch ── */
  #taskbar {
    height: 40px;
  }

  #start-button {
    height: 40px;
  }

  .taskbar-window-btn {
    height: 28px;
    font-size: 10px;
    padding: 0 6px;
    max-width: 100px;
  }

  #system-tray {
    gap: 8px;
    padding: 0 10px;
  }

  #system-tray .tray-btn {
    width: 20px;
    height: 20px;
  }

  #clock {
    font-size: 11px;
  }

  /* ── Start Menu — full width on mobile ── */
  #start-menu {
    width: 100%;
    bottom: 40px;
    border-radius: 0;
    max-height: 70vh;
    overflow-y: auto;
  }

  #start-menu .sm-body {
    flex-direction: column;
    min-height: auto;
  }

  #start-menu .sm-left,
  #start-menu .sm-right {
    width: 100%;
    padding: 6px 0;
  }

  #start-menu .sm-right {
    border-left: none;
    border-top: 1px solid #a0b8d8;
  }

  #start-menu .sm-item {
    padding: 10px 16px;
    font-size: 14px;
  }

  #start-menu .sm-item img {
    width: 24px;
    height: 24px;
  }

  #start-menu .sm-footer button {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* ── Context menu — hide on mobile ── */
  #context-menu {
    display: none !important;
  }

  /* ── Content adjustments ── */
  .about-content {
    padding: 12px;
  }

  .about-content .about-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .about-content .about-avatar {
    width: 90px;
    height: 90px;
  }

  .about-content .about-bio h2 {
    font-size: 16px;
  }

  .about-content .skill-tags {
    justify-content: center;
  }

  .about-content .social-links {
    justify-content: center;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .resume-content {
    padding: 14px;
  }

  .resume-content h2 {
    font-size: 18px;
  }

  .contact-content .contact-link {
    width: 100%;
    max-width: 280px;
  }
}

/* ── Small phones (< 400px) ── */
@media (max-width: 400px) {
  .desktop-icon {
    width: 70px;
  }

  .desktop-icon img {
    width: 32px;
    height: 32px;
  }

  #start-menu .sm-header img {
    width: 36px;
    height: 36px;
  }
}
