﻿@font-face {
  font-family:"QimenBoardSC";
  src:url("./fonts/qimen-board-sc.woff2?v=0.8.5-preview.34") 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; }
.account-menu[hidden],
.help-panel[hidden],
.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(4,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-detail-tab:disabled { color:#b4a79d; cursor:not-allowed; opacity:.58; box-shadow:none; }
.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; }
.overview-plate { display:grid; gap:6px; padding:7px; background:#f8f1e8; border:1px solid #e1d2c1; border-radius:11px; }
.overview-plate-row { min-width:0; padding:5px 7px; background:#fff; border:1px solid #eadfd3; border-radius:8px; }
.overview-plate-main, .overview-plate-stems { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px 9px; }
.overview-plate-item { display:flex; min-width:0; align-items:center; gap:5px; }
.overview-plate-label { flex:0 0 auto; color:#8a776a; font-size:10px; font-weight:700; white-space:nowrap; }
.overview-plate-values, .overview-value-pair { display:flex; min-width:0; flex-wrap:wrap; align-items:center; gap:3px; }
.overview-meaning-chip { min-height:27px; padding:3px 8px; color:#68493a; background:#fffaf4; border:1px solid #dbc7b3; border-radius:99px; font-size:12px; font-weight:800; line-height:1.2; white-space:nowrap; }
.overview-meaning-chip:hover { border-color:#b98a67; background:#fff5e9; }
.overview-meaning-chip:focus-visible { outline:2px solid var(--red); outline-offset:2px; }
.overview-status-badge { display:inline-flex; min-height:20px; align-items:center; padding:1px 4px; border-radius:5px; font-size:10px; font-weight:800; line-height:1.25; white-space:nowrap; }
.overview-status-badge.caution { color:#a13d37; background:#fff0ed; }
.overview-status-badge.positive { color:#34724d; background:#eef8f1; }
.overview-status-badge.neutral { color:#74665d; background:#f2eee9; }
.overview-plate-summary { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 12px; }
.overview-response-list, .overview-palace-status { display:flex; min-width:0; flex-wrap:wrap; align-items:center; gap:4px; }
.overview-empty { color:#9b8d83; font-size:11px; font-weight:600; }
@media screen and (max-width:420px) {
  .overview-plate { padding:6px; }
  .overview-plate-main, .overview-plate-stems { gap:5px; }
  .overview-plate-item { align-items:flex-start; flex-direction:column; gap:2px; }
  .overview-meaning-chip { min-height:25px; padding:3px 7px; font-size:11px; }
  .overview-status-badge { font-size:9px; }
}

.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; }
.merged-meaning-hero { margin-bottom:10px; }
.merged-meaning-card { overflow:hidden; background:#fff; border:1px solid #e4d6c8; border-radius:13px; }
.merged-meaning-row { padding:11px 13px; scroll-margin-top:6px; }
.merged-meaning-row + .merged-meaning-row { border-top:1px dashed #e5d8cc; }
.merged-meaning-row p { margin:0; color:#554943; font-size:13px; line-height:1.75; overflow-wrap:anywhere; }
.merged-meaning-row strong { margin-right:3px; color:var(--red-dark); font-size:13px; }
.meaning-experience-card { margin-top:11px; scroll-margin-top:6px; padding:12px 13px; color:#5c482d; background:linear-gradient(145deg,#fff5d9,#fffaf0); border:1px solid #e6cf9f; border-left:3px solid var(--gold); border-radius:5px 12px 12px 5px; }
.meaning-experience-card h4 { margin:0 0 5px; color:#8a5b16; font-size:14px; }
.meaning-experience-card p { margin:0; font-size:12px; line-height:1.7; }
.merged-current-context { margin-top:11px; margin-bottom:0; }
.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-top {
  width:100%;
  min-height:17px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  padding:0 2px;
}
.almanac-day strong { font-size:15px; line-height:1.05; font-weight:650; }
.almanac-holiday-state {
  min-width:15px;
  height:15px;
  display:inline-grid;
  place-items:center;
  border-radius:4px;
  font-size:9px;
  font-weight:800;
  line-height:1;
}
.almanac-holiday-state.rest { color:#fff; background:var(--red); }
.almanac-holiday-state.work { color:#72512f; background:#eadcc8; }
.almanac-day-ganzhi {
  width:100%;
  overflow:hidden;
  color:#6f4935;
  font-size:10px;
  font-weight:650;
  line-height:1.05;
  text-align:center;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.almanac-day small {
  width:100%;
  overflow:hidden;
  color:var(--muted);
  font-size:9px;
  line-height:1.05;
  text-align:center;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.almanac-day.is-holiday .almanac-day-label { color:var(--red); font-weight:700; }
.almanac-day.is-workday .almanac-day-label { color:#72512f; font-weight:650; }
.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;
  left:3px;
  bottom: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 {
  left:4px;
  bottom:4px;
  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; }
}


/* Input home redesign v12 */
.app-shell {
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.app-topbar {
  position: relative;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 14px;
  padding: 10px 4px 4px;
}

.app-brand {
  min-width: 0;
}

.app-brand .brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.app-brand h1 {
  margin: 0;
  font-size: clamp(1.08rem, 4.6vw, 1.46rem);
  line-height: 1.18;
}

.app-brand .subtitle {
  margin-top: 3px;
  font-size: .78rem;
  color: var(--muted, #766b65);
}

.account-bar {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.account-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(112, 54, 45, .18);
  border-radius: 999px;
  background: rgba(255, 252, 247, .94);
  color: #6f2d2d;
  font: inherit;
  font-size: .83rem;
  font-weight: 600;
  white-space: nowrap;
}

.account-menu-arrow {
  font-size: .72rem;
  transition: transform .18s ease;
}

.account-menu-toggle[aria-expanded="true"] .account-menu-arrow {
  transform: rotate(180deg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: min(278px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid rgba(112, 54, 45, .16);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 14px 40px rgba(61, 31, 26, .18);
}

.account-menu-profile {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  padding: 10px 11px 12px;
  border-bottom: 1px solid rgba(112, 54, 45, .1);
  color: #6f625c;
  font-size: .8rem;
}

.account-menu-profile strong {
  margin-bottom: 2px;
  color: #3f2924;
  font-size: 1rem;
}

.account-menu-profile b { color: #4d3934; font-weight: 600; }

.account-menu-item {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #493630;
  font: inherit;
  text-align: left;
}

.account-menu-item:hover,
.account-menu-item:focus-visible { background: #f8efea; }
.account-menu-logout { color: #9b2f2f; }

.app-navigation {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 7px max(10px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid rgba(112, 54, 45, .13);
  background: rgba(255, 253, 249, .97);
  box-shadow: 0 -8px 24px rgba(61, 31, 26, .08);
  backdrop-filter: blur(14px);
}

.app-nav-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 53px;
  padding: 5px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8a817c;
  font: inherit;
  font-size: .75rem;
}

.app-nav-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: #f3efec;
  font-size: .85rem;
  font-weight: 700;
}

.app-nav-item.active { color: #8f2929; font-weight: 700; }
.app-nav-item.active .app-nav-icon { background: #8f2929; color: #fff; }

.quick-chart-card {
  display: block;
  overflow: hidden;
  padding: 0 15px 16px;
}

.quick-chart-heading {
  margin: 0 -15px 4px;
  padding: 17px 16px 14px;
  border-bottom: 1px solid rgba(112, 54, 45, .1);
  background: linear-gradient(135deg, #fffaf5, #f9eee7);
}

.quick-chart-heading h2,
.cases-view-heading h2 { margin: 0; color: #472d28; font-size: 1.18rem; }
.quick-chart-heading p,
.cases-view-heading p { margin: 4px 0 0; color: #81736c; font-size: .82rem; }

.chart-type-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.chart-type-switch button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(112, 54, 45, .18);
  border-radius: 11px;
  background: #faf6f2;
  color: #6f5a53;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
}

.chart-type-switch button[aria-pressed="true"] {
  border-color: #8f2929;
  background: #8f2929;
  color: #fff;
  box-shadow: 0 5px 12px rgba(111, 31, 31, .16);
}

.chart-type-switch button:focus-visible {
  outline: 2px solid rgba(143, 41, 41, .38);
  outline-offset: 2px;
}

#chart-entry-content[hidden] {
  display: none !important;
}

.name-label-lifetime,
.start-chart-label-lifetime { display: none; }

#chart-entry-content[data-chart-type="终身盘"],
#chart-entry-content[data-chart-type="时盘"] {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 11px;
  padding-top: 15px;
}

#chart-entry-content[data-chart-type="终身盘"] > .chart-case-section,
#chart-entry-content[data-chart-type="终身盘"] > .chart-time-section,
#chart-entry-content[data-chart-type="时盘"] > .chart-case-section,
#chart-entry-content[data-chart-type="时盘"] > .chart-time-section {
  padding: 0;
  border: 0;
}

#chart-entry-content[data-chart-type="终身盘"] .chart-case-section > h3,
#chart-entry-content[data-chart-type="终身盘"] .chart-time-section > h3,
#chart-entry-content[data-chart-type="终身盘"] .category-field,
#chart-entry-content[data-chart-type="终身盘"] .question-field,
#chart-entry-content[data-chart-type="终身盘"] .more-case-info,
#chart-entry-content[data-chart-type="终身盘"] .reset-chart,
#chart-entry-content[data-chart-type="时盘"] .chart-case-section > h3,
#chart-entry-content[data-chart-type="时盘"] .chart-time-section > h3,
#chart-entry-content[data-chart-type="时盘"] .question-field,
#chart-entry-content[data-chart-type="时盘"] .more-case-info,
#chart-entry-content[data-chart-type="时盘"] .reset-chart {
  display: none;
}

#chart-entry-content[data-chart-type="终身盘"] .chart-case-grid,
#chart-entry-content[data-chart-type="时盘"] .chart-case-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, .72fr);
  gap: 11px 9px;
}

#chart-entry-content[data-chart-type="终身盘"] .chart-case-grid {
  grid-template-areas: "name gender";
}

#chart-entry-content[data-chart-type="时盘"] .chart-case-grid {
  grid-template-areas:
    "name gender"
    "category category";
}

#chart-entry-content[data-chart-type="终身盘"] .name-field,
#chart-entry-content[data-chart-type="时盘"] .name-field {
  grid-area: name;
  grid-row: auto;
  grid-column: auto;
  order: initial;
  min-width: 0;
}

#chart-entry-content[data-chart-type="终身盘"] .gender-field,
#chart-entry-content[data-chart-type="时盘"] .gender-field {
  grid-area: gender;
  grid-row: auto;
  grid-column: auto;
  order: initial;
  min-width: 0;
}

#chart-entry-content[data-chart-type="时盘"] .category-field {
  grid-area: category;
  grid-row: auto;
  grid-column: auto;
  order: initial;
  min-width: 0;
}

#chart-entry-content[data-chart-type="终身盘"] .chart-time-section,
#chart-entry-content[data-chart-type="时盘"] .chart-time-section,
#chart-entry-content[data-chart-type="终身盘"] .start-chart,
#chart-entry-content[data-chart-type="时盘"] .start-chart {
  grid-row: auto;
  grid-column: auto;
  order: initial;
}

#chart-entry-content[data-chart-type="终身盘"] .start-chart,
#chart-entry-content[data-chart-type="时盘"] .start-chart {
  margin-top: 2px;
}

#chart-entry-content[data-chart-type="终身盘"] .name-label-default,
#chart-entry-content[data-chart-type="终身盘"] .start-chart-label-default,
#chart-entry-content[data-chart-type="时盘"] .name-label-default,
#chart-entry-content[data-chart-type="时盘"] .start-chart-label-default { display: none; }

#chart-entry-content[data-chart-type="终身盘"] .name-label-lifetime,
#chart-entry-content[data-chart-type="终身盘"] .start-chart-label-lifetime,
#chart-entry-content[data-chart-type="时盘"] .name-label-lifetime,
#chart-entry-content[data-chart-type="时盘"] .start-chart-label-lifetime { display: inline; }
.chart-form-section {
  padding: 15px 0 14px;
  border-bottom: 1px solid rgba(112, 54, 45, .09);
}

.chart-form-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #4d3731;
  font-size: .95rem;
}

.chart-form-section h3 > span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #f2dfd4;
  color: #8f2929;
  font-size: .75rem;
}

.chart-form-section h3 small {
  color: #998c85;
  font-size: .72rem;
  font-weight: 400;
}

.chart-form-section .datetime-field {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}
.chart-form-section .datetime-field > legend { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0 0 0 0); }
.chart-setting-grid,
.chart-case-grid,
.more-case-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.chart-setting-grid-single { grid-template-columns: minmax(0, 1fr); }

.gender-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.gender-field > legend { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.gender-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gender-switch button {
  min-height: 42px;
  border: 1px solid rgba(112, 54, 45, .18);
  border-radius: 11px;
  background: #faf6f2;
  color: #6f5a53;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
}
.gender-switch button[aria-pressed="true"] {
  border-color: #8f2929;
  background: #8f2929;
  color: #fff;
  box-shadow: 0 5px 12px rgba(111, 31, 31, .14);
}
.gender-switch button:focus-visible { outline: 2px solid rgba(143, 41, 41, .38); outline-offset: 2px; }
.chart-case-grid .question-field { grid-column: 1 / -1; }
.chart-case-grid textarea { min-height: 82px; resize: vertical; }

.more-case-info {
  margin-top: 11px;
  border: 1px dashed rgba(112, 54, 45, .18);
  border-radius: 12px;
  background: #fcfaf7;
}
.more-case-info summary { padding: 11px 12px; color: #76544b; font-size: .84rem; cursor: pointer; }
.more-case-info[open] summary { border-bottom: 1px solid rgba(112, 54, 45, .08); }
.more-case-info-grid { padding: 12px 12px 5px; }
.more-case-info > p { margin: 5px 12px 12px; color: #978b84; font-size: .72rem; line-height: 1.5; }
#year-destiny { color: #8f2929; font-weight: 700; background: #f8f3ef; }

.quick-chart-card .start-chart {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border-radius: 13px;
  font-size: 1rem;
}

.quick-chart-card .reset-chart {
  display: block;
  min-height: 38px;
  margin: 5px auto -4px;
  padding: 5px 12px;
  border: 0;
  background: transparent;
  color: #8a7770;
  font: inherit;
  font-size: .82rem;
}

.cases-view-heading { padding: 15px 16px; }
.cases-view .case-center { margin-top: 12px; }
.cases-view .case-center > summary { display: none; }
.cases-view .case-center-body { padding-top: 14px; }

.help-panel {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  align-items: end;
}
.help-backdrop { position: absolute; inset: 0; border: 0; background: rgba(35, 24, 21, .48); }
.help-dialog {
  position: relative;
  z-index: 1;
  max-height: min(82vh, 760px);
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #fffdf9;
  box-shadow: 0 -18px 50px rgba(30, 18, 16, .22);
}
.help-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px;
  border-bottom: 1px solid rgba(112, 54, 45, .1);
}
.help-dialog-header h2 { margin: 0; font-size: 1.08rem; }
.help-dialog-header button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f3ece7; color: #6f5148; font-size: 1.3rem; }
.help-dialog-body { max-height: calc(min(82vh, 760px) - 65px); overflow: auto; padding: 15px 17px calc(20px + env(safe-area-inset-bottom)); }
.help-dialog-body ul { padding-left: 1.15rem; color: #62534d; line-height: 1.72; }

@media (max-width: 520px) {
  .app-topbar { align-items: flex-start; }
  .app-brand .brand-logo { width: 40px; height: 40px; flex-basis: 40px; }
  .account-menu-toggle { max-width: 98px; }
  #account-summary { overflow: hidden; text-overflow: ellipsis; }
  .chart-setting-grid,
  .chart-case-grid,
  .more-case-info-grid { grid-template-columns: 1fr; }
  .chart-case-grid .question-field { grid-column: auto; }
}

@media (min-width: 760px) {
  .app-shell { padding-bottom: 32px; }
  .app-topbar { padding-top: 14px; }
  .app-navigation {
    position: static;
    max-width: 560px;
    margin: 0 auto 16px;
    padding: 5px;
    border: 1px solid rgba(112, 54, 45, .13);
    border-radius: 16px;
    box-shadow: none;
    background: rgba(255, 253, 249, .9);
  }
  .app-nav-item { grid-template-columns: auto auto; justify-content: center; align-items: center; min-height: 42px; font-size: .86rem; }
  .app-nav-icon { width: 25px; height: 25px; }
  .quick-chart-card { max-width: 720px; margin-right: auto; margin-left: auto; }
  .cases-view { max-width: 820px; margin-right: auto; margin-left: auto; }
  .help-panel { align-items: center; justify-items: center; padding: 24px; }
  .help-dialog { width: min(720px, 100%); border-radius: 20px; }
}


/* Current time, five-element pillars and effect-image alignment v20 */
.input-view { max-width: 560px; }

.app-topbar {
  min-height: 68px;
  width: calc(100% + 12px);
  margin: -10px -6px 13px;
  padding: 10px 15px;
  align-items: center;
  border-bottom: 1px solid rgba(112, 54, 45, .12);
  background: rgba(255, 253, 249, .98);
}
.app-brand { display: flex; align-items: center; gap: 13px; }
.app-brand-seal {
  display: grid;
  width: 41px;
  height: 41px;
  flex: 0 0 41px;
  place-items: center;
  border-radius: 12px;
  background: #9a3030;
  color: #fff8ed;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(112, 32, 32, .18);
}
.app-brand h1 {
  margin: 0;
  color: #33211d;
  font-size: clamp(1.18rem, 5.2vw, 1.42rem);
  font-weight: 750;
  line-height: 1;
  letter-spacing: .12em;
}
.account-menu-toggle {
  gap: 7px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #725b53;
  box-shadow: none;
  font-size: .86rem;
  font-weight: 500;
}
.account-menu-label { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
.account-menu-avatar {
  display: grid;
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  place-items: center;
  border-radius: 50%;
  background: #eee1d9;
  color: #8f2929;
  font-weight: 800;
}

.quick-chart-card {
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.current-time-card {
  overflow: hidden;
  border: 1px solid rgba(143, 41, 41, .14);
  border-radius: 17px;
  background: linear-gradient(145deg, #fffdf9 0%, #fbf3ed 100%);
  box-shadow: 0 8px 22px rgba(93, 53, 42, .07);
}
.current-time-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 12px;
}
.current-date-copy { min-width: 0; }
.current-date-copy small {
  display: block;
  margin-bottom: 4px;
  color: #907f78;
  font-size: 11px;
  letter-spacing: .08em;
}
.current-date-copy strong {
  display: block;
  overflow: hidden;
  color: #49352f;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.current-beijing-clock {
  flex: 0 0 auto;
  color: #8f2929;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.03em;
}
.current-four-pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid rgba(112, 54, 45, .12);
  background: rgba(112, 54, 45, .12);
}
.current-pillar {
  min-width: 0;
  padding: 10px 4px 11px;
  text-align: center;
  background: rgba(255, 253, 249, .96);
}
.current-pillar small {
  display: block;
  margin-bottom: 3px;
  color: #9a8880;
  font-size: 10px;
}
.current-pillar strong {
  display: inline-flex;
  justify-content: center;
  color: #71413a;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .08em;
}
.current-pillar strong span { display: inline-block; }
.five-element-wood { color: #36834b; }
.five-element-fire { color: #c43a32; }
.five-element-earth { color: #8a5a3b; }
.five-element-metal { color: #d29b16; }
.five-element-water { color: #2f6fbd; }
.five-element-default { color: #71413a; }

.chart-type-switch { gap: 7px; margin-top: 12px; }
.chart-type-switch button {
  min-height: 43px;
  border-radius: 11px;
  background: #fbf7f3;
  color: #77635c;
  font-size: 13px;
  font-weight: 650;
}
.chart-type-switch button[aria-pressed="true"] {
  border-color: #8f2929;
  background: #f2e2dc;
  color: #8f2929;
  box-shadow: none;
}
#chart-entry-content[data-chart-type="终身盘"],
#chart-entry-content[data-chart-type="时盘"] { gap: 10px; padding-top: 13px; }
#chart-entry-content[data-chart-type="终身盘"] .chart-case-grid,
#chart-entry-content[data-chart-type="时盘"] .chart-case-grid {
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 10px 8px;
}#chart-entry-content[data-chart-type="时盘"] .category-field {
  grid-column: 1 / -1;
  width: 100%;
}
.quick-chart-card label,
.gender-field > legend { gap: 5px; margin-bottom: 0; color: #88756e; font-size: 11px; }
.quick-chart-card input,
.quick-chart-card select {
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid rgba(112, 54, 45, .16);
  border-radius: 11px;
  background: #fffdfb;
  color: #493b36;
  font-size: 13px;
}
.quick-chart-card .name-label,
.quick-chart-card .category-label,
.quick-chart-card .gender-field > legend {
  color: #684c44;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}
.quick-chart-card .category-label { display: block; }

.quick-chart-card input::placeholder { color: #a69791; }
.gender-switch { gap: 6px; }
.gender-switch button {
  min-height: 43px;
  border-radius: 11px;
  background: #fbf7f3;
  color: #77635c;
  font-size: 13px;
  font-weight: 650;
}
.gender-switch button[aria-pressed="true"] {
  border-color: #8f2929;
  background: #f2e2dc;
  color: #8f2929;
  box-shadow: none;
}
.datetime-trigger {
  min-height: 62px;
  padding: 9px 11px;
  border: 1px solid rgba(112, 54, 45, .16);
  border-radius: 11px;
  background: #fffdfb;
}
.datetime-trigger-icon {
  width: 35px;
  height: 35px;
  flex-basis: 35px;
  border-radius: 10px;
  background: #f1e3dc;
  color: #8f2929;
  font-size: 17px;
}
.datetime-trigger-copy small { color: #9a8a83; font-size: 10px; }
.datetime-trigger-copy strong { margin-top: 3px; color: #523f39; font-size: 13px; }
.datetime-trigger-arrow { color: #a48f87; font-size: 21px; }
.quick-chart-card .start-chart {
  min-height: 47px;
  margin-top: 2px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #96302f, #78201f);
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .12em;
  box-shadow: 0 8px 18px rgba(113, 31, 31, .19);
}

@media (max-width: 390px) {
  .app-brand h1 { font-size: 1.12rem; }
  .account-menu-label { max-width: 58px; }
  .current-date-copy strong { font-size: 14px; }
  .current-beijing-clock { font-size: 25px; }
  #chart-entry-content[data-chart-type="终身盘"] .chart-case-grid,
  #chart-entry-content[data-chart-type="时盘"] .chart-case-grid { grid-template-columns: minmax(0, 1fr) 116px; }
}
@media (min-width: 760px) {
  .app-topbar {
    width: 100%;
    margin: 0 auto 16px;
    border: 1px solid rgba(112, 54, 45, .12);
    border-radius: 15px;
  }
}

/* Compact result page redesign v23: scoped outside the nine-palace board. */
.result-view {
  width: min(100%, 980px);
  margin-right: auto;
  margin-left: auto;
}
.result-view .result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 10px;
  padding: 9px 10px;
  border-color: rgba(112, 54, 45, .13);
  border-radius: 16px;
  background: rgba(255, 253, 249, .97);
  box-shadow: 0 7px 20px rgba(70, 42, 34, .07);
}
.result-view .result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}
.result-view .result-heading > div { min-width: 0; }
.result-view .result-heading small { color: #a18d85; font-size: 9px; letter-spacing: .13em; }
.result-view .result-heading h2 {
  margin-top: 1px;
  color: #412a25;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: .04em;
}
.result-view .back-to-input {
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(112, 54, 45, .14);
  border-radius: 10px;
  background: #fbf7f3;
  color: #765d55;
  font-size: 11px;
}
.result-view .view-mode {
  min-height: 34px;
  margin: 0;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(112, 54, 45, .13);
  border-radius: 10px;
  background: #f7f1ed;
}
.result-view .view-mode > span { display: none; }
.result-view .view-mode-button {
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: #826d65;
  background: transparent;
  font-size: 11px;
}
.result-view .view-mode-button.active,
.result-view .view-mode-button[aria-pressed="true"] {
  color: #8f2929;
  background: #fffdf9;
  box-shadow: 0 2px 7px rgba(67, 36, 29, .08);
}
.result-view .result-toolbar,
.result-view .result-header > .chart-navigation {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.result-view .result-toolbar button,
.result-view .result-header > .chart-navigation button {
  min-width: 0;
  min-height: 36px;
  padding: 6px 4px;
  border-color: rgba(112, 54, 45, .14);
  border-radius: 10px;
  color: #765d55;
  background: #fbf7f3;
  font-size: 11px;
  line-height: 1.15;
  box-shadow: none;
}
.result-view .result-toolbar #save-case {
  border-color: #8f2929;
  color: #fff;
  background: linear-gradient(135deg, #96302f, #78201f);
  box-shadow: 0 5px 12px rgba(113, 31, 31, .14);
}
.result-view .result-header > .chart-navigation button small {
  display: inline;
  margin: 0 0 0 2px;
  font-size: 8px;
  opacity: .68;
}
.result-view .chart {
  margin-top: 8px;
  padding: 9px 9px 12px;
  border-color: rgba(112, 54, 45, .13);
  border-radius: 16px;
  background: rgba(255, 253, 249, .97);
  box-shadow: 0 7px 20px rgba(70, 42, 34, .07);
}
.result-view .chart-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  padding: 1px 1px 8px;
  border-bottom: 1px solid rgba(112, 54, 45, .11);
}
.result-view .calendar { display: grid; gap: 5px; min-width: 0; }
.result-view .calendar-date-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 6px;
  min-width: 0;
}
.result-view .calendar h2 {
  margin: 0;
  color: #422b26;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: .01em;
}
.result-view .calendar p { margin: 0; color: #9a8880; font-size: 11px; line-height: 1.35; }
.result-view .tags {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  color: #765f57;
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
  scrollbar-width: none;
}
.result-view .tags::-webkit-scrollbar { display: none; }
.result-view .tags span {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  white-space: nowrap;
}
.result-view .tags span:not([hidden]):not(:last-child)::after {
  content: "｜";
  margin: 0 4px;
  color: rgba(112, 54, 45, .28);
}
.result-view .chart-summary { grid-column: auto; display: block; min-width: 0; }
.result-view .chart-summary-main {
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid rgba(112, 54, 45, .1);
  border-radius: 9px;
  background: #fbf7f3;
  font-size: 11px;
  line-height: 1.35;
  overflow-x: auto;
  scrollbar-width: none;
}
.result-view .chart-summary-main::-webkit-scrollbar { display: none; }
.result-view .chart-summary-main span:not(:last-child)::after { margin: 0 4px; color: rgba(112, 54, 45, .27); }
.result-view .chart-summary-main small { color: #9a8880; font-size: 9px; }
.result-view .chart-summary-main strong { margin-left: 2px; color: #6e3a34; font-size: 11px; }
.result-view .pillars {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 54, 45, .1);
  border-radius: 9px;
  background: rgba(112, 54, 45, .1);
}
.result-view .pillars div {
  min-width: 0;
  padding: 5px 3px 6px;
  border: 0;
  border-radius: 0;
  background: #fffdf9;
  text-align: center;
}
.result-view .pillars small { display: block; margin-bottom: 1px; color: #9a8880; font-size: 9px; line-height: 1.2; }
.result-view .pillars strong {
  display: block;
  color: #71413a;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .06em;
}
@media (max-width: 590px) {
  .result-view .result-header { gap: 6px; padding: 8px; }
  .result-view .result-heading { gap: 6px; }
  .result-view .result-heading h2 { font-size: 16px; }
  .result-view .back-to-input { padding: 0 7px; font-size: 10px; }
  .result-view .view-mode-button { padding: 0 7px; font-size: 10px; }
  .result-view .result-toolbar button,
  .result-view .result-header > .chart-navigation button { min-height: 35px; font-size: 10px; }
  .result-view .calendar h2 { font-size: 14px; }
  .result-view .calendar p,
  .result-view .tags { font-size: 10px; }
  .result-view .chart-summary-main { font-size: 10px; }
  .result-view .chart-summary-main small { font-size: 8px; }
  .result-view .chart-summary-main strong { font-size: 10px; }
  .result-view .pillars strong { font-size: 16px; }
}
/* Mobile-first case center: title, search, grouped cards and long-press editing. */
.cases-view .cases-view-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; margin: 0; padding: 10px 14px; border-radius: 14px; }
.cases-view .cases-view-title { min-width: 0; }
.cases-view .cases-view-heading h2 { margin: 0; color: var(--red-dark); font-size: 19px; line-height: 1.2; }
.cases-view .case-count { margin-left: 3px; color: var(--muted); font-size: 14px; font-weight: 500; }
.cases-view .cases-view-heading p, .cases-view .cloud-sync-card > p, .cases-view .cloud-sync-icon { display: none; }
.cases-view .cloud-sync-card, .cases-view .cloud-sync-heading, .cases-view .cloud-sync-heading > div, .cases-view .cloud-sync-actions { display: flex; align-items: center; }
.cases-view .cloud-sync-card { min-width: 0; gap: 7px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.cases-view .cloud-sync-heading > div { gap: 4px; }
.cases-view .cloud-sync-heading strong { flex: 0 0 auto; color: var(--red); font-size: 13px; line-height: 1.2; }
.cases-view .cloud-sync-heading small { overflow: hidden; max-width: 86px; color: var(--muted); font-size: 12px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.cases-view .cloud-sync-heading small::before { content: "路 "; }
.cases-view .cloud-sync-actions { flex: 0 0 auto; gap: 5px; }
.cases-view .cloud-sync-actions button, .cases-view .cloud-sync-actions button:only-child { min-width: 48px; min-height: 34px; padding: 5px 9px; border-radius: 8px; font-size: 12px; white-space: nowrap; }
.cases-view .case-center { margin-top: 8px; overflow: visible; border-radius: 14px; background: #fffdf9; box-shadow: 0 4px 14px rgba(61, 37, 31, .05); }
.cases-view .case-center > summary { display: none; }
.cases-view .case-center-body { padding: 12px; border-top: 0; }
.cases-view .case-search-row { display: block; padding-top: 0; }
.cases-view .case-search-row > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cases-view .case-search-row > div { display: block; }
.cases-view .case-search-row input { width: 100%; min-height: 46px; padding-inline: 13px; border-color: rgba(157, 55, 42, .28); border-radius: 10px; background: #fffefa; font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; font-size: 16px; }
.cases-view #case-search-clear { display: none; }
.cases-view .case-list { display: grid; gap: 16px; max-height: none; margin-top: 14px; overflow: visible; }
.cases-view .case-group { display: grid; gap: 8px; }
.cases-view .case-group-title { display: flex; align-items: baseline; gap: 4px; padding-inline: 3px; color: var(--red-dark); }
.cases-view .case-group-title strong { font-size: 15px; line-height: 1.25; }
.cases-view .case-group-title span { color: var(--muted); font-size: 12px; line-height: 1.25; }
.cases-view .case-group-items { display: grid; gap: 8px; }
.cases-view .case-empty { padding: 20px 13px; }
.cases-view .case-item { min-height: 112px; overflow: hidden; border: 1px solid rgba(157, 55, 42, .14); border-radius: 13px; background: #fffefa; box-shadow: 0 2px 8px rgba(61, 37, 31, .04); }
.cases-view .case-item.active { border-color: rgba(157, 55, 42, .42); box-shadow: 0 0 0 2px rgba(157, 55, 42, .08); }
.cases-view .case-open { display: flex; width: 100%; min-height: 112px; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 13px; text-align: left; touch-action: pan-y; }
.cases-view .case-open-main { display: grid; min-width: 0; gap: 7px; }
.cases-view .case-open strong { overflow: hidden; color: var(--red-dark); font-size: 18px; line-height: 1.3; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cases-view .case-item-meta { overflow: hidden; color: #71665d; font-size: 14px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.cases-view .case-category { width: fit-content; max-width: 100%; overflow: hidden; padding: 3px 7px; border-radius: 999px; background: rgba(157, 55, 42, .08); color: var(--red-dark); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.cases-view .case-open-arrow { flex: 0 0 auto; color: var(--red); font-family: Arial, sans-serif; font-size: 30px; line-height: 1; font-weight: 300; }
.cases-view .backup-actions { gap: 7px; margin-top: 14px; }
.cases-view .backup-actions button { min-height: 40px; padding: 7px; font-size: 12px; }
.cases-view .case-storage-status { margin: 8px 2px 0; font-size: 11px; line-height: 1.45; }
@media screen and (max-width: 390px) { .cases-view .cases-view-heading { gap: 7px; padding-inline: 11px; } .cases-view .cloud-sync-card { gap: 5px; } .cases-view .cloud-sync-heading small { max-width: 70px; } .cases-view .cloud-sync-actions button { min-width: 44px; padding-inline: 7px; } .cases-view .case-center-body { padding-inline: 10px; } }
@media screen and (max-width: 350px) { .cases-view .cloud-sync-heading small { display: none; } .cases-view .cases-view-heading h2 { font-size: 18px; } }

/* Almanac visual harmony: compact header, month controls and calendar cells */
.almanac-view {
  --almanac-paper:#fffaf4;
  --almanac-paper-strong:#fffdf9;
  --almanac-soft:#f6eee6;
  --almanac-border:rgba(112,54,45,.14);
}
.almanac-view .almanac-header {
  top:0;
  gap:7px;
  min-height:52px;
  margin-bottom:6px;
  padding:6px 7px;
  border-color:var(--almanac-border);
  border-radius:14px;
  background:rgba(255,250,244,.96);
  box-shadow:0 5px 18px rgba(75,44,35,.07);
}
.almanac-view .almanac-title-group { display:grid; gap:1px; }
.almanac-view .almanac-header h2 {
  color:#3f2924;
  font-size:17px;
  font-weight:750;
  letter-spacing:.08em;
  line-height:1.15;
}
.almanac-view .almanac-offline-state {
  margin:0;
  font-size:9px;
  line-height:1.1;
  opacity:.82;
}
.almanac-view .almanac-header button {
  min-width:58px;
  min-height:36px;
  padding:6px 9px;
  border-color:rgba(155,47,47,.34);
  border-radius:10px;
  background:rgba(255,253,249,.72);
  font-size:13px;
}
.almanac-view #almanac-back {
  color:#765c55;
  border-color:rgba(112,54,45,.18);
}
.almanac-view #almanac-today {
  color:var(--red);
  background:#fff8f4;
}
.almanac-view .almanac-calendar {
  padding:6px 6px 7px;
  border-color:var(--almanac-border);
  border-radius:16px;
  background:var(--almanac-paper-strong);
  box-shadow:0 7px 24px rgba(75,44,35,.07);
  overflow:hidden;
}
.almanac-view .almanac-month-nav {
  grid-template-columns:38px minmax(0,1fr) 38px;
  gap:5px;
  margin:0 0 2px;
  padding:1px 0 4px;
  border-bottom:1px solid rgba(112,54,45,.08);
}
.almanac-view .almanac-month-nav > .ghost {
  width:36px;
  min-width:36px;
  min-height:36px;
  justify-self:center;
  padding:0;
  border-color:rgba(112,54,45,.15);
  border-radius:10px;
  color:var(--red);
  background:#fffaf6;
  font-size:22px;
  box-shadow:none;
}
.almanac-view .almanac-month-title {
  min-height:36px;
  padding:2px 8px;
  color:#33231f;
  font-size:20px;
  font-weight:750;
  letter-spacing:.06em;
}
.almanac-view .almanac-month-title::after {
  margin-left:4px;
  color:#8a756e;
  font-size:10px;
}
.almanac-view .almanac-date-jump {
  margin:2px 1px 6px;
  border-color:rgba(112,54,45,.12);
  border-radius:12px;
  background:#fffaf5;
  box-shadow:none;
}
.almanac-view .almanac-weekdays { padding:1px 0 2px; }
.almanac-view .almanac-weekdays span {
  padding:3px 0 4px;
  color:#786963;
  font-size:11px;
  font-weight:600;
}
.almanac-view .almanac-days { row-gap:1px; }
.almanac-view .almanac-day {
  min-height:51px;
  gap:1px;
  padding:3px 1px 4px;
  border-radius:10px;
}
.almanac-view .almanac-day-top {
  position:relative;
  min-height:16px;
  padding:0 14px;
}
.almanac-view .almanac-day strong {
  color:#352723;
  font-size:15px;
  line-height:1;
}
.almanac-view .almanac-day-ganzhi {
  color:#704334;
  font-size:9px;
  font-weight:700;
  line-height:1.05;
}
.almanac-view .almanac-day-label {
  color:#8a7a73;
  font-size:9px;
  line-height:1.05;
}
.almanac-view .almanac-holiday-state {
  position:absolute;
  top:50%;
  right:0;
  min-width:14px;
  height:14px;
  transform:translateY(-50%);
  border-radius:4px;
  font-size:8px;
}
.almanac-view .almanac-case-badge,
.almanac-view .almanac-case-badge.single {
  position:absolute;
  top:50%;
  left:0;
  bottom:auto;
  right:auto;
  min-width:13px;
  width:auto;
  height:13px;
  padding:0 3px;
  transform:translateY(-50%);
  border:0;
  border-radius:999px;
  color:#fff;
  background:#9a713f;
  font-size:8px;
  box-shadow:none;
}
.almanac-view .almanac-case-badge.single {
  left:3px;
  min-width:6px;
  width:6px;
  height:6px;
  padding:0;
}
.almanac-view .almanac-day.selected {
  border-color:rgba(155,47,47,.72);
  background:#fff0ea;
  box-shadow:inset 0 0 0 1px rgba(155,47,47,.12);
}
.almanac-view .almanac-day.selected strong { color:#8f2828; }
.almanac-view .almanac-day.selected .almanac-day-ganzhi { color:#81332d; }
.almanac-view .almanac-day.outside { opacity:.38; }

@media (max-width:370px) {
  .almanac-view .almanac-header button { min-width:52px; padding-inline:6px; }
  .almanac-view .almanac-calendar { padding-inline:3px; }
  .almanac-view .almanac-day { min-height:49px; }
  .almanac-view .almanac-day-top { padding-inline:12px; }
  .almanac-view .almanac-day-ganzhi,
  .almanac-view .almanac-day-label { font-size:8px; }
}

/* Almanac compact lower controls: date facts, hour selector and chart action */
.almanac-view .almanac-detail {
  margin-top:6px;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom));
  border-radius:14px;
}
.almanac-view .almanac-detail-heading {
  align-items:center;
  gap:8px;
}
.almanac-view .almanac-detail-heading small {
  font-size:11px;
  line-height:1.2;
}
.almanac-view .almanac-detail-heading h3 {
  margin:1px 0 0;
  font-size:18px;
  line-height:1.2;
}
.almanac-view .almanac-term {
  padding:3px 7px;
  font-size:11px;
}
.almanac-view .almanac-facts {
  margin:7px 0 8px;
}
.almanac-view .almanac-facts div {
  grid-template-columns:64px minmax(0,1fr);
  gap:6px;
  padding:6px 0;
}
.almanac-view .almanac-facts dt {
  font-size:11px;
}
.almanac-view .almanac-facts dd {
  min-width:0;
  font-size:13px;
  line-height:1.35;
}
.almanac-view .almanac-hour-field {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:8px;
  margin-top:8px;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
}
.almanac-view .almanac-hour-field select {
  min-width:0;
  width:100%;
  min-height:38px;
  padding-block:5px;
  font-size:13px;
}
.almanac-view .almanac-pillars {
  gap:5px;
  margin-top:8px;
}
.almanac-view .almanac-pillars span {
  padding:5px 2px;
  border-radius:8px;
}
.almanac-view .almanac-pillars small {
  margin-bottom:2px;
  font-size:9px;
}
.almanac-view .almanac-pillars strong {
  font-size:16px;
  line-height:1.15;
}
.almanac-view .almanac-boundary {
  margin:6px 0 7px;
  font-size:10px;
  line-height:1.3;
}
.almanac-view .almanac-use-time {
  min-height:42px;
  padding:8px 12px;
  border-radius:10px;
  font-size:14px;
}
@media (max-width:370px) {
  .almanac-view .almanac-detail { padding-inline:8px; }
  .almanac-view .almanac-facts div { grid-template-columns:58px minmax(0,1fr); }
  .almanac-view .almanac-pillars { gap:4px; }
  .almanac-view .almanac-pillars strong { font-size:15px; }
}
/* Almanac compact secondary panels: saved cases and collapsible details */
.almanac-view .almanac-case-summary {
  margin:7px 0;
  border-color:rgba(154,113,63,.28);
  border-radius:10px;
  box-shadow:none;
}
.almanac-view .almanac-case-summary[hidden] {
  display:none !important;
}
.almanac-view .almanac-case-summary header {
  min-height:34px;
  padding:5px 9px;
  font-size:11px;
}
.almanac-view .almanac-case-list {
  border-top-color:rgba(154,113,63,.18);
}
.almanac-view .almanac-case-item {
  min-height:42px;
  gap:6px;
  padding:5px 9px;
}
.almanac-view .almanac-case-item strong {
  font-size:12px;
  line-height:1.25;
}
.almanac-view .almanac-case-item em,
.almanac-view .almanac-case-item small {
  margin-top:1px;
  font-size:9px;
  line-height:1.25;
}
.almanac-view .almanac-case-item > b {
  font-size:10px;
}
.almanac-view .almanac-traditional,
.almanac-view .almanac-hour-fortunes {
  margin:7px 0 0;
  border-color:rgba(112,54,45,.14);
  border-radius:10px;
  background:#fffaf6;
  box-shadow:none;
}
.almanac-view .almanac-traditional summary,
.almanac-view .almanac-hour-fortunes summary {
  min-height:40px;
  padding:6px 10px;
  font-size:13px;
}
.almanac-view .almanac-traditional summary::after,
.almanac-view .almanac-hour-fortunes summary::after {
  font-size:10px;
}
.almanac-view .almanac-yiji {
  gap:6px;
  padding:8px;
}
.almanac-view .almanac-yiji > div {
  grid-template-columns:25px minmax(0,1fr);
  gap:5px;
}
.almanac-view .almanac-yiji strong {
  width:24px;
  height:24px;
  font-size:12px;
}
.almanac-view .almanac-yiji p {
  margin-top:1px;
  font-size:11px;
  line-height:1.45;
}
.almanac-view .almanac-traditional-facts {
  padding:0 8px 8px;
}
.almanac-view .almanac-traditional-facts div {
  padding:5px 3px;
}
.almanac-view .almanac-traditional-facts dt {
  font-size:10px;
}
.almanac-view .almanac-traditional-facts dd {
  margin-top:2px;
  font-size:12px;
  line-height:1.4;
}
.almanac-view .almanac-hour-list {
  gap:5px;
  padding:7px;
}
.almanac-view .almanac-hour-card {
  min-height:52px;
  gap:1px 5px;
  padding:6px 7px;
  border-radius:7px;
}
.almanac-view .almanac-hour-card > span strong {
  font-size:13px;
}
.almanac-view .almanac-hour-card > span small {
  margin-top:1px;
  font-size:8px;
}
.almanac-view .almanac-hour-card > b {
  font-size:12px;
}
.almanac-view .almanac-hour-card > em,
.almanac-view .almanac-hour-card > small {
  font-size:9px;
}
.almanac-view .almanac-hour-detail {
  margin:0 7px 7px;
  padding:7px;
}
.almanac-view .almanac-hour-detail header strong {
  font-size:13px;
}
.almanac-view .almanac-hour-detail header span {
  padding:2px 6px;
  font-size:10px;
}
.almanac-view .almanac-hour-detail dl {
  margin-top:5px;
}
.almanac-view .almanac-hour-detail dl div {
  padding:4px 0;
}
.almanac-view .almanac-hour-detail dt {
  font-size:10px;
}
.almanac-view .almanac-hour-detail dd {
  font-size:11px;
  line-height:1.4;
}
@media (max-width:370px) {
  .almanac-view .almanac-yiji { grid-template-columns:1fr; }
  .almanac-view .almanac-hour-card { padding-inline:5px; }
}
/* Almanac five-element pillars after redundant date detail removal */
.almanac-view .almanac-pillars strong {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:1px;
}

/* Formal mobile home v1 - 2026-08-06 */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-topbar {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  min-height: 88px;
  margin: -10px auto 0;
  padding: 12px 20px 20px;
  align-items: flex-start;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: var(--red);
  color: #fff;
}
.app-brand {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
}
.app-brand-logo {
  position: absolute;
  left: 0;
  width: 40px;
  height: 40px;
  padding: 4px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.app-brand h1 {
  margin: 0;
  color: #fff;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(1.42rem, 6vw, 1.65rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .12em;
}
.account-bar {
  position: absolute;
  top: 12px;
  right: 20px;
  z-index: 8;
}
.account-menu-toggle {
  min-height: 40px;
  color: rgba(255, 255, 255, .82);
  font-size: 14px;
}
.account-menu-toggle:hover,
.account-menu-toggle:focus-visible { color: #fff; }
.account-menu-avatar { display: none; }
.account-menu { right: 0; }

.almanac-view,
.cases-view {
  position: relative;
  z-index: 2;
  margin-top: -20px;
}

.input-view {
  position: relative;
  z-index: 2;
  width: min(100%, 520px);
  max-width: 520px;
  margin: -20px auto 0;
  padding: 0 10px calc(78px + env(safe-area-inset-bottom));
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.input-view .quick-chart-card {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.current-time-card {
  width: calc(100% - 16px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(73, 52, 45, .05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.current-time-card:active { transform: translateY(1px); }
.current-time-card:focus-visible {
  outline: 3px solid rgba(155, 47, 47, .22);
  outline-offset: 3px;
}
.current-time-main {
  min-height: 62px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.current-date-copy { min-width: 0; }
.current-date-copy small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
}
.current-date-copy strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.current-lunar-date {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.current-beijing-clock {
  flex: 0 0 auto;
  color: var(--red);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
}
.current-four-pillars {
  height: 52px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 0;
  background: transparent;
}
.current-pillar {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  align-content: center;
  background: transparent;
}
.current-pillar + .current-pillar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 1px;
  background: var(--line);
}
.current-pillar strong {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--red);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}
.current-pillar strong span { display: block; }
.current-four-pillars .current-pillar strong span { color: var(--red); }

.home-form-card {
  margin-top: 12px;
  padding: 0 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(73, 52, 45, .045);
}
.home-field-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
#chart-entry-content {
  display: block;
  padding: 0 !important;
}
#digital-number-row[hidden],
#case-category-row[hidden],
#case-question-row[hidden],
#chart-time-row[hidden] {
  display: none !important;
}
#chart-entry-content[data-chart-type="鏃剁洏"] #case-question-row:not([hidden]) {
  display: flex;
}
#chart-entry-content .home-field-row:last-child { border-bottom: 0; }
.home-field-label {
  width: 62px;
  flex: 0 0 62px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.quick-chart-card label.home-field-row > .home-field-label {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.quick-chart-card .name-gender-row > .home-field-label {
  color: var(--ink) !important;
  font-size: 16px !important;
  font-weight: 800 !important;
}
.quick-chart-card .home-name-input,
.quick-chart-card .home-name-input::placeholder {
  font-size: 16px !important;
}
.home-field-control {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.chart-type-switch {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  margin: 0;
}
.chart-type-switch button,
.gender-switch button {
  min-width: 0;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.chart-type-switch button::before,
.gender-switch button::before {
  content: "";
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border: 1px solid #cbbfb6;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--paper);
}
.chart-type-switch button[aria-pressed="true"],
.gender-switch button[aria-pressed="true"] {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-weight: 500;
}
.chart-type-switch button[aria-pressed="true"]::before,
.gender-switch button[aria-pressed="true"]::before {
  content: "\2713";
  display: grid;
  place-items: center;
  border-color: var(--red);
  background: var(--paper);
  box-shadow: none;
  color: var(--red);
  font: 800 14px/1 Arial, sans-serif;
}
.name-gender-control { justify-content: space-between; gap: 8px; }
.home-name-input,
.home-choice-select,
.home-question-input {
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}
.home-name-input { min-width: 0; flex: 1; }
.quick-chart-card .home-name-input,
.quick-chart-card .home-choice-select,
.quick-chart-card .home-question-input {
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  outline: 0;
}
.home-name-input::placeholder,
.home-question-input::placeholder { color: #a99c96; }
.gender-field { flex: 0 0 auto; }
.gender-switch {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 12px;
}
.home-choice-select {
  appearance: none;
  padding-right: 24px;
  background-image: linear-gradient(45deg, transparent 50%, #9f8c83 50%), linear-gradient(135deg, #9f8c83 50%, transparent 50%);
  background-position: calc(100% - 8px) 18px, calc(100% - 3px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.home-question-input:disabled {
  color: var(--muted);
  opacity: .82;
}
.digital-number-row { min-height: 76px; }
.digital-number-control {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  padding: 17px 0 7px;
}
.digital-number-boxes {
  width: min(100%, 280px);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
}
.digital-number-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px !important;
  padding: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
  font-size: 18px !important;
  font-weight: 800;
  text-align: center;
}
.digital-number-input:focus {
  border-color: var(--red) !important;
  outline: 0;
  box-shadow: 0 0 0 2px rgba(155, 47, 47, .12);
}
.digital-number-feedback {
  min-height: 0;
  color: #a1241c;
  font-size: 11px;
  line-height: 1.35;
}
.chart-time-row .datetime-field { width: 100%; }
.chart-time-row .datetime-trigger {
  width: 100%;
  min-height: 61px;
  padding: 7px 0;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.chart-time-row .datetime-trigger:active { transform: none; background: transparent; }
.chart-time-row .datetime-trigger-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.chart-time-row .datetime-trigger-copy strong {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}
.chart-time-row #datetime-conversion {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.chart-time-row .datetime-trigger-copy small {
  color: #9f8c83;
  font-size: 10px;
}
.chart-time-row .datetime-trigger-arrow {
  color: #9f8c83;
  font-size: 20px;
}
.chart-time-row .datetime-feedback:empty { display: none; }
.chart-time-row .datetime-feedback:not(:empty) {
  width: 100%;
  margin: 4px 0 7px;
  padding: 7px 9px;
  display: block;
  font-size: 12px;
}
.quick-chart-card .start-chart {
  width: 100%;
  min-height: 50px;
  margin-top: 15px;
  border: 1px solid var(--red);
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .12em;
  box-shadow: none;
}
.quick-chart-card .start-chart:active { background: var(--red-dark); }
.open-case-records {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: .03em;
}
.open-case-records:active { color: var(--red); }
.home-offline-hint {
  margin: 4px 0 0;
  color: #9b8b83;
  font-size: 12px;
  text-align: center;
}
.quick-chart-card .reset-chart[hidden] { display: none !important; }

@media (max-width: 390px) {
  .input-view { padding-right: 10px; padding-left: 10px; }
  .app-topbar { padding-right: 14px; padding-left: 14px; }
  .account-bar { right: 14px; }
  .app-brand h1 { font-size: 1.4rem; }
  .current-date-copy strong { font-size: 12px; }
  .current-beijing-clock { font-size: 21px; }
  .home-form-card { padding: 0 12px; }
  .home-field-row { gap: 9px; }
  .home-field-label { width: 54px; flex-basis: 54px; }
  .chart-type-switch { gap: 8px; }
  .chart-type-switch button,
  .gender-switch button { font-size: 13px; gap: 4px; }
  .chart-type-switch button::before,
  .gender-switch button::before { width: 19px; height: 19px; flex-basis: 19px; }
  .gender-switch { gap: 8px; }
}

@media (min-width: 760px) {
  .app-topbar {
    margin: 0 auto 16px;
    border-radius: 16px;
  }
  .input-view { margin-top: 0; }
}


/* Formal mobile one-screen result page */
body.result-screen-active{margin:0;padding:0;overflow-x:hidden;background:#fffdf8}
body.result-screen-active.result-more-open{overflow:hidden}
body.result-screen-active .app-shell{width:100%;max-width:none;min-height:100dvh;margin:0;padding:0}
body.result-screen-active .app-topbar,body.result-screen-active .app-navigation{display:none!important}
body.result-screen-active .result-view{width:100%;max-width:none;min-height:100dvh;margin:0;padding:0;overflow:visible;background:#fffdf8}
body.result-screen-active .result-view[hidden]{display:none!important}
.result-screen-active .result-header{position:relative;z-index:15;width:100%;margin:0;padding:0;border:0;border-radius:0;background:#9b2f2f;box-shadow:none}
.result-screen-active .result-topbar{display:grid;grid-template-columns:78px minmax(0,1fr) 78px;align-items:center;height:48px;padding:env(safe-area-inset-top,0) 7px 0;color:#fff;background:#9b2f2f}
.result-screen-active .result-topbar h2{min-width:0;margin:0;color:#fff;font-family:"STKaiti","KaiTi",serif;font-size:21px;font-weight:800;line-height:1;letter-spacing:.08em;text-align:center;white-space:nowrap}
.result-screen-active .result-top-action{width:max-content;min-width:60px;height:34px;padding:0 9px;border:1px solid rgba(255,255,255,.55);border-radius:8px;color:#6f2020;background:rgba(255,255,255,.96);box-shadow:none;font-size:14px;font-weight:800}
.result-screen-active .result-save{justify-self:end}
.result-screen-active .chart-navigation{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;height:41px;margin:0;padding:4px 5px;border:0;border-bottom:1px solid #c7aa74;border-radius:0;background:#9b2f2f}
.result-screen-active .result-header>.chart-navigation button{min-width:0;min-height:0;height:33px;padding:0 2px;border:1px solid #e2cfa5;border-radius:7px;color:#33251f;background:#fff7d2;box-shadow:none;font-size:13px;font-weight:800;white-space:nowrap}
.result-screen-active .result-header>.chart-navigation button.now{color:#9b2f2f;border-color:#d0ad67;background:#fffbe6}
.result-screen-active .chart{width:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;background:#fffdf8;box-shadow:none}
.result-screen-active .chart-meta{display:block;margin:0;padding:0;border:0;border-bottom:1px solid #a99788;background:#fff}
.result-screen-active .result-meta-table{display:block;margin:0}
.result-screen-active .result-meta-row{display:grid;min-height:29px;border-top:1px solid #cfc3b6}
.result-screen-active .result-date-row{grid-template-columns:49px minmax(0,1fr)}
.result-screen-active .result-ju-row{grid-template-columns:49px repeat(3,minmax(0,1fr))}
.result-screen-active .result-meta-label,.result-screen-active .result-meta-row>strong,.result-screen-active .result-meta-value{display:flex;align-items:center;justify-content:center;min-width:0;margin:0;padding:3px 4px;border-right:1px solid #cfc3b6;line-height:1.2;white-space:nowrap}
.result-screen-active .result-meta-label{color:#b89858;font-size:14px;font-weight:900;letter-spacing:.04em}
.result-screen-active .result-date-row .result-meta-value{justify-content:flex-start;padding-left:9px;overflow:hidden;color:#241a17;font-size:clamp(15px,4.3vw,18px);font-weight:900;text-overflow:ellipsis}
.result-screen-active .result-ju-row>strong{color:#241a17;font-size:clamp(13px,3.8vw,16px);font-weight:900}
.result-screen-active .result-hidden-tags{display:none!important}
.result-screen-active .chart-summary{display:block;margin:0}
.result-screen-active .chart-summary-main{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));min-height:39px;margin:0;padding:0;overflow:hidden;border:0;border-top:1px solid #cfc3b6;border-radius:0;background:#fff}
.result-screen-active .chart-summary-main span{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;gap:2px;padding:3px 1px;border-right:1px solid #cfc3b6;white-space:nowrap}
.result-screen-active .chart-summary-main span::after{display:none!important;content:none!important}
.result-screen-active .chart-summary-main small{color:#b89858;font-size:11px;font-weight:900;line-height:1}
.result-screen-active .chart-summary-main strong{min-width:0;margin:0;overflow:hidden;color:#241a17;font-size:clamp(13px,3.6vw,15px);font-weight:900;line-height:1.05;text-overflow:ellipsis}
.result-screen-active .result-pillars-row{display:grid;grid-template-columns:49px minmax(0,1fr);min-height:43px;border-top:1px solid #cfc3b6}
.result-screen-active .result-pillars-row>.result-meta-label{border-right:1px solid #cfc3b6}
.result-screen-active .pillars{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;width:100%;margin:0;overflow:hidden;border:0;border-radius:0;background:#fff}
.result-screen-active .pillars div{display:grid;place-items:center;min-width:0;padding:2px 1px;border:0;border-right:1px solid #cfc3b6;border-radius:0;background:#fff}
.result-screen-active .pillars strong{display:block;margin:0;font-family:"STKaiti","KaiTi",serif;font-size:19px;font-weight:900;line-height:1;letter-spacing:.08em;text-align:center}
.result-screen-active .pillars strong span{display:block;line-height:1.02}
.result-screen-active .pillars small{display:none!important}
.result-screen-active .board-wrap{position:relative;display:grid;grid-template-columns:minmax(24px,1fr) minmax(0,326px) minmax(24px,1fr);grid-template-rows:28px 326px 28px;width:100%;height:382px;margin:0;padding:0;overflow:hidden;border:0;border-radius:0;background:#fffdf8}
.result-screen-active .board-wrap .board{position:relative;inset:auto;transform:none;grid-column:2;grid-row:2;width:326px;height:326px;min-width:0;min-height:0;margin:0 auto;border:1.5px solid #332722;background:#fff}
.result-screen-active .board-wrap .palace{min-width:0;min-height:0;padding:5px 6px 7px;border-color:#51443d;border-radius:0;background:#fff;font-family:"STKaiti","KaiTi",serif}
.result-screen-active .board-wrap .palace-god{font-size:16px;line-height:1}
.result-screen-active .board-wrap .star-door strong{font-size:18px;line-height:1}
.result-screen-active .board-wrap .star-door .door{font-size:19px;line-height:1}
.result-screen-active .board-wrap .stem{font-size:19px;line-height:1}
.result-screen-active .board-wrap .palace-name{font-size:9px;opacity:.64}
.result-screen-active .board-wrap .taiji-disc{width:64px;height:64px}
.result-screen-active .board-wrap .center-host{font-size:10px}
.result-screen-active .board-wrap .direction-label{position:relative;inset:auto;transform:none;z-index:7;width:25px;height:25px;display:grid;place-items:center;border:1px solid rgba(155,47,47,.25);border-radius:50%;color:#9b2f2f;background:#fffdf8;font-size:13px;font-weight:900;line-height:1}
.result-screen-active .board-wrap .direction-south{grid-column:2;grid-row:1;align-self:center;justify-self:center}
.result-screen-active .board-wrap .direction-north{grid-column:2;grid-row:3;align-self:center;justify-self:center}
.result-screen-active .board-wrap .direction-east{grid-column:1;grid-row:2;align-self:center;justify-self:end}
.result-screen-active .board-wrap .direction-west{grid-column:3;grid-row:2;align-self:center;justify-self:start}
.result-screen-active .board-wrap .outer-ring{position:relative;inset:auto;transform:none;color:#2c211d;font-size:14px;font-weight:800}
.result-screen-active .board-wrap .outer-top,.result-screen-active .board-wrap .outer-bottom{grid-column:2;width:326px;height:28px;margin:0 auto}
.result-screen-active .board-wrap .outer-top{grid-row:1}
.result-screen-active .board-wrap .outer-bottom{grid-row:3}
.result-screen-active .board-wrap .outer-left,.result-screen-active .board-wrap .outer-right{grid-row:2;width:100%;height:326px}
.result-screen-active .board-wrap .outer-left{grid-column:1}
.result-screen-active .board-wrap .outer-right{grid-column:3}
.result-screen-active .board-wrap .outer-branch{color:#9b2f2f;font-size:11px}
.result-screen-active .board-wrap .board-horse{z-index:8;font-size:13px}
.result-screen-active .result-status-tools{display:flex;align-items:center;justify-content:space-between;gap:7px;min-height:39px;padding:4px 7px;border-top:1px solid #cfc3b6;background:#fff}
.result-screen-active .result-status-badges{display:flex;align-items:center;gap:4px;min-width:0}
.result-screen-active .result-status-badge{display:grid;place-items:center;height:27px;min-width:44px;padding:0 6px;border-radius:6px;color:#fff;font-size:14px;font-weight:900;line-height:1;box-shadow:inset 0 0 0 1px rgba(255,255,255,.22)}
.result-screen-active .result-status-badge.tomb-punish{background:#c521bc}
.result-screen-active .result-status-badge.in-tomb{background:#13861d}
.result-screen-active .result-status-badge.strike{background:#1238ad}
.result-screen-active .result-status-badge.door-press{background:#e21d1d}
.result-screen-active .result-status-badge.dimmed{background:#b3a99e;opacity:0.5}
.result-screen-active .result-status-badge[aria-pressed="true"]{box-shadow:inset 0 0 0 2px rgba(255,255,255,.7),0 0 5px 2px rgba(255,255,255,.5)}
.result-screen-active .board.highlight-both .palace.has-both{box-shadow:inset 0 0 0 3px #c521bc}
.result-screen-active .board.highlight-tomb .palace.has-tomb{box-shadow:inset 0 0 0 3px #13861d}
.result-screen-active .board.highlight-strike .palace.has-strike{box-shadow:inset 0 0 0 3px #1238ad}
.result-screen-active .board.highlight-pressure .palace.has-pressure{box-shadow:inset 0 0 0 3px #e21d1d}
.result-screen-active .result-changsheng-toggle{flex:0 0 auto;height:29px;display:flex;align-items:center;gap:6px;padding:0 7px 0 9px;border:1px solid #b97c77;border-radius:7px;color:#6f2020;background:#fff9f4;font-size:13px;font-weight:900}
.result-screen-active .result-toggle-track{position:relative;width:31px;height:17px;border-radius:999px;background:#c7b8ae;transition:.18s ease}
.result-screen-active .result-toggle-track::after{content:"";position:absolute;left:2px;top:2px;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:.18s ease}
.result-screen-active .result-changsheng-toggle[aria-pressed="true"] .result-toggle-track{background:#9b2f2f}
.result-screen-active .result-changsheng-toggle[aria-pressed="true"] .result-toggle-track::after{transform:translateX(14px)}
.result-screen-active .result-bottom-tools{display:flex;align-items:center;justify-content:space-between;min-height:35px;padding:0 8px;border-top:1px solid #cfc3b6;background:#fbf7ef;color:#7d6e67;font-size:12px}
.result-screen-active .result-bottom-tools button{height:27px;padding:0 12px;border:1px solid #cdbdaf;border-radius:7px;color:#6f2020;background:#fffdf8;font-weight:800}
.result-screen-active .fortune-inline{margin:0;padding:10px}
.result-screen-active .result-more-sheet{position:fixed;z-index:1000;inset:0;display:grid;align-items:end}
.result-screen-active .result-more-sheet[hidden]{display:none!important}
.result-screen-active .result-more-backdrop{position:absolute;inset:0;border:0;border-radius:0;background:rgba(35,22,18,.42);opacity:0;transition:opacity .18s ease}
.result-screen-active .result-more-panel{position:relative;z-index:1;width:100%;max-height:min(78dvh,660px);overflow:auto;border-radius:18px 18px 0 0;background:#fffdf8;box-shadow:0 -10px 35px rgba(50,25,18,.2);transform:translateY(24px);opacity:0;transition:transform .18s ease,opacity .18s ease}
.result-screen-active .result-more-sheet.open .result-more-backdrop{opacity:1}
.result-screen-active .result-more-sheet.open .result-more-panel{transform:translateY(0);opacity:1}
.result-screen-active .result-more-panel>header{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;min-height:58px;padding:9px 15px;border-bottom:1px solid #ded2c7;background:rgba(255,253,248,.96)}
.result-screen-active .result-more-panel header small{color:#9a8880;font-size:11px}
.result-screen-active .result-more-panel header h3{margin:1px 0 0;color:#6f2020;font-size:20px}
.result-screen-active .result-more-panel header button{width:36px;height:36px;padding:0;border:1px solid #d8c9bd;border-radius:50%;color:#6f2020;background:#fff;font-size:24px}
.result-screen-active .result-more-content{display:grid;gap:10px;padding:12px 14px calc(16px + env(safe-area-inset-bottom,0px))}
.result-screen-active .result-more-group{padding:12px;border:1px solid #e1d6cb;border-radius:12px;background:#fff}
.result-screen-active .result-more-group h4{margin:0 0 9px;color:#8b7770;font-size:12px}
.result-screen-active .result-more-view-mode{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.result-screen-active .result-more-view-mode>span{display:none}
.result-screen-active .result-more-view-mode button{min-height:40px;border:1px solid #d8c9bd;border-radius:9px;color:#604c45;background:#fffaf2;font-weight:800}
.result-screen-active .result-more-view-mode button.active{color:#fff;border-color:#9b2f2f;background:#9b2f2f}
.result-screen-active .result-more-actions>button,.result-screen-active .result-more-actions summary{width:100%;min-height:48px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 2px;border:0;border-bottom:1px solid #eee4dc;color:#33251f;background:transparent;font-size:15px;font-weight:800;text-align:left;list-style:none}
.result-screen-active .result-more-actions summary::-webkit-details-marker{display:none}
.result-screen-active .result-more-actions>button span,.result-screen-active .result-more-actions summary span{color:#998981;font-size:11px;font-weight:500}
.result-screen-active .chart-basis-content{padding:10px 0 0}
.result-screen-active .result-user-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.result-screen-active .result-user-row span{min-width:0;overflow:hidden;color:#33251f;font-size:15px;font-weight:800;text-overflow:ellipsis;white-space:nowrap}
.result-screen-active .result-user-row button,.result-screen-active .result-logout{min-height:38px;padding:0 12px;border:1px solid #d8c9bd;border-radius:8px;background:#fffaf2;color:#6f2020;font-weight:800}
.result-screen-active .result-logout{width:100%;margin-top:10px;color:#a12424;background:#fff7f3}
@media(max-width:370px){
.result-screen-active .result-topbar{grid-template-columns:72px minmax(0,1fr) 72px}
.result-screen-active .result-topbar h2{font-size:19px}
.result-screen-active .result-top-action{min-width:56px;padding-inline:7px;font-size:13px}
.result-screen-active .result-header>.chart-navigation button{font-size:12px}
.result-screen-active .result-date-row .result-meta-value{font-size:15px}
.result-screen-active .result-ju-row>strong{font-size:13px}
.result-screen-active .board-wrap{grid-template-columns:minmax(23px,1fr) minmax(0,314px) minmax(23px,1fr);grid-template-rows:30px 314px 30px;height:374px}
.result-screen-active .board-wrap .board{width:314px;height:314px}
.result-screen-active .board-wrap .outer-top,.result-screen-active .board-wrap .outer-bottom{width:314px;height:30px}
.result-screen-active .board-wrap .outer-left,.result-screen-active .board-wrap .outer-right{height:314px}
.result-screen-active .board-wrap .palace-god{font-size:15px}
.result-screen-active .board-wrap .star-door strong{font-size:17px}
.result-screen-active .board-wrap .star-door .door,.result-screen-active .board-wrap .stem{font-size:18px}
.result-screen-active .result-status-tools{gap:4px;padding-inline:5px}
.result-screen-active .result-status-badges{gap:3px}
.result-screen-active .result-status-badge{min-width:39px;padding-inline:5px;font-size:13px}
.result-screen-active .result-changsheng-toggle{gap:4px;padding-inline:6px;font-size:12px}
.result-screen-active .result-toggle-track{width:29px}
}
@media(min-width:700px){body.result-screen-active .result-view{max-width:560px;margin:0 auto;border-right:1px solid #ded2c7;border-left:1px solid #ded2c7}.result-screen-active .result-more-panel{max-width:560px;margin:0 auto}}

/* Formal result specificity fixes */
body.result-screen-active .result-view .result-header{display:block!important;grid-template-columns:none!important;gap:0!important}
body.result-screen-active .result-view .result-header>.chart-navigation{grid-column:1/-1!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px!important;width:100%!important;height:41px!important;margin:0!important;padding:4px 5px!important;border:0!important;border-bottom:1px solid #c7aa74!important;border-radius:0!important;background:#9b2f2f!important}
body.result-screen-active .result-view .result-header>.chart-navigation button{grid-area:auto!important;min-width:0!important;min-height:0!important;height:33px!important;padding:0 2px!important;border:1px solid #e2cfa5!important;border-radius:7px!important;color:#33251f!important;background:#fff7d2!important;box-shadow:none!important;font-size:13px!important;font-weight:800!important;line-height:1!important;white-space:nowrap!important}
body.result-screen-active .result-view .result-header>.chart-navigation button.now{color:#9b2f2f!important;border-color:#d0ad67!important;background:#fffbe6!important}
@media(max-width:370px){body.result-screen-active .result-view .result-header>.chart-navigation button{font-size:12px!important}}


/* Result board cleanup and changsheng control refinement */
.result-screen-active .board-wrap .palace{padding-bottom:5px}
.result-screen-active .result-changsheng-toggle{
  height:31px;
  gap:7px;
  padding:0 6px 0 11px;
  border:1px solid #d3b07e;
  border-radius:999px;
  color:#6f2020;
  background:linear-gradient(180deg,#fffdf7 0%,#f8ead7 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92),0 1px 4px rgba(89,51,32,.12);
  font-size:13px;
  font-weight:900;
  letter-spacing:.04em;
  transition:border-color .18s ease,background .18s ease,box-shadow .18s ease,transform .18s ease;
}
.result-screen-active .result-changsheng-toggle:active{transform:scale(.98)}
.result-screen-active .result-changsheng-toggle:focus-visible{outline:2px solid rgba(155,47,47,.35);outline-offset:2px}
.result-screen-active .result-toggle-track{
  width:34px;
  height:19px;
  border:1px solid rgba(111,82,65,.18);
  background:#ded1c6;
  box-shadow:inset 0 1px 3px rgba(75,51,38,.16);
}
.result-screen-active .result-toggle-track::after{
  left:2px;
  top:2px;
  width:13px;
  height:13px;
  border:1px solid rgba(148,106,67,.2);
  background:#fffdf8;
  box-shadow:0 1px 4px rgba(59,36,24,.28);
}
.result-screen-active .result-changsheng-toggle[aria-pressed="true"]{
  border-color:#9b2f2f;
  color:#8f2424;
  background:linear-gradient(180deg,#fff8f2 0%,#f4dfd7 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 2px 6px rgba(111,32,32,.16);
}
.result-screen-active .result-changsheng-toggle[aria-pressed="true"] .result-toggle-track{background:linear-gradient(180deg,#b84040 0%,#8f2424 100%);border-color:#7d1f1f}
.result-screen-active .result-changsheng-toggle[aria-pressed="true"] .result-toggle-track::after{transform:translateX(15px)}
@media(max-width:370px){
  .result-screen-active .result-changsheng-toggle{height:29px;gap:5px;padding:0 5px 0 8px;font-size:12px}
  .result-screen-active .result-toggle-track{width:31px;height:18px}
  .result-screen-active .result-changsheng-toggle[aria-pressed="true"] .result-toggle-track::after{transform:translateX(12px)}
}

/* Formal result pillar colors: heavenly stems / earthly branches */
.result-screen-active #pillars strong>span:first-child{color:#8f2433!important}
.result-screen-active #pillars strong>span:last-child{color:#245a9b!important}


/* Formal result outer-ring collision fix */
.result-screen-active .board-wrap .outer-top,
.result-screen-active .board-wrap .outer-bottom,
.result-screen-active .board-wrap .outer-left,
.result-screen-active .board-wrap .outer-right{padding:0!important;overflow:visible}
.result-screen-active .board-wrap .outer-slot{gap:0!important;min-width:0;min-height:0;line-height:1}
.result-screen-active .board-wrap .outer-top .outer-slot,
.result-screen-active .board-wrap .outer-bottom .outer-slot{display:grid!important;grid-template-rows:repeat(2,minmax(0,1fr));align-items:center;justify-items:center;height:100%;padding:0}
.result-screen-active .board-wrap .outer-top .outer-branch{grid-row:1;align-self:start}
.result-screen-active .board-wrap .outer-top .outer-hidden{grid-row:2;align-self:end}
.result-screen-active .board-wrap .outer-bottom .outer-hidden{grid-row:1;align-self:start}
.result-screen-active .board-wrap .outer-bottom .outer-branch{grid-row:2;align-self:end}
.result-screen-active .board-wrap .outer-left .outer-slot,
.result-screen-active .board-wrap .outer-right .outer-slot{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;width:100%;padding:0}
.result-screen-active .board-wrap .outer-left .outer-branch,
.result-screen-active .board-wrap .outer-left .outer-hidden,
.result-screen-active .board-wrap .outer-right .outer-branch,
.result-screen-active .board-wrap .outer-right .outer-hidden{writing-mode:vertical-rl;text-orientation:upright;letter-spacing:0;line-height:1}
.result-screen-active .board-wrap .outer-left .outer-branch{grid-column:1;justify-self:start}
.result-screen-active .board-wrap .outer-left .outer-hidden{grid-column:2;justify-self:end}
.result-screen-active .board-wrap .outer-right .outer-hidden{grid-column:1;justify-self:start}
.result-screen-active .board-wrap .outer-right .outer-branch{grid-column:2;justify-self:end}
.result-screen-active .board-wrap .outer-branch{font-size:12px!important}
.result-screen-active .board-wrap .outer-hidden,
.result-screen-active .board-wrap .outer-hidden.empty{font-size:13px!important}

.result-screen-active .board-wrap .outer-left{padding-left:2px!important}
.result-screen-active .board-wrap .outer-right{padding-right:2px!important}

/* Keep each side branch and hidden stem centered on the same palace row */
.result-screen-active .board-wrap .outer-left .outer-branch,
.result-screen-active .board-wrap .outer-left .outer-hidden,
.result-screen-active .board-wrap .outer-right .outer-branch,
.result-screen-active .board-wrap .outer-right .outer-hidden{grid-row:1}
.result-screen-active .board-wrap .outer-left .outer-branch{transform:translateX(2px)}
.result-screen-active .board-wrap .outer-right .outer-branch{transform:translateX(-2px)}


/* Formal result board enlargement - 2026-08-06 */
.result-screen-active .board-wrap{
  --formal-board-size:clamp(314px,calc(100vw - 54px),359px);
  grid-template-columns:minmax(27px,1fr) minmax(0,var(--formal-board-size)) minmax(27px,1fr);
  grid-template-rows:26px var(--formal-board-size) 26px;
  height:calc(var(--formal-board-size) + 52px);
}
.result-screen-active .board-wrap .board{width:var(--formal-board-size);height:var(--formal-board-size)}
.result-screen-active .board-wrap .outer-top,
.result-screen-active .board-wrap .outer-bottom{width:var(--formal-board-size);height:26px}
.result-screen-active .board-wrap .outer-left,
.result-screen-active .board-wrap .outer-right{height:var(--formal-board-size)}
@media(max-width:370px){
  .result-screen-active .board-wrap{
    --formal-board-size:min(314px,calc(100vw - 46px));
    grid-template-columns:minmax(23px,1fr) minmax(0,var(--formal-board-size)) minmax(23px,1fr);
    grid-template-rows:28px var(--formal-board-size) 28px;
    height:calc(var(--formal-board-size) + 56px);
  }
  .result-screen-active .board-wrap .outer-top,
  .result-screen-active .board-wrap .outer-bottom{height:28px}
}

/* Preserve edge clearance after board enlargement */
.result-screen-active .board-wrap .outer-left .outer-branch,
.result-screen-active .board-wrap .outer-right .outer-branch{transform:none}


/* Formal result outer-branch toggle - 2026-08-06 */
.result-screen-active:not(.show-outer-branches) .board-wrap .outer-branch{visibility:hidden}
.result-screen-active .result-display-toggles{display:flex;align-items:center;gap:4px;flex:0 0 auto}
.result-screen-active .result-display-toggles .result-changsheng-toggle{width:111px;justify-content:space-between}
.result-screen-active .result-display-toggles .result-changsheng-toggle>span{white-space:nowrap}
.result-screen-active .result-status-tools{gap:4px;padding-inline:5px}
.result-screen-active .result-status-badges{gap:3px}
.result-screen-active .result-status-badge{min-width:40px;padding-inline:5px}
@media(max-width:390px){
  .result-screen-active .result-status-tools{gap:3px;padding-inline:3px}
  .result-screen-active .result-status-badges{gap:2px}
  .result-screen-active .result-status-badge{min-width:34px;padding-inline:3px;font-size:12px}
  .result-screen-active .result-display-toggles{gap:3px}
  .result-screen-active .result-display-toggles .result-changsheng-toggle{width:99px;gap:4px;padding-inline:6px;font-size:12px}
  .result-screen-active .result-display-toggles .result-toggle-track{width:29px}
}


/* Formal result palace typography - 2026-08-06 */
.result-screen-active .board-wrap .palace-god,
.result-screen-active .board-wrap .star-door strong,
.result-screen-active .board-wrap .star-door .door,
.result-screen-active .board-wrap .stem{
  font-size:27px!important;
  line-height:1!important;
}


/* Formal result outer hidden typography - 2026-08-06 */
.result-screen-active .board-wrap .outer-hidden,
.result-screen-active .board-wrap .outer-hidden.empty{
  font-size:17px!important;
  line-height:1!important;
}
