/* ===== 谚语大全 · 移动优先样式 ===== */
:root {
  --paper: #f5f3ef;
  --card: #ffffff;
  --ink: #2c2c2c;
  --ink-soft: #6b6b6b;
  --muted: #9a9a9a;
  --accent: #b03a2e;       /* 朱红 */
  --accent-soft: #f3e2df;
  --line: #e7e2da;
  --shadow: 0 1px 3px rgba(60, 40, 30, .08), 0 4px 12px rgba(60, 40, 30, .05);
  --radius: 14px;
  --maxw: 720px;
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部 ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, #b03a2e 0%, #8e2c22 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 16px) 16px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
}
.subtitle {
  margin: 2px 0 12px;
  font-size: 12px;
  opacity: .85;
}
.subtitle span { font-weight: 600; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 0 12px;
  height: 42px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.search-icon { font-size: 15px; margin-right: 6px; opacity: .6; }
#searchInput {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  height: 100%;
}
#searchInput::-webkit-search-cancel-button { display: none; }
.clear-btn {
  border: 0;
  background: #d9d4cc;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
  padding: 0;
}

.quick-actions { margin-top: 10px; }
.pill {
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.pill:active { background: rgba(255, 255, 255, .28); }

/* ===== 字母索引条 ===== */
.index-bar {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 132px);
  z-index: 20;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  background: rgba(245, 243, 239, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.index-bar::-webkit-scrollbar { display: none; }
.index-bar button {
  flex: 0 0 auto;
  min-width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.index-bar button.disabled {
  color: #cfc9c0;
  background: #efece6;
  box-shadow: none;
  cursor: default;
}
.index-bar button.active {
  background: var(--accent);
  color: #fff;
}

/* ===== 内容区 ===== */
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 12px calc(env(safe-area-inset-bottom) + 40px);
}
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 4px 12px;
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 15px;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: -2px;
}

.search-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 4px 12px;
}

/* ===== 卡片 ===== */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border-left: 3px solid var(--accent-soft);
  transition: transform .08s ease, border-color .15s ease;
}
.card:active { transform: scale(.985); border-left-color: var(--accent); }
.card .riddle {
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}
.card .answer {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.card .answer::before { content: "—— "; opacity: .6; font-weight: 400; }
mark {
  background: #ffe9a8;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 14px;
}

/* ===== 加载更多 ===== */
.load-more-wrap { text-align: center; margin-top: 18px; }
.load-more {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  padding: 9px 28px;
  border-radius: 999px;
  cursor: pointer;
}
.load-more:active { background: var(--accent-soft); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 70px);
  transform: translateX(-50%);
  max-width: 80%;
  background: rgba(30, 25, 22, .92);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 50;
  text-align: center;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== 品牌点击返回 + 分类入口 ===== */
.brand { cursor: pointer; }
.cat-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 4px 6px;
}
.cat-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border-left: 3px solid var(--accent);
}
.cat-chip:active { background: var(--accent-soft); }
.cat-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.cat-count {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 8px;
  min-width: 22px;
  text-align: center;
}
.cat-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 4px 0;
}
