/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:        #f0f5fb;
  --surface:   #ffffff;
  --card:      #ffffff;
  --card-h:    #f7fafd;
  --accent:    #4a8fdc;
  --accent2:   #7eb3f5;
  --gold:      #e8a838;
  --green:     #27ae60;
  --red:       #e74c3c;
  --text:      #1a3352;
  --muted:     #7b9db8;
  --dim:       #bfcedf;
  --border:    rgba(0, 40, 80, 0.08);
  --border-accent: rgba(74, 143, 220, 0.22);
  --r:         12px;
  --shadow:    0 4px 20px rgba(0, 40, 80, 0.07);
  --shadow-md: 0 8px 32px rgba(0, 40, 80, 0.11);
  --glow:      0 0 18px rgba(74, 143, 220, 0.22);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(240, 245, 251, 0.93);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}

.header-inner {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.logo-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(74, 143, 220, 0.35));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.logo:hover .logo-icon {
  transform: scale(1.12) rotate(-4deg);
  filter: drop-shadow(0 3px 12px rgba(74, 143, 220, 0.55));
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #4a8fdc 0%, #7eb3f5 38%, #e8a838 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-55 {
  font-style: normal;
  font-weight: 900;
  letter-spacing: -1.5px;
}

/* ── Search ─────────────────────────────────────────────────────────────────── */
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 9px 40px 9px 18px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.search-wrap.has-value input {
  padding-right: 64px;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.search-wrap input::placeholder { color: var(--muted); }

/* 🔍 搜索按钮（可点击） */
.search-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  transition: opacity 0.15s;
}

.search-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  background: rgba(74, 143, 220, 0.1);
  color: var(--accent);
}

/* ✕ 清空按钮（有内容时显示在🔍左侧） */
.search-clear {
  position: absolute;
  right: 36px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--dim);
  color: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
  user-select: none;
  padding: 0;
  flex-shrink: 0;
}

.search-clear:hover {
  background: var(--muted);
  transform: translateY(-50%) scale(1.1);
}

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

/* ── Search History Dropdown ───────────────────────────────────────────────── */
.search-history {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
  animation: sh-in 0.15s ease;
}

@keyframes sh-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
}

.search-history-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.search-history-clear {
  font-size: 0.72rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.search-history-clear:hover {
  color: var(--accent);
  background: rgba(74,143,220,0.08);
}

.search-history-list {
  max-height: 240px;
  overflow-y: auto;
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s;
}

.search-history-item:hover {
  background: var(--dim);
}

.search-history-item-icon {
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.6;
}

.search-history-item-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-history-item-del {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  padding: 0;
  font-size: 0.7rem;
}

.search-history-item:hover .search-history-item-del {
  opacity: 1;
}

.search-history-item-del:hover {
  background: rgba(220,74,74,0.12);
  color: #e05252;
}

.sort-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sort-btn:hover { 
  color: var(--accent);
  background: rgba(74, 143, 220, 0.07);
}
.sort-btn.active {
  color: var(--accent);
  background: rgba(74, 143, 220, 0.08);
  font-weight: 600;
}

.hot-filter-btn:hover {
  color: #ff5025;
  background: rgba(255, 80, 37, 0.07);
}
.hot-filter-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #ff5025, #ff8c3a);
  font-weight: 600;
}

/* ── Main Layout ─────────────────────────────────────────────────────────────── */
.main { margin-top: 64px; }

.main-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 16px;
}

.main-center {
  flex: 1;
  min-width: 0;
}

.main-side {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: calc(64px + 10px);
  min-height: 200px;
}

/* ── Stats Banner ────────────────────────────────────────────────────────────── */
.stats-bar {
  background: var(--bg);
  padding: 10px 0 0;
}

.stats-bar .bar-inner {
  max-width: 100%;
  margin: 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #e8f1fb 0%, #e4eeff 60%, #e8f1fb 100%);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  min-width: 3.5ch;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label { font-size: 0.8rem; color: var(--muted); }
.stats-bar-right { margin-left: auto; color: var(--muted); font-size: 0.85rem; }

/* ── Category Pills ──────────────────────────────────────────────────────────── */
.cats-wrap {
  background: var(--bg);
  padding: 10px 0;
}

.cats-wrap .bar-inner {
  max-width: 100%;
  margin: 0;
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8fd 60%, #eef4fb 100%);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}


.cat-pill {
  padding: 5px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cat-pill:hover { color: var(--accent); background: rgba(74,143,220,0.07); }
.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Content Area ────────────────────────────────────────────────────────────── */
.content {
  max-width: 100%;
  padding: 12px 0;
}

/* ── Card entry animation ────────────────────────────────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card { animation: card-in 0.32s ease both; }

/* ── Movie Grid ──────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

a.card { display: flex; }

.card {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-accent);
}

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg);
  overflow: hidden;
}

.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover .card-poster img { transform: scale(1.05); }


/* ── NEW Badge ───────────────────────────────────────────────────────────────── */
.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--green);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: 0.6px;
}

/* ── HOT Badge ───────────────────────────────────────────────────────────────── */
.hot-badge {
  position: absolute;
  bottom: 8px; left: 8px;
  background: linear-gradient(135deg, #ff5025, #ff8c3a);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 6px rgba(255, 80, 37, 0.45);
}

.card-poster-fallback {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(160deg, #ddeaf8 0%, #d6e5f7 50%, #dce8fb 100%);
}

.poster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.poster-fallback-title {
  font-size: 0.75rem;
  color: #6a8fb5;
  text-align: center;
  line-height: 1.4;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.cat-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(74, 143, 220, 0.88);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.rating-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  white-space: nowrap;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* When hot-badge and rating-badge coexist, prevent overlap */
.hot-badge ~ .rating-badge {
  max-width: calc(100% - 72px);
}

.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hot-title { color: #e00404; }

.card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-meta span::after { content: '·'; margin-left: 6px; }
.card-meta span:last-child::after { content: ''; }

.card-synopsis {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-detail {
  font-size: 0.8rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.btn-detail:hover { text-decoration: underline; }
.date-tag { font-size: 0.75rem; color: var(--dim); }


/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0 16px;
}

.pg-btn {
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--surface);
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.pg-btn:hover:not(:disabled) { background: rgba(74,143,220,0.08); color: var(--accent); box-shadow: none; }
.pg-btn.active:hover { color: #fff; }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

.pg-info { color: var(--muted); font-size: 0.9rem; padding: 0 8px; }

/* ── Loading & Empty ─────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 16px;
  color: var(--muted);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton Loading ────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.skel-block,
.skel-line,
.skel-poster {
  background: var(--dim);
  border-radius: 4px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skel-poster {
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: 0;
}

.skel-line {
  height: 12px;
  margin-bottom: 8px;
}

.card-skeleton { pointer-events: none; animation: none; opacity: 1; transform: none; }
.card-skeleton .card-poster { overflow: hidden; }
.card-skeleton .card-body { gap: 8px; }

.empty {
  text-align: center;
  padding: 52px 40px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon { font-size: 3rem; }

/* 错误状态：带 surface 卡片感 */
.empty.empty-error {
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.empty-error-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(231, 76, 60, 0.08);
  border: 1.5px solid rgba(231, 76, 60, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  flex-shrink: 0;
}

.empty-error .empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.empty-error .empty-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: -4px;
}

/* ── 重试按钮 & 慢加载提示 ──────────────────────────────────────────────────── */
.retry-btn {
  margin-top: 4px;
  padding: 9px 26px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.2s;
}
.retry-btn:hover { opacity: 0.82; }

.load-slow-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 8px 0 4px;
  animation: sh-in 0.4s ease;
}

/* ── Back to Top ─────────────────────────────────────────────────────────────── */
.back-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s, background 0.2s;
  pointer-events: none;
  z-index: 90;
}

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

.back-top:hover { background: #3a7fcf; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 14px 24px;
  color: var(--dim);
  font-size: 0.70rem;
  background: var(--bg);
  opacity: 0.9;
}
.footer-disclaimer {
  font-size: 0.66rem;
  color: #8fadc8;
  margin: 2px 0;
  line-height: 1.5;
}
.footer-disclaimer a {
  color: #8fadc8;
  text-decoration: none;
}
.footer-disclaimer a:hover { color: #aec5d8; }
.beian {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  font-size: 0.62rem;
  font-style: italic;
}
.beian a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #8fadc8;
  text-decoration: none;
  font-style: italic;
}
.beian a:hover { color: #aec5d8; }
.beian a img {
  width: 12px;
  height: 12px;
  object-fit: contain;
  opacity: 0.6;
}
.beian-sep { color: #8fadc8; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}

/* 位置变体 */
.toast-container.pos-bottom-right  { bottom: 28px; right: 24px; }
.toast-container.pos-bottom-left   { bottom: 28px; left: 24px; }
.toast-container.pos-bottom-center { bottom: 28px; left: 50%; transform: translateX(-50%); align-items: center; }
.toast-container.pos-top-right     { top: 28px; right: 24px; flex-direction: column; }
.toast-container.pos-top-left      { top: 28px; left: 24px; flex-direction: column; }
.toast-container.pos-top-center    { top: 28px; left: 50%; transform: translateX(-50%); flex-direction: column; align-items: center; }
.toast-container.pos-center        { top: 50%; left: 50%; transform: translate(-50%, -50%); flex-direction: column; align-items: center; }

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 256px;
  max-width: 360px;
  padding: 13px 12px 14px 15px;
  background: rgba(232, 243, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--r);
  box-shadow: 0 8px 36px rgba(0, 40, 100, 0.11), 0 1.5px 5px rgba(0, 40, 100, 0.07);
  border: 1px solid rgba(74, 143, 220, 0.2);
  border-left-width: 3px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.toast.toast-hiding {
  animation: toast-out 0.22s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(14px) scale(0.96); }
}

/* 居中位置专用动画（从下滑入） */
.toast.toast-center {
  animation-name: toast-in-center;
}
.toast.toast-center.toast-hiding {
  animation-name: toast-out-center;
}

@keyframes toast-in-center {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes toast-out-center {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.96); }
}

.toast-icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.toast-msg {
  font-size: 0.815rem;
  color: #6b90b8;
  margin-top: 2px;
  line-height: 1.45;
}

.toast-title:only-child {
  font-weight: 500;
}

.toast-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-top: -1px;
  margin-right: -2px;
}

.toast-copy,
.toast-close {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  color: #aac4de;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.toast-copy:hover,
.toast-close:hover {
  color: var(--accent);
  background: rgba(74, 143, 220, 0.1);
}

.toast-copy--done {
  color: var(--accent) !important;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2.5px;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  border-radius: 0 0 0 calc(var(--r) - 3px);
}

/* ── Type variants ── */
.toast-success { border-left-color: var(--accent); }
.toast-success .toast-icon  { color: var(--accent); }
.toast-success .toast-progress { background: var(--accent); }

.toast-error   { border-left-color: var(--red); }
.toast-error   .toast-icon  { color: var(--red); }
.toast-error   .toast-progress { background: var(--red); }

.toast-warning { border-left-color: var(--gold); }
.toast-warning .toast-icon  { color: var(--gold); }
.toast-warning .toast-progress { background: var(--gold); }

.toast-info    { border-left-color: var(--accent2); }
.toast-info    .toast-icon  { color: var(--accent2); }
.toast-info    .toast-progress { background: var(--accent2); }

@media (max-width: 480px) {
  .toast-container.pos-bottom-right,
  .toast-container.pos-bottom-left  { left: 16px; right: 16px; bottom: 20px; }
  .toast-container.pos-bottom-center { left: 16px; right: 16px; bottom: 20px; transform: none; }
  .toast-container.pos-top-right,
  .toast-container.pos-top-left     { left: 16px; right: 16px; top: 16px; }
  .toast-container.pos-top-center   { left: 16px; right: 16px; top: 16px; transform: none; }
  .toast-container.pos-center       { left: 16px; right: 16px; top: 50%; transform: translateY(-50%); }
  .toast { min-width: 0; max-width: 100%; }
}

/* ── History Button ──────────────────────────────────────────────────────────── */
.history-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}

.history-btn:hover {
  color: var(--accent);
  background: rgba(74, 143, 220, 0.07);
}

.history-btn:active {
  border: none;
}

/* ── History Modal ───────────────────────────────────────────────────────────── */
.history-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 25, 45, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hm-fade-in 0.18s ease;
}

@keyframes hm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.history-modal-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 40, 80, 0.22), 0 0 0 1px var(--border);
  width: 100%;
  max-width: 740px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: hm-slide-in 0.2s ease;
  overflow: hidden;
}

@keyframes hm-slide-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.history-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.history-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-modal-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 5px;
  transition: color 0.2s, background 0.2s;
}

.history-modal-clear:hover {
  color: var(--red);
  background: rgba(231, 76, 60, 0.08);
}

.history-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.history-modal-close:hover {
  background: var(--dim);
  color: var(--text);
}

.history-modal-body {
  overflow-y: auto;
  padding: 16px 20px 20px;
  flex: 1;
}

.history-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}

.history-modal-empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.history-modal-empty-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

a.history-modal-card { display: block; text-decoration: none; }

.history-modal-card {
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.history-modal-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
}

.history-modal-poster {
  aspect-ratio: 2 / 3;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.history-modal-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.history-modal-card:hover .history-modal-poster img { transform: scale(1.06); }

.history-modal-poster-fb {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #ddeaf8 0%, #d6e5f7 50%, #dce8fb 100%);
  opacity: 0.9;
}

.history-modal-poster-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 26px 8px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.84) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
}

.history-modal-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-modal-card-meta {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Wish Button ─────────────────────────────────────────────────────────────── */
.wish-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}

.wish-btn:hover {
  color: var(--accent);
  background: rgba(74, 143, 220, 0.07);
}

/* ── Wish Modal ──────────────────────────────────────────────────────────────── */
.wish-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 25, 45, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hm-fade-in 0.18s ease;
}

.wish-modal-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 40, 80, 0.22), 0 0 0 1px var(--border);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: hm-slide-in 0.2s ease;
  overflow: hidden;
}

.wish-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wish-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.wish-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.wish-modal-close:hover {
  background: var(--dim);
  color: var(--text);
}

/* ── Wish Form ───────────────────────────────────────────────────────────────── */
.wish-form-wrap {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 10px;
  column-gap: 8px;
  background: linear-gradient(135deg, #f4f8fd 0%, #eef4fb 100%);
}

.wish-form-row {
  display: contents;
}

.wish-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.88rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.wish-input:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.wish-input::placeholder { color: var(--muted); }

.wish-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.88rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237b9db8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.wish-select:focus { border-color: var(--accent); }

.wish-submit-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.wish-submit-btn:hover { background: #3a7fcf; }
.wish-submit-btn:active { transform: scale(0.97); }
.wish-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Wish List ───────────────────────────────────────────────────────────────── */
.wish-hint {
  position: relative;
  margin: 8px 20px 2px;
  padding: 7px 12px 7px 15px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  background: rgba(74, 143, 220, 0.06);
  border-radius: 6px;
}

.wish-hint::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent2);
  border-radius: 2px;
}

.wish-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 14px 20px;
}

.wish-list-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.88rem;
}

.wish-list-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.wish-list-empty-icon { font-size: 2.6rem; margin-bottom: 10px; opacity: 0.5; }

.wish-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.wish-item:last-child { border-bottom: none; }

.wish-item-main { flex: 1; min-width: 0; }

.wish-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wish-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.wish-type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(74, 143, 220, 0.1);
  color: var(--accent);
  flex-shrink: 0;
}

.wish-item-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.wish-item-meta {
  font-size: 0.74rem;
  color: var(--dim);
  margin-top: 5px;
}

.wish-del-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  margin-top: 2px;
}
.wish-del-btn:hover {
  color: var(--red);
  background: rgba(231, 76, 60, 0.08);
}

.wish-modal-footer {
  padding: 10px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.wish-count-text {
  font-size: 0.8rem;
  color: var(--muted);
}

.wish-clear-btn {
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.wish-clear-btn:hover {
  color: var(--red);
  background: rgba(231, 76, 60, 0.07);
}

/* ── Fav Button ──────────────────────────────────────────────────────────────── */
.fav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}

.fav-btn:hover {
  color: var(--gold);
  background: rgba(232, 168, 56, 0.09);
}

/* ── Fav Modal ───────────────────────────────────────────────────────────────── */
.fav-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 25, 45, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hm-fade-in 0.18s ease;
}

.fav-modal-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 40, 80, 0.22), 0 0 0 1px var(--border);
  width: 100%;
  max-width: 760px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  animation: hm-slide-in 0.2s ease;
  overflow: hidden;
}

.fav-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fav-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.fav-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.fav-modal-close:hover {
  background: var(--dim);
  color: var(--text);
}

.fav-modal-body {
  overflow-y: auto;
  padding: 16px 20px 12px;
  flex: 1;
}

.fav-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
}

.fav-modal-card-wrap {
  position: relative;
}

a.fav-modal-card { display: block; text-decoration: none; }

.fav-modal-card {
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: block;
}

.fav-modal-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
}

.fav-modal-poster {
  aspect-ratio: 2 / 3;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.fav-modal-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.fav-modal-card:hover .fav-modal-poster img { transform: scale(1.06); }

.fav-modal-poster-fb {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #ddeaf8 0%, #d6e5f7 50%, #dce8fb 100%);
  opacity: 0.9;
}

.fav-modal-poster-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 26px 8px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.84) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
}

.fav-modal-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-modal-card-meta {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-modal-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
  backdrop-filter: blur(2px);
  padding: 0;
  z-index: 2;
}

.fav-modal-card-wrap:hover .fav-modal-remove {
  opacity: 1;
}

.fav-modal-remove:hover {
  background: rgba(220, 60, 60, 0.85);
}

.fav-modal-empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.fav-modal-empty-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.fav-modal-empty small {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--dim);
}

.fav-modal-footer {
  padding: 10px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.fav-count-text {
  font-size: 0.8rem;
  color: var(--muted);
}

.fav-clear-btn {
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}

.fav-clear-btn:hover {
  color: var(--red);
  background: rgba(231, 76, 60, 0.07);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

/* 宽屏：收窄侧栏，中间区域 ≥1300px，6列卡片约200px+（24÷6=4整行） */
@media (min-width: 1640px) {
  .main-side { width: 140px; }
  .grid { grid-template-columns: repeat(6, 1fr); }
}

/* 侧栏在中等屏幕收窄 */
@media (max-width: 1280px) {
  .main-side { width: 160px; }
}

@media (max-width: 1080px) {
  /* 侧栏仍可见但中间区域已较窄，切换为3列（24÷3=8整行） */
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* 侧栏在小屏隐藏，恢复单列布局 */
@media (max-width: 960px) {
  .main-layout { padding: 0; gap: 0; }
  .main-side { display: none; }
  /* 侧栏消失后宽度大增，回到4列（24÷4=6整行） */
  .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 12px; gap: 8px; }
  .logo { gap: 6px; }
  .logo-icon { width: 26px; height: 26px; }
  .logo-text { font-size: 1.05rem; }
  .sort-btn { display: none; }
  .sort-btn.hot-filter-btn { display: inline-flex; align-items: center; padding: 6px 10px; }
  .wish-btn span { display: none; }
  .wish-btn { padding: 6px 10px; }
  .history-btn span { display: none; }
  .history-btn { padding: 6px 10px; }
  .fav-btn span { display: none; }
  .fav-btn { padding: 6px 10px; }
  .wish-form-wrap { grid-template-columns: 1fr; }
  .wish-submit-btn { width: 100%; }
  .stats-bar { padding: 8px 16px 0; }
  /* 允许换行，避免小屏内容溢出 */
  .stats-bar .bar-inner { padding: 12px 16px; gap: 16px 24px; flex-wrap: wrap; min-height: 64px; }
  .stat-num { min-width: 3ch; font-size: 1.3rem; }
  .stats-bar-right { flex-basis: 100%; min-width: 0; font-size: 0.8rem; }
  .cats-wrap { padding: 8px 16px; }
  .cats-wrap .bar-inner { padding: 10px 16px; }
  .content { padding: 16px 0; }
  /* 3列（24÷3=8整行） */
  .grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  /* 分页允许换行 */
  .pagination { flex-wrap: wrap; gap: 6px; padding: 24px 16px 12px; }
  .pg-btn { padding: 7px 14px; font-size: 0.85rem; }
  /* 收藏模态框网格适配 */
  .fav-modal-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
  .history-modal-box { max-height: 90vh; border-radius: 12px; }
  .history-modal-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
  /* 模态框内边距缩减 */
  .fav-modal-head,
  .wish-modal-head,
  .history-modal-head { padding: 14px 16px; }
  .fav-modal-body,
  .history-modal-body { padding: 12px 14px; }
  .fav-modal-footer,
  .history-modal-actions { padding: 10px 16px; }
}

@media (max-width: 480px) {
  /* 2列（24÷2=12整行） */
  .grid { grid-template-columns: repeat(2, 1fr); }
  /* 极窄屏卡片内容收紧 */
  .card-body { padding: 10px; }
  .card-title { font-size: 0.88rem; }
  .card-synopsis { display: none; }
  /* 分页简化 */
  .pagination { gap: 4px; }
  .pg-btn { padding: 6px 10px; font-size: 0.8rem; }
  .pg-info { font-size: 0.8rem; padding: 0 4px; }
  /* 统计栏进一步压缩 */
  .stats-bar .bar-inner { gap: 12px 16px; padding: 10px 14px; }
  .stat-num { font-size: 1.15rem; }
  /* 回到顶部避开 iPhone 底部安全区 */
  .back-top { bottom: max(20px, env(safe-area-inset-bottom, 20px)); right: 16px; }
  /* 搜索框最小宽度限制 */
  .search-wrap { min-width: 0; }
}

/* 触屏设备：hover 隐藏的交互元素改为始终可见 */
@media (hover: none) {
  /* 搜索历史删除按钮 */
  .search-history-item-del { opacity: 1; }
  /* 收藏卡片删除按钮 */
  .fav-modal-remove { opacity: 1; }
}

/* iOS 竖屏：回到顶部使用安全区 */
@supports (bottom: env(safe-area-inset-bottom)) {
  .back-top { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ── Tooltip ─────────────────────────────────────────────────────────────────── */
#tip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  padding: 5px 10px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  border-radius: 7px;
  box-shadow: 0 4px 18px rgba(0, 40, 80, 0.22);
  white-space: pre-wrap;
  max-width: 220px;
  word-break: break-word;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
#tip.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (hover: none) {
  #tip { display: none; }
}
