/* Mobile companion viewport repair.
 * Some Android in-app browsers report svh/dvh shorter than the visible page.
 * Keep the mini-program layout, but force the companion surface to cover the
 * classic viewport so the composer cannot end above a black page gutter.
 */
@media (max-width: 900px) {
  .companion-product,
  .companion-product__device,
  .companion-product__main {
    width: 100%;
    min-height: 100vh;
    background-color: #0f1624;
  }

  .companion-product {
    height: auto;
    overflow: visible;
  }

  .companion-product__device {
    height: auto;
  }

  .companion-product__main {
    height: 100vh;
    min-height: 100vh;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .companion-product__workspace {
    min-height: 0;
  }

  .companion-product--treehole.is-empty .companion-product__workspace {
    flex: 0 0 clamp(315px, 46vh, 390px);
  }

  .companion-product__welcome {
    padding-top: clamp(34px, 6vh, 54px);
  }

  .companion-product__welcome .companion-product__mobile-copy {
    color: rgba(247, 241, 223, 0.72);
  }

  .companion-product__trust span {
    color: rgba(230, 233, 240, 0.55);
  }

  .companion-product--treehole.is-empty .companion-product__trust {
    display: none !important;
  }

  .companion-product__composer-wrap {
    margin-top: 0;
    background: linear-gradient(180deg, rgba(15, 22, 36, 0.84), #0f1624 22%);
  }

  .companion-product__mobile-switch {
    margin: 0 0 8px;
    display: flex;
    gap: 6px;
  }

  .companion-product__composer textarea::placeholder {
    color: rgba(230, 233, 240, 0.62);
  }

  .companion-product__composer-wrap > p {
    color: rgba(218, 224, 235, 0.58);
    font-size: 0;
  }

  .companion-product__composer-wrap > p::after {
    content: "AI 生成内容 · 仅供陪伴与整理参考";
    font-size: 9px;
  }

  .companion-product__mobile-nav {
    box-shadow: 0 -10px 30px rgba(2, 7, 15, 0.2);
  }
}

@supports (height: 100dvh) {
  @media (max-width: 900px) {
    /* Keep vh last deliberately: Baidu and several embedded Android browsers
       expose dvh but calculate it from a second, smaller browser viewport. */
    .companion-product__main {
      height: 100dvh;
      height: 100vh;
    }
  }
}
