/* ===== 周易六爻起卦 · 青绿主题（与主站品牌绿 #138101 呼应） ===== */
:root {
  --paper: #f2f6ee;
  --paper-2: #fcfdf9;
  --paper-3: #e6efe1;
  --ink: #232b23;
  --ink-2: #4c5a4c;
  --ink-3: #7a877a;
  --cinnabar: #138101;      /* 主强调色 = 品牌绿 */
  --cinnabar-lt: #24a018;
  --bronze: #55795d;        /* 次强调 = 灰绿 */
  --gold: #6ba36b;
  --line: #cfdec9;
  --line-2: #b8cfb2;
  --shadow: rgba(35, 60, 35, 0.1);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "STSong", Georgia, serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", var(--serif);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 关键兜底：浏览器默认的 [hidden]{display:none} 属于 UA 样式，优先级低于本文件里的
   .gua-modal{display:flex} 等作者规则，会导致带 hidden 属性的元素仍然显示
   （例如弹窗遮罩一进页面就铺满全屏）。此处强制让它生效。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.85;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-text-size-adjust: 100%;
}

/* 移动端触控优化（全局）：去掉点击高亮、消除 300ms 延迟、禁用长按菜单 */
.btn, .g-cell, .modal-close, .panel-title.collapsible, #btnClearHistory, .site-home, .site-brand, .site-crumb a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.coin, .btn, .g-cell, .modal-close { -webkit-touch-callout: none; }
input, textarea { -webkit-tap-highlight-color: transparent; }

/* 宣纸底纹 */
.ink-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(19, 129, 1, 0.06) 0%, transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(107, 163, 107, 0.09) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 252, 0.5) 0%, transparent 70%);
  pointer-events: none;
}
.ink-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(90, 120, 90, 0.025) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(90, 120, 90, 0.02) 3px 4px);
}

/* ===== 站点顶栏（与主站 51help.top 同款，品牌绿 #138101） ===== */
.site-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #138101;
  color: #fff;
  box-shadow: 0 1px rgba(0, 0, 0, 0.08);
}
.site-bar-inner {
  max-width: 960px;   /* 与正文 .wrap 对齐 */
  margin: 0 auto;
  height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
}
.site-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  flex: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.site-brand:hover { color: #fff; }
.site-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}
.site-crumb a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-crumb a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.55); }
.crumb-sep { opacity: 0.5; }
.crumb-now {
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.site-home {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.site-home svg { width: 15px; height: 15px; }
.site-home:hover { background: rgba(255, 255, 255, 0.26); border-color: rgba(255, 255, 255, 0.55); color: #fff; }

/* ===== 页头 ===== */
.site-head {
  border-bottom: 2px solid var(--line-2);
  background: linear-gradient(180deg, rgba(252, 253, 249, 0.92), rgba(242, 246, 238, 0.55));
  padding: 30px 20px 22px;
  position: relative;
}
.site-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--line);
}
.head-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.title-block h1 {
  font-size: 42px;
  letter-spacing: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.subtitle {
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--bronze);
  margin-top: 4px;
}
.motto {
  font-family: var(--kai);
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--ink-3);
  padding-bottom: 6px;
}

/* ===== 布局 ===== */
.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 50px;
}

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 24px 26px;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px var(--shadow);
  position: relative;
}

.panel-title {
  font-size: 19px;
  letter-spacing: 6px;
  color: var(--cinnabar);
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.panel-title > span:first-child { position: relative; padding-left: 14px; }
.panel-title > span:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 18px;
  background: var(--cinnabar);
}
.panel-title.collapsible { cursor: pointer; user-select: none; margin-bottom: 0; padding-bottom: 12px; }
.panel-title.collapsible.open { margin-bottom: 18px; }
.toggle-mark { font-size: 20px; color: var(--bronze); letter-spacing: 0; }

/* ===== 起卦区 ===== */
.ask-row { margin-bottom: 14px; }
.ask-row label {
  display: block;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--ink-2);
  margin-bottom: 8px;
}
#question, .search-input {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#question:focus, .search-input:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(19, 129, 1, 0.12);
}
#question::placeholder, .search-input::placeholder { color: #b0a48c; }

.ritual-tip {
  font-family: var(--kai);
  font-size: 13.5px;
  color: var(--ink-3);
  letter-spacing: 1.5px;
  padding: 8px 0 4px;
  border-left: 2px solid var(--line-2);
  padding-left: 12px;
  margin: 14px 0 20px;
}

/* 铜钱 */
.coin-stage {
  text-align: center;
  padding: 26px 10px 20px;
  background: linear-gradient(180deg, rgba(230, 239, 226, 0.55), rgba(252, 253, 249, 0.2));
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-bottom: 20px;
}
.coins {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-bottom: 18px;
  min-height: 62px;
}
.coin { width: 58px; height: 58px; perspective: 500px; }
.coin-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.1, 0.3, 1);
}
.coin.flipped .coin-inner { transform: rotateY(180deg); }
.coin.tossing .coin-inner { animation: toss 0.45s linear infinite; }
@keyframes toss {
  0%   { transform: rotateY(0deg)   translateY(0) }
  25%  { transform: rotateY(180deg) translateY(-16px) }
  50%  { transform: rotateY(360deg) translateY(0) }
  75%  { transform: rotateY(540deg) translateY(-8px) }
  100% { transform: rotateY(720deg) translateY(0) }
}
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  letter-spacing: 0;
  border: 2px solid var(--bronze);
  box-shadow: inset 0 0 0 4px rgba(252, 253, 249, 0.75), 0 2px 4px rgba(40, 80, 40, 0.22);
}
.face .hole {
  width: 13px; height: 13px;
  background: var(--paper-2);
  border: 1px solid rgba(58, 100, 48, 0.5);
  flex-shrink: 0;
}
.face span { font-size: 12.5px; line-height: 1; letter-spacing: 1px; }
.face.front {
  background: radial-gradient(circle at 35% 30%, #e2ecd2, #b9d3a0 70%);
  color: #3c6b2c;
}
.face.back {
  background: radial-gradient(circle at 35% 30%, #d3e5c2, #a5c88c 70%);
  color: #325c24;
  transform: rotateY(180deg);
}

.cast-hint {
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: 1.5px;
  min-height: 26px;
  font-family: var(--kai);
}
.cast-hint .em { color: var(--cinnabar); font-weight: 700; }

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
}
.pdot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: transparent;
  transition: all 0.3s;
}
.pdot.done { background: var(--cinnabar); border-color: var(--cinnabar); }
.pdot.active { border-color: var(--cinnabar); box-shadow: 0 0 0 3px rgba(19, 129, 1, 0.15); }

/* 按钮 */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 3px;
  padding: 11px 30px;
  border: 1px solid var(--line-2);
  background: var(--paper-2);
  color: var(--ink-2);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover:not(:disabled) {
  border-color: var(--bronze);
  color: var(--ink);
  background: var(--paper-3);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-main {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #f4faf0;
  font-weight: 600;
}
.btn-main:hover:not(:disabled) {
  background: var(--cinnabar-lt);
  border-color: var(--cinnabar-lt);
  color: #fff;
}
.btn-ghost { background: transparent; }
.btn-sm { font-size: 13px; padding: 8px 20px; letter-spacing: 2px; }

/* 成卦过程 */
.building { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-2); }
.building-label {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--bronze);
  text-align: center;
  margin-bottom: 12px;
}
.yao-stack { display: flex; flex-direction: column-reverse; align-items: center; gap: 9px; }

/* ===== 爻的绘制 ===== */
.yao-row {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: yaoIn 0.4s ease-out;
}
@keyframes yaoIn {
  from { opacity: 0; transform: translateY(8px) }
  to   { opacity: 1; transform: translateY(0) }
}
.yao-pos {
  font-size: 12px;
  color: var(--ink-3);
  width: 34px;
  text-align: right;
  letter-spacing: 1px;
}
.yao-bar { display: flex; gap: 7px; width: 108px; }
.yao-seg {
  height: 11px;
  background: var(--ink);
  border-radius: 1px;
}
.yao-yang .yao-seg { width: 108px; }
.yao-yin .yao-seg { width: 50.5px; }
.yao-moving .yao-seg {
  background: var(--cinnabar);
  box-shadow: 0 0 0 1px rgba(19, 129, 1, 0.25);
}
.yao-mark {
  font-size: 13px;
  color: var(--cinnabar);
  width: 62px;
  letter-spacing: 1px;
  font-weight: 700;
}
.yao-sum { font-size: 11.5px; color: var(--ink-3); width: 30px; }

/* ===== 结果区 ===== */
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 26px;
}
.q-echo {
  font-family: var(--kai);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 1.5px;
}
.q-echo::before {
  content: "所问";
  font-size: 12px;
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar);
  padding: 1px 7px;
  margin-right: 10px;
  letter-spacing: 2px;
  vertical-align: 2px;
}
.cast-time { font-size: 12.5px; color: var(--ink-3); letter-spacing: 1px; }

/* 卦象对照 */
.gua-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 22px;
}
.gua-card { text-align: center; margin-bottom: 0; padding: 22px 18px; }
.gua-tag {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: 4px;
  color: var(--paper-2);
  background: var(--bronze);
  padding: 2px 13px;
  margin-bottom: 16px;
}
#bianCard .gua-tag { background: var(--cinnabar); }
.gua-symbol {
  font-size: 40px;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.gua-figure {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}
.gua-figure .yao-bar { width: 92px; }
.gua-figure .yao-yang .yao-seg { width: 92px; }
.gua-figure .yao-yin .yao-seg { width: 42.5px; }
.gua-name { margin-bottom: 8px; }
.gua-num {
  display: block;
  font-size: 12.5px;
  color: var(--bronze);
  letter-spacing: 2px;
  margin-bottom: 3px;
}
.gua-full {
  display: block;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--ink);
}
.gua-level {
  display: inline-block;
  font-size: 12px;
  color: var(--cinnabar);
  border: 1px solid rgba(19, 129, 1, 0.42);
  padding: 1px 9px;
  margin-top: 7px;
  letter-spacing: 2px;
}
.gua-struct { font-size: 13px; color: var(--ink-3); letter-spacing: 1.5px; }

.pair-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 54px;
}
.arrow-mark { font-size: 26px; color: var(--cinnabar); }
.arrow-text {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 2px;
  text-align: center;
  line-height: 1.5;
}

/* 断卦 */
.verdict-panel { border-left: 3px solid var(--cinnabar); }
.verdict-rule {
  font-size: 13.5px;
  color: var(--bronze);
  letter-spacing: 1.5px;
  padding: 9px 14px;
  background: rgba(19, 129, 1, 0.07);
  border-radius: 2px;
  margin-bottom: 16px;
}
.verdict-rule b { color: var(--cinnabar); font-weight: 700; }
.verdict-body .v-block { margin-bottom: 18px; }
.verdict-body .v-block:last-child { margin-bottom: 0; }
.v-label {
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--cinnabar);
  margin-bottom: 7px;
  font-weight: 600;
}
.v-quote {
  font-family: var(--kai);
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 1.5px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 9px;
  line-height: 1.9;
}
.v-plain { font-size: 15px; color: var(--ink-2); letter-spacing: 0.8px; }

/* 详解 */
.detail .d-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
  align-items: start;
}
.detail .d-row:last-child { border-bottom: none; }
.d-key {
  font-size: 13.5px;
  color: var(--bronze);
  letter-spacing: 3px;
  padding-top: 2px;
}
.d-val { font-size: 15.5px; color: var(--ink); letter-spacing: 0.6px; }
.d-val.classic { font-family: var(--kai); font-size: 16.5px; line-height: 1.9; }

/* 六爻列表 */
.yao-list .yl-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 13px 12px;
  border-bottom: 1px dashed var(--line);
  align-items: start;
  border-radius: 2px;
}
.yao-list .yl-item:last-child { border-bottom: none; }
.yao-list .yl-item.is-moving {
  background: rgba(19, 129, 1, 0.06);
  border-left: 3px solid var(--cinnabar);
  padding-left: 10px;
}
.yao-list .yl-item.is-used {
  background: rgba(19, 129, 1, 0.08);
  box-shadow: inset 0 0 0 1px rgba(19, 129, 1, 0.35);
}
.yl-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.yl-pos { font-size: 13px; color: var(--bronze); letter-spacing: 2px; }
.yl-fig .yao-bar { width: 74px; }
.yl-fig .yao-yang .yao-seg { width: 74px; }
.yl-fig .yao-yin .yao-seg { width: 33.5px; }
.yl-badge {
  font-size: 11px;
  padding: 1px 7px;
  letter-spacing: 1px;
  border-radius: 2px;
  background: var(--cinnabar);
  color: #f4faf0;
}
.yl-badge.used { background: var(--bronze); }
.yl-text { font-family: var(--kai); font-size: 16px; color: var(--ink); line-height: 1.85; }
.yl-plain { font-size: 14px; color: var(--ink-2); margin-top: 5px; letter-spacing: 0.5px; }

/* ===== 卦录 ===== */
.history-list .h-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.history-list .h-item:last-child { border-bottom: none; }
.h-main { flex: 1; min-width: 200px; }
.h-gua { font-size: 16px; color: var(--ink); letter-spacing: 2px; font-weight: 600; }
.h-gua .h-arrow { color: var(--cinnabar); margin: 0 7px; font-weight: 400; }
.h-q { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; font-family: var(--kai); }
.h-time { font-size: 12px; color: var(--ink-3); }
.h-empty { font-size: 14px; color: var(--ink-3); text-align: center; padding: 14px; }

/* ===== 六十四卦速查 ===== */
.browse-body { padding-top: 4px; }
.search-input { margin-bottom: 18px; }
.gua-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);  /* 8 列 × 8 行，64 卦恰好排满 */
  gap: 10px;
}
.g-cell {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 2px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
}
.g-cell:hover {
  border-color: var(--cinnabar);
  background: var(--paper-2);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px var(--shadow);
}
.g-sym { font-size: 21px; color: var(--ink); line-height: 1.2; }
.g-num { font-size: 11px; color: var(--bronze); margin: 4px 0 2px; letter-spacing: 1px; }
.g-name { font-size: 14.5px; color: var(--ink); letter-spacing: 1.5px; font-weight: 600; }
.g-none { grid-column: 1 / -1; text-align: center; color: var(--ink-3); font-size: 14px; padding: 20px; }

/* ===== 弹窗 ===== */
.gua-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(28, 44, 28, 0.5); backdrop-filter: blur(2px); }
.modal-box {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  max-width: 640px;
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  padding: 30px 30px 26px;
  box-shadow: 0 12px 40px rgba(28, 44, 28, 0.26);
  animation: modalIn 0.22s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.99) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 21px;
  line-height: 1;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.18s;
}
.modal-close:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.m-head { text-align: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.m-sym { font-size: 38px; color: var(--ink); line-height: 1.2; }
.m-num { font-size: 12.5px; color: var(--bronze); letter-spacing: 2px; margin: 6px 0 3px; }
.m-name { font-size: 25px; font-weight: 700; letter-spacing: 5px; color: var(--ink); }
.m-level {
  display: inline-block;
  font-size: 12px; color: var(--cinnabar);
  border: 1px solid rgba(19, 129, 1, 0.42);
  padding: 1px 9px; margin-top: 8px; letter-spacing: 2px;
}

/* ===== 页脚 ===== */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 24px 20px 32px;
  text-align: center;
  background: rgba(230, 239, 226, 0.35);
}
.site-foot p { font-size: 12.5px; color: var(--ink-3); letter-spacing: 1px; }
.site-foot .disclaimer { margin-top: 7px; font-size: 12px; color: #a1957c; max-width: 640px; margin-left: auto; margin-right: auto; line-height: 1.75; }

/* ===== 响应式 / 移动端优化 ===== */
@viewport { width: device-width; }

@media (max-width: 700px) {
  /* 站点顶栏（窄屏：隐藏面包屑，缩小品牌与按钮） */
  .site-bar-inner {
    height: 52px;
    padding: 0 14px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    gap: 12px;
  }
  .site-crumb { display: none; }
  .site-brand { font-size: 15.5px; }
  .site-logo { width: 30px; height: 30px; border-radius: 7px; }
  .site-home { height: 30px; padding: 0 10px; font-size: 12.5px; }

  /* 标题与页头（字号用 clamp 自适应） */
  .title-block h1 { font-size: clamp(28px, 9vw, 36px); letter-spacing: 8px; }
  .subtitle { font-size: 13px; letter-spacing: 3px; }
  .motto { display: none; }
  .site-head { padding: 22px 16px 18px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right)); }
  .site-foot { padding: 22px 16px 28px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom)); }

  /* 安全区留白（刘海屏 / 底部手势条） */
  .wrap { padding: 18px 14px calc(40px + env(safe-area-inset-bottom)); }

  /* 字号与触控 */
  body { font-size: 16px; }
  #question, .search-input { font-size: 16px; }  /* 避免 iOS 聚焦时自动放大页面 */
  .panel { padding: 18px 14px; }
  .panel-title { font-size: 18px; letter-spacing: 4px; }

  /* 铜钱 */
  .coin { width: 54px; height: 54px; }
  .coins { gap: 18px; }
  .coin-stage { padding: 20px 8px 16px; }

  /* 本卦/变卦：竖排 + 箭头向下 */
  .gua-pair { grid-template-columns: 1fr; gap: 10px; }
  .gua-card { padding: 18px 14px; }
  .gua-symbol { font-size: clamp(34px, 11vw, 44px); }
  .pair-arrow { flex-direction: row; gap: 10px; padding: 2px 0; }
  .arrow-mark { transform: rotate(90deg); font-size: 20px; }
  .arrow-text br { display: none; }

  /* 结果区操作按钮：吸底，方便单手操作 */
  #result > .btn-row {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 12px;
    background: var(--paper-2);
    margin: 0 calc(-1 * 14px) calc(-1 * 18px);
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 14px var(--shadow);
    z-index: 20;
  }
  #result > .btn-row .btn { flex: 1; }

  /* 列表单列 */
  .detail .d-row { grid-template-columns: 1fr; gap: 4px; }
  .yao-list .yl-item { grid-template-columns: 1fr; gap: 8px; }
  .yl-left { flex-direction: row; align-items: center; gap: 10px; }

  /* 按钮触控尺寸（≥46px 易点） */
  .btn { flex: 1; min-width: 0; min-height: 46px; padding: 12px 16px; font-size: 15px; }
  .btn-sm { min-height: 40px; }

  /* 速查网格：4 列 × 16 行，同样排满不留孤格 */
  .gua-grid { grid-template-columns: repeat(4, 1fr); gap: 9px; }
  .g-cell { padding: 11px 6px; }

  /* 弹窗适配动态视口高度（避开移动端地址栏） */
  .modal-box { max-height: 86dvh; max-height: 86vh; padding: 24px 16px 22px; }
  .m-sym { font-size: 34px; }
  .m-name { font-size: 22px; letter-spacing: 4px; }
}

/* 超小屏（窄至 320px，如 iPhone SE） */
@media (max-width: 360px) {
  .coins { gap: 12px; }
  .coin { width: 48px; height: 48px; }
  .gua-grid { grid-template-columns: repeat(4, 1fr); }
  .btn { letter-spacing: 1px; padding: 12px 10px; }
}
