/* ============================================
   明明虾导航 · 玻璃拟态 PWA
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-base: #f5f7fa;
  --bg-base-2: #ffffff;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-3: #3b82f6;
  --accent: #10b981;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #475569;
  --text-4: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --glass-bg: rgba(255, 255, 255, 1);
  --glass-bg-strong: rgba(255, 255, 255, 1);
  --glass-bg-hover: rgba(248, 250, 252, 1);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: #f5f7fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-attachment: fixed;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

/* ===== 背景装饰: 亮色模式下不适用, 隐藏 ===== */
.bg-decor { display: none; }

/* ===== 顶部栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(14px + var(--safe-top)) 20px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* 搜索框 */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0 12px;
  min-width: 200px;
  flex: 0 1 320px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.search-icon {
  font-size: 14px;
  color: var(--text-3);
  margin-right: 8px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 0;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-4);
}

.search-clear {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  display: none;
}

.search-clear.visible {
  display: block;
}

/* 添加按钮 */
.add-btn, .install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: white;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.add-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45);
}

.add-btn:active {
  transform: translateY(0);
}

.add-btn-icon {
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}

.install-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text);
}

.install-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary);
}

/* ===== 主容器 ===== */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* 统计栏 */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  width: fit-content;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
}

.stat-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

/* 分类导航 */
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

/* 滚动时增强阴影提示 */
.category-nav.is-stuck {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.category-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.category-chip:hover {
  background: #f1f5f9;
  color: var(--text);
}

.category-chip.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.category-chip-count {
  font-size: 11px;
  opacity: 0.75;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

/* ===== 卡片网格 ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.site-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  isolation: isolate;
}

.site-card::before { display: none; }

.site-card:hover {
  transform: translateY(-3px);
  background: #f8fafc;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.site-card:active {
  transform: translateY(-1px) scale(0.99);
  background: #f1f5f9;
  box-shadow: var(--shadow-sm);
}
  box-shadow: var(--shadow-md);
}

.site-card.custom {
  border-color: rgba(245, 158, 11, 0.35);
}

.site-card.custom::after {
  content: '自添加';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.card-icon-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.card-icon.latex { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.card-icon.news { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.card-icon.art { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.card-icon.chenggu { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.card-icon.schedule { background: linear-gradient(135deg, #10b981, #06b6d4); }
.card-icon.paper { background: linear-gradient(135deg, #f97316, #f59e0b); }
.card-icon.grade { background: linear-gradient(135deg, #14b8a6, #10b981); }
.card-icon.monitor { background: linear-gradient(135deg, #475569, #1e293b); }
.card-icon.teach { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.card-icon.gaokao { background: linear-gradient(135deg, #ef4444, #f97316); }
.card-icon.puzzle { background: linear-gradient(135deg, #a855f7, #ec4899); }
.card-icon.media { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.card-icon.liuran { background: linear-gradient(135deg, #6366f1, #1e1b4b); }
.card-icon.paikebiao { background: linear-gradient(135deg, #f97316, #e11d48); }
.card-icon.macmini { background: linear-gradient(135deg, #1e293b, #0f172a); }
.card-icon.custom-icon { background: linear-gradient(135deg, var(--warning), var(--primary-2)); }

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  font-weight: 400;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.card-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-weight: 500;
}

.card-cat {
  padding: 3px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.card-delete {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.18);
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.site-card.custom:hover .card-delete {
  display: flex;
}

.card-delete:hover {
  background: rgba(239, 68, 68, 0.32);
  color: #fecaca;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-text {
  font-size: 14px;
  margin-bottom: 18px;
}

.empty-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary);
  background: var(--glass-bg);
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.empty-add-btn:hover {
  background: var(--primary);
  color: white;
}

/* ===== 页脚 ===== */
.footer {
  padding: 24px 20px calc(20px + var(--safe-bottom));
  text-align: center;
  color: var(--text-4);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.footer a {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--primary);
}

/* ===== ICP / 公安备案 ===== */
.beian-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

.beian-bar a.beian-link {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.2px;
}

.beian-bar a.beian-link:hover {
  color: var(--primary);
}

.beian-police {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.beian-police img {
  display: inline-block !important;
  width: 14px !important;
  height: 16px !important;
  vertical-align: middle;
}

.beian-icon {
  width: 14px !important;
  height: 16px !important;
  vertical-align: middle;
  display: inline-block !important;
}

.footer-copy {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-4);
}

.dot {
  opacity: 0.4;
}

#offline-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#offline-status.offline {
  color: var(--warning);
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

.modal-overlay[hidden] {
  display: none;
}

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

.modal {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  animation: slideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text);
}

.modal-sm {
  max-width: 380px;
}

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

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 20px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  font-weight: 300;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
  background: #ffffff;
}

.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 8px;
}

.form-group .required {
  color: var(--danger);
  font-weight: 700;
}

.form-group .hint {
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: all 0.18s ease;
}

.form-group input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.form-group input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.form-group input::placeholder {
  color: var(--text-4);
}

.form-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: 8px;
  line-height: 1.5;
  font-weight: 500;
}

.form-error {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 10px;
}

.form-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 20px 0;
}

.confirm-text {
  font-size: 15px;
  color: #0f172a;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.5;
}

.confirm-text strong {
  color: #2563eb;
  font-weight: 700;
}

.confirm-hint {
  font-size: 13px;
  color: #64748b;
}

/* 按钮 */
.btn {
  padding: 11px 22px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  min-height: 44px;
}

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

.btn-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:not(:disabled):hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:not(:disabled):active {
  background: #1e40af;
  transform: translateY(0);
}

.btn-cancel {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

.btn-cancel:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.btn-danger:not(:disabled):hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: calc(20px + var(--safe-top));
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 14px 18px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  animation: toastIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: 360px;
}

.toast.toast-success { border-left: 4px solid #10b981; }
.toast.toast-error { border-left: 4px solid #ef4444; }
.toast.toast-warn { border-left: 4px solid #f59e0b; }
.toast.toast-info { border-left: 4px solid #2563eb; }

.toast.removing {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

/* ============================================
   明明虾导航 · 移动端优化样式(覆盖默认)
   ============================================ */

/* 平板及以下 */
/* 平板及以下 */
@media (max-width: 768px) {
  /* ===== 顶部栏:logo+标题显示, 搜索+按钮分两行 ===== */
  .topbar {
    padding: calc(12px + var(--safe-top)) 16px 12px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .brand {
    flex: 1 1 100%;
    order: 1;
    gap: 10px;
  }
  .brand-logo {
    width: 40px;
    height: 40px;
    font-size: 24px;
    border-radius: 11px;
  }
  .brand-title { font-size: 17px; }
  .brand-sub { font-size: 11px; }
  .topbar-actions {
    flex: 1 1 100%;
    order: 2;
    justify-content: stretch;
    gap: 8px;
  }
  .search-box {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 0 14px;
  }
  .search-box input { font-size: 15px; padding: 12px 0; }
  .search-icon { font-size: 16px; margin-right: 10px; }
  .add-btn, .install-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    min-height: 44px;
    font-size: 14px;
  }
  .add-btn-text { display: none; }
  .add-btn { padding: 0; width: 44px; justify-content: center; }
  .install-btn-text { display: none; }
  .install-btn { padding: 0 12px; }
  .add-btn-icon { font-size: 22px; }

  /* ===== 主区 ===== */
  .main { padding: 16px 16px 32px; }

  /* 统计栏:全宽, 更大数字 */
  .stats-bar {
    padding: 14px 18px;
    gap: 14px;
    width: 100%;
    border-radius: var(--radius-md);
  }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 12px; }
  .stat-divider { height: 22px; }

  /* 分类标签:横向滚动 + 紧凑 + 吸顶 */
  .category-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px;
    margin-bottom: 18px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-chip {
    flex: 0 0 auto;
    padding: 9px 14px;
    font-size: 13px;
    scroll-snap-align: start;
  }
  .category-nav { scroll-snap-type: x proximity; }
  .category-chip-count { font-size: 11px; }

  /* ===== 卡片:单列大卡 + 横向布局 (左 icon, 右内容) ===== */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .site-card {
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "icon  name"
      "icon  desc"
      "meta  meta";
    gap: 4px 14px;
    align-items: start;
  }
  .card-icon-wrap {
    grid-area: icon;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
    gap: 0;
  }
  .card-icon {
    width: 52px;
    height: 52px;
    font-size: 26px;
    border-radius: 14px;
  }
  .card-name {
    grid-area: name;
    font-size: 17px;
    font-weight: 600;
    margin-top: 4px;
  }
  .card-desc {
    grid-area: desc;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-top: 4px;
    -webkit-line-clamp: 2;
    min-height: auto;
  }
  .card-meta {
    grid-area: meta;
    margin-top: 10px;
    padding-top: 10px;
    font-size: 12px;
  }
  .card-url {
    opacity: 1;
    color: var(--text);
    font-weight: 500;
  }
  .card-cat {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--glass-bg-strong);
    color: var(--text-2);
    font-weight: 500;
  }
  .card-delete {
    bottom: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* 自添加角标移到右上(避免和删除按钮重叠) */
  .site-card.custom::after {
    top: 10px;
    right: 14px;
  }

  /* 空状态 */
  .empty-state { padding: 50px 20px; }
  .empty-icon { font-size: 56px; }
  .empty-text { font-size: 15px; }

  /* 页脚 */
  .footer {
    padding: 22px 16px calc(20px + var(--safe-bottom));
    font-size: 12px;
  }
  .footer-meta { font-size: 11px; }
  .beian-bar { font-size: 11px; gap: 6px 10px; padding-top: 10px; margin-top: 10px; }
  .beian-icon { width: 12px !important; height: 14px !important; }
  .footer-copy { font-size: 10px; margin-top: 8px; }

  /* Toast 全宽 */
  .toast-container {
    top: calc(16px + var(--safe-top));
    right: 16px;
    left: 16px;
  }
  .toast {
    min-width: 0;
    max-width: 100%;
    font-size: 14px;
    padding: 12px 16px;
  }

  /* 弹窗移动端适配 */
  .modal { max-width: 100%; }
  .modal-header { padding: 16px 18px 14px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 14px 18px 16px; flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* 手机竖屏 (≤480px):更紧凑 */
@media (max-width: 480px) {
  .topbar { padding: calc(10px + var(--safe-top)) 14px 10px; gap: 8px; }
  .brand-logo { width: 38px; height: 38px; font-size: 22px; }
  .brand-title { font-size: 16px; }
  .brand-sub { font-size: 10px; }
  .main { padding: 14px 12px 28px; }
  .stats-bar { padding: 12px 14px; gap: 10px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .stat-divider { height: 20px; }
  .site-card { padding: 14px; gap: 2px 12px; }
  .card-icon { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; }
  .card-name { font-size: 16px; }
  .card-desc { font-size: 12.5px; }
}

/* 手机横屏(高度<500px):进一步精简 */
@media (max-height: 500px) and (max-width: 850px) {
  .topbar { padding: calc(8px + var(--safe-top)) 14px 8px; }
  .main { padding: 12px 14px 20px; }
  .stats-bar { padding: 10px 14px; }
  .stat-num { font-size: 18px; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .orb { animation: none; }
}
