
@font-face { font-family: 'Sanrui Serif SC'; src: url('/assets/fonts/sanrui-serif-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
h1, h2, .panel-title, .section-index, .side-brand h1, .side-kicker { font-family: 'Sanrui Serif SC', 'Noto Serif SC', 'Songti SC', 'SimSun', serif; }


    * { box-sizing: border-box; }
    body {
      margin: 0;
      min-height: 100vh;
      color: #2d2418;
      background:
        radial-gradient(circle at 14% 8%, rgba(214, 169, 89, .18) 0, rgba(214, 169, 89, 0) 30%),
        radial-gradient(circle at 86% 14%, rgba(140, 47, 57, .10) 0, rgba(140, 47, 57, 0) 28%),
        linear-gradient(135deg, #fbf6ea 0%, #f4ebdc 48%, #edf3f0 100%);
      font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: -1;
      pointer-events: none;
      background:
        linear-gradient(90deg, rgba(87, 64, 42, .035) 1px, transparent 1px),
        linear-gradient(0deg, rgba(87, 64, 42, .028) 1px, transparent 1px);
      background-size: 46px 46px;
      mask-image: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,.08) 72%, transparent);
    }
    .container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 8px 6px; }
    .side-brand {
      margin: 0 0 12px;
      padding: 12px 10px 14px;
      border: 1px solid rgba(140,47,57,.14);
      border-radius: 10px;
      background:
        linear-gradient(135deg, rgba(140,47,57,.08), rgba(214,169,89,.12)),
        rgba(255,255,255,.54);
    }
    .side-brand h1 {
      margin: 0;
      color: #8c2f39;
      font-size: 1.22rem;
      line-height: 1.22;
      letter-spacing: 0;
      text-shadow: 1px 1px 3px rgba(0,0,0,.42);
    }
    .side-brand p { margin: 6px 0 0; color: #6f6252; font-size: .78rem; line-height: 1.45; }
    .side-kicker {
      display: inline-flex;
      margin-bottom: 7px;
      padding: 3px 8px;
      border-radius: 999px;
      color: #8c2f39;
      background: rgba(140,47,57,.08);
      border: 1px solid rgba(140,47,57,.18);
      font-size: .72rem;
      font-weight: 700;
    }
    .ziwei-proof-strip {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
      margin: 10px 0 12px;
    }
    .ziwei-proof {
      padding: 8px 6px;
      border: 1px solid rgba(255,255,255,.10);
      border-radius: 8px;
      color: #3d3226;
      background: rgba(255,255,255,.42);
      text-align: center;
      font-size: .72rem;
      line-height: 1.35;
    }
    .ziwei-proof strong {
      display: block;
      color: #8c2f39;
      font-size: .9rem;
      margin-bottom: 2px;
    }
    .ziwei-site-nav {
      position: sticky;
      top: 0;
      z-index: 50;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      margin: 0 auto 10px;
      padding: 10px 12px;
      border: 1px solid rgba(255,211,125,.22);
      border-radius: 10px;
      background:
        linear-gradient(135deg, rgba(255, 252, 241, .96), rgba(248, 238, 218, .94)),
        rgba(255,255,255,.86);
      backdrop-filter: blur(10px);
      box-shadow: 0 12px 26px rgba(87,64,42,.12);
    }
    .ziwei-nav-brand {
      display: flex;
      flex-direction: column;
      color: #251d14;
      text-decoration: none;
      font-weight: 800;
      white-space: nowrap;
    }
    .ziwei-nav-brand small { color: #6f6252; font-weight: 400; margin-top: 2px; }
    .ziwei-nav-links {
      display: flex;
      gap: 6px;
      align-items: center;
      overflow-x: auto;
      padding-bottom: 2px;
    }
    .ziwei-nav-links a {
      padding: 6px 9px;
      border-radius: 7px;
      color: #5c5040;
      text-decoration: none;
      white-space: nowrap;
      font-size: .82rem;
      border: 1px solid transparent;
    }
    .ziwei-nav-links a:hover,
    .ziwei-nav-links a[aria-current="page"] {
      color: #ffd37d;
      border-color: rgba(140,47,57,.22);
      background: rgba(140,47,57,.08);
    }
    .ziwei-nav-links a.header-cta {
      color: #fff;
      background: #8c2f39;
      border-color: rgba(140,47,57,.36);
      box-shadow: 0 8px 18px rgba(140,47,57,.18);
    }
    .ziwei-nav-links a.header-cta:hover { background: #a33a45; color: #fff; }
    .ziwei-nav-toggle {
      display: none;
      width: 42px;
      height: 42px;
      border: 1px solid rgba(140,47,57,.18);
      border-radius: 8px;
      background: rgba(255,255,255,.88);
      color: #251d14;
      place-items: center;
      cursor: pointer;
      box-shadow: 0 8px 18px rgba(87,64,42,.10);
    }
    .ziwei-nav-toggle span,
    .ziwei-nav-toggle::before,
    .ziwei-nav-toggle::after {
      content: "";
      width: 18px;
      height: 2px;
      border-radius: 999px;
      background: currentColor;
      display: block;
      transition: transform .18s ease, opacity .18s ease;
    }
    .ziwei-nav-toggle { gap: 4px; }
    body.ziwei-nav-open .ziwei-nav-toggle span { opacity: 0; }
    body.ziwei-nav-open .ziwei-nav-toggle::before { transform: translateY(6px) rotate(45deg); }
    body.ziwei-nav-open .ziwei-nav-toggle::after { transform: translateY(-6px) rotate(-45deg); }
    .audit-ribbon { display: none; }
    .main-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 3fr); gap: 14px; align-items: start; }
    .input-panel, .chart-section, .flying-section {
      border: 1px solid rgba(214, 169, 89, .2);
      border-radius: 12px;
      background:
        linear-gradient(145deg, rgba(255,255,255,.84), rgba(255,250,238,.72)),
        rgba(255,255,255,.72);
      box-shadow: 0 18px 44px rgba(87,64,42,.12), inset 0 0 0 1px rgba(255,255,255,.55);
    }
    .input-panel {
      max-height: calc(100vh - 100px);
      overflow-y: auto;
      padding: 14px;
    }
    .display-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; align-items: stretch; }
    .panel-title {
      margin-bottom: 10px;
      padding-bottom: 6px;
      color: #8c2f39;
      border-bottom: 1px solid rgba(214,169,89,.24);
      font-size: 1rem;
    }
    .boundary-note {
      margin-bottom: 12px;
      padding: 8px 10px;
      border: 1px solid rgba(255,193,7,.22);
      border-radius: 5px;
      color: #69512c;
      background: rgba(214,169,89,.12);
      font-size: .78rem;
      line-height: 1.45;
    }
    .form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .form-group { margin-bottom: 10px; }
    .form-group label { display: block; margin-bottom: 3px; color: #6f6252; font-size: .82rem; }
    input, select {
      width: 100%;
      padding: 7px 9px;
      border: 1px solid rgba(140,47,57,.3);
      border-radius: 5px;
      color: #2d2418;
      background: rgba(255,255,255,.72);
      font-size: .9rem;
    }
    .section-divider { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(140,47,57,.18); }
    .setting-row { display: flex; align-items: center; gap: 6px; margin: 7px 0; color: #5c5040; font-size: .84rem; }
    .setting-row input { width: auto; }
    .setting-row.disabled { opacity: .45; pointer-events: none; }
    .switch-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 6px;
      margin: 4px 0 6px;
    }
    .switch-row .setting-row {
      min-width: 0;
      margin: 0;
      white-space: nowrap;
      font-size: .8rem;
    }
    .switch-row.single {
      grid-template-columns: minmax(0, 1fr);
      margin-top: 8px;
    }
    .disabled-note { font-size: .72rem; color: #888; margin-left: 2px; }
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      margin-top: 7px;
      padding: 10px;
      border-radius: 5px;
      border: none;
      color: #fff;
      background: linear-gradient(135deg, #8c2f39, #8c2f39);
      font-size: .9rem;
      text-decoration: none;
      cursor: pointer;
    }
    .btn.secondary { color: #8c2f39; border: 1px solid #8c2f39; background: rgba(140,47,57,.15); }
    .btn[disabled] { opacity: .58; cursor: not-allowed; }
    .legend { display: flex; flex-wrap: wrap; gap: 9px; font-size: .78rem; color: #aaa; }
    .legend-item { display: flex; align-items: center; gap: 5px; }
    .legend-color { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
    .legend-color.lu { background: #4caf50; }
    .legend-color.quan { background: #2196f3; }
    .legend-color.ke { background: #ffd54f; }
    .legend-color.ji { background: #f44336; }
    .chart-section { padding: 10px 16px 12px; position: relative; overflow-x: auto; flex: 0 0 auto; }
    .chart-section.primary-chart {
      min-height: calc(100vh - 100px);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      color: #e9e1cf;
      border-color: rgba(140,47,57,.32);
      background:
        radial-gradient(circle at 50% 42%, rgba(255, 231, 157, .12) 0, rgba(255, 231, 157, 0) 34%),
        linear-gradient(145deg, #172238 0%, #101829 54%, #14283b 100%);
      box-shadow: 0 20px 46px rgba(68,45,28,.18), inset 0 0 0 1px rgba(255,244,196,.05);
    }
    .primary-chart .panel-title {
      flex: 0 0 auto;
      margin-bottom: 10px;
      color: #f2d48b;
      border-bottom-color: rgba(242,212,139,.22);
    }
    .chart-wrapper {
      position: relative;
      width: 560px;
      max-width: min(560px, calc(100vh - 176px), calc(100vw - 370px));
      min-width: 520px;
      aspect-ratio: 1 / 1;
      margin: auto;
    }
    .chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; position: relative; z-index: 2; height: 100%; }
    .arrow-svg {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 5;
      pointer-events: none;
      overflow: visible;
    }
    .arrow-line {
      fill: none;
      stroke-width: 2.8;
      stroke-linecap: round;
      stroke-linejoin: round;
      opacity: .9;
      filter: drop-shadow(0 0 4px rgba(0,0,0,.4));
    }
    .arrow-line.stacked {
      stroke-width: 3.8;
      opacity: .95;
      filter: drop-shadow(0 0 5px rgba(0,0,0,.5));
    }
    .arrow-count-bg {
      fill: rgba(20,32,30,.88);
      stroke: rgba(255,255,255,.5);
      stroke-width: 1.2;
    }
    .arrow-count-text {
      fill: #fff;
      font-size: 12px;
      font-weight: 800;
      paint-order: stroke;
      stroke: rgba(20,32,30,.9);
      stroke-width: 2.5px;
      dominant-baseline: central;
      text-anchor: middle;
    }
    .palace-cell {
      position: relative;
      aspect-ratio: 1 / 1;
      min-height: 0;
      padding: 7px;
      border: 2px solid rgba(232,168,155,.32);
      border-radius: 8px;
      color: #dfe7e3;
      background:
        linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,0)),
        #182b27;
      overflow: hidden;
      text-decoration: none;
      transition: transform .18s, border-color .18s, background .18s;
    }
    .palace-cell.empty {
      border-color: rgba(232,168,155,.34);
      background:
        linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,0)),
        #21332e;
    }
    .palace-cell.empty .palace-name { color: rgba(240,170,158,.92); }
    .palace-cell.empty .palace-branch { color: rgba(255,255,255,.62); }
    .palace-cell.empty .chain-badge, .palace-cell.empty .palace-subject { display: none; }
    .palace-cell:hover,
    .palace-cell.selected {
      border-color: #e8a89b;
      background:
        linear-gradient(145deg, rgba(140,47,57,.2), rgba(255,244,196,.04)),
        #151b2b;
      transform: scale(1.015);
    }
    .palace-cell.ming { border-color: #e8a89b; }
    .palace-cell.shen { border-color: #ffc107; }
    .palace-cell.chain-source {
      outline: 1px dashed rgba(255,255,255,.38);
      outline-offset: -5px;
    }
    .palace-cell.chain-target { border-width: 2px; }
    .palace-cell.effect-lu {
      border-color: rgba(76,175,80,.95);
      box-shadow: 0 0 0 2px rgba(76,175,80,.18), inset 0 0 22px rgba(76,175,80,.2);
    }
    .palace-cell.effect-quan {
      border-color: rgba(33,150,243,.95);
      box-shadow: 0 0 0 2px rgba(33,150,243,.18), inset 0 0 22px rgba(33,150,243,.2);
    }
    .palace-cell.effect-ke {
      border-color: rgba(255,213,79,.98);
      box-shadow: 0 0 0 2px rgba(255,213,79,.2), inset 0 0 22px rgba(255,213,79,.2);
    }
    .palace-cell.effect-ji {
      border-color: rgba(244,67,54,.98);
      box-shadow: 0 0 0 2px rgba(244,67,54,.22), inset 0 0 24px rgba(244,67,54,.24);
    }
    .palace-cell[data-effect]::before {
      content: attr(data-effect);
      position: absolute;
      left: 6px;
      bottom: 4px;
      padding: 1px 4px;
      border-radius: 3px;
      color: rgba(255,255,255,.9);
      background: rgba(0,0,0,.42);
      font-size: .62rem;
      font-weight: 700;
      line-height: 1.2;
      pointer-events: none;
    }
    .palace-cell[data-effect][data-impact]::before {
      content: attr(data-effect) "·" attr(data-impact);
    }
    .palace-cell.chain-source[data-effect]::before {
      color: #2b2412;
      background: rgba(255,213,79,.82);
    }
    .palace-cell.effect-lu[data-effect]::before { background: rgba(76,175,80,.86); }
    .palace-cell.effect-quan[data-effect]::before { background: rgba(33,150,243,.86); }
    .palace-cell.effect-ke[data-effect]::before { color: #2b2412; background: rgba(255,213,79,.9); }
    .palace-cell.effect-ji[data-effect]::before { background: rgba(244,67,54,.86); }
    .palace-cell.dense { padding: 6px; }
    .palace-cell.extra-dense { padding: 5px; }
    .palace-cell.micro-dense { padding: 4px; }
    .palace-name { color: #f2b3a6; font-weight: 700; line-height: 1.1; font-size: .92rem; padding-right: 34px; }
    .palace-branch { color: rgba(255,255,255,.78); font-size: .72rem; margin: 2px 0 4px; }
    .palace-stars { color: #e9efe9; font-size: .8rem; line-height: 1.22; }
    .main-star { color: #ffd700; }
    .palace-transforms { display: none; }
    .palace-dynamic-tags {
      margin-top: 4px;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 2px 5px;
      pointer-events: none;
    }
    .palace-dynamic-tag {
      min-width: 0;
      color: rgba(240,236,224,.78);
      font-size: .56rem;
      font-weight: 700;
      line-height: 1.18;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .palace-dynamic-tag b {
      margin-right: 2px;
      font-weight: 800;
    }
    .palace-dynamic-tag.limit b { color: #ffd54f; }
    .palace-dynamic-tag.year b { color: #28d3e6; }
    .palace-dynamic-tag.month b { color: #64b5f6; }
    .palace-dynamic-tag.day b { color: #81c784; }
    .palace-subject {
      position: absolute;
      top: 5px;
      right: 5px;
      max-width: 48px;
      color: rgba(255,244,196,.9);
      font-size: .62rem;
      font-weight: 700;
      line-height: 1.05;
      text-align: right;
      pointer-events: none;
    }
    .palace-score-badge {
      position: absolute;
      right: 5px;
      bottom: 5px;
      min-width: 28px;
      padding: 2px 5px;
      border-radius: 999px;
      color: rgba(255,255,255,.92);
      background: rgba(0,0,0,.42);
      font-size: .66rem;
      font-weight: 800;
      line-height: 1.15;
      text-align: center;
      pointer-events: none;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
    }
    .palace-score-badge.good { color: #dfffe3; background: rgba(76,175,80,.34); }
    .palace-score-badge.neutral { color: #fff3bd; background: rgba(255,193,7,.34); }
    .palace-score-badge.risk { color: #ffd6d6; background: rgba(244,67,54,.42); }
    .palace-score-badge.pending { color: rgba(255,255,255,.58); background: rgba(255,255,255,.08); font-weight: 700; }
    .chain-badge {
      position: absolute;
      top: 50%;
      right: 5px;
      transform: translateY(-50%);
      font-size: .62rem;
      line-height: 1.08;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      padding: 2px 3px;
      border-radius: 3px;
      background: rgba(0,0,0,.26);
    }
    .badge-in { color: #4caf50; }
    .badge-out { color: #e57373; }
    .palace-cell.dense .palace-name { font-size: .88rem; line-height: 1.08; }
    .palace-cell.dense .palace-branch { font-size: .68rem; margin: 1px 0 3px; }
    .palace-cell.dense .palace-stars { font-size: .74rem; line-height: 1.16; }
    .palace-cell.dense .palace-dynamic-tag { font-size: .56rem; }
    .palace-cell.dense .palace-score-badge { font-size: .66rem; min-width: 26px; }
    .palace-cell.extra-dense .palace-name { font-size: .8rem; }
    .palace-cell.extra-dense .palace-branch { font-size: .64rem; }
    .palace-cell.extra-dense .palace-stars { font-size: .68rem; line-height: 1.1; }
    .palace-cell.extra-dense .palace-score-badge { font-size: .62rem; min-width: 24px; }
    .palace-cell.micro-dense .palace-name { font-size: .74rem; }
    .palace-cell.micro-dense .palace-branch { font-size: .6rem; }
    .palace-cell.micro-dense .palace-stars { font-size: .64rem; line-height: 1.08; }
    .palace-cell.micro-dense .palace-dynamic-tags { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .palace-cell.micro-dense .palace-dynamic-tag { font-size: .52rem; }
    .palace-cell.micro-dense .palace-score-badge { font-size: .58rem; min-width: 22px; }
    .center-merged {
      grid-column: 2 / span 2;
      grid-row: 2 / span 2;
      min-height: 0;
      height: 100%;
      padding: 6px;
      border: 1px solid rgba(156,120,34,.5);
      border-radius: 6px;
      color: #2d2418;
      background: #fff8e0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 3px;
      font-size: .78rem;
      line-height: 1.15;
      position: relative;
      z-index: 3;
      box-shadow: 0 0 6px rgba(156,120,34,.12), inset 0 0 0 1px rgba(255,255,255,.55);
    }
    .center-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #8a7e6b;
      gap: 6px;
      font-size: .78rem;
      line-height: 1.5;
    }
    .center-empty .prompt-icon { font-size: 1.4rem; opacity: .55; }
    .center-title { color: #1a1510; font-weight: 700; text-align: center; font-size: 1.05em; margin-bottom: 0; }
    .center-subtitle { display: flex; justify-content: space-between; gap: 8px; color: #2d2418; font-weight: 700; font-size: .82em; }
    .center-section { border-top: 1px solid rgba(128,96,24,.28); padding-top: 3px; margin-top: 1px; }
    .center-section.identity { display: grid; grid-template-columns: auto 1fr auto 1.35fr; column-gap: 4px; row-gap: 1px; align-items: baseline; }
    .center-section.identity .val { font-size: .9em; }
    .center-foot { display: flex; justify-content: space-between; gap: 6px; border-top: 1px solid rgba(128,96,24,.26); padding-top: 3px; color: #1a1510; font-weight: 700; font-size: .82em; }
    .row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
    .label { color: #5c5040; white-space: nowrap; }
    .val { color: #1a1510; font-weight: 700; text-align: right; }
    .pending { color: #5c4e38; }
    .sizhu-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; text-align: center; }
    .sizhu-p { padding: 2px 1px; border: 1px solid rgba(128,96,24,.22); border-radius: 3px; background: rgba(255,252,236,.82); }
    .sizhu-p .l { color: #5c5040; font-size: .76em; }
    .sizhu-p .g { color: #1a1510; font-size: 1.02em; font-weight: 700; }
    .flow-board { border-top: 1px solid rgba(128,96,24,.28); padding-top: 3px; display: grid; gap: 1px; }
    .flow-row {
      display: grid;
      grid-template-columns: 22px repeat(12, minmax(0, 1fr));
      gap: 1px;
      align-items: stretch;
      min-width: 0;
    }
    .flow-label {
      color: #5c5040;
      font-weight: 700;
      font-size: .7em;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .flow-chip {
      min-width: 0;
      height: 22px;
      padding: 0 1px;
      border: 1px solid rgba(128,96,24,.22);
      border-radius: 3px;
      text-align: center;
      color: #5c5040;
      background: rgba(255,252,236,.62);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      line-height: .9;
    }
    .flow-chip .stem { color: #3d7a33; font-weight: 700; font-size: .74em; }
    .flow-chip .branch { color: #235a9e; font-weight: 700; font-size: .74em; }
    .flow-chip .age { color: #5c5040; font-size: .6em; }
    .flow-chip.current {
      color: #1a1510;
      background: rgba(140,47,57,.26);
      border-color: rgba(140,47,57,.88);
      box-shadow: inset 0 0 0 1px rgba(140,47,57,.42), 0 0 0 1px rgba(140,47,57,.24);
    }
    .flow-row.flow-year .flow-chip.current { background: rgba(0,188,212,.26); border-color: rgba(0,188,212,.9); box-shadow: inset 0 0 0 1px rgba(0,188,212,.42), 0 0 0 1px rgba(0,188,212,.2); }
    .flow-row.flow-month .flow-chip.current { background: rgba(33,150,243,.26); border-color: rgba(33,150,243,.9); box-shadow: inset 0 0 0 1px rgba(33,150,243,.42), 0 0 0 1px rgba(33,150,243,.2); }
    .flow-row.flow-day .flow-chip.current { background: rgba(76,175,80,.26); border-color: rgba(76,175,80,.9); box-shadow: inset 0 0 0 1px rgba(76,175,80,.42), 0 0 0 1px rgba(76,175,80,.2); }
    .flow-chip.off { opacity: 1; }
    .chart-side-note {
      display: block;
      position: absolute;
      top: 62px;
      width: 224px;
      color: #453d35;
      font-size: .88rem;
      line-height: 1.6;
      border-top: 1px solid rgba(140,47,57,.22);
      border-bottom: 1px solid rgba(140,47,57,.14);
      background: rgba(255,252,241,.62);
      border-radius: 8px;
      padding: 12px 10px;
      pointer-events: none;
    }
    .chart-side-note.left { left: 18px; text-align: left; }
    .chart-side-note.right { right: 18px; text-align: left; }
    .note-title { color: #2d2418; font-weight: 800; margin-bottom: 8px; font-size: 1.06rem; letter-spacing: 0; }
    .guide-line { margin: 7px 0; overflow-wrap: anywhere; }
    .ziwei-visual-card {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
      gap: 18px;
      align-items: stretch;
      margin: 10px 0 14px;
      padding: 14px;
      border: 1px solid rgba(214,169,89,.28);
      border-radius: 14px;
      background: rgba(255,252,241,.72);
      box-shadow: 0 12px 30px rgba(87,64,42,.10);
    }
    .ziwei-visual-card img {
      width: 100%;
      height: 100%;
      min-height: 220px;
      object-fit: cover;
      border-radius: 10px;
      border: 1px solid rgba(140,47,57,.16);
    }
    .ziwei-visual-copy {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 10px;
      color: #3d3226;
      line-height: 1.75;
    }
    .ziwei-visual-copy span {
      align-self: flex-start;
      padding: 4px 10px;
      border-radius: 999px;
      color: #8c2f39;
      background: rgba(140,47,57,.08);
      border: 1px solid rgba(140,47,57,.18);
      font-weight: 800;
      font-size: .8rem;
    }
    .ziwei-visual-copy h2 { margin: 0; color: #251d14; font-size: 1.35rem; line-height: 1.35; }
    .ziwei-visual-copy p { margin: 0; color: #625342; }
    .guide-muted { color: #6f6252; font-size: .86em; }
    .guide-em {
      color: #8c2721;
      font-weight: 800;
      padding: 7px 8px;
      border-left: 3px solid rgba(140,47,57,.5);
      background: rgba(140,47,57,.05);
      border-radius: 0 6px 6px 0;
    }
    .selected-info { padding: 10px 16px; font-size: .82rem; }
    .selected-info .title { color: #8c2f39; margin-bottom: 6px; font-weight: 700; }
    .filter-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
    .filter-btn { border: 1px solid rgba(140,47,57,.28); border-radius: 4px; padding: 4px 7px; color: #aaa; background: rgba(0,0,0,.22); font-size: .72rem; cursor: pointer; }
    .filter-btn.active { color: #8c2f39; border-color: #8c2f39; background: rgba(140,47,57,.18); }
    .chain-list { max-height: 140px; overflow-y: auto; padding-right: 4px; }
    .chain-item { margin: 4px 0; padding-left: 8px; border-left: 2px solid transparent; font-size: .78rem; line-height: 1.35; }
    .chain-item.lu-in { border-left-color: #4caf50; }
    .chain-item.quan-in { border-left-color: #2196f3; }
    .chain-item.ke-in { border-left-color: #ffd54f; }
    .chain-item.ji-in { border-left-color: #f44336; }
    .chain-item.rule-item { color: #f2c6c6; }
    .chain-role { font-size: .7rem; color: #999; margin-left: 4px; }
    .chain-role.lu { color: #4caf50; }
    .chain-role.quan { color: #2196f3; }
    .chain-role.ke { color: #ffd54f; }
    .chain-role.ji { color: #f44336; }
    .flying-section { padding: 12px 16px; flex: 0 0 auto; }
    .flying-table { width: 100%; border-collapse: collapse; font-size: .8rem; table-layout: fixed; }
    .flying-table th { background: rgba(140,47,57,.2); color: #8c2f39; padding: 6px 4px; text-align: left; font-weight: 400; border-bottom: 1px solid rgba(140,47,57,.3); }
    .flying-table td { padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,.06); color: #bbb; overflow: hidden; text-overflow: ellipsis; }
    .flying-table .lu { color: #4caf50; }
    .flying-table .quan { color: #2196f3; }
    .flying-table .ke { color: #ffd54f; }
    .flying-table .ji { color: #f44336; }
    .info-section { padding: 10px 14px; }
    .info-bar { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 10px; background: rgba(0,0,0,.18); border-radius: 5px; font-size: .78rem; }
    .info-item .label { color: #777; margin-right: 3px; }
    .info-item .value { color: #8c2f39; }
    .event-reminder-section { padding: 10px 14px; }
    .event-reminder {
      display: grid;
      grid-template-columns: 1.1fr 1.5fr 1.5fr 1.6fr;
      gap: 8px;
      padding: 9px;
      background: rgba(255, 252, 242, .94);
      border: 1px solid rgba(214,169,89,.32);
      border-radius: 8px;
      box-shadow: 0 10px 26px rgba(87,64,42,.10);
    }
    .event-reminder.score-only {
      grid-template-columns: minmax(220px, 1fr);
      max-width: 360px;
    }
    .event-reminder.score-only .event-reminder-item:not(.current-palace-card) {
      display: none;
    }
    .event-reminder-item {
      min-height: 44px;
      padding: 7px 9px;
      border-radius: 7px;
      background: #fffaf0;
      border: 1px solid rgba(214,169,89,.22);
      color: #33271b;
      font-size: .78rem;
      line-height: 1.35;
    }
    .event-reminder-item .label {
      display: block;
      color: #8c2f39;
      font-size: .7rem;
      margin-bottom: 3px;
      font-weight: 800;
    }
    .event-reminder-item .value { color: #2d2418; font-weight: 700; }
    .current-palace-value {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .current-palace-text { min-width: 0; }
    .score-pill {
      flex: 0 0 auto;
      min-width: 30px;
      padding: 1px 7px;
      border-radius: 999px;
      border: 1px solid currentColor;
      text-align: center;
      font-size: .9rem;
      font-weight: 800;
      line-height: 1.45;
      background: rgba(214,169,89,.10);
    }
    .score-pill.good { color: #237a3b; box-shadow: 0 0 0 1px rgba(35,122,59,.14); }
    .score-pill.neutral { color: #b88912; box-shadow: 0 0 0 1px rgba(184,137,18,.16); }
    .score-pill.risk { color: #8c2f39; box-shadow: 0 0 0 1px rgba(199,62,84,.16); }
    .score-pill.score-pending { color: #888; box-shadow: 0 0 0 1px rgba(136,136,136,.14); font-weight: 600; font-size: .72rem; }
    .event-reminder-item.main {
      border-color: rgba(140,47,57,.30);
      background: #fff7ea;
    }
    .top-event-reminder {
      padding: 0;
      border: 0;
      background: transparent;
    }
    .top-event-reminder .panel-title {
      margin-bottom: 6px;
      padding-bottom: 5px;
      font-size: .95rem;
    }
    .top-event-reminder .event-reminder {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      padding: 7px;
      gap: 7px;
      border-color: rgba(140,47,57,.2);
    }
    .top-event-reminder .event-reminder-item {
      min-height: 42px;
      padding: 6px 8px;
      font-size: .76rem;
    }
    .top-event-reminder .event-reminder-item .label {
      margin-bottom: 2px;
      font-size: .68rem;
    }
    .top-event-reminder .timing-scope-control {
      margin-bottom: 3px;
      color: #8c2f39;
      font-weight: 800;
    }
    .timing-scope-control {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 0 0 5px;
      color: rgba(255,244,196,.76);
      font-size: .7rem;
    }
    .timing-scope-control select {
      min-width: 68px;
      height: 24px;
      padding: 1px 22px 1px 7px;
      border: 1px solid rgba(140,47,57,.38);
      border-radius: 4px;
      background: rgba(20,32,30,.92);
      color: rgba(255,255,255,.92);
      font-size: .72rem;
      outline: none;
    }
    @media (max-width: 1100px) {
      .event-reminder {
        width: min(100%, 374px);
        grid-template-columns: 1fr;
      }
      .chart-side-note {
        display: none;
      }
    }
    @media (max-width: 1250px) and (min-width: 641px) {
      .container { padding: 8px 10px; }
      .main-layout { grid-template-columns: minmax(270px, 1fr) minmax(0, 3fr); gap: 10px; }
      .chart-side-note { width: 150px; font-size: .78rem; line-height: 1.45; top: 56px; }
      .chart-side-note.left { left: 12px; }
      .chart-side-note.right { right: 12px; }
      .chart-wrapper { width: 540px; max-width: min(540px, calc(100vh - 168px), calc(75vw - 64px)); min-width: 500px; }
    }
    @media (max-width: 640px) {
      .ziwei-site-nav {
        position: sticky;
        align-items: center;
        flex-direction: row;
        gap: 10px;
      }
      .ziwei-nav-brand {
        min-width: 0;
        flex: 1;
      }
      .ziwei-nav-brand span,
      .ziwei-nav-brand small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .ziwei-nav-toggle {
        display: grid;
        flex: 0 0 auto;
      }
      .ziwei-nav-links {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        z-index: 60;
        display: none;
        grid-template-columns: 1fr;
        gap: 6px;
        max-height: calc(100vh - 92px);
        overflow: auto;
        padding: 8px;
        border: 1px solid rgba(140,47,57,.16);
        border-radius: 8px;
        background: rgba(255,252,241,.98);
        box-shadow: 0 18px 42px rgba(87,64,42,.16);
      }
      body.ziwei-nav-open .ziwei-nav-links {
        display: grid;
      }
      .ziwei-nav-links a {
        display: block;
        padding: 11px 12px;
        color: #5c5040;
      }
      .ziwei-visual-card { grid-template-columns: 1fr; }
      .event-reminder {
        grid-template-columns: 1fr;
      }
      .ziwei-visual-copy,
      .side-brand,
      .boundary-note,
      .event-reminder-item {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
        line-break: anywhere;
      }
      .ziwei-visual-copy h2,
      .side-brand h1 {
        width: min(100%, 13em);
        max-width: 13em;
        overflow-wrap: anywhere;
        word-break: break-all;
        line-break: anywhere;
      }
      .ziwei-visual-copy p,
      .side-brand p,
      .boundary-note,
      .event-reminder-item .value {
        width: min(100%, 18em);
        max-width: 18em;
        overflow-wrap: anywhere;
        word-break: break-all;
        line-break: anywhere;
      }
      .main-layout { grid-template-columns: 1fr; }
      .input-panel, .display-panel { max-height: none; overflow: visible; }
      .display-panel { order: 1; }
      .input-panel { order: 2; }
      .chart-side-note { display: none; }
      .chart-section.primary-chart {
        min-height: auto;
        overflow-x: hidden;
        padding-left: 8px;
        padding-right: 8px;
      }
      .chart-wrapper {
        width: min(100%, 374px);
        max-width: 100%;
        min-width: 0;
        margin: 8px 0 0;
      }
      .chart-grid {
        gap: 5px;
      }
      .palace-cell {
        padding: 6px;
        border-radius: 7px;
      }
      .palace-name {
        padding-right: 24px;
        font-size: .8rem;
      }
    }
    .ziwei-reading-guide {
      margin-top: 12px;
      padding: 16px;
      border: 1px solid rgba(214,169,89,.22);
      border-radius: 12px;
      background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(255,250,238,.78));
      box-shadow: 0 16px 36px rgba(87,64,42,.12);
    }
    .ziwei-reading-guide .guide-heading {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
      gap: 16px;
      align-items: end;
      margin-bottom: 12px;
    }
    .ziwei-reading-guide .guide-heading p { margin: 0; color: #6f6252; line-height: 1.65; }
    .ziwei-reading-guide .eyebrow { margin: 0 0 6px; color: #8c2f39; font-weight: 800; }
    .ziwei-reading-guide h2 { margin: 0; color: #2d2418; font-size: 1.3rem; line-height: 1.35; }
    .ziwei-guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .ziwei-guide-card {
      padding: 12px;
      border: 1px solid rgba(140,47,57,.13);
      border-radius: 10px;
      background: rgba(255,255,255,.62);
    }
    .ziwei-guide-card strong { display: block; color: #8c2f39; margin-bottom: 5px; }
    .ziwei-guide-card p { margin: 0; color: #4b4136; line-height: 1.6; font-size: .9rem; }
    .action-checklist { margin: 12px 0; padding: 14px 16px; border: 1px solid rgba(140,47,57,.18); border-radius: 12px; background: linear-gradient(135deg, rgba(140,47,57,.05), rgba(46,109,104,.05)), #fffdf8; }
.action-checklist .panel-title { margin-bottom: 10px; }
.action-step { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px dashed rgba(140,47,57,.14); }
.action-step:first-of-type { border-top: 0; }
.action-tag { display: inline-grid; place-items: center; min-height: 28px; border-radius: 6px; font-weight: 800; font-size: .8rem; }
.action-step:nth-child(2) .action-tag { color: #fff; background: #2e6d68; }
.action-step:nth-child(3) .action-tag { color: #7b4617; background: rgba(201,162,75,.18); }
.action-step:nth-child(4) .action-tag { color: #fff; background: #8c2721; }
.action-text { font-size: .88rem; line-height: 1.65; color: #2d2418; }
@media (max-width: 900px) {
      .ziwei-reading-guide .guide-heading,
      .ziwei-guide-grid { grid-template-columns: 1fr; }
      .ziwei-reading-guide,
      .ziwei-guide-card {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
        line-break: anywhere;
      }
      .ziwei-reading-guide h2 {
        width: min(100%, 13em);
        max-width: 13em;
        overflow-wrap: anywhere;
        word-break: break-all;
        line-break: anywhere;
      }
      .ziwei-reading-guide .guide-heading p,
      .ziwei-guide-card p {
        width: min(100%, 18em);
        max-width: 18em;
        overflow-wrap: anywhere;
        word-break: break-all;
        line-break: anywhere;
      }
    }
  
    .am-translation { margin: 28px auto; padding: 32px; border: 1px solid rgba(67,78,72,.18); border-top: 3px solid #8c2f39; border-radius: 6px; background: #f4f1e8; }
    .am-translation .am-heading { display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.8fr); gap: 24px; align-items: end; margin-bottom: 22px; }
    .am-translation .am-kicker { margin: 0 0 7px; color: #8c2f39; font-size: 13px; font-weight: 800; }
    .am-translation h2 { margin: 0; color: #182b27; font-size: clamp(25px,3vw,38px); line-height: 1.25; }
    .am-translation .am-intro { margin: 0; color: #53605b; line-height: 1.75; }
    .am-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
    .am-card { min-width: 0; padding: 20px; border: 1px solid rgba(67,78,72,.15); border-top: 3px solid #8c2f39; border-radius: 5px; background: #fffdf8; }
    .am-card:nth-child(2) { border-top-color: #2e6d68; }
    .am-card:nth-child(3) { border-top-color: #a18445; }
    .am-card span { display: block; margin-bottom: 7px; color: #8c2f39; font-size: 12px; font-weight: 800; }
    .am-card:nth-child(2) span { color: #2e6d68; }
    .am-card:nth-child(3) span { color: #80682f; }
    .am-card strong { display: block; margin-bottom: 7px; color: #182b27; font-size: 18px; line-height: 1.4; }
    .am-card p { margin: 0; color: #59635f; line-height: 1.7; }
    @media (max-width: 760px) { .am-translation { padding: 23px 17px; } .am-translation .am-heading, .am-grid { grid-template-columns: 1fr; } }


.form-row.depth-row { margin-top: 6px; }

/* R28 分析增强（浅色主题） */
.attention-board { margin: 0 0 10px; padding: 10px 12px; background: rgba(140,47,57,.05); border: 1px solid rgba(140,47,57,.16); border-radius: 10px; }
.attention-lead { margin-bottom: 4px; color: #8c2f39; font-weight: 700; font-size: .86rem; }
.attention-clickable { cursor: pointer; border-radius: 6px; padding: 6px 8px; margin: 0 -8px; }
.attention-clickable:hover { background: rgba(140,47,57,.06); }
.attention-clickable:focus-visible { outline: 2px solid #8c2f39; outline-offset: 1px; }
.attention-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed rgba(31,41,38,.1); font-size: .82rem; }
.attention-item:last-child { border-bottom: 0; }
.attention-palace { color: #8c2f39; font-weight: 700; white-space: nowrap; }
.attention-event { flex: 1; color: rgba(45,36,24,.82); }
.attention-timing { color: #8c6a2f; white-space: nowrap; font-size: .74rem; }
.score-legend { margin-top: 8px; }
#copyChartSummary { margin-top: 6px; }

/* R29 叙事卡（证据串联·大白话版） */
.narrative-card { margin: 0 0 12px; padding: 12px 14px; background: linear-gradient(135deg, rgba(140,47,57,.06), rgba(46,109,104,.05)); border: 1px solid rgba(140,47,57,.18); border-radius: 12px; }
.narrative-card .panel-title { color: #8c2f39; }
.narrative-p { margin: 0 0 10px; font-size: .9rem; line-height: 1.8; color: #2d2418; text-align: justify; }
.narrative-p:last-child { margin-bottom: 0; }
.narrative-p:nth-last-child(2) { color: #8c2f39; }
