/* 手机端沉浸模式样式（与现有功能完全隔离） */

/* 仅当 body 带有 fishpond-immersive-mode 类时生效；
 * 是否为手机由 JS 控制进入沉浸模式的逻辑决定，
 * 这里不再使用 max-width 限制，避免横屏宽度变化导致样式失效。
 */

/* 隐藏头部和底部，专注鱼池 */
body.fishpond-immersive-mode .nm-header,
body.fishpond-immersive-mode .nm-footer {
  display: none;
}

/* 隐藏主内容区，仅保留鱼池区域 */
body.fishpond-immersive-mode .nm-main {
  display: none;
}

/* 让鱼池卡片占满屏幕，作为沉浸背景 */
body.fishpond-immersive-mode #fishpond-card {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  /* 完全全屏，包括灵动岛区域 */
  padding: 0;
  background: #1a1a2e;
}

/* 沉浸模式下，画布容器填满可用高度 */
body.fishpond-immersive-mode .fishpond-canvas-wrap {
  width: 100%;
  height: 100%;
  /* 确保内容不被裁剪，同时填充背景 */
  position: absolute;
  top: 0;
  left: 0;
}

/* 沉浸模式 UI：退出按钮 + 信息 HUD */
body.fishpond-immersive-mode .fishpond-immersive-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2100;
  /* UI 层不需要 padding，让子元素自己处理安全区域 */
}

body.fishpond-immersive-mode .fishpond-immersive-exit {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top)); /* 适配顶部刘海 */
  left: calc(16px + env(safe-area-inset-left));
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  pointer-events: auto;
}

body.fishpond-immersive-mode .fishpond-immersive-hud {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(20px + env(safe-area-inset-bottom)); /* 适配底部横条 */
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #e5f2ff;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: auto;
}

/* iOS PWA 安装指引提示 */
.ios-pwa-guide {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: slideUp 0.5s ease-out;
}

.ios-pwa-guide.show {
  display: flex;
}

.ios-pwa-guide h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #000;
}

.ios-pwa-guide p {
  font-size: 13px;
  color: #666;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.ios-pwa-guide .guide-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #007aff; /* iOS blue */
}

.ios-pwa-guide .close-guide {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
}

/* 指引小箭头，指向底部 Safari 分享按钮 */
.ios-pwa-guide::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.9);
}

@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* 沉浸模式空闲状态：淡化按钮但保持可点击，点击后会唤醒 */
body.fishpond-immersive-mode.fishpond-immersive-idle .fishpond-immersive-exit,
body.fishpond-immersive-mode.fishpond-immersive-idle .fab-dock,
body.fishpond-immersive-mode.fishpond-immersive-idle .fishpond-header {
  opacity: 0.3; /* 改为半透明而不是完全隐藏 */
  transition: opacity 0.3s ease;
  /* 移除 pointer-events: none，保持按钮可点击 */
}

/* 从空闲状态被唤醒时，按钮重新淡入 */
body.fishpond-immersive-mode .fishpond-immersive-exit,
body.fishpond-immersive-mode .fab-dock,
body.fishpond-immersive-mode .fishpond-header {
  transition: opacity 0.3s ease;
}
