/* ============================================================
 * sheet-motion.css — 手机端弹窗 = 底部抽屉
 * 点击玩法后报备单从屏幕底部滑上来；按住头部往下拖可以拉走，
 * 松手回弹或顺势滑出关闭（逻辑在 app.js）。
 * ============================================================ */

/* 弹窗打开期间锁住页面的滚动容器，关闭后保留原来的位置。 */
:root:has(> body > dialog:modal),
body:has(> dialog:modal),
body:has(> dialog:modal) #app [data-scroll] {
  overflow: hidden;
  overscroll-behavior: none;
}

dialog:modal,
dialog:modal .dialog-body {
  overscroll-behavior: contain;
}

dialog:modal::backdrop {
  touch-action: none;
}

/* 头部是拖拽区：禁掉浏览器自带滚动/缩放手势，才能连续跟手 */
#dialog .dialog-head {
  touch-action: none;
}

/* 报备单底部操作条：不要让它在弹窗底部压出一条白色横带，改成融进底色的渐隐 */
#dialog .form-actions,
#dialog:where(:not([data-landscape])) form .form-actions {
  border-top: 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--panel, #fff) 0%, transparent),
    var(--panel, #fff) 42%
  );
}
#dialog .mobile-sheet-grab {
  cursor: grab;
}
#dialog .mobile-sheet-grab:active {
  cursor: grabbing;
}

@media (max-width: 760px) {
  /* 弹窗本身不再多留一条底边（会变成底部一条白带），安全区交给内容区处理 */
  #dialog:where(:not([data-landscape]))[open] {
    padding-bottom: 0;
  }
  #dialog:where(:not([data-landscape])) .dialog-body {
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }
  /* 横屏风格的报备单（选了玩法之后）顶部也补一条拖拽条 */
  #dialog[data-landscape] .mobile-sheet-grab {
    display: grid;
    place-items: center;
    position: absolute;
    top: 6px;
    left: 50%;
    right: auto;
    width: 68px;
    margin-left: -34px;
    min-height: 20px;
    color: #fff;
    touch-action: none;
    z-index: 3;
  }
  #dialog[data-landscape] .mobile-sheet-grab::before {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: currentColor;
    opacity: 0.42;
  }
}
