:root {
  --ucai-shell-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ucai-shell-lift: 14px;
}

body.ucai-app-shell-enabled {
  padding-bottom: calc(102px + var(--ucai-shell-safe-bottom));
}

body.ucai-app-shell-enabled .ifmm-floating-wrap {
  display: none !important;
}

body.ucai-app-shell-is-transitioning {
  cursor: progress;
}

.ucai-app-shell {
  position: fixed;
  right: 0;
  bottom: var(--ucai-shell-lift);
  left: 0;
  z-index: 99999;
  padding: 10px 14px calc(10px + var(--ucai-shell-safe-bottom));
  pointer-events: none;
}

.ucai-app-shell__inner {
  --ucai-shell-bg: rgba(6, 10, 16, 0.76);
  --ucai-shell-bg-2: rgba(34, 43, 55, 0.52);
  --ucai-shell-border: rgba(229, 217, 183, 0.22);
  --ucai-shell-text: #f8f5ed;
  --ucai-shell-muted: #c6c0b1;
  --ucai-shell-active-bg: rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.2);
  --ucai-shell-active-ring: rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.46);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(var(--ucai-shell-items, 4), minmax(0, 1fr));
  gap: 4px;
  width: min(var(--ucai-shell-maxw, 620px), calc(100vw - 24px));
  min-height: 66px;
  margin: 0 auto;
  padding: 7px;
  border: 1px solid var(--ucai-shell-border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 38%, rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.12)),
    radial-gradient(circle at 16% 8%, rgba(255, 255, 255, 0.26), transparent 34%),
    radial-gradient(circle at 86% 92%, rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.24), transparent 38%),
    linear-gradient(180deg, var(--ucai-shell-bg), var(--ucai-shell-bg-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -18px 34px rgba(255, 255, 255, 0.05),
    0 26px 72px rgba(0, 0, 0, 0.48),
    0 10px 34px rgba(5, 10, 17, 0.42);
  backdrop-filter: blur(30px) saturate(1.75) contrast(1.08);
  -webkit-backdrop-filter: blur(30px) saturate(1.75) contrast(1.08);
  touch-action: none;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.ucai-app-shell__inner::before,
.ucai-app-shell__inner::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
}

.ucai-app-shell__inner::before {
  border-radius: inherit;
  background:
    linear-gradient(108deg, transparent 0 17%, rgba(255, 255, 255, 0.22) 32%, transparent 50%),
    linear-gradient(284deg, transparent 0 55%, rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.16) 68%, transparent 84%);
  opacity: 0.86;
  mix-blend-mode: screen;
}

.ucai-app-shell__inner::after {
  inset: 1px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 27px;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.13);
}

.ucai-app-shell__item {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 22px;
  color: var(--ucai-shell-muted);
  font: 700 11px/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color 180ms ease, background 180ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1), border-color 180ms ease;
}

.ucai-app-shell__item:hover,
.ucai-app-shell__item:focus {
  color: var(--ucai-shell-text);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none !important;
}

.ucai-app-shell__item.is-active,
.ucai-app-shell__item.is-peeking {
  color: var(--ucai-shell-text);
  background: var(--ucai-shell-active-bg);
}

.ucai-app-shell__item.is-active {
  border-color: var(--ucai-shell-active-ring);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 10px 28px rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.18);
}

.ucai-app-shell__item.is-peeking {
  transform: translateY(-6px) scale(1.1);
}

.ucai-app-shell__item:active {
  transform: scale(0.97);
}

.ucai-app-shell__icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  color: var(--ucai-shell-accent, #b49a57);
}

.ucai-app-shell__icon svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ucai-app-shell__dashicon {
  width: 22px;
  height: 22px;
  font-size: 22px;
  line-height: 22px;
}

.ucai-app-shell__image-icon {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
}

.ucai-app-shell__label {
  overflow: hidden;
  max-width: 72px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ucai-app-shell__lens {
  --ucai-lens-width: calc((100% - ((var(--ucai-shell-items, 4) - 1) * 4px) - 14px) / var(--ucai-shell-items, 4));
  --ucai-lens-height: 58px;
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: max(76px, var(--ucai-lens-width));
  height: var(--ucai-lens-height);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 31% 23%, rgba(255, 255, 255, 0.86), transparent 18%),
    radial-gradient(circle at 70% 76%, rgba(var(--ucai-shell-accent-rgb, 180,154,87), 0.36), transparent 34%),
    linear-gradient(138deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08) 48%, rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.64),
    inset -9px -14px 22px rgba(5, 18, 28, 0.18),
    0 16px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px) saturate(2.05) contrast(1.14) brightness(1.08);
  -webkit-backdrop-filter: blur(8px) saturate(2.05) contrast(1.14) brightness(1.08);
  transform: translate3d(
    calc(var(--ucai-lens-x, 0px) - (max(76px, var(--ucai-lens-width)) / 2)),
    calc(var(--ucai-lens-y, 0px) - (var(--ucai-lens-height) / 2)),
    0
  ) scale(0.9);
  transition: opacity 140ms ease, transform 170ms cubic-bezier(0.2, 0.95, 0.2, 1);
}

.ucai-app-shell__lens-map {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--ucai-shell-items, 4), minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  opacity: 0.96;
  filter: saturate(1.25) contrast(1.08);
  pointer-events: none;
  will-change: transform;
}

.ucai-app-shell__lens-map .ucai-app-shell__item {
  color: var(--ucai-shell-text);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.ucai-app-shell__inner.is-dragging .ucai-app-shell__lens {
  opacity: 1;
  transform: translate3d(
    calc(var(--ucai-lens-x, 0px) - (max(76px, var(--ucai-lens-width)) / 2)),
    calc(var(--ucai-lens-y, 0px) - (var(--ucai-lens-height) / 2)),
    0
  ) scale(1);
}

.ucai-app-shell__inner.is-dragging .ucai-app-shell__item:not(.is-peeking) {
  opacity: 0.62;
}

.ucai-app-skeleton {
  display: grid;
  gap: 16px;
  padding: clamp(16px, 4vw, 24px);
}

.ucai-app-skeleton__hero,
.ucai-app-skeleton__line,
.ucai-app-skeleton__card,
.ucai-app-skeleton__chip {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #ece7db;
}

.ucai-app-skeleton__hero {
  height: 134px;
  border-radius: 18px;
}

.ucai-app-skeleton__line {
  height: 14px;
}

.ucai-app-skeleton__line:nth-child(2) {
  width: 72%;
}

.ucai-app-skeleton__line:nth-child(3) {
  width: 54%;
}

.ucai-app-skeleton__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ucai-app-skeleton__card {
  min-height: 112px;
  border-radius: 16px;
}

.ucai-app-skeleton__chips {
  display: flex;
  gap: 8px;
}

.ucai-app-skeleton__chip {
  width: 84px;
  height: 34px;
  border-radius: 999px;
}

.ucai-app-skeleton__hero::after,
.ucai-app-skeleton__line::after,
.ucai-app-skeleton__card::after,
.ucai-app-skeleton__chip::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: ucai-app-skeleton-shimmer 1.2s infinite;
}

@keyframes ucai-app-skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (min-width: 981px) {
  .ucai-app-shell--hide-desktop {
    display: none;
  }
}

@media (max-width: 980px) {
  .ucai-app-shell--hide-mobile {
    display: none;
  }
}

@media (max-width: 420px) {
  .ucai-app-shell {
    padding-inline: 8px;
  }

  .ucai-app-shell__inner {
    width: min(var(--ucai-shell-maxw, 620px), calc(100vw - 14px));
    gap: 2px;
    padding: 5px;
  }

  .ucai-app-shell__item {
    gap: 3px;
    min-height: 50px;
    padding-inline: 2px;
    font-size: 10px;
  }

  .ucai-app-shell__label {
    max-width: 58px;
  }
}

@media (prefers-color-scheme: light) {
  .ucai-app-shell__inner {
    --ucai-shell-bg: rgba(255, 255, 255, 0.72);
    --ucai-shell-bg-2: rgba(244, 239, 228, 0.5);
    --ucai-shell-border: rgba(70, 58, 35, 0.18);
    --ucai-shell-text: #151a21;
    --ucai-shell-muted: #5d6470;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.74),
      inset 0 -18px 34px rgba(255, 255, 255, 0.18),
      0 20px 52px rgba(20, 24, 31, 0.22);
  }

  .ucai-app-skeleton__hero,
  .ucai-app-skeleton__line,
  .ucai-app-skeleton__card,
  .ucai-app-skeleton__chip {
    background: #edf0f3;
  }
}
