/* Original worksheet presentation. Calculation stays in the Python API. */
.chart-panel{background:#fff;border-radius:0;box-shadow:none}
.sheet-output{container-type:inline-size;max-width:620px;margin:0 auto;color:#000;font-family:"PMingLiU","Noto Serif TC","Songti TC",serif;line-height:1.15}
.sheet-header{display:grid;grid-template-columns:minmax(0,1fr) 18%;gap:4%;margin-bottom:22px;font-size:clamp(10px,2.9cqw,18px)}
.sheet-calendar{border-collapse:collapse;width:100%;text-align:left;font-variant-numeric:tabular-nums;white-space:nowrap}
.sheet-calendar th,.sheet-calendar td{border:1px solid #dedede;padding:1px 3px;font-weight:400;height:1.3em}
.sheet-calendar th{width:1%;font-weight:600}.sheet-calendar tr:first-child td{font-weight:600}
.sheet-pillars{display:grid;grid-template-rows:repeat(4,1fr);align-self:start;line-height:1.3}
.sheet-pillars>div{display:grid;grid-template-columns:1fr 2fr;border-bottom:1px solid #dedede}
.sheet-pillars strong{font-weight:400;letter-spacing:.08em}.sheet-pillars span{border-right:1px solid #dedede}
.sheet-output .palace-grid{border:1px solid #000;background:#000;gap:1px}
.sheet-output .sheet-palace{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:repeat(6,minmax(0,1fr));aspect-ratio:1.135;min-height:0;padding:0;gap:0;font-size:clamp(12px,3.75cqw,23px);font-weight:400;line-height:1;position:relative;text-align:center;align-items:center;justify-items:center;color:#000}
.sheet-output [data-element="木"]{--palace-bg:#c1e7bd}
.sheet-output [data-element="火"]{--palace-bg:#ffc1bb}
.sheet-output [data-element="土"]{--palace-bg:#fff19b}
.sheet-output [data-element="金"]{--palace-bg:#fff}
.sheet-output [data-element="水"]{--palace-bg:#252525}
.sheet-output [data-element="neutral"]{--palace-bg:#e6e6e6}
.sheet-output .sheet-palace{background:var(--palace-bg)}
.element-key{display:flex;gap:12px;flex-wrap:wrap;margin:-8px 0 10px;font:10px/1.5 var(--sans);color:#555}
.element-key>span{display:inline-flex;align-items:center;gap:4px}
.element-key>span::before{content:"";width:11px;height:11px;background:var(--palace-bg);border:1px solid #aaa}
.sheet-palace>span,.sheet-palace>strong{font-size:inherit;line-height:1;letter-spacing:0;white-space:nowrap;font-weight:400;min-width:0}
.sheet-number{grid-area:1/6;font-family:"Times New Roman",serif}
.sheet-void{grid-area:2/3}.sheet-deity{grid-area:2/4}.sheet-earth-deity{grid-area:2/5}
.sheet-guide{grid-area:3/3}.sheet-guide-extra{grid-area:4/3}.sheet-star{grid-area:3/4}.sheet-heaven{grid-area:3/5}.sheet-heaven-extra{grid-area:3/6}
.sheet-door{grid-area:4/4}.sheet-earth{grid-area:4/5}.sheet-earth-extra{grid-area:4/6}
.sheet-horse{grid-area:5/3}.sheet-pressure{grid-area:5/4}.sheet-punishment{grid-area:5/5}.sheet-tomb{grid-area:5/6}
.sheet-guide,.sheet-guide-extra{color:#005c20}
.sheet-palace[data-palace="2"] .sheet-guide,.sheet-palace[data-palace="2"] .sheet-guide-extra,.sheet-palace[data-palace="6"] .sheet-guide,.sheet-palace[data-palace="6"] .sheet-guide-extra{color:#00f}
.sheet-void,.sheet-horse,.sheet-pressure,.sheet-punishment,.sheet-tomb{color:#b00000}
.sheet-output .sheet-palace[data-element="水"]{color:#fff}
.sheet-palace[data-element="水"] .sheet-guide,.sheet-palace[data-element="水"] .sheet-guide-extra{color:#91e3aa}
.sheet-palace[data-element="水"] .sheet-void,.sheet-palace[data-element="水"] .sheet-horse,.sheet-palace[data-element="水"] .sheet-pressure,.sheet-palace[data-element="水"] .sheet-punishment,.sheet-palace[data-element="水"] .sheet-tomb{color:#ff9393}
.sheet-chief-star-label{grid-area:2/1/3/3}.sheet-chief-star{grid-area:3/1/4/3;justify-self:start;margin-left:.15em}
.sheet-chief-door-label{grid-area:4/1/5/3}.sheet-chief-door{grid-area:5/1/6/3;justify-self:start;margin-left:.15em}
.sheet-pattern{grid-area:1/3/2/7}.sheet-xun{grid-area:2/3/3/7}.sheet-hour{grid-area:3/3/4/7}.sheet-center-earth{grid-area:6/6}
.sheet-output .sheet-palace{aspect-ratio:.95;grid-template-rows:.6fr .9fr 1.6fr 1.6fr .8fr .5fr}
.sheet-palace>.stem-marked{display:flex;flex-direction:column;align-items:center;gap:1px}
.stem-char{font:inherit;line-height:1}
.stem-labels{display:grid;grid-template-columns:1fr;gap:0 1px;padding:1px;border:1px solid #666;border-radius:2px;background:#fff;color:#111;font:600 clamp(7px,1.4cqw,9px)/1 var(--sans);letter-spacing:0}
.stem-labels[data-count="1"]{font-size:clamp(8px,1.6cqw,10px)}
.stem-labels[data-count="2"],.stem-labels[data-count="3"],.stem-labels[data-count="4"]{grid-template-columns:repeat(2,1fr)}
.stem-labels i{font:inherit;font-style:normal}
.sheet-center-earth{grid-area:5/6/7/7;align-self:end;padding-bottom:3px}
.stem-note{font:10px/1.7 var(--sans);color:#555;margin:8px 0 0}
.palace-hint{font:11px/1.5 var(--sans);color:#555;margin:0 0 8px}
.sheet-palace[role="button"]{cursor:pointer}
.sheet-palace.selected-palace,.sheet-palace:focus-visible{outline:3px solid #9c5c24;outline-offset:-3px}
.sheet-palace[data-element="水"].selected-palace,.sheet-palace[data-element="水"]:focus-visible{outline-color:#fff}
.palace-reference,.reference-library{margin-top:18px;padding:15px;border:1px solid #ccc;background:#fff;font:12px/1.8 var(--sans);min-width:0;overflow-wrap:anywhere}
.reference-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
.reference-heading h3{font-size:15px;margin:0}.reference-heading button{font-size:11px;background:#fff;border:1px solid #ccc;border-radius:3px;padding:3px 8px}
.reference-intro,.reference-source{font-size:10px;color:#666}.reference-source{margin-bottom:0}
.palace-reference h4{font-size:13px;margin:15px 0 7px}.palace-reference h5{font-size:12px;margin:8px 0 4px}
.reference-symbol,.reference-pair{border-top:1px solid #e2e2e2;padding:8px 0}
.reference-symbol summary,.reference-pair summary,.reference-library summary{cursor:pointer}
.reference-symbol summary small,.reference-pair summary small{font-size:10px;color:#666;margin-left:8px}
.reference-category ul{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0;padding:0 0 0 16px}
.reference-category li{margin-right:7px}.reference-pair p{margin:7px 0}
.reference-library label{display:block;font-size:11px;margin:10px 0 4px}.reference-library select{font:inherit;max-width:100%;padding:5px 8px;border:1px solid #bbb;background:#fff}
.reference-table-wrap{max-width:100%;overflow:auto;margin-top:12px;max-height:500px}
.reference-table{border-collapse:collapse;font-size:11px;line-height:1.8;text-align:left}
.reference-table td,.reference-table th{border:1px solid #ddd;padding:5px 8px;vertical-align:top;min-width:65px;max-width:350px;white-space:pre-line}
.reference-table th{min-width:28px;color:#777;font-weight:400;font-size:9px}
@media print{.palace-hint,.reference-library{display:none}.sheet-palace.selected-palace{outline:0}.palace-reference{break-inside:avoid}}
@media(max-width:360px){.stem-labels{font-size:6px;gap:0;padding:1px 0}}
.chart-key{max-width:620px;margin-left:auto;margin-right:auto;line-height:1.7}
@media(max-width:440px){.chart-panel{padding-left:8px;padding-right:8px}.sheet-header{gap:2%;grid-template-columns:minmax(0,1fr) 16%;margin-bottom:15px}.sheet-calendar th,.sheet-calendar td{padding:1px}.sheet-pillars strong{letter-spacing:0}}
@media print{.sheet-output .sheet-palace{-webkit-print-color-adjust:exact;print-color-adjust:exact}.chart-panel{max-width:720px}}
