@font-face {
  font-family:"QimenBoardSC";
  src:url("./fonts/qimen-board-sc.woff2?v=0.8.5-preview.11") format("woff2");
  font-style:normal;
  font-weight:400;
  font-display:block;
}

:root {
  --ink: #241a17;
  --muted: #766963;
  --paper: #fffdf7;
  --paper-2: #f8f1e5;
  --red: #9b2f2f;
  --red-dark: #702020;
  --gold: #c6a65b;
  --line: #d8cbbb;
  --shadow: 0 18px 50px rgba(58, 34, 23, .12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body { margin: 0; color: var(--ink); font-family: "Noto Serif SC", "Songti SC", SimSun, serif; background:
  radial-gradient(circle at 15% 0, rgba(198,166,91,.16), transparent 28rem),
  linear-gradient(135deg, #efe7da, #faf7ef 50%, #eee4d6); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1180px; margin: auto; padding: 28px 22px 48px; }
.app-view[hidden] { display:none !important; }
.input-view { max-width:760px; margin:0 auto; }
.input-masthead { justify-content:center; padding-top:7vh; text-align:left; }
.input-view .controls { grid-template-columns:repeat(4,minmax(0,1fr)); }
.input-view .datetime-field { grid-column:1 / 3; }
.input-view .chart-type-field { grid-column:3; }
.input-view .gender-field { grid-column:4; }
.input-view .name-field { grid-column:1 / 3; }
.input-view .sample-field { grid-column:3 / 5; }
.input-view .start-chart { grid-column:1 / 4; }
.input-view .reset-chart { grid-column:4; }


/* 鍏巻锛忓啘鍘嗭紡鍥涙煴鏃堕棿褰曞叆 */
.input-view .datetime-field { grid-column:1 / -1; }
.input-view .chart-type-field { grid-column:1; }
.input-view .gender-field { grid-column:2; }
.input-view .name-field { grid-column:3 / 5; }
.input-view .sample-field { grid-column:1 / 3; }
.input-view .start-chart { grid-column:3; }
.input-view .reset-chart { grid-column:4; }
.datetime-field { min-width:0; margin:0; padding:0; border:0; }
.datetime-field > legend { margin:0 0 7px; padding:0; color:var(--muted); font-size:13px; }
.datetime-mode-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:12px; padding:3px; background:#f1e7d7; border:1px solid var(--line); border-radius:7px; }
.datetime-mode-tab { min-height:42px; padding:8px 12px; color:var(--red-dark); background:transparent; border:0; border-radius:5px; font-weight:800; letter-spacing:.08em; }
.datetime-mode-tab.active { color:#fff; background:var(--red); box-shadow:0 3px 10px rgba(112,32,32,.2); }
.datetime-mode-tab:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.datetime-mode-panel[hidden] { display:none !important; }
.date-select-grid { display:grid; grid-template-columns:1.25fr repeat(4,minmax(0,1fr)); gap:8px; }
.bazi-select-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.date-select-grid label, .bazi-select-grid label { color:var(--muted); font-size:12px; text-align:center; }
.date-select-grid select, .bazi-select-grid select { min-height:46px; padding:9px 7px; color:var(--ink); background:#fffefa; font-size:16px; font-weight:700; text-align:center; text-align-last:center; }
.datetime-help { margin:9px 2px 0; color:var(--muted); font-size:12px; line-height:1.55; }
.bazi-search { width:100%; min-height:44px; margin-top:10px; }
.datetime-feedback { display:grid; grid-template-columns:auto minmax(0,1fr); gap:3px 10px; align-items:center; margin-top:12px; padding:10px 12px; background:#fff8e9; border-left:4px solid var(--gold); }
.datetime-feedback small { grid-row:1 / 3; color:var(--muted); white-space:nowrap; }
.datetime-feedback strong { color:var(--red-dark); font-size:16px; line-height:1.35; }
.datetime-feedback span { color:var(--muted); font-size:12px; line-height:1.45; }
.datetime-feedback.error { background:#fff0ed; border-left-color:#c1392b; }
.datetime-feedback.error span { color:#a1241c; }
.datetime-feedback.pending { background:#f6f0e3; }
.bazi-candidates { margin-top:10px; }
.candidate-summary, .candidate-empty { margin:0 0 7px; color:var(--muted); font-size:12px; }
.candidate-empty { padding:10px; color:#a1241c; background:#fff0ed; border:1px solid rgba(193,57,43,.25); }
.candidate-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; max-height:210px; overflow:auto; }
.candidate-button { display:grid; grid-template-columns:24px minmax(0,1fr); gap:7px; align-items:center; min-height:46px; padding:8px; text-align:left; color:var(--ink); background:#fffefa; border:1px solid var(--line); border-radius:4px; }
.candidate-button small { display:grid; place-items:center; width:22px; height:22px; color:var(--red-dark); background:#f1e7d7; border-radius:50%; }
.candidate-button strong { min-width:0; font-size:13px; }
.candidate-button.selected { color:var(--red-dark); background:#fff4df; border-color:var(--red); box-shadow:inset 0 0 0 1px var(--red); }

.result-header { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:13px 16px; }
.result-heading { display:flex; align-items:center; gap:14px; min-width:0; }
.result-heading > div { min-width:0; }
.result-heading small { display:block; color:var(--muted); font-size:11px; letter-spacing:.08em; }
.result-heading h2 { margin:2px 0 0; color:var(--red-dark); font-size:22px; line-height:1.1; }
.back-to-input { white-space:nowrap; }
.result-toolbar { flex-wrap:wrap; justify-content:flex-end; }
.masthead { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:22px; }
.brand { display:flex; align-items:center; gap:15px; }
.brand-logo { width:58px; height:58px; flex:0 0 auto; display:block; object-fit:contain; }
h1 { margin:0; font-size:clamp(25px,4vw,42px); letter-spacing:.12em; }
.subtitle { margin:.3rem 0 0; color:var(--muted); letter-spacing:.18em; }
.toolbar { display:flex; gap:10px; }
.primary, .ghost { border-radius:4px; padding:11px 18px; border:1px solid var(--red); }
.primary { color:white; background:var(--red); }
.ghost { color:var(--red); background:transparent; }
.panel { background:rgba(255,253,247,.9); border:1px solid rgba(155,47,47,.18); box-shadow:var(--shadow); }
.controls { padding:18px; display:grid; grid-template-columns:1.15fr .8fr .65fr .55fr 1.25fr auto auto; gap:12px; align-items:end; }
label { display:grid; gap:6px; color:var(--muted); font-size:13px; }
input, select { min-width:0; width:100%; color:var(--ink); background:#fffefa; border:1px solid var(--line); padding:11px 12px; border-radius:3px; }
.chart-navigation { margin-top:12px; padding:10px 12px; display:grid; grid-template-columns:auto auto minmax(180px,1fr) auto auto; gap:9px; align-items:center; }
.chart-navigation button { min-width:102px; padding:9px 12px; }
.chart-navigation button small { display:block; margin-top:2px; font-size:10px; opacity:.72; }
.navigation-current { min-width:0; text-align:center; }
.navigation-current small { display:block; color:var(--muted); font-size:11px; }
.navigation-current strong { display:block; margin-top:3px; color:var(--red-dark); font-size:18px; letter-spacing:.04em; }
.chart { margin-top:18px; padding:22px; }
.chart-meta { display:grid; grid-template-columns:1.35fr .65fr; gap:18px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.chart-summary { grid-column:1 / -1; display:grid; gap:8px; }
.chart-summary-main { display:flex; flex-wrap:nowrap; align-items:center; gap:0; width:100%; color:var(--ink); font-size:14px; line-height:1.55; white-space:nowrap; }
.chart-summary-main span { display:inline-flex; align-items:baseline; min-width:0; white-space:nowrap; }
.chart-summary-main span:not(:last-child)::after { content:"｜"; margin:0 5px; color:var(--line-strong); font-weight:400; }
.chart-summary-main small { margin-right:4px; color:var(--muted); font-size:inherit; }
.chart-summary-main strong { color:var(--red-dark); font-size:inherit; line-height:inherit; }
.chart-basis-toggle { border:1px solid var(--line); border-radius:4px; background:#fffdf7; }
.chart-basis-toggle > summary { padding:8px 10px; color:var(--red-dark); font-size:12px; font-weight:800; cursor:pointer; list-style-position:inside; }
.chart-basis-content { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(220px,.65fr); gap:12px; padding:0 10px 10px; border-top:1px solid var(--line); }
.compact-ju-basis { padding-top:8px; }
.compact-ju-basis p { margin:0 0 6px; color:var(--muted); font-size:12px; line-height:1.55; }
.compact-ju-basis strong, .compact-ju-basis small { display:block; line-height:1.55; }
.compact-ju-basis small { margin-top:4px; color:var(--muted); }
.compact-facts { grid-column:1 / -1; grid-template-columns:repeat(4,minmax(0,1fr)); }
.detail-panel-compat[hidden], #status[hidden] { display:none !important; }
.calendar h2 { margin:0 0 8px; font-size:24px; }
.calendar p { margin:6px 0; color:var(--muted); }
.pillars { display:grid; grid-template-columns:repeat(4,1fr); border:1px solid var(--line); }
.pillars div { padding:9px; text-align:center; border-right:1px solid var(--line); }
.pillars div:last-child { border-right:0; }
.pillars small { display:block; color:var(--muted); margin-bottom:5px; }
.pillars strong { color:var(--red-dark); font-size:22px; }
.tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.tags span { padding:5px 9px; background:var(--paper-2); border-left:3px solid var(--gold); font-size:14px; }
.main-grid { display:grid; grid-template-columns:minmax(520px, 1fr) 280px; gap:22px; margin-top:22px; align-items:start; min-width:0; }
.board-column { min-width:0; }
.board-wrap {
  position:relative;
  display:grid;
  grid-template-columns:96px minmax(0, 1fr) 96px;
  grid-template-rows:82px minmax(0, 1fr) 82px;
  grid-template-areas:
    ". top ."
    "left board right"
    ". bottom .";
  align-items:stretch;
  width:100%;
  min-width:0;
  align-self:start;
}
.board { grid-area:board; width:100%; min-width:0; aspect-ratio:1; display:grid; grid-template-columns:repeat(3,1fr); border:2px solid var(--ink); background:#fffef9; }
.board-horse { z-index:4; display:grid; place-items:center; width:22px; height:22px; color:var(--red); font-size:16px; font-style:normal; font-weight:900; line-height:1; text-shadow:0 0 4px var(--paper), 0 0 4px var(--paper); pointer-events:none; }
.board-horse[hidden] { display:none; }
.board-horse.horse-top-left { grid-column:1; grid-row:1; align-self:end; justify-self:end; margin:0 5px 5px 0; }
.board-horse.horse-top-right { grid-column:3; grid-row:1; align-self:end; justify-self:start; margin:0 0 5px 5px; }
.board-horse.horse-bottom-left { grid-column:1; grid-row:3; align-self:start; justify-self:end; margin:5px 5px 0 0; }
.board-horse.horse-bottom-right { grid-column:3; grid-row:3; align-self:start; justify-self:start; margin:5px 0 0 5px; }
.direction-label { position:absolute; z-index:3; display:grid; place-items:center; width:28px; height:28px; color:var(--red-dark); background:var(--paper); border:1px solid rgba(155,47,47,.28); border-radius:50%; font-size:16px; font-weight:800; line-height:1; box-shadow:0 2px 8px rgba(58,34,23,.08); pointer-events:none; }
.direction-south { top:0; left:50%; transform:translateX(-50%); }
.direction-north { bottom:0; left:50%; transform:translateX(-50%); }
.direction-east { top:50%; left:0; transform:translateY(-50%); }
.direction-west { top:50%; right:0; transform:translateY(-50%); }
.outer-ring { color:var(--ink); min-width:0; min-height:0; }
.outer-top, .outer-bottom { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
.outer-top { grid-area:top; padding-top:30px; }
.outer-bottom { grid-area:bottom; padding-bottom:30px; }
.outer-left, .outer-right { display:grid; grid-template-rows:repeat(3,minmax(0,1fr)); }
.outer-left { grid-area:left; padding-left:32px; }
.outer-right { grid-area:right; padding-right:32px; }
.outer-slot { display:flex; align-items:center; justify-content:center; gap:7px; min-width:0; min-height:0; }
.outer-top .outer-slot, .outer-bottom .outer-slot { flex-direction:column; gap:3px; }
.outer-left .outer-slot { flex-direction:row-reverse; }
.outer-right .outer-slot { flex-direction:row; }
.outer-branch { flex:0 0 auto; color:#bd2d2d; font-size:18px; font-weight:800; line-height:1; }
.outer-hidden { min-width:0; font-size:21px; font-weight:700; letter-spacing:.03em; line-height:1; white-space:nowrap; }
.outer-hidden.empty { color:#c9bfb1; font-size:17px; }
.palace { position:relative; display:grid; grid-template-rows:auto minmax(0,1fr); min-width:0; width:100%; text-align:left; color:var(--ink); background:transparent; border:0; border-right:1px solid var(--ink); border-bottom:1px solid var(--ink); padding:10px 10px 16px; min-height:155px; transition:.18s ease; overflow:hidden; }
.palace:nth-child(3n) { border-right:0; }
.palace:nth-child(n+7) { border-bottom:0; }
.palace:hover, .palace:focus-visible { z-index:2; background:#f9efdd; outline:2px solid var(--gold); }
.palace-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; align-items:start; min-height:34px; }
.palace-head,
.palace-core { transform:translateY(5px); }
.palace-god, .star-door { font-size:20px; line-height:1.2; }
.palace-god { align-self:start; font-weight:600; white-space:nowrap; }
.palace-core { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; min-width:0; min-height:0; }
.stems, .star-door { display:grid; grid-template-rows:repeat(2,minmax(0,1fr)); min-width:0; min-height:0; }
.stems { font-size:23px; line-height:1.08; }
.stem-layer { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); align-items:end; gap:4px; min-width:0; min-height:0; }
.stem-layer:empty { min-height:1em; }
.stem-stack { display:grid; grid-template-rows:13px auto; align-content:end; justify-items:start; min-width:0; min-height:0; }
.changsheng-state { display:none; grid-row:1; align-self:end; color:var(--muted); font-family:"Microsoft YaHei","PingFang SC","Noto Sans CJK SC",sans-serif; font-size:11px; font-weight:400; line-height:13px; letter-spacing:0; white-space:nowrap; font-synthesis:none; }
.show-changsheng .changsheng-state { display:block; }
.stem { grid-row:2; display:block; min-width:0; line-height:1.08; white-space:nowrap; }
.stem-char { display:inline-block; }
.stem.s1 { color:#3153a6; }
.stem.s2 { color:#7d281f; }
.star-door { justify-items:end; align-items:stretch; flex:0 0 auto; }
.star-door strong, .star-door span { display:flex; align-items:flex-end; justify-content:flex-end; min-height:0; white-space:nowrap; }
.star-door strong { font-weight:600; }
.star-door span { color:var(--ink); font-weight:700; }
.palace-name { position:absolute; left:50%; bottom:3px; transform:translateX(-50%); color:var(--muted); font-size:10px; font-weight:400; line-height:1; text-align:center; white-space:nowrap; pointer-events:none; }
.marks { position:static; display:flex; flex-wrap:nowrap; align-items:center; justify-content:flex-end; gap:5px; min-width:0; min-height:16px; }
.mark { display:inline-grid; place-items:center; flex:0 0 auto; min-width:14px; min-height:14px; padding:0; color:var(--red-dark); background:transparent; border-radius:0; font-style:normal; font-size:13px; font-weight:800; line-height:1; white-space:nowrap; }
.mark.void { color:var(--ink); background:transparent; transform:translate(-4px, 4px); }
.void-rings { position:relative; display:inline-block; width:14px; height:14px; border:1.4px solid currentColor; border-radius:50%; box-sizing:border-box; }
.void-rings::after { content:""; position:absolute; inset:3px; border:1.2px solid currentColor; border-radius:50%; box-sizing:border-box; }
.mark.horse { color:var(--red); background:transparent; }
.center { display:flex; flex-direction:column; justify-content:center; align-items:center; background:radial-gradient(circle, #fff 0, #f7efdf 75%); }
.taiji-scene { position:relative; display:grid; place-items:center; width:74px; height:74px; transform:translateY(5px); perspective:260px; pointer-events:none; }
.taiji-scene::after { content:""; position:absolute; left:16%; right:16%; bottom:-5px; height:10px; border-radius:50%; background:rgba(35,27,19,.24); filter:blur(5px); animation:taiji-shadow 8s ease-in-out infinite; }
.taiji-disc { position:relative; z-index:1; display:block; width:100%; height:100%; border-radius:50%; transform-style:preserve-3d; animation:taiji-spin-3d 8s linear infinite; box-shadow:inset -4px -5px 8px rgba(0,0,0,.24), inset 3px 3px 5px rgba(255,255,255,.58), 0 4px 7px rgba(38,28,18,.3); }
.taiji-disc::after { content:""; position:absolute; inset:2px; border-radius:50%; border:1px solid rgba(255,255,255,.34); box-shadow:inset 0 0 0 1px rgba(0,0,0,.2); pointer-events:none; }
.taiji-svg { display:block; width:100%; height:100%; border-radius:50%; overflow:visible; }
.center-host { transform:translateY(5px); }
@keyframes taiji-spin-3d {
  0% { transform:rotateX(12deg) rotateY(-8deg) rotateZ(0deg); }
  25% { transform:rotateX(5deg) rotateY(10deg) rotateZ(90deg); }
  50% { transform:rotateX(-12deg) rotateY(7deg) rotateZ(180deg); }
  75% { transform:rotateX(-4deg) rotateY(-10deg) rotateZ(270deg); }
  100% { transform:rotateX(12deg) rotateY(-8deg) rotateZ(360deg); }
}
@keyframes taiji-shadow {
  0%, 100% { opacity:.62; transform:scaleX(.9); }
  50% { opacity:.35; transform:scaleX(.72); }
}
@media (prefers-reduced-motion:reduce) {
  .taiji-disc, .taiji-scene::after { animation:none; }
}
.center small { color:var(--muted); margin-top:8px; }
.sidebar { display:grid; min-width:0; align-content:start; gap:14px; }
.side-card { border-top:4px solid var(--red); background:var(--paper-2); padding:16px; }
.side-card h3 { margin:0 0 12px; }
.facts { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.facts div { background:#fffdf7; border:1px solid var(--line); padding:9px; }
.facts small { display:block; color:var(--muted); }
.facts strong { font-size:18px; color:var(--red-dark); }
dl { margin:0; } dl div { display:flex; justify-content:space-between; gap:10px; padding:7px 0; border-bottom:1px dashed var(--line); } dt { color:var(--muted); } dd { margin:0; text-align:right; }
.status { margin-top:18px; padding:12px 14px; border-left:4px solid; }
.status.success { background:#edf5eb; border-color:#53854a; }
.status.warning { background:#fff1d9; border-color:#c07a15; }
.notes { margin-top:18px; padding:18px 22px; }
.notes h3 { margin-top:0; } .notes li { margin:8px 0; color:var(--muted); }
@media (max-width: 850px) {
  .masthead { align-items:flex-start; } .toolbar { flex-direction:column; }
  .controls { grid-template-columns:1fr 1fr; } .controls label:first-child, .controls .datetime-field { grid-column:1/-1; }
  .chart-navigation { grid-template-columns:repeat(4,1fr); } .navigation-current { grid-column:1/-1; grid-row:1; } .chart-navigation button { min-width:0; }
  .chart-meta, .main-grid { grid-template-columns:1fr; }
  .chart-basis-content { grid-template-columns:1fr; }
  .sidebar { grid-template-columns:1fr 1fr; }
}
@media (max-width: 590px) {
  .app-shell { padding:14px 8px 30px; } .masthead { flex-direction:column; }
  .toolbar { width:100%; flex-direction:row; } .toolbar button { flex:1; }
  .controls { grid-template-columns:1fr 1fr; } .controls label:first-child, .controls .datetime-field { grid-column:1/-1; }
  .chart-navigation { grid-template-columns:1fr 1fr; padding:9px; } .navigation-current { grid-column:1/-1; } .chart-navigation button { font-size:13px; }
  .chart { padding:10px; } .calendar h2 { font-size:19px; }
  .chart-meta { gap:10px; padding-bottom:10px; }
  .chart-summary { gap:6px; }
  .chart-summary-main { gap:0; font-size:clamp(10px, 3vw, 12px); }
  .chart-summary-main span:not(:last-child)::after { margin:0 2px; }
  .chart-basis-toggle > summary { padding:7px 8px; }
  .chart-basis-content { gap:6px; padding:0 8px 8px; }
  .compact-facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .main-grid { display:block; } .sidebar { margin-top:14px; grid-template-columns:1fr; }
  .board-wrap { grid-template-columns:64px minmax(0, 1fr) 64px; grid-template-rows:64px minmax(0, 1fr) 64px; }
  .direction-label { width:24px; height:24px; font-size:14px; }
  .outer-top { padding-top:26px; } .outer-bottom { padding-bottom:26px; } .outer-left { padding-left:26px; } .outer-right { padding-right:26px; }
  .outer-slot { gap:3px; } .outer-top .outer-slot, .outer-bottom .outer-slot { gap:2px; } .outer-branch { font-size:14px; } .outer-hidden { font-size:16px; }
  .palace { min-height:112px; padding:6px 6px 12px; } .palace-head { min-height:30px; gap:3px; }
  .palace-god, .star-door { font-size:17px; } .stems { font-size:17px; } .stem-layer { gap:2px; } .stem-stack { grid-template-rows:10px auto; } .changsheng-state { font-size:9px; } .palace-core { gap:4px; } .marks { gap:3px; min-height:14px; } .mark { min-width:12px; min-height:12px; font-size:11px; } .void-rings { width:12px; height:12px; } .void-rings::after { inset:2.5px; } .palace-name { font-size:8px; } .taiji-scene { width:53px; height:53px; perspective:210px; }
}
@media print {
  body { background:white; } .app-shell { padding:0; } .controls, .toolbar, .chart-navigation, .notes { display:none; } .panel { box-shadow:none; } .chart { border:0; margin:0; }
}

/* 闂冨娲忛崚鎴濐暩鏉╊偊顤侀懝鑼额潐閸?*/
.effect-tomb { color:#16883b !important; }
.effect-strike { color:#1857d8 !important; }
.effect-both { color:#d51fb8 !important; }
.effect-pressure { color:#d01818 !important; }
.stem-char { display:inline; }
.door { font-weight:700; }
.center-host { margin-top:6px; color:#78552b; font-size:14px; }
.color-legend { display:flex; flex-wrap:wrap; gap:8px; list-style:none; margin-left:-20px !important; }
.legend { padding:5px 9px; background:#fffdf7; border:1px solid var(--line); font-weight:700; }
.legend.tomb { color:#16883b; }
.legend.strike { color:#1857d8; }
.legend.both { color:#d51fb8; }
.legend.pressure { color:#d01818; }
.ju-card p { margin:0 0 9px; color:var(--muted); line-height:1.6; }
.ju-card > strong { display:block; color:var(--red-dark); background:#fffdf7; border:1px solid var(--line); padding:10px; font-size:16px; }
.ju-card > small { display:block; margin-top:9px; color:var(--muted); line-height:1.55; }









/* 缁堣韩鐩樺ぇ杩?*/
.dayun-section { margin-top:20px; border-top:1px solid var(--line); padding-top:18px; }
.dayun-section[hidden] { display:none; }
.dayun-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:12px; }
.dayun-heading h3 { margin:2px 0 0; font-size:22px; color:var(--red-dark); }
.dayun-heading small { color:var(--muted); letter-spacing:.12em; }
.dayun-heading p { margin:0; color:var(--muted); text-align:right; line-height:1.55; }
.fortune-inline { width:100%; min-width:0; }
.dayun-table-wrap { width:100%; max-width:100%; overflow:hidden; border:1px solid var(--line); background:#fffdf7; }
.dayun-table { width:100%; min-width:0; border-collapse:collapse; table-layout:fixed; text-align:center; }
.dayun-table th, .dayun-table td { border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:12px 9px; white-space:nowrap; }
.dayun-table tr:last-child th, .dayun-table tr:last-child td { border-bottom:0; }
.dayun-table th { width:66px; color:var(--red-dark); background:#f5e8cf; font-size:14px; }
.dayun-table td { min-width:0; font-size:17px; font-weight:700; }
.dayun-table #dayun-ganzhi td { color:var(--red-dark); font-size:20px; }
.dayun-table td.current-dayun { background:#fff0c7; box-shadow:inset 0 -4px 0 #c07a15; }
.dayun-table td[data-dayun-index] { cursor:pointer; transition:background .15s ease, box-shadow .15s ease; }
.dayun-table td[data-dayun-index]:hover { background:#fff7df; }
.dayun-table td.selected-dayun { background:#f8e5bc; box-shadow:inset 0 0 0 2px var(--red-dark); }
.dayun-table td.current-dayun.selected-dayun { background:#ffe3a2; box-shadow:inset 0 0 0 2px var(--red-dark), inset 0 -4px 0 #c07a15; }
.liunian-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin:20px 0 10px; }
.liunian-heading h4 { margin:2px 0 0; font-size:19px; color:var(--red-dark); }
.liunian-heading small, .liunian-heading p { color:var(--muted); }
.liunian-heading p { margin:0; text-align:right; line-height:1.55; }
.liunian-table-wrap { width:100%; max-width:100%; overflow:hidden; border:1px solid var(--line); background:#fffdf7; }
.liunian-table { width:100%; min-width:0; border-collapse:collapse; table-layout:fixed; text-align:center; }
.liunian-table th, .liunian-table td { border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:10px 7px; white-space:nowrap; }
.liunian-table tr:last-child th, .liunian-table tr:last-child td { border-bottom:0; }
.liunian-table th { width:66px; color:var(--red-dark); background:#f5e8cf; font-size:14px; }
.liunian-table td { min-width:0; font-size:16px; font-weight:700; }
.liunian-table #liunian-ganzhi td { color:var(--red-dark); font-size:19px; }
.liunian-table td.current-liunian { background:#fff0c7; box-shadow:inset 0 -4px 0 #c07a15; }
@media (max-width:590px) {
  .dayun-heading, .liunian-heading { align-items:flex-start; flex-direction:column; gap:6px; }
  .dayun-heading p, .liunian-heading p { text-align:left; font-size:13px; }
  .dayun-table, .liunian-table { width:100%; min-width:0; }
  .dayun-table th, .dayun-table td, .liunian-table th, .liunian-table td { padding:8px 2px; }
}


/* 鍙姌鍙犱俊鎭崱 */
.mobile-detail { overflow:hidden; }
.mobile-detail > summary, .notes > summary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  color:var(--red-dark);
  font-weight:800;
  cursor:pointer;
  list-style:none;
}
.mobile-detail > summary::-webkit-details-marker, .notes > summary::-webkit-details-marker { display:none; }
.mobile-detail > summary::after, .notes > summary::after {
  content:"＋";
  flex:0 0 auto;
  font-size:20px;
  font-weight:400;
  line-height:1;
}
.mobile-detail[open] > summary::after, .notes[open] > summary::after { content:"－"; }
.mobile-detail[open] > summary { margin-bottom:12px; }
.detail-content h3 { margin:0 0 12px; }
.notes > summary { font-size:18px; }
.notes[open] > summary { margin-bottom:10px; }

/* 鎵嬫満浼樺厛甯冨眬锛氭牳蹇冩帓鐩樺崰婊″睆骞曪紝娆¤淇℃伅鎶樺彔 */
@media screen and (max-width:700px) {
  body { background:#f3ede3; }
  .app-shell { width:100%; max-width:none; padding:10px 6px 28px; overflow:hidden; }
  .panel { box-shadow:0 8px 24px rgba(58,34,23,.08); }
  .app-view { width:100%; }
  .input-view { min-height:calc(100vh - 38px); display:flex; flex-direction:column; justify-content:center; }
  .input-masthead { justify-content:flex-start; padding:0 6px; }
  .input-view .controls { width:100%; }
  .input-view .notes { margin-top:10px; }
  .result-header { position:sticky; top:0; z-index:20; margin:0 -2px 8px; padding:8px; flex-direction:column; align-items:stretch; gap:8px; background:rgba(255,253,247,.97); backdrop-filter:blur(8px); }
  .result-heading { justify-content:space-between; gap:8px; }
  .result-heading > div { order:-1; }
  .result-heading small { font-size:9px; }
  .result-heading h2 { font-size:18px; }
  .back-to-input { min-height:44px; padding:8px 12px; }
  .result-toolbar { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; gap:6px; }
  .result-toolbar button { min-width:0; min-height:44px; padding:8px 4px; font-size:12px; line-height:1.2; }

  .masthead { flex-direction:column; gap:10px; margin-bottom:12px; }
  .brand { width:100%; gap:10px; }
  .brand-logo { width:44px; height:44px; }
  h1 { font-size:clamp(18px,5.8vw,22px); letter-spacing:.04em; white-space:nowrap; }
  .subtitle { margin-top:2px; font-size:11px; letter-spacing:.1em; }
  .toolbar { width:100%; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .toolbar button { min-width:0; min-height:44px; padding:8px 4px; font-size:12px; line-height:1.2; }

  .controls, .input-view .controls { padding:12px; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 8px; align-items:end; }
  .datetime-field > legend { font-size:12px; }
  .datetime-mode-tabs { position:sticky; top:8px; z-index:4; margin-bottom:10px; }
  .datetime-mode-tab { min-height:44px; padding:8px 4px; font-size:15px; }
  .date-select-grid { grid-template-columns:repeat(6,minmax(0,1fr)); gap:7px 5px; }
  .date-select-grid label:nth-child(1) { grid-column:span 2; }
  .date-select-grid label:nth-child(2), .date-select-grid label:nth-child(3) { grid-column:span 2; }
  .date-select-grid label:nth-child(4), .date-select-grid label:nth-child(5) { grid-column:span 3; }
  .bazi-select-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
  .date-select-grid select, .bazi-select-grid select { min-height:48px; padding:8px 3px; font-size:16px; }
  .datetime-feedback { grid-template-columns:1fr; gap:3px; padding:9px 10px; }
  .datetime-feedback small { grid-row:auto; }
  .datetime-feedback strong { font-size:15px; }
  .candidate-list { grid-template-columns:1fr; max-height:240px; }
  .candidate-button { min-height:48px; }
  .controls .datetime-field, .controls .name-field, .controls .sample-field,
  .input-view .datetime-field, .input-view .name-field, .input-view .sample-field { grid-column:1/-1; }
  .controls .datetime-field { grid-row:1; }
  .controls .chart-type-field { grid-row:2; grid-column:1; }
  .controls .gender-field { grid-row:2; grid-column:2; }
  .controls .name-field { grid-row:3; }
  .controls .sample-field { grid-row:4; }
  .controls .start-chart, .input-view .start-chart { grid-row:5; grid-column:1; }
  .controls .reset-chart { grid-row:5; grid-column:2; }
  label { gap:5px; font-size:12px; }
  input, select, .controls button { min-height:46px; padding:10px 11px; font-size:16px; }
  .controls .start-chart { font-size:17px; font-weight:800; }

  .chart-navigation {
    margin-top:8px;
    padding:8px;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-areas:"current current" "prev-ju next-ju" "prev-day next-day";
    gap:7px;
  }
  #previous-day { grid-area:prev-day; }
  #previous-ju { grid-area:prev-ju; }
  #next-ju { grid-area:next-ju; }
  #next-day { grid-area:next-day; }
  .navigation-current { grid-area:current; padding:4px 4px 7px; border-bottom:1px solid var(--line); }
  .navigation-current strong { margin-top:2px; font-size:17px; }
  .chart-navigation button { min-width:0; min-height:44px; padding:7px 6px; font-size:14px; }
  .chart-navigation button small { display:inline; margin:0 0 0 2px; font-size:9px; }

  .chart { margin-top:10px; padding:10px 4px 14px; overflow:hidden; }
  .chart-meta { display:block; padding:0 6px 12px; }
  .calendar h2 { margin-bottom:5px; font-size:18px; line-height:1.35; }
  .calendar p { margin:4px 0; font-size:13px; line-height:1.45; }
  .tags { flex-wrap:nowrap; gap:6px; margin:8px -2px 10px; padding:0 2px 4px; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
  .tags::-webkit-scrollbar { display:none; }
  .tags span { flex:0 0 auto; padding:4px 7px; font-size:11px; white-space:nowrap; }
  .pillars { margin-top:8px; }
  .pillars div { min-width:0; padding:7px 2px; }
  .pillars small { margin-bottom:3px; font-size:10px; }
  .pillars strong { font-size:18px; }

  .main-grid { display:block; min-width:0; margin-top:12px; }
  .board-column { width:100%; min-width:0; }
  .board-wrap {
    width:100%;
    grid-template-columns:32px minmax(0,1fr) 32px;
    grid-template-rows:46px minmax(0,1fr) 46px;
  }
  .board { min-width:0; width:100%; aspect-ratio:1; }
  .direction-label { width:18px; height:18px; font-size:11px; box-shadow:none; }
  .direction-south { top:-2px; }
  .direction-north { bottom:-2px; }
  .direction-east { left:-2px; }
  .direction-west { right:-2px; }
  .outer-top { padding:18px 0 2px; }
  .outer-bottom { padding:2px 0 18px; }
  .outer-left { padding:0 1px 0 19px; }
  .outer-right { padding:0 19px 0 1px; }
  .outer-slot, .outer-top .outer-slot, .outer-bottom .outer-slot { gap:1px; }
  .outer-left .outer-slot, .outer-right .outer-slot { flex-direction:column; }
  .outer-left .outer-hidden, .outer-right .outer-hidden { writing-mode:vertical-rl; text-orientation:upright; }
  .outer-branch { font-size:12px; }
  .outer-hidden, .outer-hidden.empty { font-size:13px; letter-spacing:0; }
  body[data-display-mode="simple"] .board-wrap { grid-template-columns:30px minmax(0,1fr) 30px; grid-template-rows:34px minmax(0,1fr) 34px; }
  body[data-display-mode="simple"] .direction-label { width:16px; height:16px; font-size:10px; }
  body[data-display-mode="simple"] .outer-top { padding:17px 0 0; }
  body[data-display-mode="simple"] .outer-bottom { padding:0 0 17px; }
  body[data-display-mode="simple"] .outer-left { padding:0 0 0 17px; }
  body[data-display-mode="simple"] .outer-right { padding:0 17px 0 0; }

  .palace { min-height:0; padding:4px 4px 22px; }
  .palace-head { min-height:22px; gap:2px; }
  .palace-god, .star-door { font-size:14px; line-height:1.1; }
  .palace-god { font-weight:700; }
  .palace-core { gap:3px; }
  .stems { font-size:15px; line-height:1.05; }
  .stem-layer { gap:1px; }
  .stem-stack { grid-template-rows:10px auto; }
  .changsheng-state { font-size:8px; line-height:10px; letter-spacing:0; transform:none; }
  .marks { gap:2px; min-height:12px; }
  .mark { min-width:11px; min-height:11px; font-size:10px; }
  .void-rings { width:11px; height:11px; border-width:1.2px; }
  .void-rings::after { inset:2.3px; border-width:1px; }
  .palace-name { bottom:2px; font-size:7px; }
  .taiji-scene { width:39px; height:39px; perspective:180px; }
  .center small { margin-top:3px; }
  .center-host { margin-top:3px; font-size:10px; }

  .sidebar { margin-top:12px; display:grid; grid-template-columns:1fr; gap:8px; }
  .side-card { padding:12px; border-top-width:3px; }
  .mobile-detail > summary { min-height:24px; font-size:16px; }
  .mobile-detail > summary::after { font-size:18px; }
  .mobile-detail[open] > summary { margin-bottom:9px; }
  .facts { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .facts div { min-width:0; padding:7px; }
  .facts small { font-size:10px; }
  .facts strong { display:block; overflow-wrap:anywhere; font-size:14px; }
  dl div { padding:7px 0; font-size:13px; }
  dd { max-width:68%; overflow-wrap:anywhere; }
  .detail-content h3 { margin-bottom:7px; font-size:16px; }
  .detail-content p { margin:0; color:var(--muted); font-size:13px; line-height:1.6; }
  .ju-card p, .ju-card > small { font-size:12px; }
  .ju-card > strong { padding:8px; font-size:14px; overflow-wrap:anywhere; }

  .dayun-section { margin-top:12px; padding:12px 4px 0; }
  .dayun-heading, .liunian-heading { align-items:flex-start; flex-direction:column; gap:3px; margin-bottom:8px; }
  .dayun-heading h3 { font-size:19px; }
  .liunian-heading { margin-top:15px; }
  .liunian-heading h4 { font-size:17px; }
  .dayun-heading p, .liunian-heading p { text-align:left; font-size:11px; }
  .dayun-table-wrap, .liunian-table-wrap { width:100%; max-width:100%; overflow:hidden; }
  .dayun-table, .liunian-table { width:100%; min-width:0; table-layout:fixed; }
  .dayun-table th, .dayun-table td, .liunian-table th, .liunian-table td { padding:7px 1px; overflow:hidden; text-overflow:clip; }
  .dayun-table th, .liunian-table th { width:34px; font-size:10px; }
  .dayun-table td { min-width:0; font-size:10px; }
  .dayun-table #dayun-ganzhi td { font-size:12px; }
  .liunian-table td { min-width:0; font-size:9px; }
  .liunian-table #liunian-ganzhi td { font-size:11px; }

  .status { margin:12px 4px 0; padding:10px; font-size:12px; line-height:1.55; }
  .notes { margin-top:10px; padding:13px; }
  .notes > summary { min-height:30px; font-size:15px; }
  .notes ul { margin:0; padding-left:20px; }
  .notes li { margin:7px 0; font-size:12px; line-height:1.55; }
  .color-legend { margin-left:-20px !important; gap:4px; }
  .legend { padding:4px 6px; font-size:11px; }
}

@media screen and (max-width:360px) {
  .app-shell { padding-left:4px; padding-right:4px; }
  .chart { padding-left:2px; padding-right:2px; }
  .board-wrap { grid-template-columns:28px minmax(0,1fr) 28px; grid-template-rows:44px minmax(0,1fr) 44px; }
  .direction-label { width:16px; height:16px; font-size:10px; }
  .outer-top { padding:16px 0 2px; } .outer-bottom { padding:2px 0 16px; } .outer-left { padding:0 0 0 16px; } .outer-right { padding:0 16px 0 0; }
  body[data-display-mode="simple"] .board-wrap { grid-template-columns:28px minmax(0,1fr) 28px; grid-template-rows:30px minmax(0,1fr) 30px; }
  body[data-display-mode="simple"] .direction-label { width:14px; height:14px; font-size:9px; }
  body[data-display-mode="simple"] .outer-top { padding:15px 0 0; } body[data-display-mode="simple"] .outer-bottom { padding:0 0 15px; } body[data-display-mode="simple"] .outer-left { padding:0 0 0 15px; } body[data-display-mode="simple"] .outer-right { padding:0 15px 0 0; }
  .palace { padding:3px 3px 22px; }
  .palace-god, .star-door { font-size:13px; }
  .stems { font-size:14px; }
  .palace-core { gap:2px; }
  .stem-layer { gap:0; }
  .marks { gap:1px; }
  .taiji-scene { width:34px; height:34px; }
  .center-host { font-size:9px; }
}

@media print {
  .dayun-table-wrap, .liunian-table-wrap { overflow:visible; }
  .dayun-table, .liunian-table { min-width:0; }
  .dayun-table th, .dayun-table td, .liunian-table th, .liunian-table td { padding:8px 4px; font-size:12px; }
  .dayun-table #dayun-ganzhi td, .liunian-table #liunian-ganzhi td { font-size:14px; }
}


/* 鎵嬫満浼樺厛鏃堕棿閫夋嫨鍣細涓婚〉闈繚鎸佺畝娲侊紝鐐瑰嚮鍚庝粠搴曢儴寮瑰嚭婊氳疆 */
.datetime-trigger {
  width:100%; min-height:82px; display:grid; grid-template-columns:44px minmax(0,1fr) 20px;
  align-items:center; gap:12px; padding:13px 14px; color:var(--ink); text-align:left;
  background:linear-gradient(135deg,#fffefa,#fff8ec); border:1px solid #d9c8b3; border-radius:14px;
  box-shadow:0 7px 18px rgba(82,48,31,.08); -webkit-tap-highlight-color:transparent;
}
.datetime-trigger:active { transform:scale(.995); background:#fff7e8; }
.datetime-trigger:focus-visible { outline:3px solid rgba(155,47,47,.2); outline-offset:2px; }
.datetime-trigger-icon { display:grid; place-items:center; width:44px; height:44px; color:#fff; background:var(--red); border-radius:13px; font-size:19px; font-weight:900; box-shadow:inset 0 0 0 2px rgba(255,255,255,.2); }
.datetime-trigger-copy { display:grid; min-width:0; gap:3px; }
.datetime-trigger-copy small { color:var(--red); font-size:12px; font-weight:800; letter-spacing:.05em; }
.datetime-trigger-copy strong { overflow:hidden; color:var(--ink); font-size:18px; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.datetime-trigger-copy > span { overflow:hidden; color:var(--muted); font-size:12px; line-height:1.4; text-overflow:ellipsis; white-space:nowrap; }
.datetime-trigger-arrow { color:#b49b83; font-family:Arial,sans-serif; font-size:31px; font-weight:300; }
.datetime-feedback { display:none; margin:7px 2px 0; padding:8px 10px; border:0; border-radius:8px; font-size:12px; line-height:1.45; }
.datetime-feedback.error, .datetime-feedback.pending { display:block; }
.datetime-feedback.error { color:#a1241c; background:#fff0ed; }
.datetime-feedback.pending { color:#78552b; background:#fff7df; }

.datetime-sheet[hidden] { display:none !important; }
.datetime-sheet { position:fixed; inset:0; z-index:1000; display:flex; align-items:flex-end; justify-content:center; font-family:"Noto Sans SC","Microsoft YaHei",sans-serif; }
.datetime-backdrop { position:absolute; inset:0; width:100%; height:100%; padding:0; background:rgba(25,18,15,.48); border:0; opacity:0; transition:opacity .22s ease; -webkit-tap-highlight-color:transparent; }
.datetime-sheet-panel { position:relative; width:min(100%,560px); max-height:min(88vh,720px); padding:0 14px calc(14px + env(safe-area-inset-bottom)); overflow-y:auto; overscroll-behavior:contain; color:#26201d; background:#fff; border-radius:22px 22px 0 0; box-shadow:0 -16px 45px rgba(31,20,15,.22); transform:translateY(102%); transition:transform .24s cubic-bezier(.2,.75,.25,1); }
.datetime-sheet.open .datetime-backdrop { opacity:1; }
.datetime-sheet.open .datetime-sheet-panel { transform:translateY(0); }
.datetime-sheet-open { overflow:hidden; touch-action:none; }
.sheet-grabber { width:38px; height:4px; margin:8px auto 3px; background:#d8d3cf; border-radius:999px; }
.datetime-sheet-header { display:grid; grid-template-columns:64px minmax(0,1fr) 64px; align-items:center; min-height:48px; border-bottom:1px solid #eee9e5; }
.datetime-sheet-header h2 { margin:0; font-size:16px; text-align:center; letter-spacing:.03em; }
.sheet-action { min-height:44px; padding:5px 4px; background:transparent; border:0; font-size:15px; }
.sheet-cancel { color:#777; text-align:left; }
.sheet-confirm { color:var(--red); text-align:right; font-weight:800; }
.datetime-sheet .datetime-mode-tabs { width:min(100%,270px); margin:12px auto 4px; padding:2px; background:#fff; border:1px solid #d9b2b2; border-radius:999px; }
.datetime-sheet .datetime-mode-tab { min-height:34px; padding:5px 12px; color:#554b47; border-radius:999px; font-size:14px; letter-spacing:.03em; }
.datetime-sheet .datetime-mode-tab.active { color:#fff; background:#d73535; box-shadow:none; }
.picker-preview { display:grid; gap:2px; min-height:54px; padding:8px 4px 4px; text-align:center; }
.picker-preview strong { color:#2e2825; font-size:15px; line-height:1.4; }
.picker-preview span { color:#9a8f89; font-size:11px; line-height:1.35; }
.datetime-sheet .datetime-mode-panel { padding-top:2px; }
.wheel-picker { --wheel-row:46px; position:relative; display:grid; height:calc(var(--wheel-row) * 5); overflow:hidden; border-top:1px solid #f0ece9; border-bottom:1px solid #f0ece9; }
.wheel-picker-five { grid-template-columns:1.18fr .82fr .82fr .82fr .82fr; }
.wheel-picker-bazi { grid-template-columns:repeat(4,minmax(0,1fr)); }
.wheel-picker::before { content:""; position:absolute; z-index:0; left:0; right:0; top:calc(var(--wheel-row) * 2); height:var(--wheel-row); background:linear-gradient(90deg,rgba(155,47,47,.06),rgba(155,47,47,.105),rgba(155,47,47,.06)); border-top:1px solid rgba(155,47,47,.17); border-bottom:1px solid rgba(155,47,47,.17); pointer-events:none; }
.wheel-picker::after { content:""; position:absolute; z-index:3; inset:0; background:linear-gradient(to bottom,#fff 0,rgba(255,255,255,.82) 15%,transparent 39%,transparent 61%,rgba(255,255,255,.82) 85%,#fff 100%); pointer-events:none; }
.wheel-column { position:relative; z-index:1; min-width:0; }
.wheel-heading { position:absolute; z-index:4; top:50%; right:2px; transform:translateY(-50%); color:#9f948d; font-size:10px; pointer-events:none; }
.wheel-scroll { height:100%; overflow-y:auto; overscroll-behavior:contain; scroll-snap-type:y mandatory; scrollbar-width:none; -webkit-overflow-scrolling:touch; touch-action:pan-y; }
.wheel-scroll::-webkit-scrollbar { display:none; }
.wheel-spacer { height:calc(var(--wheel-row) * 2); }
.wheel-option { display:block; width:100%; height:var(--wheel-row); padding:0 12px 0 2px; overflow:hidden; color:#aaa09b; background:transparent; border:0; scroll-snap-align:center; scroll-snap-stop:always; font-size:15px; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
.wheel-option.selected { color:#241f1c; font-size:18px; font-weight:800; }
.wheel-picker-bazi .wheel-option { padding-right:2px; font-size:18px; }
.wheel-picker-bazi .wheel-option.selected { color:var(--red); font-size:22px; }
.datetime-sheet .datetime-help { margin:9px 4px 0; text-align:center; font-size:11px; }
.datetime-sheet .bazi-search { min-height:46px; margin-top:12px; color:#fff; background:var(--red); border:0; border-radius:999px; font-size:15px; font-weight:800; }
.datetime-sheet .bazi-candidates { margin:10px 0 2px; }
.datetime-sheet .candidate-list { max-height:150px; }
.datetime-sheet .candidate-button { min-height:48px; border-radius:10px; }
.datetime-state-controls { position:absolute !important; width:1px !important; height:1px !important; overflow:hidden !important; clip-path:inset(50%) !important; white-space:nowrap !important; }

@media screen and (max-width:700px) {
  .input-masthead { padding-top:12px; }
  .input-view .controls { padding:12px; border-radius:14px; }
  .datetime-field > legend { margin-bottom:7px; }
  .datetime-trigger { min-height:84px; padding:13px 12px; border-radius:13px; }
  .datetime-trigger-copy strong { font-size:17px; }
  .datetime-sheet-panel { width:100%; max-height:91dvh; border-radius:20px 20px 0 0; }
  .wheel-picker { --wheel-row:44px; }
  .wheel-option { font-size:14px; }
  .wheel-option.selected { font-size:17px; }
  .candidate-list { grid-template-columns:1fr; }
}

@media screen and (min-width:701px) {
  .datetime-sheet { align-items:center; padding:24px; }
  .datetime-sheet-panel { border-radius:22px; transform:translateY(30px) scale(.98); opacity:0; transition:transform .22s ease,opacity .22s ease; }
  .datetime-sheet.open .datetime-sheet-panel { transform:translateY(0) scale(1); opacity:1; }
}

/* 婊氳疆蹇呴』鍦ㄥ浐瀹氶珮搴﹀唴婊氬姩锛屼笉鑳借闀垮勾浠藉垪琛ㄦ拺楂?*/
.wheel-picker { min-height:calc(var(--wheel-row) * 5); }
.wheel-column { min-height:0; height:100%; overflow:hidden; }
.wheel-scroll { position:absolute; inset:0; height:auto; }

/* 鎵嬫満绔洓鏌憋細姣忔鍙搷浣滀竴鏌憋紝澶╁共涓庡湴鏀垎鍒粴鍔ㄩ€夋嫨 */
.bazi-mode-panel { padding-top:8px !important; }
.bazi-pillar-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin:0 2px 10px; }
.bazi-pillar-tab { min-width:0; min-height:58px; padding:7px 2px 6px; color:#756a64; background:#f7f3f0; border:1px solid #e8dfda; border-radius:12px; text-align:center; }
.bazi-pillar-tab small { display:block; margin-bottom:3px; color:#9b8e87; font-size:11px; line-height:1.2; }
.bazi-pillar-tab strong { display:block; color:#332b27; font-family:"Noto Serif SC","Songti SC",serif; font-size:19px; line-height:1.15; letter-spacing:.08em; }
.bazi-pillar-tab.active { background:#fff8f5; border-color:rgba(155,47,47,.52); box-shadow:0 3px 12px rgba(115,42,42,.09); }
.bazi-pillar-tab.active small,.bazi-pillar-tab.active strong { color:var(--red); }
.bazi-current-label { display:flex; align-items:center; justify-content:space-between; min-height:34px; padding:0 7px; }
.bazi-current-label span { color:var(--red); font-size:14px; font-weight:800; }
.bazi-current-label strong { color:#9b8e87; font-size:12px; font-weight:600; }
.bazi-pillar-wheel[hidden] { display:none !important; }
.wheel-picker-bazi-pair { grid-template-columns:repeat(2,minmax(0,1fr)); border-radius:12px; }
.wheel-picker-bazi-pair .wheel-column:first-child { border-right:1px solid #eee8e4; }
.wheel-picker-bazi-pair .wheel-heading { right:10px; color:#9f948d; font-size:11px; }
.wheel-picker-bazi-pair .wheel-option { padding:0 32px 0 10px; font-family:"Noto Serif SC","Songti SC",serif; font-size:21px; }
.wheel-picker-bazi-pair .wheel-option.selected { color:var(--red); font-size:28px; font-weight:900; }
.bazi-parity-note { display:flex; justify-content:center; gap:22px; margin:8px 0 0; color:#9b8e87; font-size:11px; }
.bazi-parity-note span::before { content:""; display:inline-block; width:5px; height:5px; margin:0 5px 2px 0; background:var(--red); border-radius:50%; opacity:.55; }

@media screen and (max-width:700px) {
  .datetime-sheet-header { position:sticky; top:0; z-index:20; background:#fff; }
  #bazi-picker .bazi-pillar-tabs { margin-bottom:5px; }
  #bazi-picker .bazi-current-label { min-height:28px; }
  #bazi-picker .wheel-picker-bazi-pair { --wheel-row:40px; height:calc(var(--wheel-row) * 3); min-height:calc(var(--wheel-row) * 3); }
  #bazi-picker .wheel-picker-bazi-pair::before { top:var(--wheel-row); }
  #bazi-picker .wheel-picker-bazi-pair::after { background:linear-gradient(to bottom,#fff 0,rgba(255,255,255,.72) 20%,transparent 36%,transparent 64%,rgba(255,255,255,.72) 80%,#fff 100%); }
  #bazi-picker .wheel-picker-bazi-pair .wheel-spacer { height:var(--wheel-row); }
  #bazi-picker .bazi-parity-note { margin-top:5px; }
  #bazi-picker .bazi-search { min-height:44px; margin-top:6px; }
}

@media screen and (max-width:380px) {
  .bazi-pillar-tabs { gap:5px; }
  .bazi-pillar-tab { min-height:55px; border-radius:10px; }
  .bazi-pillar-tab strong { font-size:18px; }
  .wheel-picker-bazi-pair .wheel-option.selected { font-size:26px; }
}
/* PWA installation and standalone-mode polish */
.pwa-install-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 42px 10px 10px;
  border: 1px solid rgba(155, 47, 47, .22);
  background: linear-gradient(135deg, rgba(255, 250, 240, .98), rgba(252, 238, 222, .96));
}
.pwa-install-card[hidden] { display: none !important; }
.pwa-install-icon {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: contain;
}
.pwa-install-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-install-copy strong { color: var(--ink); font-size: 15px; }
.pwa-install-copy span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.pwa-install-button { min-width: 68px; min-height: 40px; padding: 7px 12px; }
.pwa-install-dismiss {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}
html.pwa-standalone body { padding-top: env(safe-area-inset-top); }
html.pwa-standalone .result-header { top: env(safe-area-inset-top); }

@media screen and (max-width: 700px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .pwa-install-card {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 10px 42px 10px 10px;
  }
  .pwa-install-button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
  }
}

@media print {
  .pwa-install-card { display: none !important; }
}


/* Case library, chart basis, and mobile case editor */
button, input, select, textarea { font: inherit; }
.case-center { margin-top:14px; overflow:hidden; }
.case-center > summary {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  min-height:52px; padding:12px 16px; color:var(--red-dark); cursor:pointer;
  font-weight:800; list-style:none; -webkit-tap-highlight-color:transparent;
}
.case-center > summary::-webkit-details-marker { display:none; }
.case-center > summary::after { content:"＋"; flex:0 0 auto; font-size:20px; font-weight:400; line-height:1; }
.case-center[open] > summary::after { content:"－"; }
.case-center > summary small { margin-left:auto; color:var(--muted); font-size:12px; font-weight:400; }
.case-center-body { padding:0 16px 16px; border-top:1px solid rgba(155,47,47,.12); }
.case-search-row { display:grid; gap:6px; padding-top:14px; }
.case-search-row > label { color:var(--muted); font-size:12px; }
.case-search-row > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.case-search-row input { min-height:46px; }
.case-search-row button { min-width:72px; min-height:46px; padding:8px 12px; }
.case-list { display:grid; gap:10px; max-height:430px; margin-top:12px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.case-empty { padding:24px 14px; color:var(--muted); background:rgba(248,241,229,.72); border:1px dashed var(--line); border-radius:9px; font-size:13px; line-height:1.65; text-align:center; }
.case-item { padding:10px; background:#fffefa; border:1px solid var(--line); border-radius:10px; box-shadow:0 4px 12px rgba(58,34,23,.05); }
.case-item.active { background:#fff7e8; border-color:var(--red); box-shadow:inset 3px 0 0 var(--red),0 4px 12px rgba(58,34,23,.06); }
.case-open { width:100%; min-height:48px; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:10px; padding:5px 4px; color:var(--ink); text-align:left; background:transparent; border:0; }
.case-open span { min-width:0; display:grid; gap:4px; }
.case-open strong { overflow:hidden; color:var(--red-dark); font-size:15px; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.case-open small { overflow:hidden; color:var(--muted); font-size:11px; line-height:1.45; text-overflow:ellipsis; white-space:nowrap; }
.case-open em { color:var(--red); font-size:12px; font-style:normal; font-weight:800; white-space:nowrap; }
.case-item > p { max-height:4.6em; margin:7px 4px 9px; overflow:hidden; color:#5f534d; font-size:12px; line-height:1.55; white-space:pre-wrap; }
.case-item-actions { display:grid; grid-template-columns:minmax(0,1fr) 74px; gap:8px; padding-top:8px; border-top:1px solid rgba(216,203,187,.72); }
.case-item-actions button { min-height:44px; padding:7px 10px; border-radius:5px; font-size:12px; }
.danger-link { color:#a1241c; background:#fff; border:1px solid rgba(193,57,43,.35); }
.backup-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:12px; }
.backup-actions button { min-height:46px; padding:9px 8px; }
.case-storage-status { margin:10px 2px 0; color:var(--muted); font-size:12px; line-height:1.55; }
.case-storage-status.success { color:#176b35; }
.case-storage-status.error { color:#a1241c; }

.basis-card { border-left:3px solid var(--gold); }
.chart-basis { display:grid; gap:0; }
.chart-basis div { display:grid; grid-template-columns:76px minmax(0,1fr); gap:8px; padding:8px 0; border-bottom:1px solid rgba(216,203,187,.72); }
.chart-basis div:last-child { border-bottom:0; }
.chart-basis small { color:var(--muted); font-size:11px; line-height:1.45; }
.chart-basis strong { min-width:0; color:var(--ink); font-size:12px; line-height:1.55; overflow-wrap:anywhere; }

.case-sheet[hidden] { display:none !important; }
.case-sheet { position:fixed; inset:0; z-index:1100; display:flex; align-items:flex-end; justify-content:center; font-family:"Noto Sans SC","Microsoft YaHei",sans-serif; }
.case-sheet-backdrop { position:absolute; inset:0; width:100%; height:100%; padding:0; background:rgba(25,18,15,.5); border:0; opacity:0; transition:opacity .2s ease; -webkit-tap-highlight-color:transparent; }
.case-sheet-panel { position:relative; width:min(100%,600px); max-height:min(88dvh,760px); padding:0 14px calc(16px + env(safe-area-inset-bottom)); overflow-y:auto; overscroll-behavior:contain; color:var(--ink); background:#fff; border-radius:22px 22px 0 0; box-shadow:0 -16px 45px rgba(31,20,15,.24); transform:translateY(102%); transition:transform .22s cubic-bezier(.2,.75,.25,1); }
.case-sheet.open .case-sheet-backdrop { opacity:1; }
.case-sheet.open .case-sheet-panel { transform:translateY(0); }
.case-sheet-open { overflow:hidden; touch-action:none; }
.case-sheet-header { position:sticky; top:0; z-index:2; display:grid; grid-template-columns:64px minmax(0,1fr) 64px; align-items:center; min-height:50px; background:#fff; border-bottom:1px solid #eee9e5; }
.case-sheet-header h2 { margin:0; font-size:16px; text-align:center; letter-spacing:.03em; }
.case-editor { display:grid; gap:15px; padding:14px 0 2px; }
.case-editor-meta { margin:0; padding:9px 11px; color:var(--muted); background:#f8f1e5; border-radius:8px; font-size:12px; line-height:1.55; }
.case-editor label { display:grid; gap:7px; color:var(--red-dark); font-size:13px; font-weight:800; }
.case-editor input, .case-editor textarea { width:100%; min-width:0; padding:11px 12px; color:var(--ink); background:#fffefa; border:1px solid var(--line); border-radius:8px; font-size:16px; font-weight:400; line-height:1.55; }
.case-editor input { min-height:48px; }
.case-editor textarea { min-height:190px; resize:vertical; }
.case-editor-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.case-editor-actions small { color:var(--muted); font-size:11px; line-height:1.45; text-align:right; }
.danger { min-height:44px; padding:8px 14px; color:#a1241c; background:#fff2ef; border:1px solid rgba(193,57,43,.4); border-radius:6px; white-space:nowrap; }

@media screen and (max-width:700px) {
  .result-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .case-center { margin:10px 0 0; }
  .case-center > summary { min-height:50px; padding:11px 13px; }
  .case-center-body { padding:0 10px 12px; }
  .case-search-row { padding-top:10px; }
  .case-search-row > div { gap:6px; }
  .case-search-row button { min-width:64px; }
  .case-list { max-height:48dvh; margin-top:10px; padding-right:1px; }
  .case-item { padding:8px; border-radius:9px; }
  .case-open { min-height:50px; }
  .case-open strong { font-size:14px; }
  .case-item-actions { grid-template-columns:minmax(0,1fr) 68px; gap:6px; }
  .backup-actions { gap:6px; }
  .backup-actions button { min-width:0; font-size:12px; }
  .chart-basis div { grid-template-columns:84px minmax(0,1fr); padding:7px 0; }
  .chart-basis small { font-size:10px; }
  .chart-basis strong { font-size:11px; }
  .case-sheet-panel { max-height:88dvh; padding-left:12px; padding-right:12px; }
  .case-editor { padding-top:11px; }
  .case-editor textarea { min-height:210px; }
  .case-editor-actions { align-items:flex-end; }
}

@media screen and (max-width:360px) {
  .case-open small { white-space:normal; }
  .case-editor-actions { align-items:stretch; flex-direction:column-reverse; }
  .case-editor-actions small { text-align:left; }
  .danger { width:100%; }
}

@media print {
  .case-center, .case-sheet, #save-case { display:none !important; }
}

/* 缁撴灉椤垫爣绛俱€佹ā寮忎笌鍒嗕韩 */
.view-mode { display:flex; align-items:center; gap:4px; padding:4px; color:var(--muted); background:#f6efe4; border:1px solid var(--line); border-radius:5px; white-space:nowrap; }
.view-mode > span { padding:0 4px; font-size:11px; }
.view-mode-button { min-height:32px; padding:5px 9px; color:var(--muted); background:transparent; border:0; border-radius:3px; font-size:12px; font-weight:800; }
.view-mode-button.active { color:var(--red-dark); background:#fffdf7; box-shadow:0 1px 4px rgba(70,40,20,.12); }
.result-panel { min-width:0; }
.result-panel > .chart-meta { margin-bottom:20px; }
.details-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.details-grid .facts-card { grid-column:1 / -1; }
.basis-grid { grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr); }
.fortune-empty { padding:30px 18px; color:var(--muted); text-align:center; background:#fffdf7; border:1px dashed var(--line); border-radius:6px; }
.fortune-link-summary { margin:10px 0 12px; padding:10px 12px; color:var(--red-dark); background:#fff4de; border-left:3px solid var(--gold); line-height:1.5; }
.fortune-link-summary strong { margin-right:5px; }
.dayun-table td.selected-dayun, .liunian-table td.selected-liunian { position:relative; z-index:1; }
.selected-palace { background:#fff4d7 !important; outline:2px solid var(--red) !important; outline-offset:-2px; }
body[data-display-mode="simple"] .technical-tag,
body[data-display-mode="simple"] .outer-hidden,
body[data-display-mode="simple"] .marks,
body[data-display-mode="simple"] .changsheng-state,
body[data-display-mode="simple"] .pro-only { display:none !important; }
@media screen and (min-width:701px) { body[data-display-mode="simple"] .board-wrap { grid-template-rows:56px minmax(0,1fr) 56px; grid-template-columns:58px minmax(0,1fr) 58px; } }
body[data-display-mode="simple"] .calendar h2 { font-size:21px; }
body[data-display-mode="simple"] .pillars strong { font-size:20px; }
.palace-sheet[hidden] { display:none !important; }
.palace-sheet {
  position:fixed; inset:0; z-index:1200; display:flex; align-items:flex-end; justify-content:center;
  pointer-events:none;
}
.palace-sheet-panel {
  position:relative; display:flex; flex-direction:column; width:min(100%,600px); height:min(44dvh,500px); max-height:92dvh;
  padding:0 0 env(safe-area-inset-bottom); overflow:hidden; pointer-events:auto; color:var(--ink); background:#fffdf9;
  border:1px solid rgba(109,67,34,.2); border-bottom:0; border-radius:22px 22px 0 0;
  box-shadow:0 -14px 40px rgba(31,20,15,.24); transition:height .28s cubic-bezier(.2,.8,.2,1);
}
.palace-sheet-panel[data-sheet-size="expanded"] { height:92dvh; }
.palace-sheet-panel.dragging { transition:none; }
.palace-sheet-chrome { flex:0 0 auto; min-width:0; padding:0 14px; background:rgba(255,253,249,.98); border-bottom:1px solid var(--line); }
.palace-sheet-grabber {
  display:grid; place-items:center; width:100%; height:27px; padding:0; background:transparent; border:0; touch-action:none; cursor:grab;
}
.palace-sheet-grabber:active { cursor:grabbing; }
.palace-sheet-grabber span { width:44px; height:5px; background:#c8b8aa; border-radius:99px; }
.palace-sheet-header { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:50px; padding-bottom:8px; }
.palace-sheet-header > div { min-width:0; }
.palace-sheet-header h2 { margin:0; color:var(--red-dark); font-size:19px; line-height:1.25; }
.palace-sheet-header p { margin:3px 0 0; overflow:hidden; color:var(--muted); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.palace-sheet-close { display:grid; place-items:center; flex:0 0 40px; width:40px; height:40px; padding:0; color:#68564b; background:#f3eadf; border:0; border-radius:50%; font-size:25px; line-height:1; }
.palace-sheet-close:focus-visible { outline:2px solid var(--red); outline-offset:2px; }
.palace-detail-tabs { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:3px; padding:4px; background:#f5ede2; border-radius:11px; }
.palace-detail-tab { min-width:0; min-height:39px; padding:6px 2px; color:var(--muted); background:transparent; border:0; border-radius:8px; font-size:12px; font-weight:800; white-space:nowrap; }
.palace-detail-tab.active { color:#fff; background:var(--red); box-shadow:0 3px 9px rgba(133,34,31,.18); }
.palace-element-nav { display:flex; gap:7px; margin:9px -14px 0; padding:0 14px 10px; overflow-x:auto; scrollbar-width:none; touch-action:pan-x; }
.palace-element-nav::-webkit-scrollbar { display:none; }
.palace-element-chip { flex:0 0 auto; min-height:35px; padding:6px 11px; color:#6b5141; background:#fff; border:1px solid #dac8b5; border-radius:99px; font-size:12px; font-weight:700; white-space:nowrap; }
.palace-element-chip.active { color:#fff; background:#a3342f; border-color:#a3342f; }
.palace-sheet-content { min-height:0; padding:14px 14px calc(22px + env(safe-area-inset-bottom)); overflow-y:auto; overscroll-behavior:contain; scroll-behavior:smooth; }
.detail-hero { display:grid; gap:8px; margin-bottom:12px; padding:14px; background:linear-gradient(145deg,#fff4dc,#fffaf2); border:1px solid #ead4b7; border-radius:14px; }
.detail-hero-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.detail-hero h3 { margin:0; color:var(--red-dark); font-size:20px; }
.detail-hero p { margin:0; color:#66564c; font-size:13px; line-height:1.65; }
.detail-mode-badge { flex:0 0 auto; padding:4px 8px; color:#8a5c18; background:#fff; border:1px solid #e3c994; border-radius:99px; font-size:10px; font-weight:800; }
.detail-keywords { display:flex; flex-wrap:wrap; gap:6px; }
.detail-keywords span { padding:4px 8px; color:#7b4f20; background:#fff9ed; border:1px solid #ead8bb; border-radius:99px; font-size:11px; }
.detail-section { margin-top:12px; }
.detail-section-title { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 8px; color:#51392c; font-size:14px; }
.detail-section-title small { color:var(--muted); font-size:10px; font-weight:500; }
.detail-facts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
.detail-facts > div { min-width:0; padding:10px; background:#fff; border:1px solid #e5d8ca; border-radius:10px; }
.detail-facts dt { margin-bottom:4px; color:var(--muted); font-size:10px; }
.detail-facts dd { margin:0; color:#392b24; font-size:13px; font-weight:800; line-height:1.45; overflow-wrap:anywhere; }
.factor-list { display:grid; gap:8px; }
.factor-card { display:grid; grid-template-columns:34px minmax(0,1fr); gap:9px; align-items:start; padding:10px 11px; background:#fff; border:1px solid #e5d8ca; border-radius:10px; }
.factor-icon { display:grid; place-items:center; width:34px; height:34px; color:#fff; background:#9b7a4c; border-radius:10px; font-size:14px; font-weight:900; }
.factor-card.positive .factor-icon { background:#41855b; }
.factor-card.caution .factor-icon { background:#ae4c43; }
.factor-card strong { display:block; color:#4e392e; font-size:13px; }
.factor-card p { margin:3px 0 0; color:#6e5d53; font-size:12px; line-height:1.55; }
.interpretation-hero { background:linear-gradient(145deg,#fff1d6,#fffaf2 62%,#f6eee3); }
.interpretation-priority { margin:0 0 12px; padding:12px; background:#fffdf8; border:1px solid #decdb8; border-left:4px solid #9a7540; border-radius:12px; }
.interpretation-priority.caution { border-left-color:#ae4c43; background:#fff8f6; }
.interpretation-priority.positive { border-left-color:#41855b; background:#f6fbf7; }
.interpretation-priority.special { border-left-color:#6d628f; background:#faf8ff; }
.interpretation-priority.balanced { border-left-color:#9a7540; background:linear-gradient(135deg,#fff8f5,#f6fbf7); }
.interpretation-priority-heading { display:flex; align-items:center; gap:8px; margin-bottom:5px; }
.interpretation-priority-heading > span { flex:0 0 auto; padding:3px 7px; color:#fff; background:#9a7540; border-radius:99px; font-size:9px; font-weight:900; }
.interpretation-priority-heading strong { min-width:0; color:#4e392e; font-size:14px; }
.interpretation-priority > p { margin:0 0 9px; color:#6c5a50; font-size:11px; line-height:1.55; }
.interpretation-priority-list { display:grid; gap:6px; }
.interpretation-priority-item { display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:8px; align-items:center; padding:8px 9px; background:rgba(255,255,255,.84); border:1px solid #e5d8ca; border-radius:9px; }
.interpretation-priority-index { display:grid; place-items:center; width:24px; height:24px; color:#fff; background:#8c6e56; border-radius:50%; font-size:11px; font-weight:900; }
.interpretation-priority-item.caution .interpretation-priority-index { background:#ae4c43; }
.interpretation-priority-item.positive .interpretation-priority-index { background:#41855b; }
.interpretation-priority-item.special .interpretation-priority-index { background:#6d628f; }
.interpretation-priority-item > div { min-width:0; }
.interpretation-priority-item strong { display:block; color:#4e392e; font-size:12px; }
.interpretation-priority-item small { display:block; margin-top:2px; color:#75655b; font-size:10px; line-height:1.45; overflow-wrap:anywhere; }
.interpretation-priority-item em { align-self:start; padding:3px 6px; color:#765b36; background:#f5ead8; border-radius:99px; font-size:9px; font-style:normal; font-weight:900; white-space:nowrap; }
.interpretation-priority-item em.primary { color:#8f2d29; background:#ffeceb; }
.interpretation-priority-item em.important { color:#7d4d18; background:#fff0d7; }
.interpretation-priority-item em.secondary { color:#267147; background:#edf8f0; }
.interpretation-priority-note { display:block; margin-top:8px; color:#8a7a70; font-size:9px; line-height:1.45; }
.interpretation-counts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin:0 0 12px; }
.interpretation-count { display:grid; place-items:center; gap:2px; min-width:0; padding:9px 4px; background:#fff; border:1px solid #e4d6c8; border-radius:11px; }
.interpretation-count strong { color:#4f392e; font-size:19px; line-height:1; }
.interpretation-count span { color:var(--muted); font-size:10px; font-weight:800; }
.interpretation-count.positive { border-color:#bdd9c6; background:#f4fbf6; }
.interpretation-count.caution { border-color:#e2bbb6; background:#fff7f5; }
.interpretation-count.special { border-color:#decba8; background:#fffaf0; }
.interpretation-count.reference { border-color:#cfd8e3; background:#f7f9fc; }
.interpretation-section-list { display:grid; gap:9px; }
.interpretation-section-card { display:grid; grid-template-columns:36px minmax(0,1fr); gap:10px; align-items:start; padding:12px; background:#fff; border:1px solid #e5d8ca; border-radius:12px; }
.interpretation-section-card.positive { border-left:3px solid #4c8d62; }
.interpretation-section-card.caution { border-left:3px solid #b14f47; }
.interpretation-section-card.action { border-left:3px solid #9d762e; }
.interpretation-section-icon { display:grid; place-items:center; width:36px; height:36px; color:#fff; background:#8c6e56; border-radius:11px; font-size:14px; font-weight:900; }
.interpretation-section-card.positive .interpretation-section-icon { background:#41855b; }
.interpretation-section-card.caution .interpretation-section-icon { background:#ae4c43; }
.interpretation-section-card.action .interpretation-section-icon { background:#9d762e; }
.interpretation-section-card h4 { margin:0 0 4px; color:#4e392e; font-size:14px; }
.interpretation-section-card p { margin:0; color:#66564d; font-size:12px; line-height:1.7; overflow-wrap:anywhere; }
.interpretation-professional { padding-top:2px; }
.interpretation-source { margin:0 0 9px; padding:10px 11px; color:#604e44; background:#f7f1e8; border-radius:10px; font-size:11px; line-height:1.6; }
.interpretation-evidence { display:grid; gap:7px; }
.interpretation-evidence-item { overflow:hidden; background:#fff; border:1px solid #e3d5c8; border-radius:10px; }
.interpretation-evidence-item summary { display:flex; align-items:center; justify-content:space-between; gap:9px; min-height:42px; padding:9px 11px; color:#523c31; cursor:pointer; font-size:12px; font-weight:800; list-style:none; }
.interpretation-evidence-item summary::-webkit-details-marker { display:none; }
.interpretation-evidence-item summary::after { content:"＋"; flex:0 0 auto; color:#9b5a34; font-size:16px; }
.interpretation-evidence-item[open] summary::after { content:"－"; }
.interpretation-evidence-item summary span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.interpretation-evidence-item summary small { margin-left:auto; color:var(--muted); font-size:9px; white-space:nowrap; }
.interpretation-evidence-item dl { display:grid; gap:7px; margin:0; padding:0 11px 11px; }
.interpretation-evidence-item dl div { display:grid; grid-template-columns:58px minmax(0,1fr); gap:7px; }
.interpretation-evidence-item dt { color:var(--muted); font-size:10px; }
.interpretation-evidence-item dd { margin:0; color:#5f5048; font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
.meaning-card { margin-bottom:10px; padding:12px; background:#fff; border:1px solid #e5d8ca; border-radius:12px; }
.meaning-card h4 { margin:0 0 5px; color:var(--red-dark); font-size:14px; }
.meaning-card p { margin:0; color:#62534b; font-size:12px; line-height:1.7; }
.current-context { margin:12px 0; padding:11px 12px; color:#654a24; background:#fff4d9; border-left:3px solid var(--gold); border-radius:4px 10px 10px 4px; font-size:12px; line-height:1.65; }
.pattern-list { display:grid; gap:10px; }
.pattern-card { padding:12px; background:#fff; border:1px solid #e2d3c4; border-radius:12px; }
.pattern-card.emphasis { border-color:#d8a5a1; box-shadow:inset 3px 0 #a3342f; }
.pattern-card h4 { margin:0 0 7px; color:var(--red-dark); font-size:15px; }
.pattern-card dl { display:grid; gap:6px; margin:0; }
.pattern-card dl div { display:grid; grid-template-columns:62px minmax(0,1fr); gap:7px; }
.pattern-card dt { color:var(--muted); font-size:11px; }
.pattern-card dd { margin:0; color:#53443c; font-size:12px; line-height:1.55; }
.pattern-group {
  display:grid;
  gap:8px;
  margin-bottom:16px;
}
.pattern-group > h3 {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:0;
  color:#51392c;
  font-size:14px;
}
.pattern-group > h3 small { color:var(--muted); font-size:10px; }
.pattern-card-heading {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.pattern-card-heading h4 { margin:0; }
.pattern-category {
  flex:0 0 auto;
  padding:3px 7px;
  border-radius:99px;
  font-size:10px;
  font-weight:800;
}
.pattern-card.positive { border-color:#afd0b9; box-shadow:inset 3px 0 #42865d; }
.pattern-card.caution { border-color:#d8a5a1; box-shadow:inset 3px 0 #a3342f; }
.pattern-card.special { border-color:#b8b1d3; box-shadow:inset 3px 0 #6d628f; }
.pattern-card.reference { border-color:#ddccb5; box-shadow:inset 3px 0 #b58948; }
.pattern-card.positive .pattern-category { color:#267147; background:#edf8f0; }
.pattern-card.caution .pattern-category { color:#8f2d29; background:#fff0ef; }
.pattern-card.special .pattern-category { color:#5b517e; background:#f2effb; }
.pattern-card.reference .pattern-category { color:#75501f; background:#fff7e8; }
.pattern-evidence { padding-top:6px; border-top:1px dashed #e1d5ca; }
.detail-empty { padding:22px 16px; color:var(--muted); text-align:center; background:#fff; border:1px dashed #d8c8b8; border-radius:12px; font-size:12px; line-height:1.65; }
.palace-note-box { display:grid; gap:10px; }
.palace-note-box textarea { width:100%; min-height:180px; resize:vertical; padding:12px; color:var(--ink); background:#fff; border:1px solid #d7c5b4; border-radius:11px; font:inherit; font-size:14px; line-height:1.65; }
.palace-note-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.palace-note-actions small { color:var(--muted); font-size:10px; line-height:1.45; }
.palace-note-save { flex:0 0 auto; min-height:44px; padding:9px 18px; color:#fff; background:var(--red); border:0; border-radius:9px; font-weight:800; }
.palace-note-feedback { min-height:18px; margin:0; color:#267147; font-size:11px; }
.detail-disclaimer { margin:16px 2px 2px; padding-top:10px; color:#8a7a70; border-top:1px dashed #ded1c5; font-size:10px; line-height:1.55; }
body[data-display-mode="simple"] .detail-mode-badge::after { content:"简洁"; }
body[data-display-mode="professional"] .detail-mode-badge::after { content:"专业"; }

@media screen and (max-width:700px) {
  body.palace-sheet-open { padding-bottom:44dvh; }
  .palace-sheet-panel { width:100%; height:44dvh; border-left:0; border-right:0; }
  .palace-sheet-panel[data-sheet-size="expanded"] { height:92dvh; }
  .palace-sheet-content { padding-left:12px; padding-right:12px; }
  .palace-sheet-chrome { padding-left:12px; padding-right:12px; }
  .palace-element-nav { margin-left:-12px; margin-right:-12px; padding-left:12px; padding-right:12px; }
}
@media screen and (max-width:360px) {
  .palace-sheet-header h2 { font-size:17px; }
  .palace-detail-tabs { gap:2px; }
  .palace-detail-tab { padding-inline:1px; font-size:11px; }
  .interpretation-section-card { grid-template-columns:32px minmax(0,1fr); padding:10px; }
  .interpretation-section-icon { width:32px; height:32px; }
  .detail-facts { grid-template-columns:1fr 1fr; gap:6px; }
  .detail-facts > div { padding:8px; }
}
.share-stage .result-panel[hidden] { display:block !important; }
.share-stage .chart { margin:0; box-shadow:none; }
.share-stage .result-panel { padding:0; }
.share-stage .dayun-section { display:block !important; }
.share-image-root { width:390px !important; padding:16px !important; background:#fffdf7 !important; }
.share-image-root .board-wrap { margin-top:14px; }
.share-image-root .details-grid { grid-template-columns:1fr; }
.share-image-root .facts-card { grid-column:auto; }
.share-image-root .palace-sheet, .share-image-root .share-stage { display:none !important; }
.share-image-root .share-privacy-pillars { opacity:.72; }

@media screen and (max-width:850px) {
  .result-header { gap:7px; }
  .view-mode { align-self:flex-start; }
  .chart { padding:14px; }
  .details-grid, .basis-grid { grid-template-columns:1fr; gap:10px; }
  .details-grid .facts-card { grid-column:auto; }
}
@media screen and (max-width:590px) {
  .chart { padding-left:6px; padding-right:6px; }
  .view-mode { width:max-content; }
  .view-mode-button { min-height:30px; }
  .result-toolbar { grid-template-columns:repeat(3,minmax(0,1fr)) !important; }
  .result-toolbar button { font-size:11px; }
  .fortune-link-summary { font-size:12px; }
  .palace-sheet-panel { width:100%; }
}
@media screen and (max-width:360px) {
  .chart { padding-left:2px; padding-right:2px; }
}
@media print {
  .view-mode, #save-long-image, #privacy-share, .palace-sheet { display:none !important; }
  #share-capture { margin:0; padding:0; border:0; box-shadow:none; }
}

/* Stable 900px long-image layout: independent from the device viewport. */
.share-stage { width:900px !important; }
.share-image-root { width:900px !important; max-width:none !important; overflow:visible !important; }
.share-image-root .chart-meta { grid-template-columns:minmax(0,1.35fr) minmax(300px,.65fr) !important; }
.share-image-root .board-wrap {
  grid-template-columns:84px minmax(0,1fr) 84px !important;
  grid-template-rows:76px minmax(0,1fr) 76px !important;
}
.share-image-root .board { min-width:0 !important; }
.share-image-root .details-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
.share-image-root .details-grid .facts-card { grid-column:1 / -1 !important; }
.share-image-root .basis-grid { grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr) !important; }
.share-image-root .dayun-heading,
.share-image-root .liunian-heading { flex-direction:row !important; align-items:flex-end !important; }
.share-image-root .dayun-table-wrap,
.share-image-root .liunian-table-wrap { overflow:visible !important; scrollbar-gutter:auto !important; }
.share-image-root .dayun-table,
.share-image-root .liunian-table { width:100% !important; min-width:0 !important; table-layout:fixed !important; }
.share-image-root .dayun-table th,
.share-image-root .liunian-table th { position:static !important; width:68px !important; }
.share-image-root .dayun-table th,
.share-image-root .dayun-table td,
.share-image-root .liunian-table th,
.share-image-root .liunian-table td { min-width:0 !important; padding:8px 4px !important; font-size:14px !important; }
.share-image-root .dayun-table #dayun-ganzhi td,
.share-image-root .liunian-table #liunian-ganzhi td { font-size:17px !important; }
/* Cloud case synchronization */
.cloud-sync-card {
  display:grid; gap:10px; margin:12px 0 2px; padding:12px;
  background:linear-gradient(145deg,#fff8e9,#fffdf8); border:1px solid rgba(176,126,56,.28); border-radius:11px;
}
.cloud-sync-heading { display:flex; align-items:center; gap:10px; }
.cloud-sync-icon { display:grid; place-items:center; flex:0 0 38px; width:38px; height:38px; color:#fff; background:var(--red); border-radius:12px; font-size:16px; font-weight:900; box-shadow:0 5px 12px rgba(126,33,29,.2); }
.cloud-sync-heading > div { min-width:0; display:grid; gap:2px; }
.cloud-sync-heading strong { color:var(--red-dark); font-size:14px; }
.cloud-sync-heading small { color:var(--muted); font-size:11px; }
.cloud-sync-heading small.syncing { color:#8b5e18; }
.cloud-sync-heading small.success { color:#176b35; }
.cloud-sync-heading small.error { color:#a1241c; }
.cloud-sync-card > p { margin:0; color:#665851; font-size:12px; line-height:1.55; }
.cloud-sync-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.cloud-sync-actions button:only-child { grid-column:1 / -1; }
.cloud-sync-actions button { min-height:44px; padding:8px 10px; }
.cloud-sync-editor { display:grid; gap:15px; padding:14px 0 4px; }
.cloud-sync-intro { padding:12px; background:#f8f1e5; border-radius:10px; }
.cloud-sync-intro strong { display:block; color:var(--red-dark); font-size:14px; }
.cloud-sync-intro p { margin:5px 0 0; color:var(--muted); font-size:12px; line-height:1.6; }
.cloud-sync-editor > label { display:grid; gap:7px; color:var(--red-dark); font-size:13px; font-weight:800; }
.cloud-sync-editor input { width:100%; min-height:50px; padding:11px 12px; color:var(--ink); background:#fffefa; border:1px solid var(--line); border-radius:8px; font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:16px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.cloud-sync-code-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.cloud-sync-code-actions button { min-height:46px; }
.cloud-sync-code-feedback { min-height:18px; margin:-5px 2px 0; color:var(--muted); font-size:12px; line-height:1.5; }
.cloud-sync-code-feedback.success { color:#176b35; }
.cloud-sync-code-feedback.error { color:#a1241c; }
.cloud-sync-warning { display:grid; gap:4px; padding:11px 12px; color:#744b18; background:#fff5d8; border:1px solid rgba(183,125,35,.28); border-radius:9px; }
.cloud-sync-warning strong { font-size:13px; }
.cloud-sync-warning span { font-size:11px; line-height:1.55; }
.cloud-sync-editor > .danger { justify-self:start; }

@media screen and (max-width:700px) {
  .cloud-sync-card { margin-top:10px; padding:11px; }
  .cloud-sync-actions, .cloud-sync-code-actions { gap:6px; }
  .cloud-sync-actions button, .cloud-sync-code-actions button { min-width:0; font-size:12px; }
}

@media print {
  .cloud-sync-card, .cloud-sync-sheet { display:none !important; }
}



/* PWA update and startup health */
.app-health-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(177, 80, 29, .3);
  background: #fff8e8;
}
.app-health-card[hidden], .pwa-update-card[hidden] { display: none !important; }
.app-health-copy, .pwa-update-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.app-health-copy strong, .pwa-update-copy strong { color: var(--ink); font-size: 15px; }
.app-health-copy span, .pwa-update-copy span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.app-health-actions, .pwa-update-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.app-health-actions button, .pwa-update-actions button, #pwa-check-update { min-height: 42px; }
.pwa-version-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 4px 16px 0;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(155, 47, 47, .12);
  color: var(--muted);
  font-size: 12px;
}
.pwa-version-row strong { color: var(--ink); }
.pwa-version-state { min-width: 0; text-align: right; }
.pwa-version-state[data-state="update"], .pwa-version-state[data-state="error"] { color: #a43b24; }
.pwa-version-state[data-state="current"] { color: #397052; }
.pwa-update-card {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 560px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(155, 47, 47, .3);
  border-radius: 16px;
  background: rgba(255, 250, 240, .98);
  box-shadow: 0 12px 36px rgba(68, 35, 21, .2);
  backdrop-filter: blur(12px);
}

@media screen and (max-width: 700px) {
  .app-health-card { align-items: stretch; flex-direction: column; }
  .app-health-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .app-health-actions button { min-height: 44px; padding: 8px 10px; }
  .pwa-version-row { grid-template-columns: 1fr auto; }
  .pwa-version-state { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  #pwa-check-update { grid-column: 2; grid-row: 1; min-width: 92px; }
  .pwa-update-card { grid-template-columns: 1fr; }
  .pwa-update-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pwa-update-actions button { min-height: 44px; }
}

@media print {
  .app-health-card, .pwa-update-card, .pwa-version-row { display: none !important; }
}
/* 手机录入首页紧凑化：只影响录入页 */
.input-view .sample-field { display:none !important; }
.input-view .start-chart { grid-column:1 / 4; }
.input-view .reset-chart { grid-column:4; }

@media screen and (max-width:700px) {
  .input-view { justify-content:flex-start; }
  .input-view .input-masthead { padding:4px 6px 0; }
  .input-view .masthead { gap:8px; margin-bottom:9px; }
  .input-view .brand { gap:8px; }
  .input-view .brand-logo { width:38px; height:38px; }
  .input-view h1 { font-size:clamp(17px,5.2vw,20px); }
  .input-view .subtitle { margin-top:1px; font-size:10px; }

  .input-view .controls {
    padding:10px;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:7px;
  }
  .input-view .controls .datetime-field { grid-row:1; grid-column:1 / -1; }
  .input-view .controls .chart-type-field { grid-row:2; grid-column:1 / 3; }
  .input-view .controls .gender-field { grid-row:2; grid-column:3 / 5; }
  .input-view .controls .name-field { grid-row:3; grid-column:1 / -1; }
  .input-view .controls .start-chart { grid-row:4; grid-column:1 / 4; }
  .input-view .controls .reset-chart { grid-row:4; grid-column:4; }
  .input-view .datetime-trigger { min-height:78px; padding:10px; }

  .input-view .case-center { margin:8px 0 0; }
  .input-view .case-center > summary { min-height:44px; padding:8px 11px; }
  .input-view .notes { margin-top:8px; padding:0 11px; }
  .input-view .notes > summary { min-height:44px; font-size:15px; }
  .input-view .case-center > summary::after,
  .input-view .notes > summary::after {
    content:"›";
    transform:rotate(90deg);
    transition:transform .18s ease;
  }
  .input-view .case-center[open] > summary::after,
  .input-view .notes[open] > summary::after {
    content:"›";
    transform:rotate(-90deg);
  }
}


/* 奇门万年历：手机竖屏优先，限定作用域避免影响排盘页 */
.home-shortcuts {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:4px;
  padding:4px;
  margin:0 0 10px;
}
.home-shortcut {
  min-height:38px;
  border:0;
  border-radius:6px;
  color:var(--muted);
  background:transparent;
}
.home-shortcut.active {
  color:#fff;
  background:var(--accent);
}
.almanac-view { max-width:760px; margin:0 auto; }
.almanac-header {
  position:sticky;
  top:0;
  z-index:4;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:8px;
  padding:8px;
  margin-bottom:8px;
}
.almanac-title-group { min-width:0; text-align:center; }
.almanac-header h2 { margin:0; text-align:center; font-size:18px; }
.almanac-offline-state { margin:2px 0 0; color:var(--muted); font-size:10px; line-height:1.2; white-space:nowrap; }
.almanac-offline-state[data-state="offline"] { color:#8b3a32; }
.almanac-offline-state[data-state="ready"] { color:#4b7f52; }
.almanac-header button { min-height:40px; padding:7px 10px; }
.almanac-calendar { padding:10px 8px 8px; }
.almanac-month-nav {
  display:grid;
  grid-template-columns:44px 1fr 44px;
  align-items:center;
  gap:6px;
  margin-bottom:6px;
}
.almanac-month-nav strong { text-align:center; font-size:18px; letter-spacing:.06em; }
.almanac-month-nav button { min-height:40px; padding:4px; font-size:24px; line-height:1; }
.almanac-weekdays,
.almanac-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.almanac-weekdays span {
  padding:4px 0 6px;
  color:var(--muted);
  text-align:center;
  font-size:12px;
}
.almanac-weekdays span:first-child,
.almanac-weekdays span:last-child { color:var(--accent); }
.almanac-day {
  position:relative;
  min-width:0;
  min-height:54px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  padding:4px 1px;
  border:1px solid transparent;
  border-radius:8px;
  color:var(--ink);
  background:transparent;
  -webkit-tap-highlight-color:transparent;
}
.almanac-day strong { font-size:16px; line-height:1.1; font-weight:650; }
.almanac-day small {
  width:100%;
  overflow:hidden;
  color:var(--muted);
  font-size:10px;
  line-height:1.2;
  text-align:center;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.almanac-day.outside { opacity:.34; }
.almanac-day.today::after {
  content:"";
  position:absolute;
  bottom:3px;
  width:4px;
  height:4px;
  border-radius:50%;
  background:var(--accent);
}
.almanac-day.has-term small { color:var(--accent); font-weight:700; }
.almanac-day.selected {
  color:var(--red-dark);
  border-color:var(--red);
  background:#fff1ed;
  box-shadow:inset 0 0 0 1px rgba(155,47,47,.18), 0 3px 10px rgba(155,47,47,.14);
}
.almanac-day.selected strong { color:var(--red-dark); }
.almanac-day.selected small { color:#66504a; }
.almanac-day.selected.has-term small { color:var(--red); }
.almanac-day.selected.today::after { background:var(--red); }
.almanac-case-badge {
  position:absolute;
  top:3px;
  right:3px;
  min-width:15px;
  height:15px;
  display:grid;
  place-items:center;
  padding:0 3px;
  border:1px solid rgba(255,255,255,.9);
  border-radius:999px;
  color:#fff;
  background:#9a713f;
  font-size:9px;
  font-weight:700;
  line-height:1;
  box-shadow:0 1px 3px rgba(74,45,18,.2);
}
.almanac-case-badge.single {
  top:5px;
  right:5px;
  min-width:7px;
  width:7px;
  height:7px;
  padding:0;
  border:0;
}
.almanac-day.selected .almanac-case-badge {
  color:#7a5127;
  border-color:#fff;
  background:#fff1d8;
}
.almanac-loading {
  grid-column:1 / -1;
  min-height:320px;
  display:grid;
  place-items:center;
  margin:0;
  color:var(--muted);
}
.almanac-loading.error { color:var(--accent); }
.almanac-detail { margin-top:8px; padding:14px; }
.almanac-detail-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.almanac-detail-heading small { color:var(--muted); }
.almanac-detail-heading h3 { margin:2px 0 0; font-size:20px; }
.almanac-term {
  align-self:center;
  padding:4px 9px;
  border-radius:999px;
  color:#fff;
  background:var(--accent);
  font-size:12px;
  font-weight:700;
}
.almanac-facts { margin:12px 0; border-top:1px solid var(--line); }
.almanac-facts div { display:grid; grid-template-columns:76px 1fr; gap:8px; padding:9px 0; border-bottom:1px solid var(--line); }
.almanac-facts dt { color:var(--muted); font-size:13px; }
.almanac-facts dd { margin:0; text-align:right; }
.almanac-case-summary {
  margin:10px 0;
  border:1px solid #d9c6ad;
  border-radius:9px;
  background:#fffaf2;
  overflow:hidden;
}
.almanac-case-summary header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:8px 10px;
  color:#6f4d2b;
  font-size:12px;
}
.almanac-case-list { border-top:1px solid #eadcca; }
.almanac-case-item {
  width:100%;
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:7px 10px;
  border:0;
  border-top:1px dashed #eadcca;
  color:var(--ink);
  background:transparent;
  text-align:left;
}
.almanac-case-item:first-child { border-top:0; }
.almanac-case-item > span { min-width:0; }
.almanac-case-item strong,
.almanac-case-item em,
.almanac-case-item small { display:block; }
.almanac-case-item strong { font-size:13px; }
.almanac-case-item em {
  margin-top:2px;
  color:var(--muted);
  font-size:10px;
  font-style:normal;
}
.almanac-case-item small {
  margin-top:2px;
  overflow:hidden;
  color:var(--muted);
  font-size:10px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.almanac-case-item > b {
  flex:0 0 auto;
  color:#8a6238;
  font-size:11px;
}
.almanac-traditional {
  margin:10px 0 0;
  border:1px solid var(--line);
  border-radius:9px;
  background:#fffefa;
  overflow:hidden;
}
.almanac-traditional summary {
  min-height:42px;
  display:flex;
  align-items:center;
  padding:8px 12px;
  color:var(--ink);
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  list-style:none;
  -webkit-tap-highlight-color:transparent;
}
.almanac-traditional summary::-webkit-details-marker { display:none; }
.almanac-traditional summary::after { content:"展开"; margin-left:auto; color:var(--muted); font-size:11px; font-weight:400; }
.almanac-traditional[open] summary { border-bottom:1px solid var(--line); }
.almanac-traditional[open] summary::after { content:"收起"; }
.almanac-yiji { display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:10px; }
.almanac-yiji > div { display:grid; grid-template-columns:28px 1fr; align-items:start; gap:6px; min-width:0; }
.almanac-yiji strong { width:26px; height:26px; display:grid; place-items:center; border-radius:50%; color:#fff; font-size:13px; }
.almanac-yiji .recommend strong { background:#4b7f52; }
.almanac-yiji .avoid strong { background:var(--red); }
.almanac-yiji p { margin:2px 0 0; font-size:12px; line-height:1.65; }
.almanac-traditional-facts { display:grid; grid-template-columns:1fr 1fr; margin:0; padding:0 10px 10px; }
.almanac-traditional-facts div { min-width:0; padding:7px 4px; border-top:1px solid var(--line); }
.almanac-traditional-facts div:nth-child(odd):not(.wide) { padding-right:9px; border-right:1px solid var(--line); }
.almanac-traditional-facts div:nth-child(even):not(.wide) { padding-left:9px; }
.almanac-traditional-facts .wide { grid-column:1 / -1; display:grid; grid-template-columns:72px 1fr; gap:6px; }
.almanac-traditional-facts dt { color:var(--muted); font-size:11px; }
.almanac-traditional-facts dd { margin:3px 0 0; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.almanac-traditional-facts .wide dd { margin:0; }
.almanac-hour-field { margin-top:10px; }
.almanac-hour-field select { min-height:44px; }
.almanac-pillars { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; margin-top:12px; }
.almanac-pillars span { padding:8px 3px; border:1px solid var(--line); border-radius:7px; text-align:center; background:#fffefa; }
.almanac-pillars small { display:block; margin-bottom:3px; color:var(--muted); font-size:10px; }
.almanac-pillars strong { font-size:18px; }
.almanac-boundary { margin:10px 0; color:var(--muted); font-size:12px; text-align:center; }
.almanac-use-time { width:100%; min-height:48px; }

@media (max-width:600px) {
  .home-shortcuts { margin-top:-2px; }
  .almanac-view { width:100%; }
  .almanac-calendar { padding:8px 4px 6px; }
  .almanac-day { min-height:50px; }
  .almanac-detail { padding:12px 10px calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width:370px) {
  .almanac-day { min-height:46px; }
  .almanac-day strong { font-size:15px; }
  .almanac-day small { font-size:9px; }
}


/* Almanac phase 3: compact date jump and twelve double-hour fortune cards */
.almanac-month-title {
  min-height:40px;
  padding:4px 12px;
  border:0;
  color:var(--ink);
  background:transparent;
  text-align:center;
  font-size:18px;
  font-weight:700;
  letter-spacing:.06em;
}
.almanac-month-title::after { content:"⌄"; margin-left:5px; color:var(--muted); font-size:12px; }
.almanac-month-title[aria-expanded="true"]::after { content:"⌃"; }
.almanac-date-jump { margin:0 2px 8px; padding:9px; border:1px solid var(--line); border-radius:9px; background:#fffefa; }
.almanac-year-nav { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:6px; }
.almanac-year-nav button { min-height:36px; padding:5px 7px; font-size:12px; }
.almanac-year-nav button:last-child { justify-self:stretch; }
.almanac-year-nav strong { min-width:68px; text-align:center; }
.almanac-jump-fields { display:grid; grid-template-columns:1.15fr .85fr auto; align-items:end; gap:7px; margin-top:8px; }
.almanac-jump-fields label { min-width:0; color:var(--muted); font-size:11px; }
.almanac-jump-fields select { width:100%; min-height:38px; margin-top:3px; padding:5px; }
.almanac-jump-fields button { min-height:38px; padding:6px 13px; }
.almanac-hour-fortunes { margin:10px 0 0; border:1px solid var(--line); border-radius:9px; background:#fffefa; overflow:hidden; }
.almanac-hour-fortunes summary { min-height:42px; display:flex; align-items:center; padding:8px 12px; font-size:14px; font-weight:700; cursor:pointer; list-style:none; -webkit-tap-highlight-color:transparent; }
.almanac-hour-fortunes summary::-webkit-details-marker { display:none; }
.almanac-hour-fortunes summary::after { content:"展开"; margin-left:auto; color:var(--muted); font-size:11px; font-weight:400; }
.almanac-hour-fortunes[open] summary { border-bottom:1px solid var(--line); }
.almanac-hour-fortunes[open] summary::after { content:"收起"; }
.almanac-hour-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:9px; }
.almanac-hour-card { position:relative; min-width:0; min-height:56px; display:grid; grid-template-columns:minmax(0,1fr) auto auto; grid-template-rows:auto auto; align-items:center; gap:1px 6px; padding:7px 8px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:#fff; text-align:left; -webkit-tap-highlight-color:transparent; }
.almanac-hour-card > span { min-width:0; grid-row:1 / 3; }
.almanac-hour-card > span strong { display:block; font-size:14px; }
.almanac-hour-card > span small { display:block; margin-top:2px; color:var(--muted); font-size:9px; white-space:nowrap; }
.almanac-hour-card > b { font-size:13px; font-weight:650; }
.almanac-hour-card > em { min-width:21px; padding:1px 4px; border-radius:999px; font-size:10px; font-style:normal; text-align:center; }
.almanac-hour-card > small { grid-column:2 / 4; color:var(--muted); font-size:10px; text-align:right; }
.almanac-hour-card.selected { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); background:#fff9f7; }
.almanac-hour-card.current::after { content:"当前"; position:absolute; top:-5px; right:5px; padding:1px 4px; border-radius:999px; color:#fff; background:#4b7f52; font-size:8px; }
.luck-good { color:#35653c; background:#e8f3e8; }
.luck-bad { color:#9b2f2f; background:#f8e7e4; }
.almanac-hour-detail { margin:0 9px 9px; padding:9px; border-top:1px solid var(--line); background:#fff; }
.almanac-hour-detail header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.almanac-hour-detail header strong { font-size:14px; }
.almanac-hour-detail header span { padding:3px 7px; border-radius:999px; font-size:11px; white-space:nowrap; }
.almanac-hour-detail dl { margin:7px 0 0; }
.almanac-hour-detail dl div { display:grid; grid-template-columns:38px 1fr; gap:6px; padding:5px 0; border-top:1px dashed var(--line); }
.almanac-hour-detail dt { color:var(--muted); font-size:11px; }
.almanac-hour-detail dd { margin:0; font-size:12px; line-height:1.55; overflow-wrap:anywhere; }
@media (max-width:370px) {
  .almanac-jump-fields { grid-template-columns:1fr 1fr; }
  .almanac-jump-fields button { grid-column:1 / -1; }
  .almanac-hour-card { padding:6px; gap:1px 4px; }
  .almanac-hour-card > span small { font-size:8px; }
}


/* Result actions: compact two-row phone layout. */
.result-header {
  display:grid;
  grid-template-columns:auto auto minmax(0,1fr);
  align-items:center;
}
.result-toolbar {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:7px;
  width:100%;
}
.result-toolbar button { min-width:0; padding:9px 7px; white-space:nowrap; }
.result-header > .chart-navigation {
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:7px;
  width:100%;
  margin-top:0;
  padding:0;
}
.result-header > .chart-navigation button {
  grid-area:auto;
  min-width:0;
  padding:8px 5px;
}
@media screen and (max-width:850px) {
  .result-header { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .result-toolbar { grid-column:1 / -1; grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
  .result-header > .chart-navigation { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media screen and (max-width:590px) {
  .result-toolbar button { min-height:40px; padding:7px 2px; font-size:11px; }
  .result-header > .chart-navigation { gap:5px; }
  .result-header > .chart-navigation button { min-height:40px; padding:6px 2px; font-size:12px; line-height:1.15; }
  .result-header > .chart-navigation button small { display:block; margin:2px 0 0; font-size:8px; }
}

#previous-day, #previous-ju, #next-ju, #next-day { grid-area:auto; }


/* Fortune and annual palace linkage. */
.outer-slot { position:relative; }
.outer-top .outer-slot { flex-direction:column-reverse; }
.outer-year-marker { position:absolute; z-index:5; display:grid; place-items:center; min-width:25px; padding:2px 3px; color:#9f2626; background:rgba(255,250,239,.94); border:1px solid rgba(159,38,38,.32); border-radius:6px; line-height:1; box-shadow:0 1px 4px rgba(70,35,20,.12); pointer-events:none; }
.outer-year-marker b { font-size:10px; white-space:nowrap; }
.outer-year-marker small { margin-top:2px; color:#8a6659; font-size:7px; font-weight:700; }
.outer-top .outer-year-marker { left:calc(50% + 12px); bottom:19px; }
.outer-bottom .outer-year-marker { left:calc(50% + 12px); top:19px; }
.outer-left .outer-year-marker { right:18px; top:calc(50% + 8px); }
.outer-right .outer-year-marker { left:18px; top:calc(50% + 8px); }
.active-liunian-branch .outer-branch { color:#9d1f1f; text-shadow:0 0 6px rgba(198,92,50,.3); transform:scale(1.08); }
.palace.fortune-dayun-palace { z-index:1; box-shadow:inset 0 0 0 3px #c58a24; }
.palace.fortune-liunian-palace { z-index:1; background:rgba(189,45,45,.10); }
.palace.fortune-liunian-palace::after { content:attr(data-fortune-label); position:absolute; right:3px; bottom:14px; padding:1px 3px; color:#a12424; background:#fff4ed; border:1px solid rgba(161,36,36,.35); border-radius:4px; font-size:7px; font-weight:800; line-height:1.1; pointer-events:none; }
.palace.fortune-same-palace { background:linear-gradient(145deg,rgba(255,222,153,.44),rgba(189,45,45,.12)); box-shadow:inset 0 0 0 3px #bd6f16, inset 0 0 0 5px rgba(255,255,255,.7); }
.palace.fortune-same-palace::after { content:attr(data-fortune-label); }
.liunian-table td[data-liunian-index] { cursor:pointer; transition:background .15s ease, box-shadow .15s ease; }
.liunian-table td[data-liunian-index]:hover { background:#fff7df; }
.liunian-table td.selected-liunian { background:#f9e1d6; box-shadow:inset 0 0 0 2px #a8322e; }
@media screen and (max-width:700px) {
  .outer-year-marker { min-width:21px; padding:1px 2px; }
  .outer-year-marker b { font-size:8px; }
  .outer-year-marker small { font-size:6px; }
  .outer-top .outer-year-marker { left:calc(50% + 8px); bottom:16px; }
  .outer-bottom .outer-year-marker { left:calc(50% + 8px); top:16px; }
  .outer-left .outer-year-marker { right:12px; top:calc(50% + 6px); }
  .outer-right .outer-year-marker { left:12px; top:calc(50% + 6px); }
  .palace.fortune-dayun-palace { box-shadow:inset 0 0 0 2px #c58a24; }
}

/* HarmonyOS 7 Huawei Browser compact-board font compatibility. */
@media screen and (max-width:700px) {
  .harmony7-board-fix .board {
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }
  .harmony7-board-fix:not(.harmony7-board-font-ready) .board {
    visibility:hidden;
  }
  .harmony7-board-fix .board,
  .harmony7-board-fix .board button,
  .harmony7-board-fix .board b,
  .harmony7-board-fix .board strong,
  .harmony7-board-fix .board span,
  .harmony7-board-fix .board small,
  .harmony7-board-fix .board em {
    font-family:"QimenBoardSC",sans-serif !important;
    font-weight:400 !important;
    font-synthesis:none !important;
    font-synthesis-weight:none !important;
    font-variation-settings:normal !important;
    text-shadow:none !important;
    -webkit-text-stroke:0 !important;
    -webkit-font-smoothing:antialiased;
  }
  .harmony7-board-fix .board .palace {
    grid-template-rows:22px minmax(0,1fr);
    padding:3px 6px 8px;
  }
  .harmony7-board-fix .board .palace-head {
    min-height:0;
    align-items:start;
  }
  .harmony7-board-fix .board .palace-head,
  .harmony7-board-fix .board .palace-core {
    transform:none;
  }
  .harmony7-board-fix .board .palace-god {
    line-height:1;
  }
  .harmony7-board-fix .board .palace-name {
    bottom:1px;
  }
  .harmony7-board-fix .board .stem-layer {
    align-items:end;
    overflow:visible;
  }
  .harmony7-board-fix .board .stem-stack {
    position:relative;
    display:block;
    align-self:end;
    box-sizing:border-box;
    padding-top:0;
    overflow:visible;
  }
  .harmony7-board-fix .board .stem {
    display:block;
    line-height:1;
  }
  .harmony7-board-fix .board .changsheng-state {
    position:absolute;
    left:0;
    top:0;
    z-index:2;
    display:none;
    width:143%;
    height:10px;
    max-width:none;
    overflow:visible;
    font-size:10px !important;
    font-weight:400 !important;
    line-height:10px !important;
    letter-spacing:0 !important;
    white-space:nowrap;
    transform:scale(.7);
    transform-origin:left top;
    pointer-events:none;
  }
  .harmony7-board-fix .show-changsheng .board .stem-stack {
    padding-top:9px;
  }
  .harmony7-board-fix .show-changsheng .board .changsheng-state {
    display:block;
  }
}

/* Huawei Browser-only result heading fix. */
@media screen and (max-width:700px) {
  .huawei-browser-fix .result-heading { justify-content:flex-start; gap:6px; }
  .huawei-browser-fix .result-heading > div { flex:0 0 auto; }
  .huawei-browser-fix .result-heading h2 { font-size:17px; white-space:nowrap; word-break:keep-all; }
  .huawei-browser-fix .back-to-input { flex:0 0 auto; padding-left:9px; padding-right:9px; }
  .huawei-browser-fix .view-mode-button { padding-left:7px; padding-right:7px; }
}


/* Phase 1: login and account roles */
body.auth-locked { overflow:hidden; }
body.auth-locked > .app-shell,
body.auth-locked > .palace-sheet,
body.auth-locked > .datetime-sheet,
body.auth-locked > .case-sheet,
body.auth-locked > .cloud-sync-sheet,
body.auth-locked > .pwa-update-card { visibility:hidden; pointer-events:none; }
.auth-view { position:fixed; inset:0; z-index:10000; display:grid; place-items:center; min-height:100dvh; padding:24px 16px; overflow:auto; background:radial-gradient(circle at 50% 10%,rgba(218,179,101,.22),transparent 36%),linear-gradient(160deg,#fffaf0 0%,#f4e8d3 55%,#ead4b4 100%); }
.auth-view[hidden] { display:none; }
.auth-card { width:min(100%,390px); padding:30px 28px 22px; border:1px solid rgba(143,42,42,.28); border-radius:18px; background:rgba(255,253,247,.96); box-shadow:0 18px 50px rgba(83,38,25,.16); }
.auth-brand { text-align:center; }
.auth-brand img { width:56px; height:56px; object-fit:contain; }
.auth-brand h1 { margin:10px 0 5px; color:#7f2020; font-size:25px; letter-spacing:2px; }
.auth-brand p { margin:0 0 24px; color:#8a6d54; font-size:14px; letter-spacing:3px; }
.auth-form { display:grid; gap:15px; }
.auth-form > label:not(.auth-remember) { display:grid; gap:7px; color:#5d4032; font-size:14px; font-weight:700; }
.auth-form input[type="text"], .auth-form input[type="password"], .auth-form input:not([type]) { box-sizing:border-box; width:100%; height:46px; padding:0 13px; border:1px solid #d6c1a5; border-radius:9px; background:#fffefa; color:#30231d; font:inherit; outline:none; }
.auth-form input:focus { border-color:#9b2f2f; box-shadow:0 0 0 3px rgba(155,47,47,.1); }
.auth-remember { display:flex; align-items:center; gap:7px; color:#745e4e; font-size:13px; font-weight:400; }
.auth-remember input { width:16px; height:16px; accent-color:#9b2f2f; }
.auth-submit { width:100%; min-height:46px; font-size:16px; }
.auth-feedback { min-height:20px; margin:0; color:#a02c2c; font-size:13px; text-align:center; }
.auth-version { margin:6px 0 0; color:#a18a76; font-size:11px; text-align:center; }
.account-bar { display:flex; justify-content:flex-end; align-items:center; gap:8px; min-height:30px; padding:0 4px 7px; color:#765b48; font-size:12px; }
.account-link { padding:3px 7px; border:0; background:transparent; color:#8c2929; font:inherit; cursor:pointer; }
.account-link + .account-link { border-left:1px solid #d4c0a8; }
.admin-panel { position:fixed; inset:0; z-index:10020; display:grid; place-items:center; padding:18px; }
.admin-panel[hidden] { display:none; }
.admin-backdrop { position:absolute; inset:0; border:0; background:rgba(38,24,18,.5); }
.admin-card { position:relative; width:min(100%,520px); max-height:85dvh; overflow:auto; border-radius:14px; background:#fffdf7; box-shadow:0 22px 60px rgba(0,0,0,.25); }
.admin-card header { display:flex; justify-content:space-between; align-items:flex-start; padding:18px 20px 13px; border-bottom:1px solid #eadcc9; }
.admin-card h2 { margin:0; color:#7f2020; font-size:20px; }
.admin-card header p { margin:4px 0 0; color:#8b7462; font-size:12px; }
.admin-close { width:32px; height:32px; border:0; border-radius:50%; background:#f4e8d8; color:#7f2020; font-size:22px; cursor:pointer; }
.admin-user-list { display:grid; gap:10px; padding:16px 20px; }
.admin-user-list article { display:grid; grid-template-columns:1fr auto; gap:4px 12px; padding:12px 14px; border:1px solid #ead9c2; border-radius:9px; background:#fffaf1; }
.admin-user-list strong { color:#6f2828; }
.admin-user-list span { color:#3d3029; font-family:ui-monospace,monospace; }
.admin-user-list small { grid-column:1/-1; color:#8c7664; }
.admin-note { margin:0; padding:0 20px 20px; color:#876e5b; font-size:12px; line-height:1.6; }
@media (max-width:520px) { .auth-card { padding:25px 20px 18px; } .auth-brand img { width:52px; height:52px; } .auth-brand h1 { font-size:22px; } .account-bar { justify-content:center; flex-wrap:wrap; } }

/* 第二阶段：正式账号管理 */
.admin-create-form { display:grid; grid-template-columns:1fr 1fr; gap:9px; padding:16px 20px 4px; }
.admin-create-form input { min-width:0; width:100%; box-sizing:border-box; padding:9px 10px; border:1px solid #d9c7b1; border-radius:7px; background:#fff; color:#382c25; font:inherit; }
.admin-create-form label { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:8px; color:#705c4d; font-size:12px; }
.admin-create-form button { grid-column:1/-1; min-height:36px; }
.admin-feedback { min-height:18px; margin:6px 20px 0; color:#8c2929; font-size:12px; }
.admin-user-list article { grid-template-columns:1fr; }
.admin-user-title { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.admin-user-title span { font-family:ui-monospace,monospace; }
.admin-user-edit { display:grid; grid-template-columns:1fr auto; gap:7px; }
.admin-user-edit input { min-width:0; padding:7px 8px; border:1px solid #d9c7b1; border-radius:6px; background:#fff; }
.admin-user-edit button, .admin-user-actions button { padding:6px 9px; border:1px solid #d8c4aa; border-radius:6px; background:#f9efe1; color:#6f2828; cursor:pointer; }
.admin-user-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.admin-user-actions .danger { color:#a12020; }
.admin-user-actions button:disabled { opacity:.45; cursor:not-allowed; }
@media (max-width:520px) {
  .admin-card { max-height:92dvh; }
  .admin-create-form { grid-template-columns:1fr; }
  .admin-create-form button { grid-column:auto; }
}
