/* ═══ iOS PWA 安装引导 v1.0 (2026-07-09) ═══
   iOS Safari 浏览器模式不支持 requestFullscreen,
   唯一全屏方法 = 加到主屏 → PWA 独立模式 → apple-mobile-web-app-capable 隐藏 chrome
   顶部小条 + 详细步骤 modal, 引导玩家完成添加后永久 dismiss. */

/* ─── 顶部小条 (banner) ─── */
.ios-pwa-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999998;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #1a1a1a;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  transform: translateY(-100%);
  transition: transform 0.4s ease-out;
  /* iOS safe area - 避开刘海 */
  padding-top: max(8px, env(safe-area-inset-top));
}
.ios-pwa-banner.visible {
  transform: translateY(0);
}
.ios-pwa-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.ios-pwa-banner-text {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ios-pwa-banner-btn-primary,
.ios-pwa-banner-btn-secondary {
  background: rgba(0,0,0,0.18);
  border: 0;
  color: #1a1a1a;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ios-pwa-banner-btn-primary {
  background: #1a1a1a;
  color: #ffd700;
}
.ios-pwa-banner-btn-secondary {
  background: rgba(0,0,0,0.1);
  color: #555;
  font-size: 11px;
  padding: 6px 8px;
}
.ios-pwa-banner-btn-primary:active,
.ios-pwa-banner-btn-secondary:active {
  opacity: 0.7;
}

/* ─── 步骤 modal ─── */
.ios-pwa-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999999;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* iOS safe area */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  animation: ios-pwa-fade-in 0.25s ease-out;
}
@keyframes ios-pwa-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.ios-pwa-modal {
  background: #ffffff;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ios-pwa-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
@keyframes ios-pwa-scale-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.ios-pwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f0f0f0;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
}
.ios-pwa-modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}
.ios-pwa-modal-close {
  background: rgba(0,0,0,0.12);
  border: 0;
  color: #1a1a1a;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.ios-pwa-modal-close:active {
  background: rgba(0,0,0,0.25);
}
.ios-pwa-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  background: #fafafa;
  -webkit-overflow-scrolling: touch;
}
.ios-pwa-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #ececec;
}
.ios-pwa-step:last-child {
  border-bottom: 0;
}
.ios-pwa-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(255, 184, 0, 0.4);
}
.ios-pwa-step-content {
  flex: 1;
  min-width: 0;
}
.ios-pwa-step-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 3px;
  line-height: 1.3;
}
.ios-pwa-step-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}
.ios-pwa-step-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}
.ios-pwa-modal-footer {
  padding: 12px 18px 16px;
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ios-pwa-btn-primary,
.ios-pwa-btn-secondary {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  border: 0;
  transition: opacity 0.15s;
}
.ios-pwa-btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #1a1a1a;
  font-weight: 700;
}
.ios-pwa-btn-secondary {
  background: #f0f0f0;
  color: #666;
}
.ios-pwa-btn-primary:active,
.ios-pwa-btn-secondary:active {
  opacity: 0.7;
}

/* ─── PC/桌面 隐藏 (无 iOS) ─── */
@media (min-width: 1024px) {
  .ios-pwa-banner,
  .ios-pwa-modal-overlay {
    display: none !important;
  }
}

/* ─── 小屏 iPhone (≤375px) 字号微调 ─── */
@media (max-width: 375px) {
  .ios-pwa-banner {
    font-size: 12px;
    padding: 6px 10px;
    gap: 6px;
  }
  .ios-pwa-banner-text {
    /* 小屏省略号, 只显示按钮 */
    display: none;
  }
}
