#desktop-screen {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: linear-gradient(180deg, #35538a, #1b2f59);
  padding: 1.2rem 2rem 2rem;
  position: relative;
  width: 100%;
  height: 100%;
}

#desktop-screen.active {
  align-items: stretch;
  justify-content: flex-start;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.4rem;
  border: 4px solid rgba(0, 0, 0, 0.3);
  background: rgba(9, 17, 36, 0.6);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  color: var(--accent);
  text-shadow: 0 4px 0 #102039;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.hud .stat {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-color);
}

.hud .stat span {
  color: var(--accent);
}

.desktop-area {
  flex: 1;
  border: 6px solid rgba(2, 7, 19, 0.6);
  background: repeating-linear-gradient(45deg, rgba(13, 26, 52, 0.95), rgba(13, 26, 52, 0.95) 12px, rgba(9, 18, 38, 0.95) 12px, rgba(9, 18, 38, 0.95) 24px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 2rem;
  align-content: start;
  padding: 2rem;
  position: relative;
}

.icon {
  width: 120px;
  height: 120px;
  border: none;
  background: none;
  padding: 0;
  cursor: var(--cursor-pointer), pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-color);
}

.icon:focus {
  outline: 2px dashed var(--accent);
  outline-offset: 6px;
}

.icon-sprite {
  width: 100px;
  height: 100px;
  position: relative;
}

.icon.blocked {
  cursor: var(--cursor-not-allowed), not-allowed !important;
}

.icon.blocked .icon-sprite {
  cursor: var(--cursor-not-allowed), not-allowed !important;
}

.icon-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  text-align: center;
  text-transform: uppercase;
  color: var(--text-color);
  text-shadow: 0 3px 0 #111c31;
}

@media (min-width: 769px) and (max-width: 1024px) {
  #desktop-screen {
    padding: 1rem 1.5rem 1.5rem;
  }

  .hud {
    padding: 0.8rem 1.2rem;
    font-size: 0.5rem;
    gap: 0.6rem;
  }

  .hud .stat {
    font-size: 0.5rem;
    gap: 0.4rem;
  }

  .desktop-area {
    padding: 1.5rem;
    gap: 1.8rem;
  }

  .icon {
    width: 110px;
    height: 110px;
  }

  .icon-sprite {
    width: 80px;
    height: 80px;
  }

  .icon-label {
    font-size: 0.55rem;
  }
}

@media (max-width: 768px) {
  #desktop-screen {
    padding: 0;
    padding-bottom: 0;
  }

  .hud {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.6rem calc(0.8rem + env(safe-area-inset-left, 0px)) calc(0.6rem + env(safe-area-inset-bottom, 0px)) calc(0.8rem + env(safe-area-inset-right, 0px));
    font-size: 0.55rem;
    gap: 0.4rem;
    z-index: 999;
    border: none;
    border-top: 4px solid rgba(0, 0, 0, 0.3);
    background: rgba(9, 17, 36, 0.95);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    justify-content: space-around;
  }

  .hud .stat {
    gap: 0.3rem;
    font-size: 0.55rem;
    white-space: nowrap;
  }

  .desktop-area {
    border: none;
    padding: 1.5rem 1rem;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
    gap: 1.5rem 1rem;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-items: center;
    align-items: start;
  }

  .icon {
    position: relative;
    padding: 0.6rem;
    width: 100%;
    max-width: 110px;
    height: auto;
    min-height: 110px;
    justify-content: center;
    min-width: 100px;
  }

  .icon-sprite {
    width: 64px;
    height: 64px;
  }

  .icon::before {
    content: '';
    position: absolute;
    inset: -10px;
    z-index: -1;
  }

  .icon:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }

  .icon-label {
    text-shadow: 0 2px 0 #111c31, 0 0 8px rgba(0, 0, 0, 0.8);
    font-size: 0.5rem;
    margin-top: 0.5rem;
    line-height: 1.3;
  }
}


.icon:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.icon-label {
  text-shadow: 0 2px 0 #111c31, 0 0 8px rgba(0, 0, 0, 0.8);
}

@media (max-width: 480px) {
  .hud {
    padding: 0.5rem 0.6rem;
    font-size: 0.5rem;
  }

  .hud .stat {
    font-size: 0.5rem;
    gap: 0.25rem;
  }

  .desktop-area {
    padding: 1.2rem 0.8rem;
    padding-bottom: 115px;
    gap: 1.2rem 0.8rem;
  }

  .icon {
    max-width: 95px;
    min-height: 95px;
  }

  .icon-sprite {
    width: 56px;
    height: 56px;
  }

  .icon-label {
    font-size: 0.55rem;
    margin-top: 0.4rem;
  }
}

@media (max-width: 360px) {
  .hud {
    font-size: 0.48rem;
    padding: 0.4rem 0.5rem;
  }

  .hud .stat {
    font-size: 0.48rem;
  }

  .desktop-area {
    padding: 1rem 0.6rem;
    padding-bottom: 105px;
    gap: 1rem 0.6rem;
  }

  .icon {
    max-width: 85px;
    min-height: 85px;
  }

  .icon-sprite {
    width: 48px;
    height: 48px;
  }

  .icon-label {
    font-size: 0.5rem;
  }
}


@media (max-width: 768px) and (orientation: landscape) {
  .desktop-area {
    grid-template-columns: repeat(5, 1fr);
    padding: 1rem;
    padding-bottom: 85px;
    gap: 1rem;
  }

  .icon {
    max-width: 90px;
    min-height: 90px;
  }

  .icon-sprite {
    width: 52px;
    height: 52px;
  }

  .icon-label {
    font-size: 0.55rem;
  }

  .hud {
    flex-direction: row;
    padding: 0.5rem 1rem;
  }
}


#stat-satiety.low {
  color: orange !important;
}

#stat-satiety.critical {
  color: var(--danger) !important;
}

#stat-energy.low {
  color: orange !important;
}

#stat-energy.critical {
  color: var(--danger) !important;
}

#stat-health.low {
  color: orange !important;
}

#stat-health.critical {
  color: var(--danger) !important;
}

.audio-toggle {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(25, 40, 65, 0.9);
  border: 2px solid var(--window-border);
  padding: 0.5rem;
  cursor: var(--cursor-pointer), pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.audio-toggle:hover {
  background: rgba(35, 50, 75, 0.9);
  transform: scale(1.1);
}

.audio-toggle.muted {
  opacity: 0.7;
}

.audio-icon {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  transition: opacity 0.2s ease;
}

@media (max-width: 768px) {
  .audio-toggle {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem;
  }

  .audio-icon {
    width: 20px;
    height: 20px;
  }
}