#home {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 24px 8px;
  align-content: start;
  padding: 48px 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-x pan-y;
}

#wallpaper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
  background-color: var(--bg);
}

#wallpaper .wallpaper-media {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

#wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--wallpaper-scrim);
}

body.has-wallpaper #home .home-name,
body.has-wallpaper #home .cos-muted {
  color: var(--on-wallpaper);
  text-shadow: var(--on-wallpaper-shadow);
}

.home-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.home-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--surface-2);
}

.home-tile img {
  display: block;
  width: 40px;
  height: 40px;
}

.home-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  font-size: var(--fs-sm);
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.home-item:active .home-tile {
  transform: scale(0.95);
}

@media (hover: hover) {
  .home-item:hover .home-tile {
    background: var(--border);
  }
}

#apps {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
}

.app-frame {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

.app-frame.is-active {
  display: block;
}

/* App bertipe hidden/tools/system: lapisan di atas segalanya (kecuali tombol melayang). Latar transparan,
   jadi beranda atau app di belakangnya tetap terlihat. */
.app-frame.app-overlay {
  z-index: 2;
  background: transparent;
}

body.has-overlay #apps {
  z-index: 960;
  overflow: hidden;
  background: transparent;
}

/* App overlay meluncur naik dari bawah saat dibuka. */
.app-frame.is-rising {
  animation: overlay-rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes overlay-rise {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-frame.is-rising {
    animation: none;
  }
}
