/* Hidden on desktop; exposed by the mobile layout only. */
.mobile-widgets-trigger { display: none; }

/* Wippix responsive mobile layout.
   Loaded last and scoped to the automatically detected mobile/touch layout. */
body[data-device="mobile"] {
  min-height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body[data-device="mobile"] .topbar {
  top: max(7px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

body[data-device="mobile"] .topbar > .date-island,
body[data-device="mobile"] .network-status-island {
  display: none !important;
}

body[data-device="mobile"] .top-cluster {
  min-width: 0;
  gap: 4px;
}

body[data-device="mobile"] .top-cluster:first-child {
  flex: 1 1 auto;
  overflow: hidden;
}

body[data-device="mobile"] .brand-island {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 0 9px;
  gap: 6px;
  font-size: 11px;
}

body[data-device="mobile"] .comet-mark { font-size: 14px; }

body[data-device="mobile"] .desktop-menu-bar {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

body[data-device="mobile"] .desktop-menu-bar::-webkit-scrollbar { display: none; }

body[data-device="mobile"] .desktop-menu-trigger {
  min-height: 34px;
  padding: 0 6px;
  font-size: 10px;
}

body[data-device="mobile"] .top-right-cluster {
  flex: 0 0 auto;
  margin-left: auto;
  gap: 5px;
}

body[data-device="mobile"] #controlCentreButton,
body[data-device="mobile"] #openSettings {
  width: 35px;
  min-width: 35px;
  height: 35px;
  min-height: 35px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

body[data-device="mobile"] #controlCentreButton > span:last-child { display: none; }

body[data-device="mobile"] .desktop-shell {
  display: block;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: calc(54px + env(safe-area-inset-top)) 7px calc(88px + env(safe-area-inset-bottom));
}

body[data-device="mobile"] .workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 23px;
}

body[data-device="mobile"] .widget-sidebar {
  position: fixed;
  z-index: 10020;
  top: calc(55px + env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  bottom: calc(82px + env(safe-area-inset-bottom));
  width: min(310px, calc(100vw - 24px));
  max-height: none;
  padding: 16px 13px;
  border-radius: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(calc(-100% - 18px));
  box-shadow: 0 24px 65px rgba(0,0,0,.38);
  transition: transform .25s ease, opacity .2s ease, visibility .2s ease;
}

body[data-device="mobile"].mobile-widgets-open .widget-sidebar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}

body[data-device="mobile"] .mobile-widgets-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 10021;
  top: calc(58px + env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 999px;
  color: #fff;
  background: rgba(13,29,49,.46);
  box-shadow: 0 8px 22px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.28);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
  backdrop-filter: blur(22px) saturate(175%);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

body[data-device="mobile"].mobile-widgets-open .mobile-widgets-trigger {
  left: auto;
  right: 16px;
}

body[data-device="mobile"] .sidebar-reopen-button { display: none !important; }

body[data-device="mobile"] .welcome-block {
  top: 27%;
  width: min(92%, 520px);
}

body[data-device="mobile"] .welcome-block h1 {
  font-size: clamp(48px, 14vw, 76px);
}

body[data-device="mobile"] .welcome-kicker {
  font-size: 8px;
  letter-spacing: .22em;
}

body[data-device="mobile"] .welcome-subtitle {
  font-size: 9px;
  letter-spacing: .22em;
}

body[data-device="mobile"] .day-label {
  margin-top: 15px;
  padding: 6px 16px;
}

body[data-device="mobile"] .desktop-icons {
  inset: 6px 5px auto auto;
  width: 74px;
  height: auto;
}

body[data-device="mobile"] .desktop-icon {
  position: relative;
  top: auto !important;
  right: auto !important;
  width: 68px;
  min-height: 70px;
  margin: 0 0 5px auto;
  padding: 5px 3px;
  font-size: 9px;
  touch-action: pan-y;
}

body[data-device="mobile"] .folder-icon svg { width: 39px; height: 34px; }
body[data-device="mobile"] .bin-icon svg { width: 27px; height: 34px; }

body[data-device="mobile"] .dock-area {
  position: fixed;
  z-index: 10010;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  width: calc(100vw - 12px);
  max-width: 560px;
  transform: translateX(-50%);
}

body[data-device="mobile"] .dock {
  width: 100%;
  min-height: 54px;
  padding: 6px;
  gap: 5px;
  justify-content: space-between;
  border-radius: 21px;
}

body[data-device="mobile"] .dock-apps { gap: 3px; }

body[data-device="mobile"] .dock-area .dock .dock-app,
body[data-device="mobile"] .dock-area .dock .dock-apps > .dock-app,
body[data-device="mobile"] .dock-area .dock > #startMenuButton,
body[data-device="mobile"] .dock-area .dock > #dockBinButton {
  --dock-icon-size: clamp(30px, 10vw, 42px);
  flex-basis: var(--dock-icon-size) !important;
  width: var(--dock-icon-size) !important;
  min-width: var(--dock-icon-size) !important;
  max-width: var(--dock-icon-size) !important;
  height: var(--dock-icon-size) !important;
  min-height: var(--dock-icon-size) !important;
  max-height: var(--dock-icon-size) !important;
  border-radius: 11px;
}

body[data-device="mobile"] .dock .dock-app img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

body[data-device="mobile"] .dock-divider {
  height: 28px;
  margin: 0 1px;
}

body[data-device="mobile"] .comet-search {
  flex: 0 1 82px !important;
  width: 82px !important;
  min-width: 54px !important;
  max-width: 82px !important;
  height: 36px;
  padding: 0 5px;
  gap: 3px;
}

body[data-device="mobile"] .comet-search .search-star { display: none; }
body[data-device="mobile"] .comet-search input {
  min-width: 0;
  font-size: 9px;
}
body[data-device="mobile"] .comet-search input::placeholder { content: "AI"; }
body[data-device="mobile"] .comet-search button {
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  padding: 0;
}

body[data-device="mobile"] .app-window-backdrop {
  z-index: 10040;
  padding: max(7px, env(safe-area-inset-top)) 7px max(7px, env(safe-area-inset-bottom));
  place-items: stretch;
}

body[data-device="mobile"] .app-window {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  border-radius: 22px;
  translate: 0 0;
}

body[data-device="mobile"] .app-window-content {
  max-height: calc(100% - 54px);
  overflow: auto;
  overscroll-behavior: contain;
}

body[data-device="mobile"] .settings-modal {
  width: 100%;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-device="mobile"] .modal-backdrop {
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}

body[data-device="mobile"] .lock-screen-top {
  padding: max(12px, env(safe-area-inset-top)) 14px 8px;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

body[data-device="mobile"] .lock-main {
  padding: 8px 12px;
  gap: 12px;
  overflow-y: auto;
}

body[data-device="mobile"] .lock-time {
  font-size: clamp(66px, 19vw, 112px);
}

body[data-device="mobile"] .lock-widgets {
  width: 100%;
  gap: 7px;
}

body[data-device="mobile"] .lock-widget {
  min-width: min(100%, 145px);
  flex: 1 1 42%;
  min-height: 64px;
  padding: 9px 10px;
}

body[data-device="mobile"] .lock-notifications {
  width: 100%;
  max-width: 440px;
}

body[data-device="mobile"] .lock-screen-footer {
  padding: 8px 14px max(12px, env(safe-area-inset-bottom));
}

body[data-device="mobile"] .lock-customize-panel,
body[data-device="mobile"] .lock-pin-panel {
  width: calc(100% - 20px);
  max-width: 440px;
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-device="mobile"] .desktop-menubar-dropdown {
  position: fixed;
  top: calc(48px + env(safe-area-inset-top));
  left: 8px;
  max-height: calc(100dvh - 70px);
}

body[data-device="mobile"] .control-centre {
  top: calc(50px + env(safe-area-inset-top));
  right: 8px;
  width: min(310px, calc(100vw - 16px));
}

@media (max-width: 370px) {
  body[data-device="mobile"] .dock-area .dock .dock-app,
  body[data-device="mobile"] .dock-area .dock .dock-apps > .dock-app,
  body[data-device="mobile"] .dock-area .dock > #startMenuButton,
  body[data-device="mobile"] .dock-area .dock > #dockBinButton {
    --dock-icon-size: 30px;
  }
  body[data-device="mobile"] .comet-search {
    flex-basis: 55px !important;
    width: 55px !important;
    max-width: 55px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-device="mobile"] .widget-sidebar { transition: none !important; }
}


/* Keep the wallpaper renderer fitted to the real phone viewport. */
body[data-device="mobile"] #wallpaperCanvas,
body[data-device="mobile"] .vignette {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  pointer-events: none !important;
}

body[data-device="mobile"] #wallpaperCanvas {
  z-index: 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body[data-device="mobile"] .desktop-shell {
  position: relative;
  height: 100dvh;
  min-height: 0;
  box-sizing: border-box;
}

body[data-device="mobile"] .workspace {
  position: relative;
  min-height: 0;
  background: transparent !important;
}
