/* ============================================================
   气泡复制机 · 主样式
   ------------------------------------------------------------
   目录：
     1. 设计变量
     2. 基础重置
     3. 通用组件（按钮 / 表单 / 弹窗 / 提示）
     4. 主体布局（容器 / 气泡 / 底栏 / 页脚）
     5. 功能组件（搜索 / 快速添加 / 统计 / 滚动 / 主题 / 时钟）
     6. 日志
     7. 主题皮肤
     8. 响应式
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg-color: #f0f0f0;
  --text-color: #333333;
  --bubble-bg: #ffffff;
  --border-color: #dddddd;

  --brand: #4facfe;
  --brand-deep: #007bff;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --muted: #6c757d;

  --radius-sm: 5px;
  --radius: 10px;
  --radius-lg: 15px;
  --radius-pill: 50px;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.25);

  --page-bg: #ffffff;
  --panel-bg: #ffffff;
  --panel-soft: #f9f9f9;
  --line: #eeeeee;
  --text-soft: #666666;
}

/* ---------- 2. 基础重置 ---------- */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background-image: url('../assets/1.png');
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-position: center;
  overflow-x: hidden;
  color: var(--text-color);
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
}

button {
  font-family: inherit;
}

/* ---------- 3. 通用组件 ---------- */

/* 3.1 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  background: var(--muted);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary { background: var(--brand-deep); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); color: #333; }
.btn-info { background: var(--info); }
.btn-secondary { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: flex; width: 100%; }
.btn-block-start { justify-content: flex-start; text-align: left; }

/* 3.2 表单 */
.form-field {
  margin-bottom: 12px;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-soft);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #333;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.15);
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
}

.form-error {
  display: none;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.form-error.show {
  display: block;
}

.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #999;
}

/* 自动填充"陷阱框"：屏幕外隐藏，用来接住浏览器自动填充的账号，
   避免它跑去填搜索框。必须是渲染状态（不能用 display:none）。 */
.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* 3.3 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 3000;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: popupIn 0.25s ease;
}

.modal.modal-wide {
  max-width: 700px;
}

.modal.modal-tall {
  max-height: 80vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  color: var(--text-color);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #999;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--danger);
  background: rgba(0, 0, 0, 0.05);
}

.modal-body {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-text {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-color);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* 3.4 顶部提示条 */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 180px;
  max-width: 80vw;
  padding: 18px 22px;
  background-color: var(--info);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 16px;
  z-index: 4000;
  display: none;
  opacity: 0;
  animation: popupIn 0.3s forwards;
}

.popup.active {
  display: block;
}

.popup.popup-success { background-color: var(--success); }
.popup.popup-error { background-color: var(--danger); }
.popup.popup-info { background-color: var(--info); }

.popup p {
  margin: 0;
  word-break: break-word;
}

/* 3.5 空状态与徽标 */
.empty-hint {
  padding: 24px 0;
  color: #999;
  font-size: 14px;
  text-align: center;
}



@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 4. 主体布局 ---------- */
.container {
  position: relative;
  max-width: 800px;
  margin: 20px auto;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease-in-out;
  transition: margin-top 0.3s ease;
}

/* 4.1 气泡 */
.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px;
  margin: 10px 0;
  max-height: 80px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: max-height 0.4s ease, box-shadow 0.3s ease, background-color 0.2s ease;
}

.bubble.expanded {
  max-height: 300px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.bubble:active {
  background-color: #e6f7ff;
}

.bubble.dragged {
  opacity: 0.5;
  background-color: #d9f2ff;
}

/* 文本框（可编辑） */
.text-box {
  position: relative;
  display: block;
  width: 97%;
  margin: 0 auto;
  padding: 10px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  outline: none;
  transition: max-height 0.4s ease, box-shadow 0.3s ease;
}

.text-box:focus {
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.35);
}

.bubble.expanded .text-box {
  white-space: pre-wrap;
  overflow: visible;
  max-height: none;
}

/* 操作按钮组 */
.buttons {
  display: none;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bubble.expanded .buttons {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.buttons button {
  max-width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.buttons button.copy { background-color: #28a745; }
.buttons button.clear { background-color: #ffc107; }
.buttons button.delete { background-color: #dc3545; }
.buttons button.edit { background-color: #ffc107; }
.buttons button.visit { background-color: #87ceeb; }

/* 4.2 底部操作区 */
#saveBubble {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

#saveBubble button {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  background-color: var(--brand-deep);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

#saveBubble button:hover {
  transform: scale(1.05);
}

#refreshPage,
#file {
  background-color: var(--info);
}

#refreshPage:hover,
#file:hover {
  background-color: #0d6efd;
}

/* 4.3 页脚与版本 */
.footer {
  margin-top: 20px;
  padding: 10px;
  background-color: #f1f1f1;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 14px;
  text-align: center;
}

.footer a {
  color: var(--brand-deep);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.version-tag {
  position: absolute;
  left: 17px;
  bottom: 1px;
  color: rgba(0, 0, 0, 0.5);
  font-size: 11px;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

/* 4.4 状态与提示 */
.status-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: orange;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.status-indicator:hover {
  transform: scale(1.2);
}

.status-indicator:hover::after {
  content: attr(title);
  position: absolute;
  top: -20px;
  left: 15px;
  padding: 5px 8px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.offline-alert {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: none;
  padding: 10px;
  background: #ff9800;
  color: #fff;
  font-size: 14px;
  text-align: center;
  z-index: 2001;
}

/* ---------- 5. 功能组件 ---------- */

/* 5.1 搜索框 */
#searchContainer {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 20px;
  padding: 8px 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 245, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#searchContainer.floating {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  margin: 0;
  border-color: rgba(66, 133, 244, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
  z-index: 999;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-icon {
  color: var(--text-soft);
  font-size: 18px;
  opacity: 0.8;
}

#searchInput {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: #333;
  font-size: 14px;
  letter-spacing: 0.3px;
  outline: none;
}

#searchInput::placeholder {
  color: #999;
  transition: color 0.2s ease;
}

#searchInput:focus::placeholder {
  color: #ccc;
}

#clearSearch {
  display: none;
  padding: 0 5px;
  border: none;
  background: none;
  color: #999;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

#clearSearch:hover {
  color: #f44336;
  transform: scale(1.2);
}

#searchStats {
  display: none;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-align: center;
}

/* 5.2 快速添加 */
#quickAddBtn {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 30px;
  background: linear-gradient(45deg, #FF6B6B, #FF8E53);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
}

#quickAddBtn:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#quickAddBtn.integrated {
  position: relative;
  bottom: auto;
  left: auto;
  display: block;
  width: 200px;
  margin: 20px auto;
  transform: none;
}

/* 5.3 统计面板 */
#statisticsContainer {
  position: fixed;
  bottom: 80px;
  left: 20px;
  z-index: 1000;
  transition: all 0.3s ease;
}

#statsToggleBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
  transition: all 0.3s ease;
}

#statsToggleBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

#statisticsPanel {
  display: none;
  min-width: 200px;
  max-width: 250px;
  margin-bottom: 10px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

#statisticsPanel.expanded {
  display: block;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stats-label {
  color: var(--text-soft);
  font-size: 13px;
}

.stats-value {
  color: var(--text-color);
  font-weight: bold;
}

.stats-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #999;
  font-size: 11px;
}

/* 5.4 滚动按钮（右侧边缘，上下两个：回到顶部 / 拉到底部） */
.scroll-btn {
  position: fixed;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  -webkit-tap-highlight-color: transparent;
}

.scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-btn svg {
  margin-bottom: 4px;
  transition: transform 0.3s ease;
}

.scroll-btn span {
  font-size: 11px;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.scroll-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.scroll-btn:hover svg {
  transform: translateY(-2px);
}

.scroll-btn.top-btn {
  bottom: 100px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.scroll-btn.bottom-btn {
  bottom: 20px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

/* 5.5 主题切换与时钟 */
#themeToggle {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
}

#themeToggle:hover {
  transform: scale(1.08);
}

.current-time {
  position: fixed;
  top: 20px;
  right: 100px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  color: var(--text-soft);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  z-index: 999;
}

/* 5.7 自动保存提示 */
#autoSaveIndicator {
  position: fixed;
  bottom: 120px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

#autoSaveIndicator.show {
  opacity: 1;
}

/* 5.8 搜索高亮 */
mark {
  padding: 2px 4px;
  background: linear-gradient(120deg, #FFEB3B 0%, #FFECB3 100%);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
  animation: highlight-fade 0.5s ease-out;
}

@keyframes highlight-fade {
  from {
    background: linear-gradient(120deg, #FFD700 0%, #FFECB3 100%);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.4);
  }

  to {
    background: linear-gradient(120deg, #FFEB3B 0%, #FFECB3 100%);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
  }
}

/* ---------- 6. 日志 ---------- */

/* 6.1 日志列表 */
.log-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.log-entry {
  padding: 8px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.log-entry.alt {
  background: #f9f9f9;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-meta {
  color: var(--text-soft);
  font-size: 13px;
}

.log-action {
  margin-top: 2px;
  font-size: 14px;
  font-weight: bold;
}

.log-detail {
  margin-top: 2px;
  color: #888;
  font-size: 12px;
  word-break: break-word;
}

/* ---------- 7. 主题皮肤 ---------- */
body.theme-dark {
  --bg-color: #1a1a1a;
  --text-color: #eeeeee;
  --bubble-bg: #2d2d2d;
  --border-color: #444444;
  --panel-bg: #242424;
  --panel-soft: #2d2d2d;
  --line: #3a3a3a;
  --text-soft: #aaaaaa;
  background-image: none;
  background-color: #141414;
  color: #eeeeee;
}

body.theme-dark .container {
  background-color: rgba(30, 30, 30, 0.92);
}

body.theme-dark .bubble {
  background-color: #2d2d2d;
  border-color: #444444;
}

body.theme-dark .text-box {
  background-color: #1f1f1f;
  border-color: #444444;
  color: #eeeeee;
}

body.theme-dark .footer {
  background-color: #242424;
  color: #aaa;
}

body.theme-dark #searchContainer,
body.theme-dark #statisticsPanel {
  background: rgba(36, 36, 36, 0.96);
  border-color: #444;
}

body.theme-dark #searchInput {
  color: #eee;
}

body.theme-dark .current-time {
  background: rgba(36, 36, 36, 0.9);
  color: #ccc;
}

body.theme-dark .version-tag {
  color: rgba(255, 255, 255, 0.45);
}

body.theme-blue {
  --bg-color: #e8f4f8;
  --text-color: #004466;
  --bubble-bg: #ffffff;
  --border-color: #b3e0ff;
  --text-soft: #2b6a86;
  background-image: none;
  background-color: #e8f4f8;
  color: #004466;
}

body.theme-blue .container {
  background-color: rgba(255, 255, 255, 0.95);
}

body.theme-blue .bubble {
  background-color: #ffffff;
  border-color: #b3e0ff;
}

body.theme-blue .footer {
  background-color: #d8ecf5;
}

/* ---------- 8. 响应式 ---------- */
@media (max-width: 768px) {

  .container {
    margin: 10px;
    padding: 10px;
  }

  .bubble {
    margin: 8px 0;
    padding: 8px;
    border-radius: 12px;
  }

  .text-box {
    width: 92%;
    padding: 8px;
    font-size: 14px;
  }

  /* 顶部元素 */
  #themeToggle,
  #statisticsContainer {
    display: none !important;
  }

  .current-time {
    top: 15px;
    right: 15px;
    margin: 60px auto;
    padding: 3px 8px;
    font-size: 12px;
  }

  .status-indicator {
    top: 15px;
    left: 15px;
  }

  .version-tag {
    left: 17px;
    bottom: 0;
    font-size: 10px;
  }

  /* 搜索框 */
  #searchContainer {
    top: 10px;
    left: 50%;
    width: calc(100% - 40px);
    max-width: none;
    padding: 6px 12px;
    border-radius: 20px;
    transform: translateX(-50%);
  }

  #searchContainer.floating {
    position: fixed;
    top: 10px;
    left: 50%;
    width: calc(100% - 40px);
    transform: translateX(-50%);
  }

  /* 底部按钮 */
  #saveBubble {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
  }

  #saveBubble button {
    flex: 1;
    min-width: 60px;
    margin: 2px;
  }

  /* 快速添加 */
  #quickAddBtn {
    bottom: 20px;
    left: 20px;
    width: calc(100% - 40px);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    transform: none;
    z-index: 1002;
  }

  #quickAddBtn.integrated {
    width: 200px;
    margin: 20px auto;
  }

  /* 统计 */
  #statisticsContainer {
    bottom: 100px;
    left: 10px;
    right: 10px;
    text-align: center;
  }

  #statsToggleBtn {
    width: 45px;
    height: 45px;
    margin: 0 auto;
    font-size: 16px;
  }

  #statisticsPanel {
    position: fixed;
    bottom: 60px;
    left: 50%;
    width: calc(100% - 40px);
    max-width: 300px;
    margin: 0;
    transform: translateX(-50%);
  }

  /* 滚动按钮 */
  .scroll-btn {
    right: 15px;
    width: 50px;
    height: 50px;
    font-size: 10px;
  }

  .scroll-btn svg {
    width: 20px;
    height: 20px;
  }

  .scroll-btn span {
    font-size: 9px;
  }

  .scroll-btn.top-btn {
    bottom: 80px;
  }

  .scroll-btn.bottom-btn {
    bottom: 15px;
  }

  #autoSaveIndicator {
    bottom: 150px;
    right: 10px;
    left: 10px;
    font-size: 11px;
    text-align: center;
  }

  /* 弹窗 */
  .popup {
    width: 90%;
    max-width: 300px;
    padding: 15px;
    font-size: 14px;
  }

  .modal {
    padding: 18px;
    max-width: 100%;
  }

  /* 触摸设备上的按钮 */
  .buttons button {
    min-width: 60px;
    margin: 2px;
    padding: 10px 12px;
  }

  /* 防止 iOS 聚焦缩放 */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 480px) {
  #searchContainer {
    width: calc(100% - 30px);
  }

  #statisticsContainer {
    bottom: 90px;
  }

  .scroll-btn {
    right: 10px;
    width: 45px;
    height: 45px;
  }

  .scroll-btn.top-btn {
    bottom: 70px;
  }

  .scroll-btn.bottom-btn {
    bottom: 10px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  #searchContainer {
    top: 10px;
    width: calc(100% - 30px);
  }
}

/* 触摸设备无悬停，点击直接展开 */
@media (hover: none) and (pointer: coarse) {
  .bubble:active {
    background-color: #e6f7ff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }

  .bubble.expanded .buttons {
    display: flex;
    opacity: 1;
    pointer-events: auto;
  }
}

/* 尊重系统“减少动效”设置 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}