:root {
  --paper: #FAF6EF;        /* 暖白宣纸（原米黄 #f6edd6 降饱和度） */
  --paper-2: #FFFFFF;
  --ink: #26221C;          /* 墨色标题 */
  --ink-soft: #7A6E5C;     /* 辅助文字 */
  /* 对齐 mastersung.com 传统黄历站：品牌红 #c00 / 装饰金 #8E6C3D */
  --red: #C02020;          /* 朱砂红：品牌主色（对齐 mastersung .title a { color: #c00 }） */
  --red-deep: #8E1A1A;     /* 深朱砂 */
  --red-soft: #FBEAE6;     /* 8% 朱砂浅底：激活态 / 忌卡，替代满铺深红 */
  --gold: #8E6C3D;         /* 暗金：品牌装饰色（对齐 mastersung .content h1 { color: #8E6C3D }） */
  --gold-deep: #6B4E22;    /* 赭金深压 */
  --gold-soft: #C4A070;    /* 暖金辅助（对齐 mastersung p,li,dd { color: #C4A070 }） */
  --line: rgba(142, 108, 61, 0.18);
  --shadow: 0 4px 20px rgba(122, 80, 50, 0.10);
  --shadow-lg: 0 8px 32px rgba(122, 80, 50, 0.14);
  /* ===== 吉凶等级配色（对齐 mastersung.com 传统黄历风格）=====
     mastersung: luckGreat/luckGood=#c00, luckAverage=#f90, luckBad=#000  */
  --lv1: #C02020;   --lv1-lt: #D43535;   --lv1-c: #FFD700;   /* 大吉 · 朱砂红 */
  --lv2: #C02020;   --lv2-lt: #D43535;   --lv2-c: #FFFFFF;   /* 中吉 · 朱砂红（与大吉同色系，参考 mastersung luckGood=#c00） */
  --lv3: #966600;   --lv3-lt: #B87A00;   --lv3-c: #FFFFFF;   /* 平日 · 深绿金（参考 mastersung .solarTerms { color: #960 }） */
  --lv4: #7A6B8A;   --lv4-lt: #A89DB8;   --lv4-c: #F3ECF8;   /* 小凶 · 暗紫（衔接中吉↔不吉） */
  --lv5: #2A2A2A;   --lv5-lt: #4A4A55;   --lv5-c: #D0D0D8;   /* 不吉 · 深墨（参考 mastersung .taboo.donts li { color: #333 }） */
  /* 各档浅底 / 边框（卡片、圆点、选中态） */
  --lv1-bg: #FFF0F0;  --lv1-bd: #FFD6D6;
  --lv2-bg: #FFF0F0;  --lv2-bd: #FFD6D6;  /* 中吉复用大吉浅底 */
  --lv3-bg: #FFF8E8;  --lv3-bd: #FFE8C0;
  --lv4-bg: #F3F0F5;  --lv4-bd: #DED8E4;
  --lv5-bg: #F0F0F2;  --lv5-bd: #D8D8DC;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(192,138,46,0.07), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(181,67,44,0.055), transparent 42%),
    var(--paper);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 56px; }

/* ===== 顶部品牌 + 标签 ===== */
header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #FDFBF6 0%, #F3EADC 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 16px rgba(120,70,20,0.15);
}
.brand { text-align: center; padding: 14px 0 8px; }
.brand h1 {
  margin: 0; font-size: 26px; letter-spacing: 6px;
  color: var(--red-deep); font-weight: 900;
  text-shadow: 0 1px 2px rgba(181,67,44,0.1);
}
.brand .sub { font-size: 11px; color: var(--ink-soft); letter-spacing: 3px; margin-top: 2px; }
.tabs { display: flex; justify-content: center; gap: 8px; padding: 8px 12px 12px; }
.tabs button {
  flex: 1; max-width: 180px; padding: 10px 6px;
  border: 1.5px solid var(--line); border-radius: 24px;
  background: rgba(255,250,240,0.8); color: var(--ink-soft);
  font-size: 14px; font-weight: 600; cursor: pointer; letter-spacing: 1px;
  transition: all .25s ease;
  backdrop-filter: blur(4px);
}
.tabs button:hover {
  border-color: var(--red);
  color: var(--red-deep);
  transform: translateY(-1px);
}
.tabs button.active {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff; border-color: var(--red-deep);
  box-shadow: 0 4px 12px rgba(122,31,31,0.35);
  transform: translateY(0);
}

/* ===== 通用卡片 ===== */
.panel { display: none; animation: fade .3s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease;
}
.card:hover {
  box-shadow: var(--shadow-lg);
}
.card h3 {
  margin: 0 0 14px; font-size: 16px; color: var(--red-deep);
  letter-spacing: 2px; border-left: 4px solid var(--gold); padding-left: 10px;
  font-weight: 700;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: repeat(2, 1fr); } }

/* ===== 日期导航 ===== */
.datebar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 16px;
}
.datebar button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); background: rgba(255,250,240,0.9);
  color: var(--red-deep); font-size: 22px; cursor: pointer; flex: none;
  transition: all .2s ease;
  backdrop-filter: blur(4px);
}
.datebar button:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  transform: scale(1.05);
}
.datebar button:active { transform: scale(.96); }
.datebar .today-btn {
  width: auto; border-radius: 22px; padding: 0 16px; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff; border-color: var(--red-deep);
}
.datebar .today-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(122,31,31,0.3);
}
.datebar input[type=date] {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; background: rgba(255,255,255,0.9); color: var(--ink);
  transition: border-color .2s;
}
.datebar input[type=date]:focus {
  border-color: var(--red);
  outline: none;
  box-shadow: 0 0 0 3px rgba(181,67,44,0.1);
}

/* ===== 通胜主卡 ===== */
.hero {
  text-align: center; padding: 24px 16px 20px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,248,232,0.5) 0%, rgba(245,230,200,0.3) 100%);
  border-bottom: 1px dashed var(--line);
}
.hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--red));
  opacity: 0.6;
}
.hero .solar-big {
  font-size: 32px; font-weight: 900; color: var(--red-deep); letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(181,67,44,0.1);
}
.hero .solar-big small { font-size: 15px; color: var(--ink-soft); font-weight: 500; margin-left: 8px; }
.hero .lunar-line { margin-top: 8px; font-size: 18px; color: var(--ink); letter-spacing: 1px; }
.hero .lunar-line .gz { color: var(--gold); font-weight: 800; }
.hero .meta-line { margin-top: 6px; font-size: 13px; color: var(--ink-soft); line-height: 1.6; }

.rating-badge {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 16px auto 8px; padding: 10px 24px; border-radius: 30px;
  color: #fff; font-weight: 900; font-size: 20px; letter-spacing: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.rating-badge.lv1 { background: linear-gradient(135deg, var(--lv1-lt) 0%, var(--lv1) 100%); color: var(--lv1-c); }
.rating-badge.lv2 { background: linear-gradient(135deg, var(--lv2-lt) 0%, var(--lv2) 100%); color: var(--lv2-c); }
.rating-badge.lv3 { background: linear-gradient(135deg, var(--lv3-lt) 0%, var(--lv3) 100%); color: var(--lv3-c); }
.rating-badge.lv4 { background: linear-gradient(135deg, var(--lv4-lt) 0%, var(--lv4) 100%); color: var(--lv4-c); }
.rating-badge.lv5 { background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%); color: var(--lv5-c); }
.rating-reasons { margin-top: 12px; font-size: 12px; color: var(--ink-soft); line-height: 1.8; }

/* 冲煞提示 */
.chong-bar {
  margin-top: 14px; text-align: center; font-size: 15px;
  background: linear-gradient(135deg, rgba(181,67,44,0.08) 0%, rgba(181,67,44,0.04) 100%);
  border: 1.5px solid var(--red); border-radius: 12px;
  padding: 10px 14px; color: var(--red-deep); font-weight: 700;
  box-shadow: 0 2px 8px rgba(181,67,44,0.1);
}

/* 宜忌 */
.yiji { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.yiji .col { padding: 6px 12px; }
.yiji .col.yi { border-right: 1.5px solid var(--line); }
.yiji-head { font-size: 15px; font-weight: 800; margin-bottom: 8px; color: var(--lv2); letter-spacing: 2px; }  /* 宜 · 珊瑚橙 */
.yiji .col.ji .yiji-head { color: var(--lv5); }  /* 忌 · 玄灰 */
.yiji-item { padding: 8px 0; border-bottom: 1px dashed rgba(184,134,11,0.15); line-height: 1.5; }
.yiji-item:last-child { border-bottom: none; }
/* 宜/忌 词语徽章 */
.yiji-term {
  display: inline-block;
  font-weight: 700; font-size: 13px; line-height: 1.3;
  padding: 4px 12px; border-radius: 20px;
  margin: 4px 6px 4px 0; letter-spacing: 1px;
  vertical-align: middle;
}
/* 宜/忌 词语徽章：桌面端对齐五行五色 —— 宜=lv2 珊瑚橙，忌=lv5 玄灰 */
.yiji-term.yi {
  color: var(--lv2);
  background: rgba(232,93,74,0.10);
  border: 1.5px solid var(--lv2);
}
.yiji-term.ji {
  color: #fff;
  background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%);
  border: 1.5px solid var(--lv5);
  box-shadow: 0 2px 8px rgba(74,74,85,0.25);
}
.yiji-desc { font-size: 11px; color: var(--ink-soft); vertical-align: middle; margin-left: 4px; }
.empty { color: var(--ink-soft); font-size: 13px; font-style: italic; }
/* 择日结果里的宜/忌标签保留小标签样式 */
.result-item .result-tags .tag { padding: 2px 7px; font-size: 11px; }
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 13px;
  background: var(--paper); border: 1px solid var(--line);
}
.tag.yi { color: var(--red-deep); border-color: rgba(181,67,44,0.35); background: rgba(181,67,44,0.06); }
/* 忌 标签 —— 深红实心徽章，对应参考站红圆角 */
.tag.ji {
  color: #fff;
  background: var(--red-deep);
  border-color: var(--red-deep);
  font-weight: 700;
  letter-spacing: 0.5px;
}
/* 不吉（吉凶评级）—— 红色加粗文字，对应参考站「不吉」呈现 */
.luck-bad {
  color: var(--red-deep);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2px;
}

/* 方位卡 */
.pos-card {
  text-align: center; padding: 16px 8px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,250,240,0.6) 0%, rgba(246,237,214,0.4) 100%);
  border: 1px solid var(--line);
  transition: all .2s ease;
}
.pos-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80,40,20,0.12);
}
.pos-card .ic { font-size: 26px; }
.pos-card .label { font-size: 12px; color: var(--ink-soft); margin-top: 4px; letter-spacing: 1px; }
.pos-card .val { font-size: 20px; font-weight: 900; color: var(--gold); margin-top: 4px; }

/* 吉神/凶煞 */
.shen-list { display: flex; flex-wrap: wrap; gap: 8px; }
.shen-list .s {
  font-size: 12px; padding: 4px 10px; border-radius: 16px;
  font-weight: 600;
}
/* 吉神/凶煞标签：桌面端对齐五行五色 —— 吉神=lv2 珊瑚橙，凶煞=lv5 玄灰 */
.s.good { color: var(--lv2); background: rgba(232,93,74,0.10); border: 1px solid rgba(232,93,74,0.25); }
.s.bad { color: #fff; background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%); border: 1px solid var(--lv5); }

/* 彭祖 */
.pengzu { font-size: 14px; color: var(--ink); line-height: 2.2; }
.pengzu-line { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pengzu-line:last-child { border-bottom: none; }
.pengzu-rule { display: inline; font-weight: 700; }
.pengzu b { color: var(--red-deep); font-weight: 700; }
.pengzu-note { display: inline; font-size: 12px; color: #888; font-style: italic; margin-left: 8px; }

/* 二十八宿 */
.xiu-song { font-size: 12px; color: var(--ink-soft); line-height: 1.9; margin-top: 10px; font-style: italic; }

/* 时辰表 */
.hour-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.hour-table th, .hour-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.hour-table th {
  color: var(--red-deep); font-weight: 800;
  background: linear-gradient(180deg, rgba(184,134,11,0.1) 0%, rgba(184,134,11,0.05) 100%);
  letter-spacing: 1px;
}
.hour-table tr.huang td { background: rgba(200,16,46,0.05); }
.hour-table tr.huang:hover td { background: rgba(200,16,46,0.1); }
.hour-gz { font-weight: 800; color: var(--ink); letter-spacing: 1px; }
.jishi-tag { display: inline-block; margin-left: 4px; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 800; background: var(--lv1); color: #fff; vertical-align: middle; }
.hour-legend { display: flex; gap: 20px; margin-top: 10px; font-size: 12px; color: var(--ink-soft); justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot.huang { background: var(--lv1); box-shadow: 0 0 4px rgba(200,16,46,0.4); }
.dot.hei { background: var(--lv5); }

/* 特殊日子标记（桌面端）：岁破日 / 月破日 / 大事勿用 —— 走 v83 不吉色（玄灰 lv5） */
.taboo.badDay {
  margin-top: 14px; padding: 12px 16px; border-radius: 14px;
  background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%);
  color: #f7f5f0; font-weight: 900; font-size: 18px; letter-spacing: .5px;
  text-align: center; box-shadow: 0 6px 20px rgba(74,74,85,0.45);
  border: 1px solid rgba(255,255,255,0.18);
  animation: danger-pulse 2s ease-in-out infinite;
}
@keyframes danger-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(74,74,85,0.45); }
  50% { box-shadow: 0 6px 28px rgba(74,74,85,0.6); }
}

/* ===== 择日 ===== */
.event-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 560px) { .event-grid { grid-template-columns: repeat(3, 1fr); } }
.event-chip {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,250,240,0.6) 0%, rgba(246,237,214,0.4) 100%);
  cursor: pointer; font-size: 14px; font-weight: 600; transition: all .2s ease;
}
.event-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80,40,20,0.12);
  border-color: var(--red);
}
.event-chip .emoji { font-size: 22px; }
.event-chip.active {
  border-color: var(--red-deep);
  background: linear-gradient(135deg, rgba(181,67,44,0.12) 0%, rgba(122,31,31,0.08) 100%);
  box-shadow: 0 0 0 3px rgba(181,67,44,0.15), inset 0 1px 4px rgba(181,67,44,0.1);
  color: var(--red-deep);
}
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.range-row label { font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 4px; letter-spacing: 1px; }
.range-row input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 14px; background: #fff; }
.btn-primary {
  width: 100%; margin-top: 20px; padding: 14px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%); color: #fff;
  font-size: 17px; font-weight: 900; letter-spacing: 4px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(122,31,31,0.35);
  transition: all .2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(122,31,31,0.45);
}
.btn-primary:active { transform: scale(.98); }

.result-summary { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.result-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.result-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,250,240,0.7) 0%, rgba(246,237,214,0.5) 100%);
  cursor: pointer; transition: all .2s ease;
}
.result-item:hover {
  transform: translateX(4px);
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(181,67,44,0.12);
}
.result-item:active { transform: scale(.99); }
.result-item .date-box { text-align: center; flex: none; width: 70px; }
.result-item .date-box .d { font-size: 22px; font-weight: 900; color: var(--red-deep); line-height: 1; }
.result-item .date-box .l { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.result-item .info { flex: 1; min-width: 0; }
.result-item .info .t1 { font-size: 15px; font-weight: 700; color: var(--ink); }
.result-item .info .t2 { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.result-item .info .reason { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.mini-badge {
  flex: none; padding: 6px 14px; border-radius: 20px; color: #fff;
  font-weight: 900; font-size: 13px; letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.mini-badge.lv1 { background: linear-gradient(135deg, var(--lv1-lt) 0%, var(--lv1) 100%); }
.mini-badge.lv2 { background: linear-gradient(135deg, var(--lv2-lt) 0%, var(--lv2) 100%); }
.mini-badge.lv3 { background: linear-gradient(135deg, var(--lv3-lt) 0%, var(--lv3) 100%); }
.mini-badge.lv4 { background: linear-gradient(135deg, var(--lv4-lt) 0%, var(--lv4) 100%); }
.mini-badge.lv5 { background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%); }

.empty-tip { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 24px 0; }

/* ===== 择日：事项下拉 / 提示 ===== */
.event-select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 10px; font-size: 15px;
  background: #fff; color: var(--ink); font-weight: 600; -webkit-appearance: none; appearance: none;
}
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 8px; line-height: 1.6; }

/* 事项描述 + 事项注解 */
.event-desc {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6;
  background: rgba(184,134,11,0.09); border: 1px solid rgba(184,134,11,0.28); color: var(--ink);
}
.event-notes { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.event-notes summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--red-deep); outline: none; }
.notes-cat { margin-top: 10px; }
.notes-cat-name { font-size: 12.5px; font-weight: 700; color: var(--gold-deep); margin-bottom: 4px; }
.notes-item { display: flex; gap: 8px; padding: 4px 2px; font-size: 12.5px; line-height: 1.5; border-bottom: 1px dashed rgba(184,134,11,0.15); }
.notes-item:last-child { border-bottom: none; }
.notes-term { font-weight: 700; white-space: nowrap; min-width: 88px; }
.notes-desc { color: var(--ink-soft); }

/* 生肖避冲 */
.zodiac-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.zodiac-chip {
  padding: 8px 14px; border-radius: 20px; border: 1.5px solid var(--line);
  background: linear-gradient(180deg, rgba(255,250,240,0.7) 0%, rgba(246,237,214,0.5) 100%);
  color: var(--ink-soft); font-size: 14px; cursor: pointer; font-weight: 600;
  transition: all .2s ease;
}
.zodiac-chip:hover {
  border-color: var(--red);
  color: var(--red-deep);
  transform: translateY(-1px);
}
.zodiac-chip.active {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff; border-color: var(--red-deep);
  box-shadow: 0 4px 12px rgba(122,31,31,0.3);
}

/* 历法切换 / 农历输入 */
.range-block { margin-top: 14px; }
.range-block + .range-block { padding-top: 14px; border-top: 1px dashed var(--line); }
.cal-toggle { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.cal-label { font-weight: 800; color: var(--red-deep); letter-spacing: 1px; }
.cal-toggle label { cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background .2s; }
.cal-toggle label:hover { background: rgba(181,67,44,0.06); }
.cal-inputs { margin-top: 6px; }
.cal-inputs.lunar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-inputs.lunar select {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 8px; font-size: 14px;
  background: rgba(255,255,255,0.9); color: var(--ink);
  transition: border-color .2s;
}
.cal-inputs.lunar select:focus { border-color: var(--red); outline: none; }

/* 结果：宜忌标签 + 吉时 */
.result-item .result-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.result-item .result-tags .tag { padding: 2px 7px; font-size: 11px; }
.result-item .jishi { font-size: 11px; color: var(--red-deep); margin-top: 4px; font-weight: 600; }
.result-item.avoid { border-color: rgba(122,31,31,0.5); background: rgba(122,31,31,0.05); }
.result-item.avoid .mini-badge { box-shadow: 0 0 0 2px rgba(122,31,31,0.3) inset; }

/* 结果筛选 + 加载更多 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.filter-btn {
  padding: 8px 16px; border-radius: 20px; border: 1.5px solid var(--line);
  background: rgba(255,250,240,0.8); color: var(--ink-soft);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .2s ease;
}
.filter-btn:hover {
  border-color: var(--red);
  color: var(--red-deep);
  transform: translateY(-1px);
}
.filter-btn.active {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff; border-color: var(--red-deep);
  box-shadow: 0 4px 12px rgba(122,31,31,0.3);
}
.load-more {
  width: 100%; margin-top: 14px; padding: 12px;
  border: 1.5px dashed var(--line); border-radius: 14px;
  background: rgba(255,250,240,0.5); color: var(--red-deep);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all .2s ease;
}
.load-more:hover {
  background: rgba(181,67,44,0.06);
  border-color: var(--red);
  transform: translateY(-1px);
}

footer {
  text-align: center; margin-top: 32px; font-size: 11px; color: var(--ink-soft);
  line-height: 1.9; letter-spacing: 1px;
  padding: 16px; border-top: 1px solid var(--line);
}
.disclaimer {
  background: rgba(184,134,11,0.06);
  border: 1px solid rgba(184,134,11,0.2);
  border-radius: 12px; padding: 12px 14px;
  margin-top: 16px; font-size: 11px; color: var(--ink-soft); line-height: 1.8;
}

/* =========================================================================
 * 移动端 APP 风格（≤768px，仅手机端，桌面端完全不变）
 * 对齐 Ardot 设计系统 G 板高保真原型
 * ========================================================================= */
/* ==========================================================================
   移动端统一比例变量：所有尺寸都走变量，方便按屏幕宽度/安全区整体缩放
   ========================================================================== */
/* 竖屏 ≤768px 走移动版；手机横屏（可视高 ≤560px）也走移动版，避免被挤成桌面窄条 */
@media (max-width: 768px), (orientation: landscape) and (max-height: 560px) and (max-width: 900px) {
  :root {
    /* 安全区兜底：env() 在部分 Android WebView / Android 15 强制 edge-to-edge 下返回 0，
       内容会被系统状态栏（时间、信号）盖住。--js-safe-top / --js-safe-bottom 由
       index.html 内联脚本实测 + 估算后写入，这里是脚本未执行时的兜底值。 */
    --js-safe-top: 26px;
    --js-safe-bottom: 0px;
    --safe-top: max(var(--js-safe-top, 22px), env(safe-area-inset-top, 0px));
    --safe-bottom: max(var(--js-safe-bottom, 0px), env(safe-area-inset-bottom, 0px));
    /* —— 尺寸：用 clamp() 随视口宽度平滑缩放，兼容 320px 小屏到 768px 平板 —— */
    --mob-statusbar-h: calc(52px + env(safe-area-inset-top, 0px));
    --mob-tabbar-h: calc(52px + env(safe-area-inset-bottom, 0px));
    --mob-gutter: clamp(10px, 3.6vw, 18px);   /* 页面左右留白 */
    --mob-gap: clamp(9px, 3.2vw, 14px);       /* 卡片纵向间距 */
    --mob-radius: clamp(12px, 3.4vw, 16px);   /* 卡片圆角 */
    --mob-pad: clamp(12px, 3.6vw, 16px);      /* 卡片内边距 */
    /* —— 字号：同样随宽度缩放 —— */
    --mob-fs-title: clamp(15px, 4.4vw, 19px);    /* 状态栏页标题 */
    --mob-fs-h3: clamp(12px, 3.4vw, 14px);       /* 卡片小标题 */
    --mob-fs-body: clamp(12px, 3.3vw, 14px);     /* 正文 */
    --mob-fs-mini: clamp(10px, 2.9vw, 12px);     /* 辅助说明 */
    --mob-fs-hero: clamp(44px, 14vw, 62px);      /* 首页大日期数字 */
    --mob-fs-tab: clamp(9px, 2.7vw, 11px);       /* Tab 文字 */

    --mob-content-bg: #FAF6EF;
    --mob-card-bg: #FFFFFF;
    --mob-statusbar-fill: #2E2620;
    --mob-tabbar-fill: #26221C;
    --mob-active-gold: #C02020;   /* 激活态朱砂红（对齐 mastersung） */
    --mob-inactive-text: #A79884; /* 加深以提高未选中项对比度 */
    --mob-inactive-icon: #6B5A48;
  }

  /* 全局重置：防止任何终端出现横向滚动 / 双击缩放 / 字体被系统放大 */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    box-sizing: border-box;
  }
  *, *::before, *::after { box-sizing: border-box; }
  body {
    background: var(--mob-content-bg) !important;
    background-image: none !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;      /* 禁止 Android 下拉刷新 / iOS 橡皮筋 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;          /* 去掉 300ms 点击延迟 */
  }
  /* 任何元素都不得超出视口宽度（含长英文、图片、表格） */
  img, svg, video, canvas, table, pre { max-width: 100%; height: auto; }
  .panel, .wrap, .wrap-inner, .card { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }

  .wrap {
    max-width: 100% !important;
    padding: 0 !important;
    padding-bottom: calc(var(--mob-tabbar-h) + 16px + var(--safe-bottom)) !important;
  }

  /* 隐藏原桌面 header */
  header.desktop-header { display: none !important; }

  /* 移动端状态栏：用户不需要模拟系统状态栏，直接隐藏 */
  .mob-statusbar {
    display: none !important;
  }
  .mob-statusbar .row {
    display: flex; justify-content: space-between; align-items: center;
    height: 14px;
  }
  .mob-statusbar .time { color: var(--paper); font-size: var(--mob-fs-mini); font-weight: 600; }
  .mob-statusbar .icons { display: flex; gap: 6px; }
  .mob-statusbar .icons i { display: block; background: var(--paper); border-radius: 2px; }
  .mob-statusbar .icons .sig { width: 14px; height: 10px; }
  .mob-statusbar .icons .bat { width: 20px; height: 10px; border-radius: 3px; }
  .mob-statusbar .title {
    color: var(--paper);
    font-family: "Noto Serif SC", serif;
    font-weight: 700;
    font-size: var(--mob-fs-title);
    margin-top: 2px;
    line-height: 1.25;
  }

  /* 内容区上移：dvh 适配移动端浏览器地址栏收起/展开 */
  .panel {
    padding-top: 0 !important;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
  }
  .panel > .wrap-inner {
    padding: var(--mob-gutter);
    display: flex;
    flex-direction: column;
    gap: var(--mob-gap);
    width: 100%;
    max-width: 720px;      /* 大屏手机/小平板竖屏时居中，避免文字拉太长 */
    margin: 0 auto;
  }

  /* 隐藏桌面 footer/disclaimer */
  footer.desktop-footer, .disclaimer.desktop-disclaimer { display: none !important; }

  /* 移动端底部 Tab Bar */
  .mob-tabbar {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    height: var(--mob-tabbar-h);
    background: var(--mob-tabbar-fill);
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    align-items: center;
    padding: 0 8px calc(6px + var(--safe-bottom));
    box-sizing: border-box;
  }
  .mob-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-tab-item .icon-box {
    width: clamp(20px, 5.6vw, 26px);
    height: clamp(20px, 5.6vw, 26px);
    display: flex; align-items: center; justify-content: center;
    color: var(--mob-inactive-icon);
    transition: color .2s;
  }
  .mob-tab-item .icon-box svg { width: 100%; height: 100%; }
  .mob-tab-item .label {
    font-size: var(--mob-fs-tab);
    color: var(--mob-inactive-text);
    font-weight: 400;
    transition: color .2s;
  }
  .mob-tab-item.active .icon-box { color: var(--mob-active-gold); }
  .mob-tab-item.active .label { color: var(--mob-active-gold); font-weight: 700; }

  /* 卡片适配 */
  .card {
    margin-top: 0 !important;
    border-radius: var(--mob-radius) !important;
    padding: var(--mob-pad) !important;
    box-shadow: none !important;
  }
  .card h3 {
    font-size: var(--mob-fs-h3) !important;
    margin-bottom: 10px !important;
    letter-spacing: 1px !important;
  }

  /* ---------- 顶部安全区（全部 4 个面板：通胜/择日/宜忌/我的，统一处理） ---------- */
  /* 优先用 --safe-top（默认含 26px 兜底：max(--js-safe-top, env)），变量异常时退化为 8px 硬兜底，确保不顶进状态栏 */
  .panel > .wrap-inner { padding-top: max(var(--safe-top, 8px), 8px) !important; }

  /* 日期导航适配：grid 4 列更紧凑、按钮变 32px 圆形、今天按钮去掉文字改旋转箭头 */
  .datebar {
    display: grid !important;
    grid-template-columns: 32px minmax(92px, 1fr) 32px 36px !important;
    align-items: center !important;
    justify-content: stretch !important;
    gap: 6px !important;
    margin-top: 0 !important;
    height: 36px;
  }
  .datebar button {
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
    flex: none !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  .datebar input[type=date] {
    font-size: 12px !important;
    padding: 6px 6px !important;
    min-width: 92px !important;
    width: 100% !important;
    height: 32px !important;
    box-sizing: border-box !important;
    flex: none !important;
  }
  /* 「今天」按钮：去掉文字，做成 36×36 圆形 + 旋转箭头 SVG */
  .datebar .today-btn {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    padding: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    position: relative !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%) !important;
    border-color: var(--red-deep) !important;
    box-shadow: 0 2px 6px rgba(181,67,44,0.28) !important;
  }
  .datebar .today-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12a9 9 0 1 0 3-6.7'/><path d='M3 4v5h5'/></svg>");
    background-size: 58% 58%;
    background-position: center;
    background-repeat: no-repeat;
  }
  .datebar .today-btn:hover { transform: scale(1.05); }

  /* 隐藏「吉时依据」来源标注 + 「吉时可用 共 N 个吉时」图例（仅移动端） */
  .hour-list-mob .hl-source,
  .hour-list-mob .hour-list-legend { display: none !important; }

  /* 按钮适配 */
  .btn-primary {
    font-size: 15px !important;
    padding: 12px !important;
    letter-spacing: 3px !important;
  }

  /* 事件芯片网格 */
  .event-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }
  .event-chip {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }
  .event-chip .emoji { font-size: 18px !important; }

  /* 结果列表适配 */
  .result-item {
    padding: 10px 12px !important;
    gap: 10px !important;
  }
  .result-item .date-box { width: 56px !important; }
  .result-item .date-box .d { font-size: 18px !important; }

  /* 吉时徽章 */
  .mini-badge {
    padding: 4px 10px !important;
    font-size: 11px !important;
  }

  /* 过滤按钮 */
  .filter-btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }

  /* 生肖芯片 */
  .zodiac-chip {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }

  /* 神位卡四宫格 */
  .pos-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }
  .pos-grid-item {
    text-align: center;
    padding: 10px 4px !important;
    background: var(--paper) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(181,67,44,0.15) !important;
  }
  .pos-grid-item .ic { font-size: 20px !important; }
  .pos-grid-item .label { font-size: 10px !important; color: var(--ink-soft) !important; }
  .pos-grid-item .val { font-size: 12px !important; font-weight: 700 !important; color: var(--ink) !important; margin-top: 2px !important; }

  /* 时辰表适配 */
  .hour-table {
    font-size: 11px !important;
  }
  .hour-table th, .hour-table td {
    padding: 6px 4px !important;
  }

  /* 移动端显隐控制 */
  .mob-only { display: block !important; }
  .desktop-only { display: none !important; }

  /* ---------- 时辰方位页（移动端高保真） ---------- */
  .hour-pos-mob { background: var(--mob-card-bg) !important; }
  .hour-pos-mob h3 {
    color: var(--red-deep) !important;
    font-size: 14px !important;
    margin-bottom: 12px !important;
  }
  .hour-pos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .hour-pos-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    background: var(--paper);
    border-radius: 12px;
    border: 1px solid rgba(181,67,44,0.12);
    color: var(--ink);
  }
  .hour-pos-icon {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
  }
  .hour-pos-label {
    font-size: 11px;
    color: var(--ink-soft);
  }
  .hour-pos-val {
    font-size: 15px;
    font-weight: 800;
  }

  .hour-list-mob { background: var(--mob-card-bg) !important; }
  .hour-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  .hour-list-head h3 {
    margin: 0 !important;
    color: var(--red-deep) !important;
  }
  .hour-current {
    font-size: var(--mob-fs-mini);
    color: var(--ink-soft);
    white-space: nowrap;
  }

  /* 「仅吉时 / 全部时辰」切换 */
  .hl-toggle {
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
  }
  .hlt-chip {
    flex: 1;
    padding: 7px 0;
    border-radius: 999px;
    border: 1px solid rgba(181,67,44,0.18);
    background: #fff;
    color: var(--ink-soft);
    font-size: var(--mob-fs-mini);
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all .16s;
  }
  .hlt-chip.active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    border-color: var(--red-deep);
    color: #fff;
    box-shadow: 0 2px 6px rgba(181,67,44,0.22);
  }

  .hour-list-body {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.8vw, 9px);
  }
  .hour-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: clamp(8px, 2.6vw, 11px) clamp(9px, 2.8vw, 12px);
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(181,67,44,0.08);
    min-width: 0;
  }
  .hour-item.current {
    background: linear-gradient(135deg, rgba(181,67,44,0.12) 0%, rgba(122,31,31,0.06) 100%);
    border-color: rgba(181,67,44,0.25);
    box-shadow: 0 2px 8px rgba(181,67,44,0.08);
  }
  .hour-item .hour-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: clamp(76px, 23vw, 104px);
    flex: none;
    font-size: var(--mob-fs-body);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    text-align: center;
  }
  .hour-item .hour-name .hour-sub {
    font-size: calc(var(--mob-fs-mini) - 1px);
    font-weight: 500;
    color: var(--ink-soft);
  }
  .hour-item .hour-range {
    font-size: var(--mob-fs-mini);
    color: var(--ink-soft);
    flex: 1;
    min-width: 0;
    text-align: center;
    line-height: 1.35;
  }
  .hour-item .hour-range .hour-desc {
    display: block;
    font-size: calc(var(--mob-fs-mini) - 1px);
    color: rgba(107,90,72,0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* 目标站时段徽标：清晨 / 早上 / 下午 / 晚上 */
  .hour-item .hour-range .hour-period {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: calc(var(--mob-fs-mini) - 2px);
    line-height: 1.5;
    white-space: nowrap;
    background: rgba(91,140,133,0.14);
    color: #8A6A1F;
    border: 1px solid rgba(91,140,133,0.28);
    vertical-align: 1px;
  }
  .hour-item.luck-吉 .hour-range .hour-period {
    background: rgba(232,93,74,0.12);
    color: var(--lv2);
    border-color: rgba(232,93,74,0.26);
  }
  /* 吉时数据来源标注 */
  .hl-source {
    margin-top: 10px;
    text-align: center;
    font-size: calc(var(--mob-fs-mini) - 1px);
    color: rgba(107,90,72,0.62);
    letter-spacing: .3px;
  }
  .hl-source.warn {
    color: var(--lv4);
  }
  .hour-item .hour-tag {
    width: clamp(24px, 7vw, 30px);
    height: clamp(24px, 7vw, 30px);
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    font-size: var(--mob-fs-mini);
    font-weight: 800;
    flex: none;
  }
  .hour-item.luck-吉 .hour-tag {
    background: rgba(232,93,74,0.12);
    color: var(--lv2);
  }
  .hour-item.luck-平 .hour-tag {
    background: rgba(91,140,133,0.12);
    color: var(--lv3);
  }
  .hour-item.luck-凶 .hour-tag {
    background: rgba(181,67,44,0.12);
    color: var(--red);
  }
  .hour-list-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(10px, 3.4vw, 20px);
    margin-top: 12px;
    font-size: var(--mob-fs-mini);
    color: var(--ink-soft);
  }
  .hour-list-legend .hl-count {
    color: var(--red-deep);
    font-weight: 700;
  }
  /* 空态（当日无吉时） */
  .hour-list-body .empty-mini {
    padding: 18px 10px;
    text-align: center;
    font-size: var(--mob-fs-mini);
    color: var(--ink-soft);
    background: rgba(181,67,44,0.04);
    border-radius: 10px;
    border: 1px dashed rgba(181,67,44,0.18);
  }
  .hour-list-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .hour-list-legend .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin: 0;
  }
  .hour-list-legend .dot.good { background: var(--lv2); }
  .hour-list-legend .dot.mid { background: var(--lv3); }
  .hour-list-legend .dot.bad { background: var(--lv5); }

  /* ---------- 设置页（移动端高保真） ---------- */
  .settings-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--mob-card-bg);
    border-radius: 14px;
    border: 1px solid rgba(181,67,44,0.1);
  }
  .settings-hero .app-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 900;
    flex: none;
  }
  .settings-hero .app-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
  }
  .settings-hero .app-meta {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 2px;
  }
  .settings-group {
    background: var(--mob-card-bg);
    border-radius: 14px;
    border: 1px solid rgba(181,67,44,0.1);
    overflow: hidden;
    margin-top: 4px;
  }
  .settings-label {
    font-size: 12px;
    color: var(--ink-soft);
    padding: 12px 16px 0;
    font-weight: 600;
  }
  .settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--ink);
    border-bottom: 1px solid rgba(181,67,44,0.08);
    cursor: pointer;
  }
  .settings-row:last-child { border-bottom: none; }
  .settings-row .settings-key { flex: 1; }
  .settings-row .settings-value {
    font-size: 13px;
    color: var(--ink-soft);
    margin-right: 8px;
  }
  .settings-row .arrow {
    color: var(--ink-soft);
    font-size: 16px;
  }
  .settings-row.danger .settings-key { color: var(--red-deep); }

  /* switch toggle */
  .switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 26px;
    flex: none;
  }
  .switch input { opacity: 0; width: 0; height: 0; }
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #EAE4D6;
    border-radius: 26px;
    transition: .3s;
  }
  .slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
  }
  .switch input:checked + .slider { background-color: var(--red); }
  .switch input:checked + .slider:before { transform: translateX(18px); }

  .settings-footer {
    text-align: center;
    font-size: 11px;
    color: var(--ink-soft);
    line-height: 1.9;
    padding: 16px 12px 8px;
  }

  /* ---------- 通胜页（移动端高保真） ---------- */
  .daily-hero-mob {
    background: var(--mob-card-bg) !important;
    padding: 16px !important;
  }
  .daily-hero-mob .dh-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(181,67,44,0.12);
  }
  .daily-hero-mob .dh-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
  }
  .daily-hero-mob .dh-day {
    font-family: "Noto Serif SC", serif;
    font-size: var(--mob-fs-hero);
    font-weight: 900;
    color: var(--red);
    line-height: 1;
    letter-spacing: -1px;
  }
  .daily-hero-mob .dh-info { display: flex; flex-direction: column; gap: 2px; }
  .daily-hero-mob .dh-ym { font-size: 14px; color: var(--ink); font-weight: 600; }
  .daily-hero-mob .dh-week { font-size: 13px; color: var(--ink-soft); }
  .daily-hero-mob .dh-day-type {
    flex: 0 0 auto;
    font-family: "Noto Serif SC", serif;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 6px 12px;
    border-radius: 8px;
    line-height: 1;
    border: 1px solid transparent;
    /* 默认：平日（暖金 = lv3） */
    color: #3D5C55;
    background: rgba(91,140,133,0.10);
    border-color: rgba(91,140,133,0.32);
  }
  .daily-hero-mob .dh-day-type.lv1 {  /* 大吉：深绿 */
    color: var(--lv1);
    background: rgba(200,16,46,0.12);
    border-color: rgba(200,16,46,0.36);
  }
  .daily-hero-mob .dh-day-type.lv2 {  /* 中吉：中绿 */
    color: var(--lv2);
    background: rgba(232,93,74,0.10);
    border-color: rgba(232,93,74,0.32);
  }
  .daily-hero-mob .dh-day-type.lv3 {  /* 平日：金黄（与默认一致） */
    color: #3D5C55;
    background: rgba(91,140,133,0.10);
    border-color: rgba(91,140,133,0.32);
  }
  .daily-hero-mob .dh-day-type.lv5 {  /* 不吉：暗红 */
    color: var(--lv5);
    background: rgba(74,74,85,0.10);
    border-color: rgba(74,74,85,0.32);
  }
  .daily-hero-mob .dh-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 12px;
  }
  .daily-hero-mob .chip {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(181,67,44,0.06);
    color: var(--ink-soft);
    border: 1px solid rgba(181,67,44,0.12);
  }
  .daily-hero-mob .chip-lunar { color: var(--red); background: rgba(181,67,44,0.08); }
  .daily-hero-mob .chip-sx { color: var(--gold); background: rgba(184,134,11,0.08); border-color: rgba(184,134,11,0.18); }
  .daily-hero-mob .dh-rating {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
  }
  .daily-hero-mob .dh-rating.lv1 { background: linear-gradient(135deg, var(--lv1-lt) 0%, var(--lv1) 100%); }  /* 大吉 · 朱砂红 */
  .daily-hero-mob .dh-rating.lv2 { background: linear-gradient(135deg, var(--lv2-lt) 0%, var(--lv2) 100%); }  /* 中吉 · 珊瑚橙 */
  .daily-hero-mob .dh-rating.lv3 { background: linear-gradient(135deg, var(--lv3) 0%, #7BA098 100%); }
  .daily-hero-mob .dh-rating.lv4, .daily-hero-mob .dh-rating.lv5 { background: linear-gradient(135deg, var(--lv5-lt) 0%, var(--lv5) 100%); }
  .daily-hero-mob .dh-rating-label { font-size: 12px; opacity: 0.85; }
  .daily-hero-mob .dh-rating-val { font-size: 14px; font-weight: 800; }

  /* 宜 / 忌 双列 */
  .yj-mob {
    display: grid !important;
    grid-template-columns: 1.1fr 0.9fr !important;
    gap: 12px !important;
    padding: 14px !important;
    background: var(--mob-card-bg) !important;
  }
  .yj-mob .yj-col {
    border-radius: 12px;
    padding: 10px 8px;
    display: flex; flex-direction: column; gap: 6px;
    align-items: center;
    min-height: 100px;
  }
  .yj-mob .yj-col.yi { background: var(--paper-2); border: 1px solid rgba(47,125,91,0.18); }
  .yj-mob .yj-col.ji { background: var(--red-soft); border: 1px solid rgba(142,47,30,0.18); color: var(--ink); }
  .yj-mob .yj-head {
    font-family: "Noto Serif SC", serif;
    font-size: 18px; font-weight: 900;
    margin-bottom: 4px;
  }
  .yj-mob .yi .yj-head { color: var(--lv2); }
  .yj-mob .ji .yj-head { color: var(--lv5); }
  .yj-mob .yj-tags {
    display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
  }
  .yj-mob .yj-tag {
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 10px;
    border: 1px solid currentColor;
    color: var(--lv2);
    background: rgba(232,93,74,0.04);
  }
  .yj-mob .yj-tag.ji {
    color: var(--lv5);
    background: rgba(142,47,30,0.06);
    border-color: rgba(142,47,30,0.18);
  }
  .yj-mob .empty-mini {
    font-size: 11px;
    color: var(--ink-soft);
    text-align: center;
    padding: 8px;
  }
  .yj-mob .ji .empty-mini { color: var(--ink-soft); }

  /* 冲煞与方位 */
  .pos-mob {
    padding: 14px !important;
    background: var(--mob-card-bg) !important;
  }
  .pos-mob .pm-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
  }
  .pos-mob .pm-title {
    font-size: 14px; font-weight: 700; color: var(--red-deep);
    letter-spacing: 1px;
  }
  .pos-mob .pm-hint { font-size: 11px; color: var(--red); }
  .pos-mob .pm-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  }
  .pos-mob .pm-cell {
    background: rgba(181,67,44,0.04);
    border: 1px solid rgba(181,67,44,0.1);
    border-radius: 10px;
    padding: 10px 4px;
    text-align: center;
  }
  .pos-mob .pm-key { font-size: 10px; color: var(--ink-soft); margin-bottom: 4px; }
  .pos-mob .pm-val { font-size: 12px; color: var(--red); font-weight: 700; }

  /* ---------- 通胜页：补齐桌面端信息维度 ----------
     顺序对齐桌面端 markup：冲煞条 → 凶日提示 → 宜忌 → 吉神凶煞 →
     建除/值神/星宿 → 神位方位 → 彭祖百忌 → 节令 → 时辰 */

  /* ② 冲煞警示条 */
  .chong-mob {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px !important;
    background: linear-gradient(135deg, rgba(181,67,44,0.07) 0%, rgba(181,67,44,0.02) 100%) !important;
    border: 1px solid rgba(181,67,44,0.18) !important;
  }
  .chong-mob .cm-badge {
    flex: none;
    width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: "Noto Serif SC", serif;
    font-size: 14px; font-weight: 900; color: #fff;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  }
  .chong-mob .cm-body { min-width: 0; }
  .chong-mob .cm-main { font-size: 14px; font-weight: 700; color: var(--red-deep); line-height: 1.4; }
  .chong-mob .cm-hint { font-size: 11px; color: var(--ink-soft); margin-top: 2px; line-height: 1.4; }

  /* ③ 凶日提示（月破 / 日破 等） */
  .taboo-mob {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px !important;
    background: rgba(142,47,30,0.08) !important;
    border: 1px dashed rgba(142,47,30,0.35) !important;
  }
  .taboo-mob .tb-badge {
    flex: none;
    font-size: 11px; font-weight: 800; letter-spacing: 1px;
    color: #fff; background: var(--lv5);
    padding: 3px 7px; border-radius: 6px;
  }
  .taboo-mob .tb-text { font-size: 14px; font-weight: 700; color: var(--lv5); line-height: 1.5; }

  /* ④ 宜 / 忌：带释义的 tag 可点按 */
  .yj-mob .yj-tag { transition: transform 0.12s ease; }
  .yj-mob .yj-tag.has-desc { cursor: pointer; }
  .yj-mob .yj-tag.has-desc::after {
    content: 'ⓘ'; margin-left: 4px; font-size: 9px; opacity: 0.55; vertical-align: 1px;
  }
  .yj-mob .yj-tag.has-desc:active { transform: scale(0.94); }

  /* ⑤ 吉神 · 凶煞 */
  .shen-mob { padding: 14px !important; background: var(--mob-card-bg) !important; }
  .shen-mob .sm-head { margin-bottom: 10px; }
  .shen-mob .sm-title { font-size: 14px; font-weight: 700; color: var(--red-deep); letter-spacing: 1px; }
  .shen-mob .sm-list { display: flex; flex-wrap: wrap; gap: 6px; }
  .shen-mob .sm-tag {
    font-size: 12px; padding: 4px 10px;
    border-radius: 10px; border: 1px solid currentColor;
  }
  .shen-mob .sm-tag.good { color: var(--lv2); background: rgba(232,93,74,0.07); }
  .shen-mob .sm-tag.bad { color: var(--lv5); background: rgba(142,47,30,0.07); }

  /* ⑥ 建除 · 值神 · 星宿 */
  .zxx-mob { padding: 14px !important; background: var(--mob-card-bg) !important; }
  .zxx-mob .zx-head { margin-bottom: 10px; }
  .zxx-mob .zx-title { font-size: 14px; font-weight: 700; color: var(--red-deep); letter-spacing: 1px; }
  .zxx-mob .zx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .zxx-mob .zx-cell {
    background: rgba(181,67,44,0.04);
    border: 1px solid rgba(181,67,44,0.1);
    border-radius: 10px; padding: 10px 4px; text-align: center;
  }
  .zxx-mob .zx-key { font-size: 10px; color: var(--ink-soft); margin-bottom: 4px; }
  .zxx-mob .zx-val { font-size: 14px; color: var(--red); font-weight: 700; line-height: 1.3; }
  .zxx-mob .zx-song {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(181,67,44,0.1);
    font-family: "Noto Serif SC", serif;
    font-size: 11.5px; line-height: 1.8; color: var(--ink-soft);
    text-align: justify;
  }

  /* ⑦ 神位方位：五行格 + 胎神独立行（文案较长） */
  .pos-mob .pm-grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .pos-mob .pm-grid5 .pm-cell { padding: 10px 2px; }
  .pos-mob .pm-grid5 .pm-val { font-size: 13px; }
  .pos-mob .pm-tai {
    display: flex; align-items: baseline; gap: 8px;
    margin-top: 8px; padding: 8px 10px;
    background: rgba(181,67,44,0.04);
    border: 1px solid rgba(181,67,44,0.1);
    border-radius: 10px;
  }
  .pos-mob .pm-tai .pm-key { margin-bottom: 0; flex: none; }

  /* ⑧ 彭祖百忌 */
  .pz-mob { padding: 14px !important; background: var(--mob-card-bg) !important; }
  .pz-mob .pz-head { margin-bottom: 8px; }
  .pz-mob .pz-title { font-size: 14px; font-weight: 700; color: var(--red-deep); letter-spacing: 1px; }
  .pz-mob .pz-line { display: flex; flex-direction: column; gap: 3px; padding: 9px 0; }
  .pz-mob .pz-line + .pz-line { border-top: 1px solid rgba(181,67,44,0.1); }
  .pz-mob .pz-rule {
    font-family: "Noto Serif SC", serif;
    font-size: 14px; font-weight: 700; color: var(--red-deep); letter-spacing: 0.5px;
  }
  .pz-mob .pz-note { font-size: 11.5px; line-height: 1.6; color: var(--ink-soft); }

  /* ⑨ 节令 */
  .jq-mob { padding: 12px 14px !important; background: var(--mob-card-bg) !important; }
  .jq-mob .pm-head { margin-bottom: 6px; }
  .jq-mob .jq-text { font-size: 13px; line-height: 1.6; color: var(--red-deep); font-weight: 600; }

  /* chips 新增项配色（月相 / 六曜 / 纳音） */
  .daily-hero-mob .chip-yx { color: #3C6E8F; background: rgba(60,110,143,0.08); border-color: rgba(60,110,143,0.18); }
  .daily-hero-mob .chip-ly { color: #6B4E8F; background: rgba(107,78,143,0.08); border-color: rgba(107,78,143,0.18); }
  .daily-hero-mob .chip-ny { color: #8F6B2F; background: rgba(143,107,47,0.08); border-color: rgba(143,107,47,0.18); }

  /* ---------- 择日页（移动端高保真） ---------- */
  .elect-step-pill {
    display: flex; align-items: center; justify-content: center;
    gap: 0;
    padding: 8px 4px;
    background: var(--mob-card-bg);
    border-radius: 24px;
    border: 1px solid rgba(181,67,44,0.08);
  }
  .elect-step-pill .es-step {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
    padding: 6px 4px;
    border-radius: 20px;
  }
  .elect-step-pill .es-step.active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    font-weight: 700;
  }
  .elect-mob-card { padding: 14px !important; background: var(--mob-card-bg) !important; }
  .emc-title {
    font-size: 14px; font-weight: 700; color: var(--ink);
    margin-bottom: 10px;
    display: flex; align-items: center;
  }
  .emc-title::before {
    content: ""; display: inline-block;
    width: 3px; height: 14px;
    background: var(--red);
    margin-right: 6px; border-radius: 2px;
  }
  .emc-flex { justify-content: space-between; }
  /* 修复：::before 红条 + 标题 + meta 三子项时 space-between 会把标题挤到中间，
     让标题始终紧贴左侧红条（v64） */
  .emc-flex > span:first-of-type { margin-right: auto; }
  .emc-meta { font-size: 11px; color: var(--ink-soft); font-weight: 400; }
  .emc-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
  }
  .emc-chip {
    padding: 8px 12px;
    border-radius: 18px;
    border: 1px solid rgba(181,67,44,0.18);
    background: #fff;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    transition: all .15s;
  }
  .emc-chip.active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    border-color: var(--red-deep);
    font-weight: 700;
  }
  /* v61 移动端：生肖避冲（可选） */
  .emc-opt { font-size: 11px; color: var(--ink-soft); font-weight: 400; margin-left: 2px; }
  .emc-hint { font-size: 11px; color: var(--ink-soft); line-height: 1.5; margin: -4px 0 10px; }
  .emc-zodiac {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
  }
  .emc-zodiac .zodiac-chip {
    display: flex; align-items: center; justify-content: center;
    padding: 9px 0;
    border-radius: 50%;
    border: 1px solid rgba(181,67,44,0.22);
    background: var(--red-soft, #FBF3EC);
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  .emc-zodiac .zodiac-chip.active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    border-color: var(--red-deep);
    font-weight: 700;
  }
  .emc-more { width: 100%; margin-top: 4px; }
  .emc-more summary {
    list-style: none;
    color: var(--ink-soft);
    font-size: 12px;
    padding: 6px 4px;
    cursor: pointer;
    text-align: center;
    border-top: 1px dashed rgba(181,67,44,0.15);
  }
  .emc-more summary::-webkit-details-marker { display: none; }
  .emc-more-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 8px;
  }
  /* v62 移动端：「更多」区按事项分类分组显示（参考目标站） */
  .emc-cat { margin-top: 12px; }
  .emc-cat:first-of-type { margin-top: 4px; }
  .emc-cat-name {
    font-size: 12px; font-weight: 700;
    color: var(--red);
    padding: 4px 0 2px;
    display: flex; align-items: center; gap: 6px;
  }
  .emc-cat-name::after {
    content: ""; flex: 1; height: 1px;
    background: rgba(181,67,44,0.15);
  }
  .emc-cat .emc-more-grid { margin-top: 6px; }
  .emc-range {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 10px;
    position: relative;
  }
  .emc-range input[type=date] {
    flex: 1; min-width: 0;
    padding: 8px 8px;
    font-size: 12px;
    border: 1px solid rgba(181,67,44,0.18);
    border-radius: 8px;
    background: #fff;
  }
  .emc-arrow { color: var(--ink-soft); font-size: 14px; }
  .emc-presets {
    display: flex; gap: 8px;
  }
  .emp-chip {
    flex: 1;
    padding: 6px 10px;
    border-radius: 16px;
    border: 1px solid rgba(181,67,44,0.18);
    background: #fff;
    font-size: 12px;
    color: var(--ink-soft);
    cursor: pointer;
  }
  .emp-chip.active {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    font-weight: 700;
  }

  /* 推荐吉日列表（移动端） */
  .erm-item {
    display: flex; align-items: stretch; gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid rgba(181,67,44,0.08);
    background: #fff;
    margin-bottom: 8px;
    cursor: pointer;
  }
  .erm-item:active { background: rgba(181,67,44,0.04); }
  .erm-pill {
    width: 48px; flex: none;
    border-radius: 8px;
    background: linear-gradient(180deg, #FFF8E8 0%, #F5E6C8 100%);
    border: 1px solid rgba(184,134,11,0.2);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--red-deep);
    padding: 4px 0;
  }
  .erm-d { font-size: 20px; font-weight: 900; line-height: 1; }
  .erm-m { font-size: 10px; margin-top: 2px; color: var(--ink-soft); }
  .erm-info { flex: 1; min-width: 0; }
  .erm-t1 { font-size: 13px; color: var(--ink); font-weight: 700; line-height: 1.4; }
  .erm-t2 { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
  .erm-t3 { font-size: 11px; margin-top: 4px; line-height: 1.4; }
  .erm-t3.lv1 { color: var(--lv1); }
  .erm-t3.lv2 { color: var(--lv2); }
  .erm-t3.lv3 { color: #3D5C55; }
  .erm-t3.lv4, .erm-t3.lv5 { color: var(--lv5); }
  .erm-badge {
    flex: none;
    align-self: center;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 14px;
    color: #fff;
    background: var(--lv2);
    font-weight: 700;
  }
  /* 评级：lv1 大吉 / lv2 吉 / lv3 平 / lv4 小凶 / lv5 凶 */
  .erm-badge.lv1 { background: var(--lv1); color: var(--lv1-c); }
  .erm-badge.lv2 { background: var(--lv2); color: var(--lv2-c); }
  .erm-badge.lv3 { background: var(--lv3); color: var(--lv3-c); }
  .erm-badge.lv4 { background: var(--lv4); color: var(--lv4-c); }
  .erm-badge.lv5 { background: var(--lv5); color: var(--lv5-c); }

  /* ---------- 宜忌查询（移动端新面板） ---------- */
  .inquiry-search {
    display: flex; align-items: center; gap: 8px;
    padding: 0 14px;
    height: 40px;
    background: #fff;
    border: 1px solid rgba(181,67,44,0.12);
    border-radius: 24px;
  }
  .inquiry-search svg { flex: none; }
  .inquiry-search input {
    flex: 1; min-width: 0;
    border: none; outline: none; background: transparent;
    font-size: 13px;
    color: var(--ink);
  }
  .inquiry-search input::placeholder { color: #9C8E73; }

  .inquiry-filter {
    display: flex;
    background: var(--mob-card-bg);
    border: 1px solid rgba(181,67,44,0.08);
    border-radius: 22px;
    padding: 4px;
    gap: 0;
  }
  .if-chip {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--ink-soft);
    border-radius: 18px;
    cursor: pointer;
  }
  .if-chip.active {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    font-weight: 700;
  }

  .inquiry-meta {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 4px;
    font-size: 12px;
    color: var(--ink-soft);
  }
  .inquiry-meta .im-left { font-weight: 700; color: var(--ink); font-size: 14px; }
  .inquiry-meta .im-right b { color: var(--red-deep); font-size: 13px; }

  .inquiry-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(181,67,44,0.1);
    margin-bottom: 8px;
  }
  .inquiry-card.inquiry-ji {
    background: linear-gradient(135deg, #FBEAE6 0%, #FCEFE9 100%);
    border-color: rgba(181,67,44,0.15);
  }
  .inquiry-card.inquiry-mid {
    background: linear-gradient(135deg, #FBF6EC 0%, #F6EDDB 100%);
    border-color: rgba(91,140,133,0.2);
  }
  .ic-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
  }
  .ic-name {
    font-family: "Noto Serif SC", serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
  }
  .ic-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
  }
  .ic-badge-yi { background: var(--lv2); }
  .ic-badge-ji { background: var(--lv5); }
  .ic-badge-mid { background: var(--lv3); }
  .ic-desc {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.6;
    margin-bottom: 6px;
  }
  .ic-dates {
    font-size: 12px;
    color: var(--lv2);
    font-weight: 600;
    margin-top: 4px;
  }
  .ic-dates-avoid { color: var(--lv5); }

  /* 字体大小 */
  body.font-large .wrap { font-size: 16px; }
  body.font-xlarge .wrap { font-size: 18px; }

  /* 4 项 Tab Bar 保持均分 */
  .mob-tab-item { flex: 1; }
}

/* ==========================================================================
   多终端比例适配
   ① 超小屏 Android  ② 大屏手机/平板竖屏  ③ 横屏  ④ 平板  ⑤ 高DPR  ⑥ 减弱动效
   ========================================================================== */

/* ① 超小屏（≤360px：Galaxy 旧款、iPhone SE 一代等） */
@media (max-width: 360px) {
  :root {
    --mob-gutter: 10px;
    --mob-gap: 8px;
    --mob-pad: 11px;
    --mob-fs-hero: 42px;
  }
  .mob-statusbar { padding-bottom: 6px; }
  .mob-statusbar .row { height: 12px; }
  .mob-tabbar { padding-left: 2px; padding-right: 2px; }
  .mob-tab-item .label { letter-spacing: -0.2px; }
  /* 神位方位：5 列在 ≤360px 挤，降为 3 列换行 */
  .pos-mob .pm-grid5 { grid-template-columns: repeat(3, 1fr); }
  .zxx-mob .zx-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .zxx-mob .zx-val { font-size: 13px; }
}

/* ② 大屏手机 / 平板竖屏（430–768px）：内容限宽居中，避免被拉伸变形 */
@media (min-width: 430px) and (max-width: 768px) {
  .panel > .wrap-inner { max-width: 560px; }
  .daily-hero-mob .dh-day { font-size: clamp(56px, 12vw, 72px); }
}

/* ③ 横屏（可视高度 ≤560px）：压缩状态栏与 Tab Bar，保证内容可见 */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 960px) {
  :root {
    --js-safe-top: 20px;
    --js-safe-bottom: 0px;
    --safe-top: max(var(--js-safe-top, 20px), env(safe-area-inset-top, 0px));
    --safe-bottom: max(var(--js-safe-bottom, 0px), env(safe-area-inset-bottom, 0px));
    --mob-statusbar-h: calc(38px + env(safe-area-inset-top, 0px));
    --mob-tabbar-h: calc(40px + env(safe-area-inset-bottom, 0px));
    --mob-gutter: 12px;
    --mob-gap: 8px;
    --mob-fs-title: 14px;
    --mob-fs-hero: 40px;
  }
  .mob-statusbar { padding-bottom: 4px; }
  .mob-statusbar .row { height: 12px; }
  .mob-statusbar .title { margin-top: 0; }
  .mob-tabbar { padding-bottom: calc(2px + var(--safe-bottom)); }
  .mob-tab-item { flex-direction: row; gap: 5px; }
  .mob-tab-item .icon-box { width: 18px; height: 18px; }
  .wrap { padding-bottom: calc(var(--mob-tabbar-h) + 10px + var(--safe-bottom)) !important; }
  .hour-list-body { display: grid; grid-template-columns: repeat(2, 1fr); }
}

/* ④ 平板 / 桌面小窗（769–1024px）：桌面布局但收紧两侧留白 */
@media (min-width: 769px) and (max-width: 1024px) {
  .wrap {
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
  }
  .hero .solar-big { font-size: 30px; }
}

/* ⑤ 高 DPR 屏：1px 边框在 2x/3x 下加粗会显脏，压到 0.5px */
@media (-webkit-min-device-pixel-ratio: 2) and (max-width: 768px) {
  .hour-item, .hlt-chip, .emc-chip, .if-chip { border-width: 0.5px; }
}

/* ⑥ 尊重系统「减弱动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============ 移动端深色模式（不污染桌面端） ============ */
body.dark-mode {
  --mob-content-bg: #1C1814;
  --mob-card-bg: #28211A;
  --paper: #1C1814;
  --paper-50: #14110D;
  --paper-100: #28211A;
  --ink: #F7F2E7;
  --ink-soft: #A99B86;
  --red: #E06A50;          /* 深色底上的朱砂需提亮 */
  --red-deep: #C74E38;
  --red-soft: rgba(224,106,80,0.14);
  --gold: #D9A855;
  --gold-soft: #E8B45C;
  /* 深色模式评级配色（对齐 mastersung.com 传统黄历风格） */
  --lv1: #E06A50;   --lv1-lt: #E88A70;   /* 大吉 · 深色朱砂红（提亮版） */
  --lv2: #E06A50;   --lv2-lt: #E88A70;   /* 中吉 · 同大吉（深色也统一红） */
  --lv3: #C4A070;   --lv3-lt: #D4B88A;   /* 平日 · 暖金（mastersung #C4A070） */
  --lv4: #A89DB8;   --lv4-lt: #B8AEC8;   /* 小凶 · 暗紫（提亮） */
  --lv5: #B8B8C0;   --lv5-lt: #C8C8D0;   /* 不吉 · 浅灰（mastersung #333 提亮） */
  --line: rgba(247,242,231,0.12);
}
body.dark-mode .mob-statusbar { background: #0E0908; }
body.dark-mode .mob-tabbar { background: #0E0908; }
body.dark-mode .panel#settings { background: var(--mob-content-bg); }
body.dark-mode .settings-group,
body.dark-mode .settings-hero {
  background: var(--mob-card-bg);
  border-color: rgba(246,237,214,0.08);
}
body.dark-mode .hour-pos-item {
  background: #1F1812;
  border-color: rgba(242,200,121,0.15);
}
body.dark-mode .hour-item {
  background: var(--mob-card-bg);
  color: var(--ink);
}
body.dark-mode .hour-item.current {
  background: rgba(242,200,121,0.12);
  border-color: rgba(242,200,121,0.4);
}
body.dark-mode .hlt-chip {
  background: rgba(246,237,214,0.06);
  border-color: rgba(246,237,214,0.18);
  color: var(--ink-soft);
}
body.dark-mode .hlt-chip.active {
  background: linear-gradient(135deg, #E0705A 0%, #C74E38 100%);
  border-color: #C74E38;
  color: #FFF6F0;
}
body.dark-mode .hour-list-body .empty-mini {
  background: rgba(246,237,214,0.04);
  border-color: rgba(246,237,214,0.16);
}
body.dark-mode .daily-hero-mob .dh-top {
  border-bottom-color: rgba(246,237,214,0.16);
}
body.dark-mode .daily-hero-mob .dh-day-type {
  background: rgba(242,200,121,0.10);
  border-color: rgba(242,200,121,0.32);
  color: #E3AE55;
}
body.dark-mode .daily-hero-mob .dh-day-type.lv1 {  /* 大吉 · 朱砂红 */
  color: #FFB3B3;
  background: rgba(200,16,46,0.16);
  border-color: rgba(200,16,46,0.42);
}
body.dark-mode .daily-hero-mob .dh-day-type.lv2 {  /* 中吉 · 珊瑚橙 */
  color: #FFCBA4;
  background: rgba(232,93,74,0.14);
  border-color: rgba(232,93,74,0.36);
}
body.dark-mode .daily-hero-mob .dh-day-type.lv3 {  /* 平日 · 石青 */
  color: #A8C5B0;
  background: rgba(91,140,133,0.16);
  border-color: rgba(91,140,133,0.40);
}
body.dark-mode .daily-hero-mob .dh-day-type.lv5 {  /* 不吉 · 玄灰 */
  color: #B8B8C0;
  background: rgba(74,74,85,0.22);
  border-color: rgba(74,74,85,0.46);
}
/* 通胜 / 择日 / 宜忌 卡片深色 */
body.dark-mode .daily-hero-mob .dh-day { color: #E3AE55; }
body.dark-mode .daily-hero-mob .chip { background: rgba(246,237,214,0.06); border-color: rgba(246,237,214,0.12); }
body.dark-mode .yj-mob .yj-col.yi { background: var(--mob-card-bg); border-color: rgba(232,93,74,0.25); }
body.dark-mode .yj-mob .yj-col.ji { background: var(--red-soft); border-color: rgba(224,106,80,0.25); }
body.dark-mode .yj-mob .yj-tag { color: var(--lv2); background: rgba(232,93,74,0.08); }
body.dark-mode .yj-mob .yj-tag.ji { color: var(--ink); background: rgba(224,106,80,0.10); border-color: rgba(224,106,80,0.30); }
body.dark-mode .yj-mob .ji .empty-mini { color: rgba(247,242,231,0.6); }
body.dark-mode .pos-mob .pm-cell { background: rgba(246,237,214,0.04); border-color: rgba(246,237,214,0.1); }
body.dark-mode .pos-mob .pm-val { color: #E3AE55; }
body.dark-mode .pos-mob .pm-hint { color: #E3AE55; }
/* 通胜页补齐区块：深色模式配色 */
body.dark-mode .chong-mob { background: rgba(181,67,44,0.14) !important; border-color: rgba(232,154,120,0.28) !important; }
body.dark-mode .chong-mob .cm-main { color: #E3AE55; }
body.dark-mode .taboo-mob { background: rgba(181,67,44,0.16) !important; border-color: rgba(232,154,120,0.35) !important; }
body.dark-mode .taboo-mob .tb-text { color: #F2A5A0; }
body.dark-mode .shen-mob .sm-title,
body.dark-mode .zxx-mob .zx-title,
body.dark-mode .pz-mob .pz-title { color: #E3AE55; }
body.dark-mode .shen-mob .sm-tag.good { color: var(--lv2); background: rgba(232,93,74,0.12); }
body.dark-mode .shen-mob .sm-tag.bad { color: #E68B85; background: rgba(181,67,44,0.14); }
body.dark-mode .zxx-mob .zx-cell { background: rgba(246,237,214,0.04); border-color: rgba(246,237,214,0.1); }
body.dark-mode .zxx-mob .zx-val { color: #E3AE55; }
body.dark-mode .zxx-mob .zx-song { color: var(--ink-soft); border-top-color: rgba(246,237,214,0.1); }
body.dark-mode .pz-mob .pz-rule { color: #E3AE55; }
body.dark-mode .pz-mob .pz-line + .pz-line { border-top-color: rgba(246,237,214,0.1); }
body.dark-mode .jq-mob .jq-text { color: #E3AE55; }
body.dark-mode .daily-hero-mob .chip-yx { color: #8FC0DA; background: rgba(143,192,218,0.10); border-color: rgba(143,192,218,0.22); }
body.dark-mode .daily-hero-mob .chip-ly { color: #B79ADA; background: rgba(183,154,218,0.10); border-color: rgba(183,154,218,0.22); }
body.dark-mode .daily-hero-mob .chip-ny { color: #E3AE55; background: rgba(217,183,120,0.10); border-color: rgba(217,183,120,0.22); }
body.dark-mode .erm-item { background: var(--mob-card-bg); border-color: rgba(246,237,214,0.08); }
  /* erm-t3 各档颜色沿用浅色 per-tier 规则（.erm-t3.lv1/lv2 用 --lv1/--lv2），深色经变量区分 */
body.dark-mode .emc-chip { background: var(--mob-card-bg); border-color: rgba(246,237,214,0.18); color: var(--ink); }
body.dark-mode .emc-range input[type=date] { background: var(--mob-card-bg); color: var(--ink); border-color: rgba(246,237,214,0.18); }
body.dark-mode .emp-chip { background: var(--mob-card-bg); border-color: rgba(246,237,214,0.18); color: var(--ink-soft); }
body.dark-mode .inquiry-search { background: var(--mob-card-bg); border-color: rgba(246,237,214,0.12); }
body.dark-mode .inquiry-search input { color: var(--ink); }
body.dark-mode .inquiry-card { background: var(--mob-card-bg); border-color: rgba(246,237,214,0.08); }
body.dark-mode .inquiry-card.inquiry-ji { background: linear-gradient(135deg, #3A1F1F 0%, #2B1717 100%); }
body.dark-mode .inquiry-card.inquiry-mid { background: linear-gradient(135deg, #3A2E1E 0%, #2B2418 100%); }
body.dark-mode .ic-dates { color: var(--lv2); }
body.dark-mode .ic-dates-avoid { color: #E68B85; }

/* 移动端专用初始隐藏（mob-only 由 @media 内部显隐控制，这里不要全局 hide） */
.mob-statusbar, .mob-tabbar { display: none; }
/* 桌面端默认隐藏移动端独有元素 */
.mob-only { display: none; }

/* ============ 移动端底部弹层 / 轻提示 ============ */
/* 注意：默认 display:none 必须写在 @media 之前，靠源码顺序保证桌面端彻底隐藏 */
.mob-sheet-mask, .mob-sheet, .mob-toast { display: none; }

@media (max-width: 768px), (orientation: landscape) and (max-height: 560px) and (max-width: 900px) {
  .mob-sheet-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(28, 22, 14, 0.45);
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .mob-sheet-mask.open { opacity: 1; pointer-events: auto; }

  .mob-sheet {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9001;
    background: var(--paper-2);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 32px rgba(80, 40, 20, 0.18);
    padding: 8px 18px calc(14px + var(--safe-bottom));
    box-sizing: border-box;
    transform: translateY(101%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 78vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mob-sheet.open { transform: translateY(0); }
  .mob-sheet .ms-handle {
    width: 38px; height: 4px; border-radius: 2px;
    background: rgba(107, 91, 69, 0.28);
    margin: 2px auto 12px;
  }
  .mob-sheet .ms-title {
    font-size: 16px; font-weight: 700; color: var(--ink);
    margin: 0 0 10px; letter-spacing: 0.3px;
  }
  .mob-sheet .ms-body {
    font-size: 14px; line-height: 1.75; color: var(--ink-soft);
    margin-bottom: 16px; white-space: pre-line;
  }
  .mob-sheet .ms-body b { color: var(--ink); font-weight: 600; }
  .mob-sheet .ms-actions { display: flex; gap: 10px; }
  .mob-sheet .ms-btn {
    flex: 1;
    -webkit-appearance: none; appearance: none;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    border-radius: 12px;
    padding: 12px 10px;
    font-size: 15px; font-weight: 600;
    font-family: inherit;
    touch-action: manipulation;
    cursor: pointer;
  }
  .mob-sheet .ms-btn:active { transform: scale(0.98); }
  .mob-sheet .ms-btn.primary {
    background: var(--red); border-color: var(--red); color: #fff8ea;
  }
  .mob-sheet .ms-btn.hidden { display: none; }
  .mob-sheet .ms-btn.hidden + .ms-btn { flex: 1; }

  .mob-toast {
    display: block;
    position: fixed;
    left: 50%;
    bottom: calc(var(--mob-tabbar-h) + 20px + var(--safe-bottom));
    z-index: 9500;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    background: rgba(28, 22, 14, 0.9);
    color: #fff6e6;
    font-size: 14px; line-height: 1.5;
    padding: 10px 16px;
    border-radius: 999px;
    max-width: 78vw;
    text-align: center;
    box-shadow: 0 6px 20px rgba(28, 22, 14, 0.28);
  }
  .mob-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* ---- v65 节日日历弹层（法定/佛教/道教）---- */
  .fcal-sheet { z-index: 9100; padding-bottom: calc(16px + var(--safe-bottom)); }
  .fcal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 2px 0 10px;
  }
  .fcal-ym { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: 0.5px; }
  .fcal-nav {
    width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: 50%;
    background: var(--paper); color: var(--ink);
    font-size: 20px; line-height: 1;
    font-family: inherit;
    touch-action: manipulation; cursor: pointer;
  }
  .fcal-nav:active { transform: scale(0.94); }
  .fcal-weeks {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 12px; color: var(--ink-soft);
    margin-bottom: 4px;
  }
  .fcal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    row-gap: 6px;
    grid-auto-rows: minmax(68px, auto);
  }
  .fcal-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 68px; height: auto;
    padding: 4px 0;
    border-radius: 12px;
    font-size: 15px; color: var(--ink);
    touch-action: manipulation; cursor: pointer;
    position: relative;
  }
  .fcal-day b { font-weight: 500; line-height: 1.2; }
  .fcal-day.empty { visibility: hidden; pointer-events: none; }
  .fcal-day.today b { color: var(--red); font-weight: 700; }
  .fcal-day.sel {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(140, 45, 25, 0.25);
  }
  .fcal-day.sel b { color: #fff; font-weight: 700; }
  .fcal-sub {
    font-size: 9px; line-height: 1.25;
    margin-top: 2px; max-width: 92%;
    max-height: 23px;
    overflow: hidden;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
  }
  .fcal-sub.legal { color: var(--red); }
  .fcal-sub.buddhist { color: #C79A3B; }
  .fcal-sub.taoist { color: #2E7D8C; }
  .fcal-sub.jieqi { color: #2E7D8C; }
  .fcal-sub.lunar { color: var(--ink-soft); }
  .fcal-sub.trad { color: #8D6E63; }
  .fcal-sub.sacri { color: #7E57C2; }
  .fcal-day.sel .fcal-sub { color: rgba(255, 255, 255, 0.95); }
  .fcal-rest {
    position: absolute;
    top: 2px; right: 2px;
    font-size: 9px; line-height: 1;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--red);
    color: #fff;
  }
  .fcal-day.sel .fcal-rest { background: rgba(255, 255, 255, 0.9); color: var(--red); }
  .fcal-dots { display: flex; gap: 3px; margin-top: 2px; height: 5px; }
  .fcal-dot {
    display: inline-block;
    width: 5px; height: 5px; border-radius: 50%;
  }
  .fcal-dot.legal { background: var(--red); }
  .fcal-dot.buddhist { background: #C79A3B; }
  .fcal-dot.taoist { background: #2E7D8C; }
  .fcal-dot.trad { background: #8D6E63; }
  .fcal-dot.sacri { background: #7E57C2; }
  .fcal-day.sel .fcal-dot.legal,
  .fcal-day.sel .fcal-dot.buddhist,
  .fcal-day.sel .fcal-dot.taoist,
  .fcal-day.sel .fcal-dot.trad,
  .fcal-day.sel .fcal-dot.sacri { background: rgba(255, 255, 255, 0.9); }
  .fcal-festtext {
    min-height: 20px;
    font-size: 12.5px; line-height: 1.5;
    color: var(--ink-soft);
    margin: 8px 0 6px;
  }
  .fcal-legend {
    display: flex; gap: 14px;
    font-size: 11.5px; color: var(--ink-soft);
    margin-bottom: 12px;
  }
  .fcal-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .fcal-actions .ms-btn { flex: 1; }
  /* v67：覆盖层精确盖住原生 date input，pointer-events 拦截让自定义日历弹出 */
  .fcal-overlay {
    position: absolute;
    z-index: 20;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }
}

/* 深色模式下的弹层配色 */
body.dark-mode .mob-sheet { background: var(--mob-card-bg); }
body.dark-mode .mob-sheet .ms-title { color: var(--ink); }
body.dark-mode .mob-sheet .ms-body { color: var(--ink-soft); }
body.dark-mode .mob-sheet .ms-btn { background: rgba(246, 237, 214, 0.08); border-color: rgba(246, 237, 214, 0.18); color: var(--ink); }
body.dark-mode .mob-sheet .ms-btn.primary { background: var(--red); border-color: var(--red); color: #fff8ea; }
body.dark-mode .mob-sheet .ms-handle { background: rgba(246, 237, 214, 0.28); }
body.dark-mode .mob-sheet-mask { background: rgba(0, 0, 0, 0.65); }

@media (prefers-reduced-motion: reduce) {
  .mob-sheet, .mob-sheet-mask, .mob-toast { transition: none !important; }
}

.panel.no-animation { animation: none !important; }

/* ============================================================
 * 桌面端吉凶等级配色 · 红橙青灰四档（v83 · 用户指定 2026-09-05）
 *   大吉 lv1 → #C8102E 朱砂红
 *   中吉 lv2 → #E85D4A 珊瑚橙
 *   平日 lv3 → #5B8C85 石青色
 *   不吉 lv5 → #4A4A55 玄灰色
 *   小凶 lv4 暗紫沿用旧值
 * 仅桌面端（≥769px）生效；手机端仍走原 :root / body.dark-mode 配色不动
 * （媒体查询排除手机 → 移动端 `--lv*` 不会被本块改写）
 * ============================================================ */
@media (min-width: 769px) {
  :root,
  body.dark-mode {
    --lv1: #C8102E;       /* 大吉 · 朱砂红 */
    --lv1-lt: #D8344A;    /* 亮端：偏暖的浅朱砂 */
    --lv1-c: #FFD700;     /* 金字（朱砂红底配金字，传统黄历风） */
    --lv2: #E85D4A;       /* 中吉 · 珊瑚橙 */
    --lv2-lt: #F0806E;    /* 亮端：更浅珊瑚 */
    --lv2-c: #FFFFFF;     /* 白字 */
    --lv3: #5B8C85;       /* 平日 · 石青色 */
    --lv3-lt: #7BA098;    /* 亮端（沿用移动端 hero 渐变已选值） */
    --lv3-c: #FFFFFF;     /* 白字 */
    --lv5: #4A4A55;       /* 不吉 · 玄灰色 */
    --lv5-lt: #6B6B78;    /* 亮端 */
    --lv5-c: #FFFFFF;     /* 白字 */
    /* lv4 暗紫（衔接中吉↔不吉）保持原值不变 */
  }
  /* 桌面端 .erm-t3.lv3（择日候选行副文本）跟进新 lv3 石青，旧硬编码 #3D5C55 与新调色板不齐 */
  .erm-t3.lv3 { color: var(--lv3); }
}