/* iOS 适配（对安卓无副作用） */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

/* iPhone 的 100vh 会被工具栏吃掉，优先用 dvh */
@supports (height: 100dvh) {
  #app { min-height: 100dvh; }
  .login-wrap { min-height: 100dvh; }
  .table-wrap { max-height: calc(100dvh - 190px); }
  .score-list { max-height: calc(100dvh - 210px); }
  .side { height: calc(100dvh - 54px); }
}

/* 滚动惯性，长表格滑起来更顺 */
.table-wrap,
.score-list,
.chips,
.filters {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 860px) {
  /* iOS 输入框字号小于 16px 会自动放大整页，这里统一压住 */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
  .table-wrap { max-height: calc(100dvh - 240px); }
  /* 底部导航给 Home 指示条留空间 */
  .mobile-nav {
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    height: calc(58px + env(safe-area-inset-bottom));
  }
  .main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* 从主屏幕图标启动（全屏模式）时，顶部刘海区域留白 */
@media all and (display-mode: standalone) {
  .topbar {
    height: calc(50px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  .side { height: calc(100dvh - 50px - env(safe-area-inset-top)); }
}

/* iPad 竖屏 / 分屏（700~860）：横屏空间够，用双栏，别拉成一根长条 */
@media (min-width: 700px) and (max-width: 860px) {
  .main { padding: 16px 22px calc(86px + env(safe-area-inset-bottom)); }
  .home-grid { grid-template-columns: 1.1fr 1fr; }
  .detail-grid { grid-template-columns: 1.2fr 1fr; }
  .score-grid { grid-template-columns: 300px 1fr; }
  .member-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 48vh; }
  .info-list { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .stat-two { grid-template-columns: 1fr 1fr; }
  .table-wrap { max-height: calc(100dvh - 190px); }
  .score-list { max-height: calc(100dvh - 210px); }
  .mobile-nav { max-width: 760px; margin: 0 auto; }
}

/* iPad 横屏（861~1180）：保留了侧边栏，把内容区用足 */
@media (min-width: 861px) and (max-width: 1180px) {
  .main { padding: 16px 22px 40px; }
  .member-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: 1.05fr 1fr; }
}

/* iOS 添加到主屏幕引导条 */
.ios-tip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 60;
  margin: 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(39, 73, 201, 0.96);
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(20, 40, 90, 0.28);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ios-tip .txt { flex: 1; }
.ios-tip .close {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
}
