/* 大六壬 —— 课纸。
   整页一张纸，不用卡片、不用阴影、不用圆角；分节靠墨线，主字靠字号与朱色。
   :root 变量名沿用旧版，js 里内联样式依赖它们。 */
:root {
  --ink: #1e1913;
  --ink-2: #5c4d3d;
  --ink-3: #94836e;
  --paper: #f2ecdf;
  --paper-2: #f7f2e7;
  --line: rgba(30, 25, 19, .13);
  --line-2: rgba(30, 25, 19, .30);
  --zhu: #8c2015;
  --zhu-2: #a8382a;
  --jin: #8a6f3c;
  --kong: #94836e;
  --qing: #3b6a5f;
  --tap: 44px;
}

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

html { min-height: 100%; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 顶栏 ---------- */
.rail {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 11px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.rail-brand {
  font-size: 14.5px; font-weight: 600; letter-spacing: .3em; text-indent: .3em;
  color: var(--ink);
}
.rail-btn {
  background: none; border: 0; padding: 0;
  /* 点击区 44，但用负 margin 把它压回原来的行高，别把顶栏撑高一倍 */
  min-height: 44px; margin: -8px 0; display: inline-flex; align-items: center;
  font-family: inherit; font-size: 11.5px; letter-spacing: .16em;
  color: var(--ink-3); cursor: pointer;
}
.rail-btn b {
  font-weight: 400; margin-left: 5px;
  font-variant-numeric: tabular-nums;
}
.rail-btn:active { color: var(--zhu); }

.sheet {
  max-width: 560px; margin: 0 auto;
  padding: 0 16px 44px;
}

/* ---------- 课头 ---------- */
.kep {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 0 13px;
  border-bottom: 1px solid var(--line);
}
.kep-when {
  position: relative; min-width: 0;
  background: none; border: 0; padding: 2px 15px 2px 0;
  text-align: left; font-family: inherit; cursor: pointer; color: inherit;
}
.kep-when b {
  display: block;
  font-size: 15px; font-weight: 600; letter-spacing: .04em; line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* 箭头跟着日期文字走，别浮在行尾 */
.kep-when b::after {
  content: ""; display: inline-block; vertical-align: 2px;
  margin-left: 7px; width: 0; height: 0;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid var(--ink-3);
}
.kep-when.open b::after { transform: rotate(180deg); vertical-align: -1px; }
.kep-when span {
  display: block; margin-top: 3px;
  font-size: 10.5px; color: var(--ink-3); letter-spacing: .1em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kep-ops { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.kep-cast {
  min-height: 38px; padding: 0 18px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 0;
  font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: .2em; text-indent: .2em;
  cursor: pointer;
}
.kep-cast:active { background: #000; }
/* 复制不是页面的主视觉，用朱色细框就够了，别做成通栏横幅 */
.ai-btn {
  min-height: 38px; padding: 0 12px;
  background: transparent; color: var(--zhu);
  border: 1px solid rgba(140, 32, 21, .42);
  font-family: inherit; font-size: 11.5px; letter-spacing: .08em;
  cursor: pointer;
}
.ai-btn:active { background: rgba(140, 32, 21, .07); }

/* ---------- 参数面板 ---------- */
.kep-panel { padding: 6px 0 14px; border-bottom: 1px solid var(--line); }
.fld { display: block; margin-bottom: 14px; }
.fld > span {
  display: block; margin-bottom: 4px;
  font-size: 10px; color: var(--ink-3); letter-spacing: .26em;
}
.fldrow { display: grid; grid-template-columns: 1fr 1fr 84px; gap: 12px; }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], select {
  width: 100%; min-height: 34px;
  padding: 3px 0; font-size: 15px; font-family: inherit;
  color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0;
  outline: none; appearance: none;
}
input::placeholder { color: #b8a894; }
input:focus, select:focus { border-bottom-color: var(--zhu); }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 8px) 15px, calc(100% - 3px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 18px;
}
.nm-fld input { letter-spacing: .1em; }

.kep-foot {
  display: flex; align-items: center; gap: 12px;
  margin-top: 2px;
}
.kep-note { font-size: 10.5px; color: #ab9b86; letter-spacing: .04em; }
.kep-hint { display: block; margin: 7px 0 0; line-height: 1.6; }

/* ---------- 按钮 ---------- */
button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 0;
  background: transparent; color: var(--ink-2);
  min-height: 34px; padding: 0 12px;
}
button:active { opacity: .7; }
.ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
/* 面板里的次要动作：只有字，别做成又一个按钮框 */
.kep-foot .ghost {
  border: 0; padding: 0; min-height: 26px;
  font-size: 11px; color: var(--ink-2); letter-spacing: .08em;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-2); text-decoration-thickness: 1px;
}
.mini {
  min-height: 30px; padding: 0 9px;
  font-size: 11px; letter-spacing: .1em; color: var(--ink-3);
}

/* ---------- 起课信息 ---------- */
.card { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
.lede { margin-bottom: 6px; }

.pillars {
  display: flex; align-items: stretch;
  padding-bottom: 14px;
}
.pillars .pl {
  position: relative; flex: 1 1 0; min-width: 0; text-align: center;
}
.pillars .pl + .pl::before {
  content: ""; position: absolute; left: 0; top: 16%; height: 68%;
  width: 1px; background: var(--line);
}
.pillars .pl b {
  display: block; font-size: 21px; font-weight: 600;
  letter-spacing: .02em; line-height: 1.3; color: var(--ink);
}
.pillars .pl span {
  display: block; margin-top: 3px;
  font-size: 9px; color: var(--ink-3); letter-spacing: .3em; text-indent: .3em;
}
.pillars .pl.yj b { color: var(--zhu); }

.meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
  padding-top: 13px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-2);
}
.meta-grid div { display: flex; gap: 7px; min-width: 0; }
.meta-grid i { flex: 0 0 auto; font-style: normal; color: var(--ink-3); letter-spacing: .12em; }
.meta-grid b {
  font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.men-line {
  display: inline-block; vertical-align: top;
  margin: 10px 20px 0 0;
  font-size: 11px; color: var(--ink-3); letter-spacing: .04em;
}
.men-line .v { color: var(--ink-2); font-weight: 600; }
.men-line .warn { color: var(--zhu); font-weight: 600; }
/* 年命行带行年，字数多，独占一行，别跟占类挤在一起 */
#benmingLine:not([hidden]) { display: block; margin-right: 0; }

.notes { margin-top: 8px; }
.notes p {
  margin: 3px 0 0; font-size: 10.5px; line-height: 1.6;
  color: #a2927d; letter-spacing: .02em;
}
.notes p::before { content: "· "; }
.notes p.bad { color: var(--zhu); }
.notes p.warn { color: #8a6410; }

/* ---------- 分节 ---------- */
.sec { margin-top: 30px; }
.sec-hd {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 13px;
}
.sec-hd h2 {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: .3em; color: var(--zhu);
}
.sec-hd h2::before { content: "—"; margin-right: 6px; letter-spacing: 0; }
.sec-hd .sub { font-size: 10px; color: var(--ink-3); letter-spacing: .1em; }


/* ---------- 天地盘 ---------- */
.pan {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 0;
  aspect-ratio: 1 / 1; width: 100%; max-width: 420px; margin: 0 auto;
  border-top: 1px solid var(--line-2);
  border-left: 1px solid var(--line-2);
  cursor: zoom-in;
}
.cell {
  position: relative; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px 1px; overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cell.mid {
  grid-column: 2 / 4; grid-row: 2 / 4;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  padding: 0; background: rgba(140, 32, 21, .026);
}
.cell.mid .mq {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px; min-width: 0;
  border-right: 1px solid rgba(30,25,19,.08); border-bottom: 1px solid rgba(30,25,19,.08);
}
.cell.mid .mq:nth-child(2n) { border-right: 0; }
.cell.mid .mq:nth-child(n+3) { border-bottom: 0; }
.cell.mid .mq b { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: .02em; }
.cell.mid .mq i { font-size: 8.5px; font-style: normal; color: var(--ink-3); letter-spacing: .18em; text-indent: .18em; }

.jiang {
  max-width: 100%; white-space: nowrap; overflow: hidden;
  font-size: 9.5px; color: var(--jin); letter-spacing: .06em;
  line-height: 1.2; height: 12px;
}
.sky {
  font-size: 29px; font-weight: 600; line-height: 1.1;
  letter-spacing: 0; margin: 1px 0; color: var(--ink);
}
.lq {
  max-width: 100%; white-space: nowrap; overflow: hidden;
  font-size: 8.5px; color: var(--qing); line-height: 1.2; height: 11px;
  opacity: .9;
}
.earth { font-size: 10px; color: var(--ink-3); line-height: 1.2; letter-spacing: .04em; }

.cell.kong .sky { color: #a4937d; }
.cell.kong::after {
  content: ""; position: absolute; top: 5px; left: 5px;
  width: 4px; height: 4px; border-radius: 50%; background: #a4937d;
}
.cell.has-chuan .sky { color: var(--zhu); }
.tag-c {
  position: absolute; top: 5px; right: 5px;
  font-size: 8.5px; line-height: 1.3; color: var(--zhu);
  font-weight: 600; opacity: .85;
}
.pan.simple .lq, .pan.simple .jiang { display: none; }
.pan.simple .sky { font-size: 32px; }

.legend {
  position: relative;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 4px 14px;
  margin: 10px 0 0; min-height: 44px;
  font-size: 9.5px; color: #ab9b86; letter-spacing: .12em;
}
/* 「简/详」不占标题行：放在图例右端，绝对定位，视觉上只有一个字 */
.legend .mini {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 0 2px;
  min-height: 44px; font-size: 10px; letter-spacing: .14em; color: var(--ink-2);
}

/* ---------- 三传 ---------- */
.chuan { display: grid; grid-template-columns: repeat(3, 1fr); }
.ch {
  position: relative; padding: 3px 6px 5px; text-align: center;
  border-left: 1px solid var(--line);
}
.ch:first-child { border-left: 0; }
.ch .pos { font-size: 9px; color: var(--ink-3); letter-spacing: .26em; text-indent: .26em; }
.ch .zhi {
  font-size: 29px; font-weight: 600; line-height: 1.15; color: var(--ink);
  margin: 1px 0 3px;
}
.ch.first .zhi { color: var(--zhu); }
.ch .row2 { font-size: 10.5px; color: var(--ink-2); line-height: 1.5; }
.ch .row2 em { font-style: normal; color: var(--jin); }
.ch .dd { font-size: 9.5px; color: var(--ink-3); line-height: 1.45; margin-top: 2px; }
.ch .kong-tag {
  position: absolute; bottom: 1px; right: 5px;
  font-size: 8px; color: #ab9b86; border: 0; background: none; padding: 0;
  letter-spacing: .06em;
}

.why { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.why summary {
  font-size: 10.5px; color: var(--ink-3); cursor: pointer; letter-spacing: .14em;
  list-style: none;
}
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: "＋ "; }
.why[open] summary::before { content: "－ "; }
.why ol, .why ul { margin: 6px 0 0; padding-left: 17px; }
.why li { font-size: 11px; color: var(--ink-2); line-height: 1.7; }

/* ---------- 四课 ---------- */
.sike { display: block; border-top: 1px solid var(--line); }
.sk {
  display: grid; grid-template-columns: 46px 46px minmax(0, 1fr);
  gap: 10px; align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.sk:last-child { border-bottom: 0; padding-bottom: 2px; }
.sk .nm { font-size: 9px; color: var(--ink-3); letter-spacing: .1em; line-height: 1.5; }
.sk .up { font-size: 21px; font-weight: 600; line-height: 1.2; }
.sk .up small { font-size: 9.5px; color: var(--ink-3); font-weight: 400; margin-left: 2px; }
.sk .info { font-size: 11px; color: var(--ink-2); line-height: 1.55; }
.sk .info b { font-weight: 600; color: var(--ink); }
.sk .info em { font-style: normal; color: var(--jin); }
.sk .info .dn-tag {
  font-style: normal; font-size: 9px; color: var(--ink-3); letter-spacing: 0;
}
.sk.kong .up { color: var(--ink-3); }

/* ---------- 底部操作 ---------- */
.actions {
  display: flex; justify-content: center; align-items: center;
  gap: 4px; flex-wrap: wrap;
  margin-top: 34px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.actions .mini {
  background: none; border: 0; min-height: 34px; padding: 0 8px;
  font-size: 10.5px; letter-spacing: .12em; color: var(--ink-3);
}

/* ---------- 抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-mask { position: absolute; inset: 0; background: rgba(30, 25, 19, .52); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(88vw, 360px);
  background: var(--paper);
  border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.drawer-hd h3 { margin: 0; font-size: 12px; letter-spacing: .3em; font-weight: 600; }
.drawer-hd .ghost {
  border: 0; padding: 0; min-height: 26px;
  font-size: 11px; color: var(--ink-3); letter-spacing: .14em;
}
.arch-list { flex: 1; overflow-y: auto; padding: 6px 14px 30px; }
.arch-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.arch-item .t { font-size: 9.5px; color: var(--ink-3); letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.arch-item .q { font-size: 13.5px; color: var(--ink); font-weight: 600; margin: 3px 0; line-height: 1.5; }
.arch-item .q.mute { font-weight: 400; color: var(--ink-3); }
.arch-item .d { font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.arch-item .ops { display: flex; gap: 18px; margin-top: 9px; }
/* 档案里的动作是文字链，不是按钮：一列按钮会把列表撑得像后台表单 */
.arch-item .ops button {
  min-height: 30px; padding: 0; border: 0; background: none;
  font-size: 11px; letter-spacing: .1em; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-2); text-decoration-thickness: 1px;
}
.arch-item .ops button + button { color: #a2927d; }
.arch-empty { text-align: center; color: var(--ink-3); font-size: 11.5px; padding: 60px 0; letter-spacing: .1em; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(30, 25, 19, .93); color: #f7f0e2;
  padding: 9px 18px; font-size: 12.5px; letter-spacing: .06em;
  z-index: 99; animation: fadeUp .2s;
  max-width: 86vw; text-align: center;
}

/* 版本更新提示条 */
.upd-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(30, 25, 19, .97); color: #f7f0e2;
  font-size: 12.5px; letter-spacing: .06em; cursor: pointer;
  animation: fadeUp .2s;
}
.upd-bar .upd-x {
  background: transparent; border: 0; color: inherit; font-size: 15px;
  padding: 0 6px; min-height: 26px; line-height: 1; opacity: .75;
}
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fadeOutBar { to { opacity: 0; transform: translateY(12px); } }

/* ---------- 盘面全屏 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(24, 19, 15, .96);
  display: flex; align-items: center; justify-content: center;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  animation: fadeIn .14s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox .lb-inner {
  width: 100%; max-width: min(94vw, 720px);
  background: var(--paper-2);
  padding: 14px;
}
/* 字号跟格子走，不跟视口走：容器查询单位 cqw */
.lightbox .pan {
  max-width: min(100%, calc(100dvh - 200px));
  container-type: inline-size;
}
.lightbox .jiang { font-size: 3.6cqw; height: 4.2cqw; line-height: 1.1; }
.lightbox .sky { font-size: 10.2cqw; line-height: 1.06; margin: 0.4cqw 0; }
.lightbox .lq { font-size: 3.2cqw; height: 3.8cqw; line-height: 1.1; }
.lightbox .earth { font-size: 3.8cqw; line-height: 1.1; }
.lightbox .cell.mid .mq b { font-size: 5.4cqw; }
.lightbox .cell.mid .mq i { font-size: 2.8cqw; }
.lightbox .cell.mid .mq { font-size: 3.2cqw; }
.lightbox .cell { padding: 1px; }
.lightbox .tag-c { font-size: 3cqw; }
.lightbox .cell { cursor: pointer; }
.lightbox .cell.sel {
  outline: 2px solid var(--zhu); outline-offset: -2px;
  background: rgba(140, 32, 21, .07);
}

/* 逐宫详情 */
.lv-detail {
  margin-top: 8px; padding: 10px 12px; min-height: 76px;
  border-top: 1px solid var(--line-2);
}
.lv-detail .dv-hd { font-size: 9.5px; color: var(--ink-3); letter-spacing: .16em; }
.lv-detail .dv-hd b { font-size: 14px; color: var(--ink); letter-spacing: .04em; }
.lv-detail .dv-line { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.lv-detail .dv-big {
  font-size: 34px; font-weight: 600; color: var(--zhu); line-height: 1.1;
  min-width: 40px; text-align: center;
}
.lv-detail .dv-kv { display: flex; flex-wrap: wrap; gap: 2px 18px; flex: 1 1 auto; }
.lv-detail .dv-kv span { font-size: 13px; color: var(--ink-2); }
.lv-detail .dv-kv i { font-style: normal; color: var(--ink-3); margin-right: 4px; }
.lv-detail .dv-kv b { color: var(--ink); font-weight: 600; }
.lv-detail .dv-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.lv-detail .dv-tags em {
  font-style: normal; font-size: 9.5px; padding: 1px 6px; letter-spacing: .08em;
  border: 1px solid var(--line-2); color: var(--ink-2);
}
.lv-detail .dv-tags em.zhu { border-color: rgba(140, 32, 21, .45); color: var(--zhu); }
.lv-detail .dv-tags em.kong { border-style: dashed; color: var(--ink-3); }
.lv-detail .dv-tags em.qing { color: var(--qing); border-color: rgba(59, 106, 95, .5); }
.lightbox .lv-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px;
}
.lightbox .lv-bar .lv-t { flex: 1 1 auto; min-width: 0; font-size: 10px; color: var(--ink-3); letter-spacing: .1em; }
.lightbox .lv-bar button { flex: 0 0 auto; }
.lv-close, .lv-btn {
  min-height: 42px; padding: 0 18px; font-size: 12.5px; letter-spacing: .14em;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
}
.lv-close { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
body.lb-lock { overflow: hidden; }

/* ---------- 安装引导 ---------- */
.install-bar {
  font-family: inherit;
  position: fixed; left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  background: rgba(30, 25, 19, .96);
  color: #f7f0e2;
  animation: fadeUpBar .22s ease-out;
}
@keyframes fadeUpBar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.install-bar .ib-ic {
  width: 30px; height: 30px; flex: 0 0 30px;
  background: var(--zhu); display: grid; place-items: center;
  font-size: 15px; font-weight: 700;
}
.install-bar .ib-tx { flex: 1 1 auto; min-width: 0; font-size: 11.5px; line-height: 1.45; }
.install-bar .ib-tx b { display: block; font-size: 12.5px; margin-bottom: 1px; letter-spacing: .06em; }
.install-bar .ib-tx span { color: #c3b5a3; }
.install-bar button {
  min-height: 34px; padding: 0 13px; font-size: 11.5px; letter-spacing: .08em;
  background: var(--zhu); color: #f7f0e2; border: 0; flex: 0 0 auto;
}
.install-bar .ib-x {
  background: transparent; border: 0; color: #918477;
  min-height: 34px; padding: 0 4px; font-size: 16px; line-height: 1;
}
.ios-guide {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(24, 19, 15, .92); color: #f7f0e2;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.ios-guide .ig-box {
  max-width: 320px;
  background: #2a221b;
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 22px 20px; font-size: 13px; line-height: 1.9;
}
.ios-guide .ig-box h4 { margin: 0 0 10px; font-size: 13.5px; letter-spacing: .14em; font-weight: 600; }
.ios-guide .ig-box ol { margin: 0 0 16px; padding-left: 19px; }
.ios-guide .ig-box b { color: #e0bb84; font-weight: 600; }
.ios-guide .ig-box button {
  width: 100%; min-height: 42px; background: transparent;
  color: #f7f0e2; border: 1px solid rgba(255, 255, 255, .3); font-size: 12.5px; letter-spacing: .12em;
}

/* ---------- 宽屏 ---------- */
@media (min-width: 560px) {
  .sheet { padding: 0 24px 56px; }
  .meta-grid { grid-template-columns: repeat(4, 1fr); }
  .pan { max-width: 470px; }
  .sky { font-size: 32px; }
  .pillars .pl b { font-size: 23px; }
  .ch .zhi { font-size: 32px; }
}
@media (min-width: 760px) {
  .sheet { max-width: 620px; }
  .pan { max-width: 560px; }
  .sky { font-size: 36px; }
  .cell.mid .mq b { font-size: 16px; }
}

/* ============================================================
   手机触控适配：只在 finger 操作下生效
   ============================================================ */
@media (pointer: coarse) {
  /* iOS：输入框字号 < 16px 聚焦会自动放大整页且不缩回 */
  input[type=text], input[type=number], input[type=date],
  input[type=datetime-local], select, textarea { font-size: 16px; }
  input[type=text], input[type=datetime-local], select { min-height: 40px; }

  button, .mini { min-height: 44px; }
  .kep-cast { min-height: 44px; }
  .ai-btn { min-height: 48px; }
  .ghost { min-height: 44px; }
  .why summary { min-height: 40px; display: flex; align-items: center; }
  .arch-item .ops button { min-height: 40px; }
  .actions .mini { min-height: 44px; padding: 0 10px; }

  /* 盘面与三传是「看」的，长按别弹系统菜单 */
  .pan, .cell, .ch, .chuan, button, .lv-close {
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
  }
  button, .cell, .ch, .why summary { touch-action: manipulation; }
}

/* 横屏：纵向空间极小，压掉非核心 */
@media (max-height: 520px) and (orientation: landscape) {
  .rail { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 7px; }
  .sheet { padding: 0 12px 20px; max-width: none; }
  .pan { max-width: min(58vh, 380px); }
  .sky { font-size: 22px; }
  .lq { display: none; }
  .pillars .pl b { font-size: 17px; }
}

/* 横屏刘海：左右安全区 */
@supports (padding: env(safe-area-inset-left)) {
  .rail {
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }
  .sheet {
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }
  .drawer-panel { padding-right: env(safe-area-inset-right); }
}
