/* PWA 外壳样式（独立文件，减少与 style.css 的合并冲突）：安全区、连接状态指示、添加到主屏幕说明、下拉刷新提示、登录页提示。
   颜色全部取 style.css 的主题 token。圆点是非文字元素（对比度 >= 3:1：浅色 waiting 3.75 / danger 4.3 / working 3.2，暗色均 > 5），
   文字一律用 --text（浅色 14.5:1），重试按钮用 --accent（浅色 5.6:1、暗色 6.5:1）。 */

/* ---------- 安全区（viewport-fit=cover；standalone 下刘海、Home 条、横屏圆角） ---------- */
.bar { padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.term-bar { height: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
.term-bar .menu { top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) - 6px); }
.dock { padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
.login { margin-top: max(16vh, calc(env(safe-area-inset-top, 0px) + 24px)); }

/* ---------- 连接状态指示（顶栏） ---------- */
.conn { display: none; align-items: center; gap: 6px; flex: none; padding: 0 6px; font-size: 12px; line-height: 1.2; color: var(--text); white-space: nowrap; }
.conn[data-kind] { display: inline-flex; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--waiting); }
.conn[data-kind="lost"] .conn-dot { background: var(--danger); }
.conn[data-kind="recovered"] .conn-dot { background: var(--working); }
.conn[data-kind="reconnecting"] .conn-dot { animation: conn-blink 1.2s ease-in-out infinite; }
.conn-retry { min-height: 32px; padding: 0 6px; color: var(--accent); font-size: 12px; text-decoration: underline; }
@keyframes conn-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .conn[data-kind="reconnecting"] .conn-dot { animation: none; } }

/* ---------- 添加到主屏幕说明 ---------- */
.pwa-guide { margin: 0 0 12px; }
.pwa-guide h4 { margin: 0 0 4px; font-size: 14px; }
.pwa-guide ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.pwa-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- 下拉刷新提示 / 登录页提示 ---------- */
.pull-tip { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 30; padding: 6px 14px;
  border-radius: 999px; background: var(--raise); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); font-size: 13px; }
.pwa-login-hint { margin: -8px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- HTTP 页面顶部的“切换到安全连接”提示（web/https.mjs） ---------- */
.https-hint { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 6px;
  max-width: 92vw; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); font-size: 13px; white-space: nowrap; }
.https-hint a { color: var(--accent); }
.https-hint-x { flex: none; min-width: 44px; min-height: 32px; padding: 0 8px; border-radius: 999px; color: var(--muted); font-size: 12px; }
.https-hint-x:active { background: var(--line); color: var(--text); }

/* 偏好页“通知渠道”区块 */
.notify-list { margin-top: 8px; }
.notify-item { display: flex; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.notify-main { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notify-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-state { color: var(--muted); font-size: 12px; }
.notify-form { display: flex; flex-direction: column; gap: 10px; }
.notify-form [hidden] { display: none; }
.notify-field { display: flex; flex-direction: column; gap: 10px; }
.notify-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.notify-err { margin: 0; color: var(--danger); font-size: 13px; }
.notify-err:empty { display: none; }

/* 偏好页“推送通知”行 */
.push-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.push-actions [hidden] { display: none; }
.push-devices { margin-top: 8px; }
.push-device { display: flex; align-items: center; gap: 8px; min-height: 44px; border-top: 1px solid var(--line); }
.push-device-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-device-time { flex: none; color: var(--muted); font-size: 12px; }
.pwa-tabs { display: flex; gap: 8px; margin: 0 0 8px; flex-wrap: wrap; }

/* ---------- 版本小字与新版本提示条（web/version.mjs） ---------- */
.ver-line, .menu-version { margin: 12px 0 0; color: var(--muted); font-size: 12px; text-align: center; user-select: text; }
.menu-version { margin: 4px 12px 8px; padding: 8px 0 0; border-top: 1px solid var(--line); text-align: left; pointer-events: none; }
.menu-note + .menu-version { margin-top: 0; padding-top: 0; border-top: 0; }
.update-bar { position: relative; z-index: 6; flex: none; display: flex; align-items: center; gap: 4px; box-sizing: border-box; min-height: 44px; padding: env(safe-area-inset-top, 0px) 4px 0 12px;
  background: var(--raise); border-bottom: 1px solid var(--accent); color: var(--text); font-size: 14px; }
/* 会话页 / 桌面页是 position:fixed 铺满视口：有提示条时整体下移，不被提示条遮住也不盖住它 */
html.has-update-bar #app > .term-page, html.has-update-bar #app > .desk-page { top: var(--ub-h, 0px); height: calc(100vh - var(--ub-h, 0px)); height: calc(100dvh - var(--ub-h, 0px)); }
html.has-update-bar .split { height: calc(100vh - var(--ub-h, 0px)); height: calc(100dvh - var(--ub-h, 0px)); }
.update-bar-go { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 6px 0; text-align: left; color: var(--accent); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.update-bar-x { flex: none; min-width: 44px; min-height: 44px; padding: 0 8px; border-radius: 8px; color: var(--muted); font-size: 12px; }
.update-bar-x:active { background: var(--line); color: var(--text); }
