/* Adaptive height for the Keep, Portainer & FreshRSS iframe widgets */
.widget-content:has(> iframe[src*="keep.wuzicangjie.com"]),
.widget-content:has(> iframe[src*="portainer.wuzicangjie.com"]),
.widget-content:has(> iframe[src*="freshrss.wuzicangjie.com"]) {
  /* keep the widget frameless so the iframe can fully expand */
  padding: 0;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}

/* Centralize offsets into variables for a simpler height calc */
:root {
  /* rename variables to be generic for any full-page iframe */
  --iframe-fix: 12px; /* adjust if you still see a sliver of scroll */
  /* Desktop: top/bottom page gaps + header top margin (gap/2) + header height + nudge */
  --iframe-offset-desktop: calc(2 * var(--widget-gap) + calc(var(--widget-gap) / 2) + var(--header-height, 45px) + var(--iframe-fix));
  /* Mobile: top/bottom gaps + bottom nav + safe-area + nudge */
  --iframe-offset-mobile: calc(2 * var(--widget-gap) + var(--mobile-navigation-height, 0px) + env(safe-area-inset-bottom, 0px) + var(--iframe-fix));
}

/* Fill the viewport */
iframe[src*="keep.wuzicangjie.com"],
iframe[src*="portainer.wuzicangjie.com"],
iframe[src*="freshrss.wuzicangjie.com"] {
  display: block;
  width: 100%;
  border: 0;
  height: calc(100dvh - var(--iframe-offset-desktop)) !important;
}

/* Mobile/tablet: swap the offset used */
@media (max-width: 1190px) {
  iframe[src*="keep.wuzicangjie.com"],
  iframe[src*="portainer.wuzicangjie.com"],
  iframe[src*="freshrss.wuzicangjie.com"] {
    height: calc(100dvh - var(--iframe-offset-mobile)) !important;
  }
}

/* Hide Live2D widget dialog bubble/tips completely */
#waifu-tips,
.waifu-tips {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Make Live2D widget smaller (use correct selector and avoid overriding container transforms) */
#live2d {
  width: 200px !important;   /* shrink from default 300px */
  height: 200px !important;
}

/* Hide the Live2D widget when the mobile navbar appears (small screens) */
@media (max-width: 1190px) {
  #live2d,
  #waifu,
  .waifu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}