/* 我们的小世界 · 页面样式
 * 页面与工具类：toast / 认证 / 配对 / 聊天 / 覆盖层 / 响应式
 * 由 index.html 内联样式拆分而来，规则顺序与原文件完全一致（样式优先级不变）。
 */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--text); color: #FFFDF9; padding: 10px 20px; border-radius: 100px; font-size: 14px; z-index: 100; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mt-20 { margin-top: 20px; } .mt-30 { margin-top: 30px; }
.hidden { display: none !important; }
.empty-state { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 0; }

.auth-screen { text-align: center; padding-top: 40px; }
.auth-screen .auth-logo { font-family: "Noto Serif SC", serif; font-size: 28px; color: var(--primary-deep); margin-bottom: 8px; }
.auth-screen .auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 32px; }
.role-pick { display: flex; gap: 12px; margin: 20px 0; }
.role-card { flex: 1; padding: 24px 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-family: inherit; text-align: center; transition: all 0.2s; }
.role-card.selected { border-color: var(--primary); background: var(--soft-warm); }
.role-card .r-icon { font-size: 32px; margin-bottom: 8px; }
.role-card .r-label { font-size: 16px; font-weight: 500; }
.role-card .r-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }
.auth-input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-family: inherit; font-size: 16px; margin-bottom: 12px; text-align: center; }
.auth-input:focus { outline: none; border-color: var(--primary); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.pin-dot { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 20px; display: flex; align-items: center; justify-content: center; }
.pin-dot.filled { border-color: var(--primary); background: var(--soft-warm); }
.pin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 260px; margin: 16px auto; }
.pin-key { padding: 14px; border-radius: 14px; border: none; background: var(--card); font-family: inherit; font-size: 20px; cursor: pointer; }
.pin-key:active { background: var(--bg); }

.me-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 100px; background: var(--card); border: 1.5px solid var(--line); font-size: 13px; color: var(--text); cursor: pointer; }
.me-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.me-chip.she .dot { background: var(--lavender); }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; font-family: inherit; padding: 6px 12px; border-radius: 100px; transition: background 0.2s; }
.avatar-btn:active { background: rgba(0,0,0,0.05); }
.avatar-circle { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 500; }
.avatar-btn.she .avatar-circle { background: var(--lavender); }
.avatar-name { font-size: 14px; color: var(--text); font-weight: 500; }

.pair-code { font-family: "Noto Serif SC", monospace; font-size: 18px; letter-spacing: 2px; background: var(--bg); border-radius: 14px; padding: 16px; text-align: center; word-break: break-all; line-height: 1.8; margin: 12px 0; }
.pair-status { display: flex; align-items: center; gap: 12px; background: var(--soft-green); border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.pair-status .p-icon { font-size: 24px; }
.pair-status .p-name { font-weight: 500; }
.pair-status .p-desc { font-size: 12px; color: var(--muted); }
.export-box { width: 100%; min-height: 100px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-family: monospace; font-size: 12px; word-break: break-all; margin: 10px 0; }

.qr-wrap { display: flex; justify-content: center; padding: 16px; background: var(--surface-2); border-radius: 16px; margin: 12px 0; }
.qr-wrap img, .qr-wrap canvas { border-radius: 8px; max-width: 220px; width: 100%; height: auto; }
.scanner-overlay { position: fixed; inset: 0; background: var(--overlay-solid); z-index: 200; display: none; flex-direction: column; }
.scanner-overlay.active { display: flex; }
.scanner-overlay video { width: 100%; flex: 1; object-fit: cover; }
.scanner-overlay .scan-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 240px; height: 240px; border: 3px solid var(--primary); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); display:flex; align-items:flex-end; justify-content:center; }
.scanner-overlay .scan-hint::after { content: '对准 TA 的二维码'; position: absolute; bottom: -36px; color: var(--surface-2); font-size: 14px; white-space: nowrap; }
.scanner-overlay .scan-close { position: absolute; top: 20px; left: 20px; z-index: 5; background: rgba(255,255,255,0.9); border: none; border-radius: 100px; padding: 10px 20px; font-family: inherit; font-size: 14px; cursor: pointer; }

.sync-overlay, .guide-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: none; flex-direction: column; padding: 20px; overflow-y: auto; }
.sync-overlay.active, .guide-overlay.active { display: flex; }
.guide-overlay { justify-content: center; }
.guide-step { max-width: 420px; margin: 0 auto; }
.guide-step .g-title { font-family: "Noto Serif SC", serif; font-size: 22px; margin-bottom: 6px; }
.guide-step .g-sub { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 22px; }
.guide-item { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; display: flex; gap: 14px; align-items: flex-start; }
.guide-item .g-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--surface-2); font-size: 13px; display: flex; align-items: center; justify-content: center; }
.guide-item .g-t { font-size: 15px; margin-bottom: 3px; }
.guide-item .g-d { font-size: 13px; color: var(--muted); line-height: 1.6; }
.coin-add-row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.coin-add-row input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font-family: inherit; font-size: 14px; }
.coin-add-row button { flex: none; width: auto; padding: 10px 18px; border-radius: 12px; font-size: 14px; }
/* 离线提示条：断网时贴顶显示，提醒"记录已存本地，联网后会自动同步" */
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 300; background: var(--lavender); color: var(--surface-2); font-size: 13px; text-align: center; padding: 8px 14px; transform: translateY(-100%); transition: transform .25s ease; }
.offline-bar.show { transform: translateY(0); }
.offline-bar .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--surface-2); margin-right: 6px; vertical-align: middle; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.update-bar { position: fixed; bottom: 76px; left: 16px; right: 16px; z-index: 300; background: var(--text); color: var(--on-primary); border-radius: 14px; padding: 12px 16px; display: none; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.update-bar.show { display: flex; }
.update-bar button { flex: none; background: var(--primary); color: var(--surface-2); border: none; border-radius: 10px; padding: 8px 14px; font-family: inherit; font-size: 13px; cursor: pointer; }
.sync-overlay .scan-close { position: fixed; top: 20px; left: 20px; z-index: 5; background: var(--card); border: 1.5px solid var(--line); border-radius: 100px; padding: 10px 20px; font-family: inherit; font-size: 14px; cursor: pointer; }
.sync-body { max-width: 420px; margin: 60px auto 0; width: 100%; }
.sync-step { text-align: center; }
.sync-step .s-title { font-family: "Noto Serif SC", serif; font-size: 20px; margin-bottom: 8px; }
.sync-step .s-desc { font-size: 14px; color: var(--muted); margin-bottom: 20px; line-height: 1.7; }

.chat-list { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 200px; }
.chat-msg { max-width: 75%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.chat-msg.me { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.chat-msg.them { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg .time { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.chat-msg .chat-name { font-size: 11px; opacity: 0.8; margin-bottom: 2px; font-weight: 500; }
.chat-msg.recalled { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; text-align: center; align-self: center; max-width: 90%; }
.chat-msg.recalled .chat-name { display: none; }
.chat-msg.recalled .time { display: none; }
.chat-msg .recalled-hint { font-style: italic; opacity: 0.75; }
.chat-input-bar { position: fixed; bottom: 130px; left: 16px; right: 16px; display: flex; gap: 8px; padding: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 28px; box-sizing: border-box; z-index: 40; }
.chat-input-bar input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 24px; border: 1.5px solid var(--line); background: var(--bg); font-family: inherit; font-size: 15px; }
.chat-input-bar input:focus { outline: none; border-color: var(--primary); }
.chat-input-bar button { padding: 12px 18px; border-radius: 24px; border: none; background: var(--primary); color: var(--on-primary); font-family: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.chat-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 60px 20px; }
.chat-offline { text-align: center; padding: 10px; background: var(--soft-red); border-radius: 12px; margin: 10px 0; font-size: 13px; color: var(--danger); }
.chat-online { text-align: center; padding: 10px; background: var(--soft-green); border-radius: 12px; margin: 10px 0; font-size: 13px; color: var(--sage); }
.trend-day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-bars { display: flex; gap: 3px; align-items: flex-end; height: 44px; }
.trend-bar { width: 10px; border-radius: 3px 3px 0 0; min-height: 4px; }
.trend-date { font-size: 10px; color: var(--muted); }
.nav-badge { position: absolute; top: 4px; right: 18px; background: var(--danger); color: var(--surface-2); font-size: 10px; min-width: 16px; height: 16px; border-radius: 100px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.nav-item { position: relative; }

@media (max-width: 380px) {
  .app { padding: 18px 16px 100px; }
  .breath-stage { width: 220px; height: 220px; }
  .breath-circle { width: 150px; height: 150px; }
}
