:root {
  --bg: #f5f5f5;
  --card-bg: #fff;
  --text: #333;
  /* 对比度达到 WCAG AA（白底 ≥ 4.5:1） */
  --text-secondary: #6b6b6b;
  --text-muted: #767676;
  --meituan-waimai: #FF6B00;
  --meituan-waimai-bg: #FFF8F0;
  --meituan-meishi: #E63946;
  --meituan-meishi-bg: #FFF0F1;
  --taobao: #FF5000;
  --taobao-bg: #FFF3F0;
  --accent: #4A90D9;
  --tag-bg: #f0f0f0;
  --expired-opacity: 0.45;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
/* 键盘导航可见焦点 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== 顶栏（含搜索入口）===== */
.header {
  /* 渐变末端去掉浅黄，保证白色文字对比度 */
  background: linear-gradient(135deg, #FF5000, #FF6B00);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.header h1 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-input {
  flex: 0 1 160px;
  min-width: 0;
  padding: 8px 14px 8px 34px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  background: rgba(255,255,255,0.92) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="%23999" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 10px center;
  transition: background-color 0.2s;
}
.search-input:focus { background-color: #fff; }
.search-input::placeholder { color: var(--text-muted); font-size: 12px; }
/* 顶栏搜索入口（按钮形态，点击打开全屏搜索） */
.search-entry {
  cursor: pointer;
  text-align: left;
  color: #999;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-entry.has-keyword { color: var(--text); }

/* ===== 吸顶筛选栏 ===== */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 99;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  padding: 6px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.filter-btn:not(.active):hover { border-color: var(--accent); color: var(--accent); }

/* ===== 卡片列表 ===== */
.card-list {
  padding: 8px 16px 24px;
  max-width: 600px;
  margin: 0 auto;
}
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card.expired { opacity: var(--expired-opacity); }

/* 卡片头部 - 平台标识 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}
.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: var(--tag-bg);
  color: var(--text-secondary);
}
.platform-badge.meituan-waimai { background: var(--meituan-waimai-bg); color: var(--meituan-waimai); }
.platform-badge.meituan-meishi { background: var(--meituan-meishi-bg); color: var(--meituan-meishi); }
.platform-badge.taobao { background: var(--taobao-bg); color: var(--taobao); }
.expired-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: #f0f0f0;
  padding: 3px 8px;
  border-radius: 4px;
}

/* 卡片内容 */
.card-body { padding: 10px 16px 14px; }
.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}
.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.validity {
  font-size: 12px;
  color: var(--text-muted);
}
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--text-secondary);
}

/* 链接按钮 */
.card-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.link-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-btn:hover { opacity: 0.85; }
.link-btn:active { opacity: 0.7; }
.link-btn.shortlink {
  background: var(--accent);
  color: #fff;
}
.link-btn.passcode {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.link-btn .icon { font-size: 14px; }

/* ===== 底部信息 ===== */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.footer .count { margin-bottom: 4px; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 999;
  max-width: 80vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 全屏搜索弹窗 ===== */
.search-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 200;
  flex-direction: column;
}
.search-overlay.active { display: flex; }
.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #FF5000, #FF6B00);
}
.search-overlay-header .search-input {
  flex: 1;
  padding: 10px 14px 10px 38px;
  border-radius: 24px;
  font-size: 14px;
  background-position-x: 12px;
}
.search-close-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
}

/* ===== 平板/桌面适配 ===== */
@media (min-width: 641px) {
  .header h1 { font-size: 17px; }
  .card-list { padding-top: 16px; }
  .card-title { font-size: 17px; }
}

/* ===== 桌面多列布局 ===== */
@media (min-width: 900px) {
  .card-list {
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  .card { margin-bottom: 0; }
}
