/* ============================================================
   赛博紫微斗数 · HUD 样式
   ------------------------------------------------------------
   视觉基调：深空观测站 / 电影 HUD（Obsidian & Copper）
     底色   近黑石墨，不再用饱和深蓝
     主色   去饱和冰青（信息、交互、次级强调）
     点睛   陈化铜金（唯一 hero，只给命宫 / 主操作 / 时间）
     结构   发丝描边 + 大留白 + 等宽字体编号，靠"排"而不是靠"发光"
   反例（上一版）：到处霓虹描边 + 斜纹镀膜 + 大范围 text-shadow
     结果是"廉价赛博"，画面被光晕糊住，金属与文字的层级全丢了。
   ============================================================ */

:root {
  /* 深空底 */
  --bg: #04060c;
  --void-2: #080d16;
  --ink: rgba(4, 6, 12, .94);

  /* 冷色主调：冰青 / 钢蓝（全部去饱和） */
  --ice: #6fbcd4;
  --ice-dim: #427f93;
  --steel: #324256;

  /* 暖色点睛：陈化铜金 */
  --gold: #e2b268;
  --gold-bright: #f3d69e;
  --gold-dim: #9a773f;

  /* 语义色：与 3D 场景同源 */
  --copper: #d08a56;
  --power: #e0683c;
  --crimson: #c94a5b;
  --jade: #5fb594;
  --violet: #8a7ad0;

  /* 玻璃面板：石墨玻璃，不是蓝色玻璃 */
  --panel: rgba(9, 13, 20, .82);
  --panel-hi: rgba(18, 24, 34, .9);
  --panel-line: rgba(158, 188, 212, .13);
  --panel-line-hi: rgba(158, 188, 212, .22);
  --text: #dbe6f2;
  --text-dim: #7c8ba0;
  --text-faint: #536172;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* 唯一允许的三层阴影：外投影、内高光、极轻辉光 */
  --shadow: 0 18px 42px rgba(0, 0, 0, .55);
  --inner-hi: inset 0 1px 0 rgba(210, 228, 245, .06);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ---------------------------------------------- 启动动画 */
#boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  background: var(--bg);
  z-index: 200;
  transition: opacity .8s ease, visibility .8s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-ring {
  width: 56px; height: 56px;
  border: 1px solid rgba(158, 188, 212, .18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1.6s cubic-bezier(.6, .05, .35, .95) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-text {
  color: var(--text-dim);
  letter-spacing: .34em;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
}
.dots::after { content: "…"; animation: dots 1.6s ease-in-out infinite; }
@keyframes dots { 0%{opacity:.25} 50%{opacity:1} 100%{opacity:.25} }

/* ---------------------------------------------- 取景框（电影感） */
.frame {
  position: fixed;
  inset: 9px;
  z-index: 26;
  pointer-events: none;
}
.frame i {
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid rgba(178, 200, 220, .16);
}
.frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ---------------------------------------------- HUD 容器 */
.hud-top, .hud-left, .hud-right, .hud-bottom {
  position: fixed;
  z-index: 20;
  pointer-events: none;
}
.hud-top > *, .hud-left > *, .hud-right > * { pointer-events: auto; }

.hud-top {
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 22px 16px;
  background: linear-gradient(180deg, rgba(4, 6, 12, .82) 0%, rgba(4, 6, 12, .28) 62%, rgba(4, 6, 12, 0) 100%);
}

/* 品牌区：靠排字与发丝线，不靠辉光 */
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid rgba(226, 178, 104, .42);
  border-radius: 1px;
  color: var(--gold-bright);
  font-size: 19px; font-weight: 700;
  letter-spacing: 0;
  background:
    linear-gradient(160deg, rgba(226, 178, 104, .10), rgba(226, 178, 104, 0) 58%),
    rgba(8, 12, 19, .7);
  box-shadow: var(--inner-hi), 0 0 0 1px rgba(0, 0, 0, .5);
  position: relative;
}
/* 左上角一道 6px 铜金短线，像机加工的标记 */
.brand-mark::after {
  content: "";
  position: absolute; top: -1px; left: -1px;
  width: 8px; height: 1px;
  background: var(--gold);
}
.brand-txt h1 {
  font-size: 18px; font-weight: 700; letter-spacing: .16em;
  color: #e8eff7;
  line-height: 1.15;
}
.brand-txt p {
  font-size: 9px; letter-spacing: .3em;
  color: var(--text-faint); margin-top: 5px;
  font-family: var(--mono);
  text-transform: uppercase;
}
.clock-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.clock-label {
  font-size: 8.5px; letter-spacing: .34em; color: var(--text-faint);
  font-family: var(--mono);
}
.clock {
  font-size: 15px; font-weight: 600; letter-spacing: .1em;
  color: rgba(226, 178, 104, .92);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------- 面板：石墨玻璃 */
.panel {
  background:
    linear-gradient(180deg, var(--panel-hi) 0%, var(--panel) 100%);
  border: 1px solid var(--panel-line);
  border-radius: 2px;
  backdrop-filter: blur(20px) saturate(.85);
  -webkit-backdrop-filter: blur(20px) saturate(.85);
  margin-bottom: 10px;
  box-shadow: var(--shadow), var(--inner-hi);
  overflow: hidden;
  position: relative;
}
/* 顶部 1px 更亮的发丝线，制造"玻璃厚度" */
.panel::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(178, 200, 220, .18), rgba(178, 200, 220, .03) 45%, transparent 100%);
}
.panel-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .26em;
  color: #9db0c3;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(158, 188, 212, .1);
  text-transform: uppercase;
}
.panel-toggle i {
  width: 6px; height: 6px;
  border-right: 1px solid var(--ice-dim);
  border-bottom: 1px solid var(--ice-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .3s ease;
}
.panel.collapsed .panel-toggle { border-bottom-color: transparent; }
.panel.collapsed .panel-toggle i { transform: rotate(-45deg) translate(-1px, 1px); }
.panel.collapsed > .panel-body { display: none !important; }
.panel-body { padding: 13px; }

/* ---------------------------------------------- 左侧 */
.hud-left {
  left: 0; top: 78px; bottom: 46px;
  width: 226px;
  padding: 0 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 188, 212, .22) transparent;
}
.hud-left::-webkit-scrollbar { width: 3px; }
.hud-left::-webkit-scrollbar-thumb { background: rgba(158, 188, 212, .22); }

.field { display: block; margin-bottom: 11px; }
.field span {
  display: block;
  font-size: 10px; letter-spacing: .2em;
  color: var(--text-faint); margin-bottom: 5px;
  font-family: var(--mono);
  text-transform: uppercase;
}
.field input, .field select {
  width: 100%;
  padding: 8px 9px;
  background: rgba(6, 10, 16, .9);
  border: 1px solid rgba(158, 188, 212, .16);
  border-radius: 1px;
  color: #dfe9f4;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .04em;
  outline: none;
  transition: border-color .2s, background .2s;
  color-scheme: dark;
}
.field input:focus, .field select:focus {
  border-color: rgba(111, 188, 212, .55);
  background: rgba(9, 15, 24, .95);
}

.btn-row { display: flex; gap: 8px; margin-top: 13px; }
.btn {
  flex: 1;
  padding: 9px 10px;
  background: rgba(16, 22, 32, .55);
  border: 1px solid rgba(158, 188, 212, .16);
  border-radius: 1px;
  color: #c2d0de;
  font-family: var(--font);
  font-size: 12px; font-weight: 600; letter-spacing: .12em;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
  white-space: nowrap;
}
.btn:hover {
  border-color: rgba(158, 188, 212, .34);
  color: #eaf1f8;
  background: rgba(28, 38, 52, .55);
}
.btn:active { transform: translateY(.5px); }
/* 主操作：唯一用铜金描边的地方 */
.btn.primary {
  background: linear-gradient(160deg, rgba(226, 178, 104, .14), rgba(226, 178, 104, .03));
  border-color: rgba(226, 178, 104, .48);
  color: var(--gold-bright);
  letter-spacing: .2em;
}
.btn.primary:hover {
  border-color: rgba(243, 214, 158, .72);
  background: linear-gradient(160deg, rgba(226, 178, 104, .22), rgba(226, 178, 104, .05));
}
.btn.sm { padding: 7px 4px; font-size: 11px; letter-spacing: .08em; }
.btn.on, .btn.active {
  border-color: rgba(111, 188, 212, .48);
  color: #d9e8f2;
  background: rgba(111, 188, 212, .1);
}
.btn.off { opacity: .38; }
.btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-grid.mt { margin-top: 6px; grid-template-columns: 1fr 1fr; }

/* 本命信息 */
.info .i-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(158, 188, 212, .09);
  font-size: 13px;
}
.info .i-row:last-child { border-bottom: none; }
.i-k { color: var(--text-faint); letter-spacing: .16em; font-size: 10px; font-family: var(--mono); text-transform: uppercase; }
.i-v { color: #dbe6f2; font-weight: 600; text-align: right; font-size: 13px; letter-spacing: .04em; }
.i-v.accent { color: var(--gold); }
.i-v.pink { color: var(--copper); }

/* ---------------------------------------------- 右侧 */
/* 右栏与左栏一致：限定上下边界并允许纵向滚动。
   之前只写了 top、没写 bottom 也没有 overflow，面板总高一旦超过视口，
   下面的「显示图层」等内容就会被推到屏幕外且无法滑出。 */
.hud-right {
  right: 0; top: 78px; bottom: 46px;
  width: 208px;
  padding: 0 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 188, 212, .22) transparent;
}
.hud-right::-webkit-scrollbar { width: 3px; }
.hud-right::-webkit-scrollbar-thumb { background: rgba(158, 188, 212, .22); }
.hud-right::-webkit-scrollbar-track { background: transparent; }
.legend-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.legend-body span {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: #bccadb;
}
.legend-body i {
  width: 14px; height: 2px; border-radius: 1px;
  box-shadow: 0 0 7px currentColor;
}
/* 图例的发光很轻：让色条自己是"玻璃里的灯"，不是霓虹灯管 */

.legend-palace {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.legend-palace span {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #b8c6d6; letter-spacing: .04em;
}
.legend-palace i {
  flex: none;
  width: 9px; height: 9px; border-radius: 1px;
  box-shadow: 0 0 6px currentColor, inset 0 0 0 1px rgba(255, 255, 255, .12);
}

/* ---------------------------------------------- 底部提示 */
.hud-bottom {
  bottom: 0; left: 0; right: 0;
  padding: 13px 22px max(13px, env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 10px; letter-spacing: .22em;
  color: rgba(124, 139, 160, .85);
  font-family: var(--mono);
  text-transform: uppercase;
  background: linear-gradient(0deg, rgba(4, 6, 12, .8) 0%, rgba(4, 6, 12, 0) 100%);
}
.hud-bottom em { color: rgba(158, 188, 212, .28); font-style: normal; }

/* ---------------------------------------------- 宫位详情抽屉 */
.detail {
  position: fixed;
  right: 18px; bottom: 54px;
  width: 312px;
  max-height: min(70vh, 580px);
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(15, 21, 30, .95) 0%, rgba(8, 12, 19, .96) 100%);
  border: 1px solid rgba(158, 188, 212, .18);
  border-radius: 2px;
  backdrop-filter: blur(26px) saturate(.9);
  -webkit-backdrop-filter: blur(26px) saturate(.9);
  box-shadow: var(--shadow), var(--inner-hi);
  padding: 18px;
  z-index: 40;
  opacity: 0; visibility: hidden;
  transform: translateX(20px);
  transition: opacity .32s ease, transform .32s ease, visibility .32s;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 188, 212, .24) transparent;
}
.detail::-webkit-scrollbar { width: 3px; }
.detail::-webkit-scrollbar-thumb { background: rgba(158, 188, 212, .24); }
.detail.open { opacity: 1; visibility: visible; transform: translateX(0); }
.detail::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 34px; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.detail-close {
  position: absolute; top: 9px; right: 11px;
  width: 26px; height: 26px;
  background: none; border: none;
  color: var(--text-faint);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: color .2s;
}
.detail-close:hover { color: var(--crimson); }

.d-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.d-name {
  font-size: 23px; font-weight: 700; letter-spacing: .16em;
  color: var(--pc, #e8eff7);
}
.d-gz {
  font-size: 11px; color: var(--text-dim); letter-spacing: .18em;
  font-family: var(--mono);
}
.d-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.tag {
  padding: 2.5px 7px;
  font-size: 10px; letter-spacing: .14em;
  border-radius: 1px;
  border: 1px solid currentColor;
  opacity: .82;
  font-family: var(--mono);
  text-transform: uppercase;
}
.tag.gold { color: var(--gold); }
.tag.red { color: var(--copper); }
.tag.gray { color: var(--text-faint); }
.tag.jade { color: #9fe0c8; }
.tag.copper { color: #e0a976; }
.d-natal {
  margin: -6px 0 10px;
  font-size: 10px; letter-spacing: .22em;
  color: var(--text-faint);
  font-family: var(--mono);
}

.d-sec { margin-bottom: 16px; }
.d-sec-t {
  font-size: 9.5px; letter-spacing: .3em;
  color: var(--text-faint);
  padding-bottom: 6px; margin-bottom: 9px;
  border-bottom: 1px solid rgba(158, 188, 212, .1);
  font-family: var(--mono);
  text-transform: uppercase;
}
.d-star {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.s-name { font-weight: 600; text-shadow: 0 0 9px currentColor; }
.s-nature { font-size: 9.5px; color: var(--text-faint); letter-spacing: .1em; font-family: var(--mono); }
.s-bri {
  font-size: 9px; color: var(--text-dim);
  padding: 1px 5px;
  background: rgba(158, 188, 212, .1);
  border-radius: 1px;
  font-family: var(--mono);
}
.s-mut {
  margin-left: auto;
  font-size: 14px; font-weight: 600;
  padding: 3px 9px; border-radius: 1px;
  letter-spacing: .1em;
}
.s-mut[data-mg="禄"] { color: #e2b268; background: rgba(226, 178, 104, .12); }
.s-mut[data-mg="权"] { color: #e0683c; background: rgba(224, 104, 60, .12); }
.s-mut[data-mg="科"] { color: #5fb594; background: rgba(95, 181, 148, .12); }
.s-mut[data-mg="忌"] { color: #c94a5b; background: rgba(201, 74, 91, .12); }
.d-empty { font-size: 11px; color: var(--text-faint); font-style: italic; }

.d-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 2.5px 7px;
  font-size: 11px;
  color: #c2d0de;
  background: rgba(158, 188, 212, .07);
  border: 1px solid rgba(158, 188, 212, .14);
  border-radius: 1px;
}
.d-chips.dim .chip {
  color: #5d6c80;
  background: rgba(8, 12, 19, .5);
  border-color: rgba(158, 188, 212, .08);
}
/* 四化 chip（禄权科忌）比普通 chip 放大一半，信息层级更高 */
.chip[data-mg] { font-size: 16.5px; padding: 4px 10px; font-weight: 600; }
.chip[data-mg="禄"] { color: #e2b268; border-color: rgba(226, 178, 104, .4); }
.chip[data-mg="权"] { color: #e0683c; border-color: rgba(224, 104, 60, .4); }
.chip[data-mg="科"] { color: #5fb594; border-color: rgba(95, 181, 148, .4); }
.chip[data-mg="忌"] { color: #c94a5b; border-color: rgba(201, 74, 91, .4); }

.d-tri { font-size: 11px; color: var(--text-dim); letter-spacing: .1em; font-family: var(--mono); }
.d-kv { display: flex; justify-content: space-between; font-size: 11px; color: #cbd8e5; }

/* ---------------------------------------------- 悬停提示 */
.tooltip {
  position: fixed; top: 0; left: 0;
  z-index: 60;
  padding: 9px 12px;
  background: rgba(8, 12, 19, .96);
  border: 1px solid rgba(158, 188, 212, .22);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .16s;
  max-width: 200px;
  box-shadow: var(--shadow), var(--inner-hi);
}
.tooltip.show { opacity: 1; }
.tooltip b {
  display: block;
  font-size: 14px; color: #e8eff7; letter-spacing: .12em;
}
.tooltip span {
  font-size: 10.5px; color: var(--gold-dim);
  font-family: var(--mono);
  letter-spacing: .1em;
  margin-left: 7px;
}
.tooltip i {
  display: block;
  margin-top: 5px;
  font-size: 11px; font-style: normal; color: #b8c6d6;
}

/* ---------------------------------------------- Toast */
.toast {
  position: fixed;
  left: 50%; top: 82px;
  transform: translate(-50%, -12px);
  padding: 9px 18px;
  background: rgba(20, 8, 12, .95);
  border: 1px solid rgba(201, 74, 91, .55);
  border-radius: 2px;
  color: #f0d5da;
  font-size: 11px;
  letter-spacing: .12em;
  font-family: var(--mono);
  z-index: 90;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------------------------------------------- 移动端适配 */
@media (max-width: 820px) {
  .frame { display: none; }
  .hud-top { padding: max(11px, env(safe-area-inset-top)) 13px 11px; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .brand-txt h1 { font-size: 13px; letter-spacing: .12em; }
  .brand-txt p { display: none; }
  .clock { font-size: 12px; }
  .clock-label { display: none; }

  /* 左侧输入改为顶部横向条 */
  .hud-left {
    left: 0; right: 0; top: 52px; bottom: auto;
    width: auto;
    padding: 0 10px;
    display: flex; gap: 8px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
    max-height: 44vh;
  }
  .hud-left::-webkit-scrollbar { display: none; }
  .hud-left .panel { min-width: 190px; margin-bottom: 0; flex-shrink: 0; align-self: flex-start; }
  .panel-toggle { padding: 7px 11px; font-size: 10px; letter-spacing: .2em; }
  .panel-body { padding: 10px; }

  .hud-left.collapsed-all { max-height: none; }

  /* 右侧控件：紧凑单行贴底 */
  .hud-right {
    right: 0; left: 0; bottom: 30px;
    width: auto;
    padding: 0 10px;
    display: flex; gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .hud-right::-webkit-scrollbar { display: none; }
  .hud-right .panel { min-width: 152px; margin-bottom: 0; flex-shrink: 0; align-self: flex-end; }
  /* 移动端只藏四化图例，十二宫配色表保留（帮助辨识宫位） */
  .legend.mutagen-only { display: none; }
  .btn-grid { grid-template-columns: repeat(3, 1fr); }
  .btn-grid.mt { grid-template-columns: 1fr 1fr; }

  /* 详情抽屉改为底部全宽 */
  .detail {
    right: 0; left: 0; bottom: 0;
    width: auto;
    max-height: 58vh;
    border-radius: 6px 6px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    transform: translateY(100%);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .detail.open { transform: translateY(0); }

  .hud-bottom { font-size: 9px; letter-spacing: .16em; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .hud-left .panel { min-width: 178px; }
  .field { margin-bottom: 8px; }
  .field input, .field select { padding: 6px 7px; font-size: 11.5px; }
}

/* 横屏矮屏：压缩纵向占用 */
@media (max-height: 520px) and (orientation: landscape) {
  .hud-bottom { display: none; }
  .hud-left, .hud-right { top: 62px; }
}

/* ---------- 大限 / 流年 时间轴 ---------- */
.plate-switch { margin-bottom: 10px; }
.plate-switch .btn.is-active {
  border-color: rgba(226, 178, 104, .55);
  color: var(--gold-bright);
  background: linear-gradient(160deg, rgba(226, 178, 104, .16), rgba(226, 178, 104, .03));
}
.time-row { display: flex; gap: 6px; align-items: stretch; }
.time-row .btn { flex: 0 0 40px; padding: 0; font-size: 15px; }
.time-row input { flex: 1 1 auto; text-align: center; font-variant-numeric: tabular-nums; }

.time-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 6px 0 0;
  background: transparent;
}
.time-range::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, rgba(66, 127, 147, .7), rgba(158, 188, 212, .16));
}
.time-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -6px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(226, 178, 104, .24);
}
.time-range::-moz-range-track { height: 2px; background: rgba(158, 188, 212, .24); }
.time-range::-moz-range-thumb {
  width: 12px; height: 12px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(226, 178, 104, .24);
}

.time-readout { display: grid; gap: 3px; margin-top: 8px; }
.t-line {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: #8fa2b7;
}
.t-line b { font-weight: 700; color: var(--jade); }
.t-line.flow b { color: var(--copper); }
.t-line.age b { color: var(--gold-bright); }
.time-actions { margin-top: 10px; }
.time-actions .btn { width: 100%; }

/* ==============================================================
 * H5 移动端：盘面优先 + 底部抽屉 + 悬浮 dock
 * --------------------------------------------------------------
 * 桌面是"左右两栏常驻"，手机上那套完全不成立：
 * 390px 宽塞两栏会把盘面挤成一条缝。所以 ≤820px 改成
 *   · 画布满屏，盘面占满整个舞台
 *   · 左右两栏各自变成底部抽屉，一次只上一个
 *   · 底部 dock 三个按钮切换：盘面 / 命盘 / 控制
 * 桌面端这套选择器全部被 media 关掉，不影响原有布局。
 * ============================================================== */
.hud-dock, .hud-hint { display: none; }

@media (max-width: 820px) {
  :root { --dock-h: 58px; }

  body {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
  }

  /* 电影取景框和桌面提示条在手机上只会挤占空间 */
  .frame, .hud-bottom, .tooltip { display: none; }

  /* ---------- 左右两栏 → 底部抽屉 ---------- */
  .hud-left, .hud-right {
    left: 0; right: 0; bottom: 0; top: auto;
    width: auto;
    /* 抽屉高度不能写死 vh：667px 的 iPhone SE 上 66vh 会吃掉 440px，
       盘面只剩一条缝。这里保证「画布可视区 ≥ 250px」，再封顶 62vh。
       dvh 解决 iOS Safari 地址栏收起时的视口跳动，vh 作为旧浏览器兜底。 */
    max-height: 60vh;
    max-height: min(62vh, calc(100dvh - 250px));
    overscroll-behavior: contain;
    padding: 10px 10px calc(var(--dock-h) + env(safe-area-inset-bottom) + 10px);
    overflow-y: auto;
    overflow-x: hidden;
    /* 抵消上一版"横向卡片条"的 flex 布局，这里要竖排堆叠 */
    display: block;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, rgba(6, 10, 17, .95) 0%, rgba(3, 5, 11, .99) 100%);
    border-top: 1px solid rgba(158, 188, 212, .16);
    box-shadow: 0 -20px 44px rgba(0, 0, 0, .6);
    transform: translateY(102%);
    transition: transform .34s cubic-bezier(.22, .8, .36, 1);
    z-index: 30;
    pointer-events: none;
  }
  .hud-left.open, .hud-right.open {
    transform: translateY(0);
    pointer-events: auto;
  }

  /* 抽屉里卡片竖排，宽度跟着容器走 */
  .hud-left .panel, .hud-right .panel {
    min-width: 0;
    flex-shrink: 1;
    align-self: stretch;
  }

  /* 抽屉里不需要玻璃模糊：手机上 backdrop-filter 是最贵的 GPU 开销之一 */
  .panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(9, 13, 20, .92);
    margin-bottom: 8px;
  }

  /* ---------- 触控尺寸与可读性 ---------- */
  .panel-toggle {
    padding: 13px 12px;
    font-size: 12px;
    letter-spacing: .2em;
  }
  .panel-body { padding: 12px; }
  .field span { font-size: 11px; letter-spacing: .16em; }
  /* 16px 是 iOS 的临界值：小于它聚焦时页面会被自动放大 */
  .field input, .field select {
    font-size: 16px;
    padding: 11px 10px;
    min-height: 44px;
  }
  .btn { font-size: 13px; min-height: 44px; letter-spacing: .1em; }
  .btn-row { margin-top: 12px; }
  .btn-grid { gap: 8px; }
  .info .i-row { padding: 9px 0; }
  .i-v { font-size: 13px; }
  .i-k { font-size: 10.5px; }

  /* ---------- 底部 dock ---------- */
  .hud-dock {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--dock-h) + env(safe-area-inset-bottom));
    padding: 8px 10px env(safe-area-inset-bottom);
    gap: 8px;
    align-items: center;
    background: linear-gradient(180deg, rgba(4, 6, 12, .74), rgba(4, 6, 12, .97));
    border-top: 1px solid rgba(158, 188, 212, .13);
    backdrop-filter: blur(14px) saturate(.9);
    -webkit-backdrop-filter: blur(14px) saturate(.9);
    z-index: 35;
    pointer-events: auto;
  }
  .dock-btn {
    flex: 1;
    height: 42px;
    background: rgba(16, 22, 32, .5);
    border: 1px solid rgba(158, 188, 212, .16);
    border-radius: 1px;
    color: #c2d0de;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .2em;
    transition: border-color .2s, color .2s, background .2s;
  }
  .dock-btn:active { background: rgba(28, 38, 52, .6); }
  .dock-btn.active {
    border-color: rgba(226, 178, 104, .5);
    color: var(--gold-bright);
    background: linear-gradient(160deg, rgba(226, 178, 104, .14), rgba(226, 178, 104, .03));
  }

  /* ---------- 手势提示：出现几秒后自己淡出 ---------- */
  .hud-hint {
    display: block;
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 10px);
    text-align: center;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .16em;
    color: rgba(124, 139, 160, .82);
    pointer-events: none;
    z-index: 34;
    transition: opacity .5s ease;
  }
  .hud-hint.hide { opacity: 0; }

  /* 详情抽屉要盖在 dock 之上 */
  .detail { z-index: 45; }
}

/* 超窄屏：dock 字距再收一点 */
@media (max-width: 360px) {
  .dock-btn { letter-spacing: .12em; font-size: 12px; }
  .hud-left .panel, .hud-right .panel { min-width: 0; }
}

/* 矮屏真机（iPhone SE / 小屏安卓 / 横屏手机）：进一步压缩占用 */
@media (max-width: 820px) and (max-height: 680px) {
  :root { --dock-h: 52px; }

  .hud-left, .hud-right {
    max-height: min(58vh, calc(100dvh - 210px));
    padding-top: 6px;
  }
  /* 提示条在矮屏上会压在盘面上，且用户滑一下就懂了，直接不显示 */
  .hud-hint { display: none; }

  .panel-toggle { padding: 11px 12px; }
  .panel-body { padding: 10px 12px; }
  .i-row { padding: 7px 0; }
  .field input, .field select { min-height: 40px; padding: 9px 10px; }
  .btn { min-height: 40px; }
}

/* 横屏手机：dock 更矮，抽屉从底部只占一半高 */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  :root { --dock-h: 46px; }
  .dock-btn { height: 36px; }
  .hud-left, .hud-right { max-height: calc(100dvh - 120px); }
  .hud-top { padding-top: 8px; }
}

/* ============================================================
   我的命盘（历史记录）+ AI 测算报告弹层
   沿用石墨玻璃 + 铜金点睛，不引入新色，保证整站视觉统一
   ============================================================ */

/* ---------- 历史记录卡片 ---------- */
.records-body { display: flex; flex-direction: column; gap: 8px; }
.records-empty {
  font-size: 11px; line-height: 1.7; color: var(--text-faint);
  padding: 6px 2px;
}
.record-card {
  position: relative;
  border: 1px solid var(--panel-line);
  background: linear-gradient(180deg, rgba(15, 21, 30, .6), rgba(8, 12, 19, .55));
  border-radius: 2px;
  padding: 9px 10px;
  transition: border-color .2s, background .2s;
}
.record-card:hover { border-color: var(--panel-line-hi); }
.record-card::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 22px; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.record-meta { display: flex; flex-direction: column; gap: 3px; padding-right: 20px; }
.record-meta .rec-date { font-family: var(--mono); font-size: 12px; color: var(--text); letter-spacing: .02em; }
.record-meta .rec-sub { font-size: 10px; color: var(--text-dim); letter-spacing: .06em; }
.record-actions { display: flex; gap: 6px; margin-top: 8px; }
.rec-btn {
  flex: 1; padding: 6px 4px; font-size: 10px; letter-spacing: .12em;
  background: rgba(16, 22, 32, .5);
  border: 1px solid var(--panel-line);
  color: var(--text-dim); border-radius: 1px; cursor: pointer;
  font-family: var(--font);
  transition: color .2s, border-color .2s, background .2s;
}
.rec-btn:hover { color: var(--text); border-color: var(--panel-line-hi); }
.rec-btn.report { color: var(--gold-dim); }
.rec-btn.report:hover { color: var(--gold-bright); border-color: rgba(226, 178, 104, .4); }
.rec-del {
  position: absolute; top: 6px; right: 8px;
  width: 18px; height: 18px;
  background: none; border: none;
  color: var(--text-faint); font-size: 14px; line-height: 1;
  cursor: pointer; opacity: .55;
  transition: color .2s, opacity .2s;
}
.rec-del:hover { color: var(--crimson); opacity: 1; }

/* ---------- 报告弹层 ---------- */
.report-sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.report-sheet.open { opacity: 1; visibility: visible; }
.report-mask {
  position: absolute; inset: 0;
  background: rgba(2, 4, 8, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.report-card {
  position: relative;
  width: min(560px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(15, 21, 30, .97) 0%, rgba(7, 10, 16, .98) 100%);
  border: 1px solid rgba(158, 188, 212, .2);
  border-radius: 2px;
  box-shadow: var(--shadow), var(--inner-hi);
  transform: translateY(14px) scale(.98);
  transition: transform .32s ease;
}
.report-sheet.open .report-card { transform: translateY(0) scale(1); }
.report-card::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 46px; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--panel-line);
}
.report-head h3 {
  font-family: var(--serif); font-size: 16px; font-weight: 700;
  letter-spacing: .14em; color: var(--gold-bright);
}
.report-close {
  width: 28px; height: 28px;
  background: none; border: none;
  color: var(--text-faint); font-size: 20px; line-height: 1;
  cursor: pointer; transition: color .2s;
}
.report-close:hover { color: var(--crimson); }
.report-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 188, 212, .24) transparent;
}
.report-body::-webkit-scrollbar { width: 3px; }
.report-body::-webkit-scrollbar-thumb { background: rgba(158, 188, 212, .24); }

.rpt-meta {
  display: flex; gap: 14px; align-items: baseline;
  margin-bottom: 12px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim); letter-spacing: .08em;
}
.rpt-meta em { color: var(--gold); font-style: normal; }
.rpt-verdict {
  font-family: var(--serif); font-size: 15px; line-height: 1.85; color: var(--text);
  background: linear-gradient(90deg, rgba(226, 178, 104, .1), transparent);
  border-left: 2px solid var(--gold);
  padding: 10px 12px; margin-bottom: 16px; border-radius: 1px;
}
.rpt-sections { display: flex; flex-direction: column; gap: 12px; }
.rpt-section h4 {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  letter-spacing: .18em; color: var(--ice); margin-bottom: 5px;
}
.rpt-section p { font-size: 13px; line-height: 1.85; color: var(--text); }
.rpt-disclaimer {
  margin-top: 18px; padding-top: 12px;
  border-top: 1px dashed var(--panel-line);
  font-size: 11px; line-height: 1.7; color: var(--text-faint);
  letter-spacing: .04em; text-align: center;
}

/* 移动端：报告弹层改成底部抽屉式，更顺手 */
@media (max-width: 820px) {
  .report-sheet { align-items: flex-end; }
  .report-card {
    width: 100%; max-height: 88vh;
    border-radius: 2px 2px 0 0;
    transform: translateY(100%);
  }
  .report-sheet.open .report-card { transform: translateY(0); }
  .rec-btn { min-height: 38px; }
}
