/* ==========================================================
   调酒师手册 · 双主题设计系统
   夜间：暗冷色（深蓝黑 + 冰蓝）   日间：高级灰（暖灰 + 石板蓝）
   ========================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-elev: #11161d;
  --bg-input: #151c25;
  --border: #212a36;
  --border-strong: #2e3947;
  --accent: #5eb0ef;
  --accent-weak: rgba(94, 176, 239, 0.12);
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --text-faint: #5c6a7d;
  --danger: #e5697a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.5);
  --glow-a: rgba(94, 176, 239, 0.07);
  --glow-b: rgba(132, 116, 216, 0.06);
  --glass-tint: rgba(10, 14, 20, 0.44);
  --glass-border: rgba(255, 255, 255, 0.09);
}

:root[data-theme="light"] {
  --bg: #eceae7;
  --bg-elev: #f6f5f3;
  --bg-input: #ffffff;
  --border: #dcd9d4;
  --border-strong: #c6c2bb;
  --accent: #46708f;
  --accent-weak: rgba(70, 112, 143, 0.11);
  --text: #26282b;
  --text-dim: #63666b;
  --text-faint: #97999e;
  --danger: #c04a5c;
  --shadow: 0 14px 36px rgba(60, 58, 54, 0.16);
  --card-shadow: 0 4px 16px rgba(60, 58, 54, 0.14);
  --card-shadow-hover: 0 18px 40px rgba(60, 58, 54, 0.22);
  --glow-a: rgba(70, 112, 143, 0.07);
  --glow-b: rgba(120, 110, 100, 0.06);
  --glass-tint: rgba(22, 26, 32, 0.38);   /* 图片上的玻璃仍用深色调，保证文字可读 */
  --glass-border: rgba(255, 255, 255, 0.14);
}

/* 暖色调：把强调色从蓝换成橙，叠加在明/暗之上（仅覆盖强调色与环境光晕，背景/文字不变） */
:root[data-warm] {
  --accent: #ef8f43;
  --accent-weak: rgba(239, 143, 67, 0.14);
  --glow-a: rgba(239, 143, 67, 0.08);
  --glow-b: rgba(214, 138, 92, 0.06);
}
:root[data-warm][data-theme="light"] {
  --accent: #bd6323;                       /* 浅底上用更深的橙，保证可读 */
  --accent-weak: rgba(189, 99, 35, 0.12);
  --glow-a: rgba(189, 99, 35, 0.07);
  --glow-b: rgba(176, 118, 78, 0.06);
}
/* 暖·夜：主背景也换成暖调暗色（棕黑系），不再是冷蓝黑 */
:root[data-warm][data-theme="dark"] {
  --bg: #13100b;
  --bg-elev: #1b1610;
  --bg-input: #221c13;
  --border: #342b20;
  --border-strong: #473b2d;
  --text: #f1ece4;
  --text-dim: #a89a89;
  --text-faint: #7a6d5b;
  --glass-tint: rgba(18, 14, 9, 0.46);
}

:root {
  --radius: 16px;
  --radius-sm: 10px;
  --gap: 18px;
  --font-display: Georgia, "Times New Roman", "Songti SC", STSong, SimSun, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}
/* 环境光：极淡的冷色光晕，为毛玻璃提供层次 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(640px 420px at 85% -8%, var(--glow-a), transparent 70%),
    radial-gradient(520px 380px at -6% 36%, var(--glow-b), transparent 70%);
  transition: background 0.35s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }
.hidden { display: none !important; }
::selection { background: var(--accent-weak); }

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 13px clamp(16px, 4vw, 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
/* logo 可以收缩省略；操作区固定不缩水——保证退出登录后变宽的「登录/注册」按钮
   永远不会把自己或旁边的按钮顶出视口，被挤压的只会是 logo 文字 */
.logo {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; letter-spacing: 1px;
  color: var(--text);
}
.logo:hover { opacity: 1; color: var(--accent); }
.logo-en { color: var(--text-faint); font-weight: 400; font-size: 12px; letter-spacing: 1.2px; }
.topbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }

.container {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(20px, 4vw, 32px) clamp(14px, 4vw, 24px) 90px;
}
/* 阅读型视图收窄居中，列表保持全宽多列 */
#view-detail, #view-edit, #view-profile, #view-story-edit, #view-settings, #view-import, #view-my-ingredients, #view-admin, #view-review, #view-tags, #view-menu-edit {
  max-width: 840px; margin: 0 auto;
}
.import-example summary { color: var(--accent); cursor: pointer; font-size: 13.5px; }
.import-example pre {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 10px;
  font-size: 12.5px; line-height: 1.7; overflow-x: auto;
}
.import-mode {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 12px 0 4px; font-size: 13px; color: var(--text-dim);
  cursor: pointer; line-height: 1.5;
}
.import-mode input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--accent); }

/* ============ 按钮与输入 ============ */
.btn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  padding: 9px 18px; font-size: 14px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { border-color: var(--border-strong); color: var(--text); }
.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--bg); font-weight: 600;
}
.btn-primary:hover { opacity: 0.88; color: var(--bg); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 顶栏「显示设置」下拉：主题 / 基酒百科 / 酒单模式 三个开关收进同一个向下展开的菜单，
   顶栏只留一个触发按钮，给退出登录后变宽的「登录/注册」按钮腾出稳定空间 */
.view-dd { position: relative; }
.view-dd-panel {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 172px; max-width: calc(100vw - 32px);
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 6px; z-index: 50;
  display: flex; flex-direction: column; gap: 2px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.view-dd-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: none; background: transparent;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--text);
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background-color 0.15s;
}
.view-dd-item:hover { background: var(--accent-weak); }
/* 主题项在暖色套时、酒单模式项开启时，同样染成强调色提示当前状态 */
.view-dd-item.warm, .view-dd-item.active { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.view-dd-ic { font-size: 16px; width: 20px; text-align: center; flex: 0 0 auto; }

.input, textarea.input, select.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px; font-size: 15px; font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.35s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.7; }
select.input { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* ============ 搜索与分类 ============ */
.search-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-row .input { flex: 1 1 260px; max-width: 440px; }
.sort-group { display: flex; gap: 8px; }

.chips {
  display: flex; gap: 8px; margin-bottom: 26px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

/* 分类 / 口味 双行筛选 */
.filter-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.filter-row .chips { flex: 1; min-width: 0; margin-bottom: 0; }  /* min-width:0 让 chips 能收缩并横向滚动，避免撑破整页 */
.filter-row:last-of-type { margin-bottom: 22px; }
.filter-label {
  flex: 0 0 auto;
  color: var(--text-faint); font-size: 12.5px; font-weight: 600;
  letter-spacing: 1px;
}
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px; font-size: 13px; font-family: inherit;
  cursor: pointer; color: var(--text-dim);
  background: transparent;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active {
  background: var(--accent-weak); color: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.chip .count { opacity: 0.6; margin-left: 5px; font-size: 12px; }

/* ============ 按材料找酒 ============ */
.match-toggle.active {
  background: var(--accent-weak); color: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.match-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.match-head {
  color: var(--text-dim); font-size: 13px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.match-head > span { flex: 1 1 240px; min-width: 0; }
.match-head-act { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.ing-groups { max-height: 320px; overflow-y: auto; margin-bottom: 12px; }
.ing-group { margin-bottom: 12px; }
.ing-group-label {
  color: var(--text-faint); font-size: 12px; font-weight: 600;
  letter-spacing: 1px; margin-bottom: 7px;
}
.match-chips { flex-wrap: wrap; overflow: visible; margin-bottom: 0; padding-bottom: 0; }
.match-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.match-add .input { flex: 0 1 260px; padding: 8px 12px; min-height: 0; font-size: 14px; }
.mying-count { color: var(--text-faint); font-size: 12.5px; margin-left: auto; }
.match-info { color: var(--text-dim); font-size: 13.5px; margin-top: 12px; }
.match-info b { color: var(--accent); }

.card-ready { box-shadow: 0 0 0 1.5px var(--accent), var(--card-shadow); }
.match-badge {
  display: inline-block;
  font-size: 11.5px; padding: 2px 9px;
  border-radius: 6px; margin-top: 8px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.match-badge.ok {
  background: var(--accent-weak); color: #bfe0f7;
  border: 1px solid var(--accent);
}
.match-badge.lack {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(242, 245, 248, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* ============ 今天喝点啥 ============ */
.lucky-box { max-width: 420px; padding: 0; overflow: hidden; }
.lucky-cover { position: relative; aspect-ratio: 16 / 9; }
.lucky-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.lucky-body { padding: 22px 26px 26px; }
.lucky-label {
  color: var(--accent); font-size: 12px; font-weight: 600;
  letter-spacing: 2px; margin-bottom: 6px;
}
.lucky-body h2 {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: 1px; line-height: 1.3;
}
.lucky-en { color: var(--text-faint); font-size: 13px; letter-spacing: 1px; margin-top: 2px; }
.lucky-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.lucky-meta span {
  background: var(--accent-weak); color: var(--accent);
  border-radius: 6px; padding: 2px 10px; font-size: 12px;
}
.lucky-desc { color: var(--text-dim); font-size: 13.5px; line-height: 1.8; margin-top: 10px; }
.lucky-actions { display: flex; gap: 10px; margin-top: 20px; }
.lucky-actions .btn { flex: 1; }

/* ============ 相关推荐 ============ */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.related-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.related-card .rname { font-weight: 600; font-size: 13.5px; padding: 9px 11px 0; }
.related-card .rsub { color: var(--text-faint); font-size: 11.5px; padding: 2px 11px 10px; }

/* ============ 瀑布流 · 毛玻璃图片卡片（桌面三列 / 手机两列） ============
   用 flex 列 + JS 分配实现瀑布流；不用 CSS columns——
   iOS Safari 在多列布局中会丢失列顶元素的绘制 */
.grid { display: flex; gap: var(--gap); align-items: flex-start; }
.grid-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  gap: var(--gap);
}
.card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-elev);
  box-shadow: var(--card-shadow);
  -webkit-mask-image: -webkit-radial-gradient(white, black);  /* Safari 圆角裁切 */
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  animation: card-in 0.5s ease backwards;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
/* 卡片高度随图片真实比例自适应，图片完整显示不裁切 */
.card-img {
  display: block;
  width: 100%; height: auto;
  min-height: 120px;                  /* 图片加载前的占位，避免瀑布流跳动 */
}
.card-glass {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 16px 15px;
  background: var(--glass-tint);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-top: 1px solid var(--glass-border);
  color: #f2f5f8;                     /* 玻璃层上固定浅色文字，双主题通用 */
}
.card-glass h3 {
  font-family: var(--font-display);
  font-size: 16.5px; font-weight: 700; letter-spacing: 0.5px;
  line-height: 1.35;
}
.card-glass .en {
  color: rgba(242, 245, 248, 0.62);
  font-size: 12px; letter-spacing: 0.8px;
  margin: 1px 0 7px;
}
.card-glass .meta { color: rgba(242, 245, 248, 0.78); font-size: 12.5px; }
.card-glass .tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 1px 8px; font-size: 11.5px;
  color: rgba(242, 245, 248, 0.85);
  margin-top: 9px;
}
.card-glass .stats {
  display: flex; gap: 12px; align-items: center;
  margin-top: 9px;
  color: rgba(242, 245, 248, 0.72); font-size: 12px;
}
.card-glass .stats span { display: inline-flex; align-items: center; gap: 4px; }
.card-glass .stats .cat {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 6px; padding: 1px 8px;
  font-size: 11px;
}

/* 横版到方形的图片卡片：信息栏下移到图片下方，不遮挡画面（fitCard 自动判定） */
.card-stack .card-img { min-height: 0; }
.card-stack .card-glass {
  position: static;
  background: var(--bg-elev);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 1px solid var(--border);
  color: var(--text);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.card-stack .card-glass .en { color: var(--text-faint); }
.card-stack .card-glass .meta { color: var(--text-dim); }
.card-stack .card-glass .stats { color: var(--text-dim); }
.card-stack .card-glass .stats .cat {
  background: var(--accent-weak); color: var(--accent);
  border: none;
}
.card-stack .match-badge.lack {
  background: var(--bg-input); color: var(--text-dim);
  border-color: var(--border);
}
.ic { width: 12px; height: 12px; fill: currentColor; flex: 0 0 auto; }

.empty { text-align: center; color: var(--text-dim); padding: 70px 0; font-size: 15px; }
.pager {
  display: flex; justify-content: center; align-items: center;
  gap: 7px; margin-top: 30px;
}
.pager-top { margin: 0 0 20px; }
.pager-top:empty { display: none; }

.page-btn, .page-num {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 13.5px; font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.page-btn:hover:not(:disabled), .page-num:hover {
  border-color: var(--accent); color: var(--accent);
  transform: translateY(-1px);
}
.page-btn:disabled { opacity: 0.3; cursor: default; }
.page-btn svg { width: 15px; height: 15px; }
span.page-num.active {
  background: var(--accent); border-color: var(--accent);
  color: var(--bg); font-weight: 700;
  font-family: var(--font-display);
  cursor: default; transform: none;
  box-shadow: 0 4px 14px var(--accent-weak);
}
.page-ellipsis { color: var(--text-faint); padding: 0 3px; letter-spacing: 2px; user-select: none; }

/* ============ 详情页 ============ */
.detail-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 16px;
}
.detail-actions { display: flex; gap: 8px; }

.detail-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 22px;
}
/* 照片框体：高度跟随图片原始长宽比，完整显示不裁切 */
.detail-hero.hero-photo-frame { aspect-ratio: auto; }
.hero-img {
  position: absolute; left: 0; top: -9%;
  width: 100%; height: 118%;
  object-fit: cover;
  will-change: transform;
}
.hero-img.hero-anchored {
  position: static; display: block;
  width: 100%; height: auto;
  will-change: auto;
  transform: none !important;
}
.hero-glass {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 24px 20px;
  background: var(--glass-tint);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-top: 1px solid var(--glass-border);
  color: #f2f5f8;
}
.hero-glass h1 {
  font-family: var(--font-display);
  font-size: clamp(22px, 4.5vw, 30px);
  font-weight: 700; letter-spacing: 1px; line-height: 1.3;
}
.hero-glass .en {
  color: rgba(242, 245, 248, 0.65);
  font-size: 14px; letter-spacing: 1.5px; margin-top: 2px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 22px 0;
}
.spec {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.spec .label { color: var(--text-faint); font-size: 12px; margin-bottom: 3px; letter-spacing: 0.5px; }
.spec .value { font-size: 14px; }
.spec-link { color: var(--accent); text-decoration: none; }
.spec-link:hover { text-decoration: underline; }
/* 基酒详情页的产地/风味/建议是长段落，改单列铺满，而不是挤在窄格子里；左侧描边+图标呼应 iba-card 的编辑体系 */
.spec-grid-wide { grid-template-columns: 1fr; gap: 12px; }
.spec-grid-wide .spec {
  padding: 14px 16px 15px 18px;
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px; border-bottom-left-radius: 4px;
}
.spec-grid-wide .spec .label { font-size: 12.5px; letter-spacing: 1px; color: var(--accent); font-weight: 600; }
.spec-grid-wide .spec .value { line-height: 1.8; margin-top: 2px; }

/* 基酒百科：列表页顶部的编辑式引导语换成更像"栏目页首"的介绍条 */
.spirit-intro {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-weak), transparent 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 24px;
}
.spirit-intro h1 {
  font-family: var(--font-display); font-size: clamp(21px, 3.4vw, 27px);
  letter-spacing: 1px; margin-bottom: 6px;
}
.spirit-intro p { color: var(--text-dim); font-size: 13.5px; max-width: 640px; line-height: 1.7; }
.spirit-intro-deco {
  position: absolute; right: -10px; bottom: -22px;
  font-size: 92px; line-height: 1; opacity: 0.08;
  pointer-events: none; user-select: none;
}

/* 基酒分级角标：六大基酒 / 特色 & 餐酒基酒（复用 .ctag 胶囊样式，独立配色不与新手/网红/IBA 混淆） */
.ctag-spirit-base { background: var(--accent); }
.ctag-spirit-specialty { background: rgba(154, 140, 196, 0.92); }

/* 基酒百科：品牌/版本卡片（详情页内的小节，图左文右） */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 28px; }
.brand-card {
  display: flex; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  transition: background-color 0.35s ease, border-color 0.35s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.brand-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--card-shadow); }
.brand-img { flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; }
.brand-img-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--accent-weak); opacity: 0.85;
}
.brand-body { min-width: 0; flex: 1; }
.brand-name { font-weight: 700; font-size: 14px; }
.brand-name .en { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 6px; }
.brand-meta { color: var(--accent); font-size: 11.5px; margin-top: 3px; letter-spacing: 0.3px; }
.brand-desc { color: var(--text-dim); font-size: 12.5px; line-height: 1.6; margin: 6px 0 0; }
.brand-actions { display: flex; gap: 6px; margin-top: 10px; }

/* 空态：与主页 .empty 一致的留白节奏，加一个弱化大图标呼应故事卡片的装饰手法 */
.spirit-empty-icon { font-size: 34px; opacity: 0.35; margin-bottom: 10px; }

/* 主页快捷筛选按钮：新手推荐 / 网红新品 */
.special-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 酒单模式：隐藏工作向按钮，仅保留搜索/网红/架构/口味 */
body.menu-mode #sort-group,
body.menu-mode .match-toggle,
body.menu-mode .lucky-btn,
body.menu-mode #beginner-btn,
body.menu-mode #match-panel,
body.menu-mode .topbar-actions .btn-primary { display: none !important; }
.menu-banner {
  background: var(--accent-weak); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 9px 14px; margin: 0 0 16px;
  font-size: 13px; color: var(--text);
}
.menu-banner a { color: var(--accent); margin-left: 8px; white-space: nowrap; }

/* 我的酒单卡片（个人主页） */
.menus-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.menu-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.menu-card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-card-sub { color: var(--text-dim); font-size: 12.5px; margin: 2px 0 10px; }
.menu-card-act { display: flex; gap: 6px; flex-wrap: wrap; }

/* 选酒器 */
.menu-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.menu-filters .input { flex: 1 1 180px; max-width: 260px; }
.menu-filters .chips { margin-bottom: 0; flex: 1 1 100%; }
.menu-edit-hint { color: var(--text-dim); font-size: 12.5px; margin-bottom: 8px; }
.menu-edit-hint a { color: var(--accent); }
.menu-row-meta { color: var(--text-faint); font-size: 12px; flex: 0 0 auto; }
.menu-save-bar { align-items: center; gap: 14px; position: sticky; bottom: 0;
  background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); }
.menu-sel-count { color: var(--text-dim); font-size: 13px; margin-right: auto; }

/* 卡片角标 & 详情标记 */
.card-tags { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; pointer-events: none; }
.detail-flags { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.ctag {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; color: #fff; white-space: nowrap;
  backdrop-filter: blur(4px); box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.ctag-beginner { background: rgba(52, 168, 110, 0.92); }
.ctag-trending { background: rgba(224, 82, 82, 0.92); }
.ctag-iba { background: rgba(158, 122, 42, 0.94); letter-spacing: 0.3px; }

/* IBA 官方标准配方卡片（详情页，与本站配方并列展示） */
.iba-card {
  background: var(--bg-elev);
  border: 1px solid rgba(158, 122, 42, 0.45);
  border-left: 3px solid rgba(158, 122, 42, 0.9);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 26px 0;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.iba-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.iba-logo {
  flex: 0 0 auto; font-weight: 800; font-size: 13px; letter-spacing: 1px; color: #fff;
  background: rgba(158, 122, 42, 0.94); border-radius: 8px; padding: 7px 10px;
}
.iba-title { font-weight: 700; font-size: 15px; }
.iba-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.iba-ings { margin-bottom: 12px; }
.iba-row { display: flex; gap: 10px; margin: 8px 0; font-size: 14px; }
.iba-row .iba-k { flex: 0 0 auto; color: var(--text-faint); font-size: 12px; padding-top: 2px; letter-spacing: 0.5px; }
.iba-row p { margin: 0; line-height: 1.7; }
.iba-en { margin-top: 10px; }
.iba-en summary { cursor: pointer; color: var(--text-dim); font-size: 12.5px; }
.iba-en p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }

/* 用户上传配方：详情页「大家的配方」区块 + 上传/编辑页 */
.urecipe-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.urecipe-bar .section-title { margin-bottom: 0; }
.urecipe-tip { color: var(--text-dim); font-size: 12.5px; margin: 6px 0 14px; line-height: 1.6; }
.urecipe-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 14px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.urecipe-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.urecipe-name { font-weight: 700; font-size: 15px; }
.urecipe-ops { flex: 0 0 auto; font-size: 12.5px; display: flex; gap: 12px; }
.urecipe-ops a { color: var(--text-dim); }
.urecipe-ops a.del:hover { color: #e05252; }
.urecipe-meta { color: var(--text-dim); font-size: 12px; margin: 4px 0 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.urecipe-source { color: var(--text); }
.urecipe-ings { margin-bottom: 10px; }
.urecipe-specs { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin: 2px 0 10px; }
.urecipe-specs em { font-style: normal; color: var(--text-faint); font-size: 12px; margin-right: 6px; }
.urecipe-steps { margin-top: 4px; }
.urecipe-note { color: var(--text-dim); font-size: 13px; line-height: 1.7; margin: 8px 0 0; }
.urecipe-block {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.urecipe-block-head { display: flex; align-items: center; justify-content: space-between; }
.urecipe-block-no { font-weight: 700; font-size: 14px; color: var(--text-dim); letter-spacing: 0.5px; }
.urecipe-block-del { width: auto; padding: 0 10px; font-size: 12.5px; }

/* 编辑页：配方文本粘贴识别 */
.recipe-paste {
  background: var(--bg-elev); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px 12px;
}
.recipe-paste textarea { min-height: 96px; resize: vertical; margin-top: 4px; }
.paste-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.paste-actions .form-hint { margin: 0; }

/* 编辑页特别标记勾选 */
.flag-row { display: flex; gap: 22px; flex-wrap: wrap; }
.flag-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; }
.flag-check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* 详情页口味标签 */
.taste-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 18px; }
.taste-label { color: var(--text-faint); font-size: 12px; letter-spacing: 0.5px; }
.taste-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.taste-tag {
  font-size: 13px; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
}

/* 酒的故事卡片 */
.story-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 24px 30px;
  margin: 26px 0;
  overflow: hidden;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.story-card::before {
  content: "\201C";
  position: absolute; left: 14px; top: -18px;
  font-family: var(--font-display);
  font-size: 110px; line-height: 1;
  color: var(--accent); opacity: 0.14;
  pointer-events: none;
}
.story-card::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent); opacity: 0.55;
}
.story-label {
  color: var(--accent); font-size: 12px; font-weight: 600;
  letter-spacing: 3px; margin-bottom: 10px;
}
.story-card p {
  font-family: var(--font-display);
  font-size: 15.5px; line-height: 2;
  color: var(--text); letter-spacing: 0.3px;
  white-space: pre-wrap;   /* 保留粘贴/输入内容中的换行与段落 */
}
.story-card.story-empty p { color: var(--text-dim); font-family: inherit; font-size: 14px; }
.story-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-top: 14px; font-size: 12.5px;
}
.story-author { color: var(--text-dim); font-family: var(--font-display); letter-spacing: 0.5px; }

/* 故事编辑独立页面 */
.story-target { margin: 4px 0 10px; }
.story-target-name {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: 0.5px;
}
.story-target-en { color: var(--text-faint); font-size: 13px; margin-left: 10px; letter-spacing: 0.8px; }
.story-edit-tip { color: var(--text-dim); font-size: 13px; margin-bottom: 14px; }
textarea.story-textarea {
  min-height: 320px;
  font-family: var(--font-display);
  font-size: 15.5px; line-height: 2; letter-spacing: 0.3px;
}

.section-title {
  color: var(--accent); font-size: 13px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  margin: 30px 0 12px;
}
.ingredient-list, .step-list { list-style: none; }
.ingredient-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 2px; font-size: 15px;
  border-bottom: 1px dashed var(--border);
}
.ingredient-list .amount { color: var(--accent); font-size: 14px; white-space: nowrap; margin-left: 16px; }
.step-list { counter-reset: step; }
.step-list li {
  counter-increment: step;
  position: relative;
  padding: 7px 0 7px 34px;
  font-size: 15px; line-height: 1.7;
}
.step-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 9px;
  width: 22px; height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--accent); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.desc-text { color: var(--text-dim); line-height: 1.9; font-size: 15px; white-space: pre-wrap; }

.byline {
  color: var(--text-faint); font-size: 13px;
  margin-top: 34px; padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.9;
}
.rev-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 8px 0;
  font-size: 13px; color: var(--text-dim);
}

/* ============ 编辑器：多选分类 & 快捷步骤 ============ */
/* 分类多达数十个：收进限高的可滚动盒子，避免撑长整个表单（手机上尤甚） */
.edit-cats {
  flex-wrap: wrap; margin-bottom: 0;
  max-height: 200px; overflow-y: auto;
  align-content: flex-start;
  padding: 10px; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input);
}
/* 编辑页的框架/口味选择器：换行全显，不做单行横向滚动（选择场景要看全） */
#f-framework, #f-tastes { flex-wrap: wrap; overflow: visible; margin-bottom: 0; }

.quick-steps {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin-top: 12px;
}
.quick-steps-label { color: var(--text-faint); font-size: 12.5px; }
.chip-mini { padding: 4px 12px; font-size: 12.5px; }
.form-hint { color: var(--text-faint); font-size: 12.5px; margin-top: 8px; }
.fw-en { color: var(--text-faint); font-size: 11.5px; }

/* ============ 点赞 ============ */
.like-btn { display: inline-flex; align-items: center; gap: 6px; }
.like-btn .ic { width: 14px; height: 14px; }
.like-btn.liked {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-weak);
}

/* ============ 评论 ============ */
.comment-editor { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.comment-editor textarea.input { min-height: 64px; flex: 1; }
.comment-login-tip { color: var(--text-dim); font-size: 14px; padding: 10px 0; }
.comment-item {
  display: flex; gap: 10px;
  padding: 13px 2px; border-bottom: 1px dashed var(--border);
}
.comment-main { flex: 1; min-width: 0; }
.comment-head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 12.5px; margin-bottom: 4px;
}
.comment-head .author { color: var(--accent); font-weight: 600; }
.comment-head .time { color: var(--text-faint); }
.comment-head .del { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.comment-head .del:hover { color: var(--danger); }
.comment-body { font-size: 14.5px; line-height: 1.8; white-space: pre-wrap; }
.comment-empty { color: var(--text-faint); font-size: 13.5px; padding: 14px 0; }

/* ============ 个人主页 ============ */
.profile-head {
  display: flex; align-items: center; gap: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.avatar {
  width: 64px; height: 64px; flex: 0 0 auto;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; color: #f2f5f8;
  vertical-align: middle; overflow: hidden;
}
img.avatar-img { object-fit: cover; border: 1px solid var(--border); }
.avatar-md { width: 52px; height: 52px; font-size: 21px; }
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-c { width: 32px; height: 32px; font-size: 14px; margin-top: 2px; }

.user-chip { display: inline-flex; align-items: center; }
.user-chip:hover { opacity: 1; }
.user-chip:hover .avatar { box-shadow: 0 0 0 2px var(--accent-weak), 0 0 0 1px var(--accent); }

.profile-head-info { min-width: 0; }
.profile-bio { color: var(--text-dim); font-size: 13.5px; margin-top: 8px; line-height: 1.7; }

.avatar-edit-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.avatar-edit-main { flex: 1; }
.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-row .input { flex: 1; }
.profile-settings .field label { margin-top: 4px; }
.profile-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: 0.5px;
}
.profile-sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.role-badge {
  display: inline-block; margin-left: 8px;
  background: var(--accent-weak); color: var(--accent);
  border-radius: 6px; padding: 1px 8px;
  font-size: 11.5px; vertical-align: 2px;
}
.role-badge.role-admin { background: var(--accent); color: #fff; }

/* 用户权限管理 */
.admin-user-list { margin-top: 6px; }
.admin-user {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 2px; border-bottom: 1px dashed var(--border);
}
.admin-user-info { flex: 1 1 auto; min-width: 0; }
.admin-user-name { font-weight: 600; }
.admin-user-sub {
  color: var(--text-dim); font-size: 12.5px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-user-act { flex: 0 0 auto; }
.admin-self { color: var(--text-faint); font-size: 12.5px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin: 18px 0 26px;
}
.stat-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px; text-align: center;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
.stat-tile .num {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--accent);
}
.stat-tile .lbl { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* 贡献卡片 + GitHub 式活跃图 */
.contrib-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 0 0 26px;
}
.contrib-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.contrib-title { font-size: 14px; color: var(--text-dim); }
.contrib-num { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent); }
.contrib-pending { color: var(--text-faint); font-size: 12.5px; }
.hm-legend { display: flex; align-items: center; gap: 3px; color: var(--text-faint); font-size: 11.5px; }
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.hm-months { display: flex; gap: 3px; margin-bottom: 3px; height: 11px; }
.hm-mon { width: 11px; flex: 0 0 auto; font-size: 9px; color: var(--text-faint); white-space: nowrap; overflow: visible; }
.heatmap { display: flex; gap: 3px; }
.hm-col { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.hm-cell {
  width: 11px; height: 11px; border-radius: 2px; flex: 0 0 auto;
  display: inline-block; background: color-mix(in srgb, var(--text) 8%, transparent);
}
.hm-empty { background: transparent; }
.hm-l0 { background: color-mix(in srgb, var(--text) 8%, transparent); }
.hm-l1 { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.hm-l2 { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.hm-l3 { background: color-mix(in srgb, var(--accent) 78%, transparent); }
.hm-l4 { background: var(--accent); }

/* 标签管理 */
.tag-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tag-toolbar .input { flex: 1 1 200px; max-width: 300px; }
.tag-toolbar .chips { margin-bottom: 0; }
.tag-bulk {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--text-dim);
}
.tag-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px dashed var(--border); }
.tag-check { width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 auto; }
.tag-name {
  flex: 1 1 auto; min-width: 0; font-weight: 600; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag-name:hover { color: var(--accent); }
.tag-name .en { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 8px; }
.tag-toggles { display: flex; gap: 6px; flex: 0 0 auto; }

/* 贡献审核列表 */
.review-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px dashed var(--border); }
.review-info { flex: 1 1 auto; min-width: 0; }
.review-name { font-weight: 600; }
.review-pts { color: var(--accent); font-size: 12.5px; font-weight: 600; margin-left: 6px; }
.review-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.review-sub a { color: var(--accent); }
.review-act { display: flex; gap: 8px; flex: 0 0 auto; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.mini-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
}
.mini-item:hover .mini-name { color: var(--accent); }
.mini-name { font-weight: 600; }
.mini-name .en { color: var(--text-faint); font-weight: 400; font-size: 12.5px; margin-left: 8px; }
.mini-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 1px; }
.mini-side {
  display: flex; gap: 12px; align-items: center; flex: 0 0 auto;
  color: var(--text-dim); font-size: 12.5px;
}
.mini-side span { display: inline-flex; align-items: center; gap: 4px; }
.profile-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.profile-settings .input { margin-bottom: 10px; }

/* ============ 编辑表单 ============ */
.edit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.edit-head h1 { font-family: var(--font-display); font-size: 24px; letter-spacing: 1px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.row-list .row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.row-list .row .input { flex: 1; }
.row-del {
  background: none; border: none;
  color: var(--text-faint); cursor: pointer;
  font-size: 15px; padding: 6px 8px;
  transition: color 0.15s;
}
.row-del:hover { color: var(--danger); }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 10px 0 0; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0;
  background: rgba(4, 7, 10, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 28px;
  width: 100%; max-width: 380px;
}
.modal-box h2 { font-family: var(--font-display); margin-bottom: 20px; font-size: 21px; letter-spacing: 1px; }
.modal-box .input { margin-bottom: 12px; }
.auth-switch { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.auth-switch a:last-child { color: var(--text-faint); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: calc(100vw - 40px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============ 手机适配 ============ */
@media (max-width: 640px) {
  :root { --gap: 12px; }
  body { font-size: 14.5px; }

  .topbar-inner { padding: 11px 14px; }
  .logo { font-size: 16px; }
  .logo-en { display: none; }
  .topbar-actions { gap: 7px; }
  .topbar-actions .btn { padding: 7px 12px; font-size: 13px; }
  .btn-icon { width: 34px; height: 34px; padding: 0; }

  .search-row .input { max-width: none; }

  /* 保持两列瀑布流，缩小玻璃层信息密度 */
  .card-glass { padding: 10px 12px 11px; }
  .card-glass h3 { font-size: 14.5px; }
  .card-glass .en { font-size: 11px; margin-bottom: 5px; }
  .card-glass .meta { font-size: 11.5px; }
  .card-glass .stats .cat { display: none; }
  .card:hover { transform: none; }

  .detail-hero { aspect-ratio: 4 / 3; }
  .hero-glass { padding: 14px 16px 16px; }
  /* 操作栏按钮变多（个人主页 5 个）：整栏换行到独立一行，按钮自适应分行，不再挤成一排 */
  .detail-top { flex-wrap: wrap; gap: 8px; }
  .detail-top > .btn { flex: 0 0 auto; }
  .detail-actions { flex: 1 1 100%; flex-wrap: wrap; gap: 8px; }
  .detail-actions .btn { flex: 1 1 auto; text-align: center; }

  .spec-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .story-card { padding: 22px 20px 20px 24px; }
  .story-card p { font-size: 14.5px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-actions .btn { flex: 1; padding: 12px; }

  .search-row .input { max-width: none; }
  .sort-group { width: 100%; }
  .sort-group .chip { flex: 1; text-align: center; }

  .profile-head { padding: 20px; gap: 14px; }
  .avatar { width: 54px; height: 54px; font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .profile-settings { grid-template-columns: 1fr; }
  .card-glass .stats { margin-top: 7px; font-size: 11px; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-box {
    max-width: none;
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  }

  .btn, .chip, .input { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  .btn-icon { min-height: 34px; }
}

/* 超窄屏（小手机 ≤400px）：压缩筛选/操作 chip 与统计块，避免元素变多后堆叠过高 */
@media (max-width: 400px) {
  .chip { padding: 6px 12px; font-size: 12.5px; }
  .stats-grid { gap: 6px; }
  .stat-tile { padding: 12px 4px; }
  .stat-tile .num { font-size: 19px; }
  .spec { padding: 10px 12px; }
  .admin-user-act .btn { padding: 6px 10px; }
  /* 顶栏「新建词条」只留图标，给 logo 和登录/注册按钮多留一点空间 */
  .topbar-actions .btn-label { display: none; }
  .topbar-actions .btn-primary { padding: 0; width: 36px; height: 36px; border-radius: 50%; }
}

/* 动效偏好：减少动态 */
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .card-img, .hero-img { transform: none !important; }
  * { transition-duration: 0.01ms !important; }
}

/* ICP 备案页脚：全站底部，低调但可见（工信部要求首页底部展示并可点击跳转） */
.site-footer {
  text-align: center;
  padding: 30px 16px 26px;
  font-size: 12px;
  letter-spacing: 0.3px;
}
.site-footer a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.2s ease;
}
.site-footer a:hover { color: var(--text-dim); }
