:root{--ink:#253c36;--muted:#7f8982;--line:#e3e6de;--paper:#fafbf7;--sage:#edf1e9;--green:#34584a;--accent:#ba7451;--serif:"Songti SC","STSong","SimSun",serif;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;color:var(--ink);background:var(--paper);font-size:13px;font-synthesis:none}
*{box-sizing:border-box}
body{margin:0;height:100vh;height:100dvh;display:flex;flex-direction:column}
button,input,select{font:inherit}
button{cursor:pointer;transition:background .15s,color .15s}
button,input,select{outline-offset:3px}
button:focus-visible,.button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent)}
button:disabled{opacity:.35;cursor:default}
svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.icon-defs{position:absolute;width:0;height:0;overflow:hidden}
[hidden],.mobile-hidden{display:none!important}
fieldset{border:0;padding:0;margin:0;min-width:0}
fieldset:disabled{opacity:.35}
.app-header{flex:none;height:80px;display:flex;align-items:center;padding:0 30px;border-bottom:1px solid var(--line);gap:22px;background:#fdfdf9}
.brand{display:flex;align-items:center;gap:12px}
.brand-seal{display:block;height:49px;width:auto;flex:none}
.brand h1{font-family:var(--serif);font-weight:600;font-size:25px;letter-spacing:3px;line-height:1.15;margin:0}
.brand p{display:flex;align-items:center;gap:8px;margin:4px 0 0;color:#68756b;font-size:11px;line-height:1.2;letter-spacing:1px}
.brand p b{font-family:var(--serif);font-size:12px;font-weight:600;letter-spacing:2px;color:#40594e}
.brand p span{border-inline-start:1px solid #cdd4c7;padding-inline-start:8px}
.chart-signature{
  --signature-gap:clamp(5px,1.15vw,14px);
  flex:none;display:flex;align-items:baseline;justify-content:center;gap:var(--signature-gap);
  flex-wrap:wrap;row-gap:2px;padding:7px 9px max(7px,env(safe-area-inset-bottom,0px));
  background:var(--paper);border-top:1px solid var(--line);color:#59685f;
  font:12px/1.4 var(--serif);
}
.chart-signature span{white-space:nowrap}
.chart-signature span+span{border-inline-start:1px solid #d6dcd1;padding-inline-start:var(--signature-gap)}
.chart-signature .signature-name{font-size:13px;font-weight:600;color:var(--green);letter-spacing:1px}
.signature-account{font:11px/1.4 -apple-system,"PingFang SC","Microsoft YaHei",sans-serif}
.signature-account a{color:var(--green);padding-block:4px;text-decoration:underline;text-decoration-color:#94a79c;text-underline-offset:3px}
.signature-account a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.compare-dialog .chart-signature{margin-top:7px;padding:3px 0 0;border:0;background:transparent}
body:has(#compareDialog[open]) > .chart-signature{visibility:hidden}
.header-note{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted)}
.status-dot{height:6px;width:6px;display:inline-block;border-radius:50%;background:#a7b5a1}
.button{cursor:pointer;border:1px solid transparent;border-radius:6px;min-height:36px;padding:8px 12px;display:inline-flex;align-items:center;justify-content:center;gap:6px;font-weight:500;background:none;color:var(--ink);white-space:nowrap}
.button-quiet,.button-secondary{background:#fdfdf9;border-color:var(--line)}
.button-quiet:hover,.button-secondary:hover{background:var(--sage)}
.button-primary{background:var(--green);color:#fff}
.button-primary:hover{background:#294639}
.button-export{background:#fdfefa;border-color:#d7ddd2;font-size:12px}
.text-button{border:0;background:none;color:var(--green);padding:5px 0;font-size:11px}
.text-button:hover{text-decoration:underline}
.icon-button{display:grid;place-items:center;border:0;background:none;border-radius:4px;color:#8a9980;font-size:24px;width:30px;height:30px}
.icon-button:hover{background:var(--sage)}
.app-layout{flex:1 0 0;min-height:490px;display:grid;grid-template-columns:290px minmax(0,1fr)}
.sidebar{background:#fdfdf9;border-right:1px solid var(--line);padding:18px;min-height:0;overflow-y:auto;scrollbar-width:thin}
.mobile-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:17px}
.mobile-tabs button{height:38px;border:0;background:none;color:#91a083;border-radius:5px;font-size:12px;white-space:nowrap}
.mobile-tabs button.active{background:#eaf0e1;color:var(--green);font-weight:600}
.control-section{padding:0 0 15px;margin-bottom:15px;border-bottom:1px solid var(--line)}
.control-section:last-child{margin-bottom:0;border-bottom:0;padding-bottom:0}
.upload-row{display:flex;gap:6px}
.upload-row #uploadBtn{flex:1;min-width:0}
.upload-row #fileName{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:130px}
.upload-row .button{padding:8px;font-size:11px}
.control-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;min-height:25px;margin-bottom:4px}
.control-heading output{font-variant-numeric:tabular-nums;font-size:11px;color:var(--green)}
.inline-rotation{display:flex;align-items:center;gap:7px}
.inline-rotation output{text-align:center;min-width:42px;font-size:12px;font-variant-numeric:tabular-nums}
.square-button{height:28px;width:28px;background:#fff;border:1px solid var(--line);border-radius:4px;font-size:18px;line-height:1;color:#718665}
.square-button:hover{background:var(--sage)}
.inline-rotation .text-button{margin-left:4px}
.frame-actions{display:flex;gap:8px;margin-top:10px}
.frame-actions .button{flex:1;font-size:12px}
.range-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:7px}
input[type=range]{appearance:none;width:100%;height:24px;margin:2px 0 5px;background:transparent;display:block;cursor:pointer}
input[type=range]::-webkit-slider-runnable-track{height:4px;background:#dce3d4;border-radius:4px}
input[type=range]::-webkit-slider-thumb{appearance:none;height:17px;width:17px;margin-top:-6.5px;background:#fdfdf9;border:4px solid var(--green);border-radius:50%}
input[type=range]::-moz-range-track{height:4px;background:#dce3d4;border-radius:4px}
input[type=range]::-moz-range-thumb{height:9px;width:9px;background:#fdfdf9;border:4px solid var(--green);border-radius:50%}
.toggle-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-top:8px}
.toggle-chip{position:relative;display:block;cursor:pointer;min-width:0}
.toggle-chip input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.toggle-chip span,.toggle-grid button{display:flex;align-items:center;justify-content:center;min-height:34px;border:1px solid #e0e5d8;border-radius:5px;background:#f6f8f1;color:#98a28e;font-size:11px}
.toggle-chip input:checked+span,.toggle-grid button[aria-pressed=true]{border-color:#b7c9ac;background:#ecf2e4;color:var(--green)}
.toggle-chip input:checked+span:before{content:"";width:4px;height:4px;background:#6f9361;border-radius:50%;margin-right:5px}
.toggle-chip input:disabled+span{opacity:.35;cursor:default}
.toggle-chip input:focus-visible+span{outline:2px solid var(--accent)}
.select-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.select-grid label{font-size:11px;color:#819176;min-width:0}
.select-grid select{display:block;width:100%;min-width:0;height:39px;padding:6px;background:#fff;border:1px solid #dce2d5;border-radius:5px;color:var(--ink);font-size:13px;margin-top:7px}
.workspace{display:flex;flex-direction:column;min-width:0;min-height:0;background:#f3f5ef}
.workspace-topbar{height:56px;flex-shrink:0;border-bottom:1px solid #e2e6dc;background:#fafbf6;display:flex;align-items:center;padding:0 22px;gap:9px}
.workspace-label{display:flex;align-items:center;gap:8px;min-width:0;margin-right:auto}
.workspace-label strong{font-weight:500;font-size:12px;white-space:nowrap}
.workspace-label>span:last-child{font-size:10px;color:#a0a995;padding-left:9px;border-left:1px solid #dde2d5;white-space:nowrap}
.expand-canvas{display:none}
.canvas-container{position:relative;flex:1;min-height:0;overflow:hidden;background-color:#eff1e9;background-image:radial-gradient(#c7cebf .65px,transparent .65px);background-size:18px 18px}
.canvas-container canvas{position:absolute;width:100%;height:100%;display:block;touch-action:none;outline-offset:-3px}
.empty-state{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;padding:20px;text-align:center;pointer-events:none}
.empty-state>*{pointer-events:auto}
.empty-symbol{height:132px;width:132px;position:relative;display:grid;place-items:center;margin-bottom:24px}
.empty-circle{position:absolute;inset:0;border:1px solid #bcc8b1;border-radius:50%}
.empty-circle:before,.empty-circle:after{content:"";width:150px;height:1px;position:absolute;background:#c8d0be;left:-10px;top:65px}
.empty-circle:after{transform:rotate(90deg)}
.empty-square{position:absolute;inset:20px;border:1px dashed #b7c3ac;transform:rotate(45deg)}
.empty-symbol svg{width:34px;height:34px;color:#9dae91;background:#eff1e9;z-index:1}
.empty-north{position:absolute;top:8px;font-family:var(--serif);font-size:12px;color:#9aa98d}
.empty-state h2{font-family:var(--serif);font-weight:500;font-size:32px;letter-spacing:6px;margin:11px 0 17px}
.empty-state p{display:none}
.button-large{padding:12px 24px;min-height:42px}
.canvas-toolbar{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:3px;padding:5px 7px;border:1px solid #dce2d3;border-radius:8px;background:#fcfdf8ed;box-shadow:0 4px 15px #3d492e0b}
.tool-button{background:none;border:0;border-radius:4px;height:32px;min-width:32px;padding:5px;color:#7b8b70;display:flex;align-items:center;justify-content:center;font-size:20px}
.tool-button svg{width:17px;height:17px}
.tool-button:hover,.tool-button.active{background:#e7eddf;color:var(--green)}
.toolbar-divider{height:18px;width:1px;background:#e0e5d8;margin:0 4px}
#zoomValue{font-size:10px;min-width:36px;text-align:center;color:#7a8b6d;font-variant-numeric:tabular-nums}
.quick-toggle{position:absolute;top:12px;right:12px;z-index:3;padding:7px 10px;border:1px solid #d0dbc7;border-radius:7px;background:#fcfdf7ed;color:var(--green);font-size:12px;min-height:34px;box-shadow:0 2px 8px #344a2d09}
.quick-panel{position:absolute;right:10px;top:10px;width:278px;max-width:calc(100% - 20px);max-height:calc(100% - 75px);overflow-y:auto;z-index:5;padding:10px 12px 12px;background:#fffffbf7;border:1px solid #cfdcc5;border-radius:9px;box-shadow:0 8px 30px #33462b1c;backdrop-filter:blur(12px);scrollbar-width:thin}
.quick-heading{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.quick-heading strong{font-size:11px;font-weight:500;margin-right:auto}
.quick-heading .icon-button{width:22px;height:22px;font-size:21px}
.quick-panel .control-heading{font-size:11px;margin:0}
.quick-panel input[type=range]{height:20px;margin:2px 0}
.quick-panel .range-grid{margin-top:5px;gap:15px}
.quick-panel .toggle-grid{gap:5px;margin-top:7px}
.quick-panel .toggle-grid button{min-height:31px;font-size:10px}
.drop-overlay{position:absolute;inset:12px;background:#edf3e6f5;border:2px dashed #7f9d6e;border-radius:12px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:20px;z-index:10;color:var(--green);pointer-events:none}
.drop-overlay svg{height:42px;width:42px}
.drop-overlay strong{font-weight:500;font-size:18px}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#263e34;color:#fff;padding:11px 20px;border-radius:7px;box-shadow:0 4px 25px #24362b20;z-index:30;font-size:12px;max-width:90vw}
.toast.error{background:#8e4e39}
dialog{border:1px solid var(--line);border-radius:12px;padding:23px;max-width:440px;width:calc(100% - 28px);max-height:90dvh;overflow-y:auto;color:var(--ink);background:#fdfdf9;box-shadow:0 20px 80px #263e3433}
dialog::backdrop{background:#293d3250;backdrop-filter:blur(3px)}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.dialog-heading h2{font-family:var(--serif);font-size:23px;letter-spacing:1px;font-weight:500;margin:0}
.dialog-heading .icon-button{margin-right:-8px}
dialog p{font-size:12px;line-height:1.9;color:#7e8d73;margin:12px 0}
table{border-collapse:collapse;width:100%;font-size:13px;text-align:center}
table th,table td{height:39px;padding:7px 5px;border-bottom:1px solid #e5e9df}
table thead{background:#f0f3e9;font-size:11px;color:#8a967e}
table th{font-weight:500}
table td{color:#65755a}
table tbody tr:last-child>*{border-bottom:0}
@media(max-width:1050px){
.app-layout{grid-template-columns:275px minmax(0,1fr)}
.sidebar{padding:15px}
.header-note{display:none}
.app-header>.button{margin-left:auto}
.workspace-label>span:last-child{display:none}
.workspace-topbar{padding:0 15px}
}
@media(max-width:800px){
html,body{overflow:hidden}
.app-header{height:62px;padding:0 17px;gap:12px}
.brand{gap:9px}
.brand-seal{height:41px}
.brand h1{font-size:21px;letter-spacing:2px}
.brand p{margin-top:3px;font-size:10px}
.brand p b{font-size:11px}
.chart-signature{--signature-gap:6px;font-size:11px;padding-block:4px max(4px,env(safe-area-inset-bottom,0px))}
.chart-signature .signature-name{font-size:12px;letter-spacing:0}
body:has(#chartSignature:not([hidden])) .sidebar{padding-bottom:0}
.app-header .button{min-height:35px;padding:7px}
.app-header .button span{display:none}
.app-layout{min-height:0;display:flex;flex-direction:column;overflow:hidden}
.workspace{order:0;flex:1;min-height:190px}
.workspace-topbar{height:47px;padding:0 12px;gap:7px}
.workspace-label{gap:6px}
.workspace-label strong{font-size:11px}
.workspace-topbar .button{min-height:33px;font-size:11px;padding:7px 9px}
.expand-canvas{display:inline-flex;gap:4px}
.expand-canvas svg{width:13px;height:13px}
.sidebar{order:1;flex:0 0 auto;max-height:42dvh;border-right:0;border-top:1px solid #dce3d3;padding:0 16px max(12px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior-y:contain}
.mobile-tabs{position:sticky;top:0;z-index:2;margin:0 -16px 10px;padding:6px 10px;background:#fdfdf9f5;border-bottom:1px solid var(--line);backdrop-filter:blur(10px)}
.mobile-tabs button{height:35px;font-size:12px}
.control-section{padding-bottom:10px;margin-bottom:10px}
.upload-row .button{min-height:37px;font-size:12px}
.upload-row #fileName{max-width:180px}
.control-heading{font-size:12px}
.inline-rotation output{font-size:12px}
.square-button{height:30px;width:30px}
.frame-actions{margin-top:8px}
.frame-actions .button{min-height:39px}
.toggle-grid{gap:6px;margin-top:7px}
.toggle-chip span{min-height:33px;font-size:12px}
.range-grid{gap:20px;margin-top:3px}
.select-grid select{font-size:16px;height:40px}
.select-grid label{font-size:11px}
.empty-symbol{height:100px;width:100px;margin-bottom:20px}
.empty-circle:before,.empty-circle:after{width:118px;left:-10px;top:49px}
.empty-square{inset:15px}
.empty-state h2{font-size:26px;letter-spacing:5px}
.canvas-toolbar{bottom:12px;padding:4px 6px}
.tool-button{height:32px;min-width:32px}
.quick-toggle{top:10px;right:10px}
.quick-panel{padding:9px 11px 11px}
.canvas-expanded .sidebar{display:none}
.canvas-expanded .workspace{flex:1;height:100%}
.toast{bottom:15px;font-size:11px;text-align:center;min-width:180px;padding:10px 15px}
dialog{padding:19px}
.dialog-heading h2{font-size:22px}
}
@media(max-width:800px) and (max-height:630px){
.app-header{height:53px}
.brand-seal{height:36px}
.sidebar{max-height:48dvh}
.workspace{min-height:160px}
.empty-symbol{display:none}
.empty-state h2{font-size:23px}
.workspace-topbar{height:42px}
}

.single-range{margin-top:6px}
.quick-heading strong{flex:1}
.quick-panel .single-range{margin-top:5px}

/* The canvas shows one chart at a time. The comparison sits outside the floor plan. */
.chart-deck {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 18px;
  background: #fcfcf8;
  border-bottom: 1px solid var(--line);
}
.chart-view-row, .chart-context { display: flex; align-items: center; min-width: 0; }
.chart-view-row { gap: 8px; flex-shrink: 0; }
.chart-views {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 2px;
  border: 1px solid #dfe4d9;
  border-radius: 8px;
  background: #f0f3ed;
}
.chart-views button, .compare-link {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  color: #4d6056;
}
.chart-views button {
  min-height: 39px;
  padding: 0 13px;
  border-radius: 5px;
}
.chart-views button[aria-pressed="false"]:hover:enabled { background: #e4eae0; }
.chart-views button[aria-pressed="true"] { font-weight: 600; }
.chart-views [data-chart-view="annual"][aria-pressed="true"] { background: #805925; color: white; }
.chart-views [data-chart-view="xuankong"][aria-pressed="true"] { background: #385d70; color: white; }
.compare-link {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #c7d3c6;
  border-radius: 6px;
  background: #fbfcf7;
  color: var(--green);
  font-weight: 600;
}
.compare-link:hover:enabled { background: #eaf0e7; }
.chart-context { justify-content: flex-end; gap: 12px; }
.chart-context strong { font-size: 12px; font-weight: 500; color: #4f6259; line-height: 1.35; }
.chart-edit {
  --edit-ink: #69471f; --edit-fill: #f5ebd9; --edit-line: #bda47e;
  display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0;
  background: transparent; border: 0; border-radius: 7px; color: var(--edit-ink);
  font-size: 13px; font-weight: 600; line-height: 1.25; white-space: nowrap;
}
.chart-edit-face {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 10px;
  border: 1px solid var(--edit-line); border-radius: 7px;
  background: var(--edit-fill);
}
.chart-edit[data-chart="xuankong"] { --edit-ink: #304f62; --edit-fill: #e4edf1; --edit-line: #97afbc; }
.chart-edit svg { width: 15px; height: 15px; stroke-width: 1.9; }
@media (hover: hover) {
  .chart-edit:hover .chart-edit-face { border-color: var(--edit-ink); }
}
.chart-edit:active .chart-edit-face { background: var(--edit-ink); color: white; }
.chart-entry { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.chart-entry:last-child { border-bottom: 0; }
.chart-action {
  flex: 1;
  display: grid;
  grid-template-columns: 8px minmax(0,1fr) auto;
  column-gap: 9px;
  align-content: center;
  align-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 6px 2px;
  background: none;
  border: 0;
  text-align: left;
  color: var(--ink);
}
.chart-action:hover:enabled span { text-decoration: underline; text-underline-offset: 3px; }
.chart-action span { grid-column: 2; font-size: 14px; font-weight: 600; }
.chart-action small { grid-column: 2; grid-row: 2; color: #66776c; font-size: 11px; line-height: 1.45; }
.chart-action small:empty { display: none; }
.chart-action b { grid-column: 3; grid-row: 1 / 3; border-radius: 5px; padding: 4px 6px; background: #edf2e9; color: var(--green); font-size: 12px; font-weight: 600; line-height: 1.25; }
.layer-dot { width: 7px; height: 7px; border-radius: 50%; }
.layer-dot.annual { background: #a67331; }
.layer-dot.xuankong { background: #517a92; }
.layer-switch { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 65px; min-height: 48px; color: #526757; font-size: 12px; cursor: pointer; }
.layer-switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.layer-switch:has(input:disabled) { color: #839083; }

.compare-dialog {
  width: min(540px, calc(100vw - 22px));
  max-width: 540px;
  max-height: calc(100dvh - 24px);
  padding: 17px;
}
.compare-dialog[open] { display: flex; flex-direction: column; }
.compare-dialog .dialog-heading { flex: none; margin-bottom: 8px; }
.compare-scroll { overflow: auto; min-height: 0; border: 1px solid var(--line); border-radius: 8px; overscroll-behavior: contain; }
#compareTable { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
#compareTable thead { position: sticky; top: 0; z-index: 1; background: #f1f4ee; }
#compareTable th, #compareTable td { height: auto; padding: 7px 3px; }
#compareTable thead th { border-bottom: 1px solid #cdd7ca; vertical-align: top; }
#compareTable thead th:first-child { width: 18%; color: #42574b; }
#compareTable thead strong { display: block; font-size: 14px; line-height: 1.5; }
#compareTable th small { display: block; margin: 2px 0 0; font-size: 11px; font-weight: 400; line-height: 1.4; color: #586b5f; overflow-wrap: anywhere; }
#compareTable th[data-chart="annual"] { background: #f6efe2; color: #7b552b; }
#compareTable th[data-chart="xuankong"] { background: #e9f0f3; color: #365869; }
#compareTable th[scope="row"] { border-right: 1px solid var(--line); background: #f6f8f2; color: #334e3d; }
#compareTable th[scope="row"] strong { display: block; font-size: 13px; font-weight: 600; }
#compareTable td { color: #304b3a; font-size: 13px; line-height: 1.4; }
#compareTable td span { display: block; }
#compareTable td[data-chart="annual"] { color: #785225; }
#compareTable td[data-chart="xuankong"] { color: #36596c; }
.xk-key { display:block; font-size:11px; line-height:1.4; color:#526875; }
.chart-context .xk-key { margin:1px 0 2px; }
.compare-dialog .xk-key { margin:0 0 8px; }
.xk-stars {
  display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:1em 1.45em;
  justify-items:center; align-items:center; width:100%; max-width:5.15em; margin:auto;
  color:#294c61; font-size:16px; font-weight:600; font-variant-numeric:tabular-nums; line-height:1;
}
.xk-mountain { grid-area:1 / 1; }
.xk-water { grid-area:1 / 3; }
.xk-base { grid-area:2 / 2; font:600 1.44em/1 var(--serif); }
#compareTable .xk-stars { font-size:14px; }
#compareTable td[data-chart="xuankong"] { padding-block:3px; }
#compareTable tbody tr:nth-child(even) td { background: #f8f9f6; }
#compareTable td+td { border-left: 1px solid #ebeee6; }
.annual-dialog{width:min(400px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto}
.annual-year{display:flex;align-items:center;gap:12px;margin-top:12px;font-size:13px}
.annual-year input{width:120px;padding:8px 10px;border:1px solid var(--line);border-radius:5px;background:#fff;color:var(--ink);font:inherit;font-size:16px}
.annual-period{font-size:12px;margin:8px 0 12px}
.annual-grid{width:100%;table-layout:fixed;border-collapse:collapse;margin-bottom:14px;text-align:center}
.annual-grid caption{padding-bottom:5px;color:#64775e;font-size:11px;text-align:right}
.annual-grid td{padding:8px 2px;border:1px solid var(--line);background:#fcfcf7}
.annual-grid td[data-palace="中"]{background:#f5eddf}
.annual-grid span,.annual-grid strong{display:block}
.annual-grid span{font-size:11px;color:#64775e}
.annual-grid strong{margin-top:3px;color:#824728;font-size:13px}
.xk-modes{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:12px 0}
.xk-modes legend{font-size:11px;color:#687865;margin-bottom:5px}
.xk-modes label{position:relative;cursor:pointer}
.xk-modes input{position:absolute;opacity:0}
.xk-modes span{display:block;padding:8px 4px;text-align:center;border:1px solid var(--line);border-radius:5px;color:#63726d}
.xk-modes input:checked+span{color:#244c64;background:#eaf1f5;border-color:#9ab3c1;font-weight:600}
.xk-modes input:focus-visible+span{outline:2px solid var(--accent)}
.xk-dialog .xk-mode-hint{margin:-5px 0 8px;font-size:11px;color:#627367}
.xk-grid tbody tr:last-child td{border-bottom:1px solid #d3dfe0}
.xk-grid td{padding:5px 8px;background:#fafcfc;border-color:#d3dfe0}
.xk-grid td[data-palace="中"]{background:#eaf2f6}
.xk-grid .xk-palace { font-size:10px; color:#5c7075; margin-top:3px; }
.xk-grid .xk-stars span { font-size:inherit; color:inherit; }
.xk-grid .xk-stars .xk-base { font-size:1.44em; }
.xk-dialog #xkFiveNote{color:#365665;padding:6px 10px;margin:6px 0 12px;background:#eff5f7;border-left:2px solid #829fab}
.workspace-topbar .quick-toggle{position:static;flex-shrink:0;box-shadow:none;background:#fdfdf9}

.annual-dialog .dialog-heading, .compare-dialog .dialog-heading { align-items: center; }
.annual-dialog .dialog-heading .icon-button, .compare-dialog .dialog-heading .icon-button { width: 44px; height: 44px; }
.annual-dialog .select-grid label, .annual-dialog .xk-modes legend { font-size: 13px; color: #526557; }
.annual-dialog .select-grid select, .annual-year input { min-height: 44px; }
.xk-modes span { display: grid; place-items: center; min-height: 42px; }
.annual-dialog button.button-primary { min-height: 44px; }

@media (max-width: 1120px) {
  .chart-deck { flex-wrap: wrap; row-gap: 0; }
  .chart-context { margin-left: auto; }
}
@media (max-width: 800px) {
  .sidebar.folded { padding-bottom:env(safe-area-inset-bottom,0px); }
  .sidebar.folded .mobile-tabs { margin-bottom:0; }
  .sidebar.folded .mobile-tabs button { color:#506752; }
  .workspace-topbar .quick-toggle { padding:6px 8px; font-size:11px; }
  .chart-deck { display: block; padding: 4px 12px 0; }
  .chart-view-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .chart-views button, .compare-link { min-height: 43px; padding-inline: 5px; font-size: 13px; }
  .compare-link { padding-inline: 9px; }
  .chart-context { justify-content: space-between; gap: 6px; }
  .annual-dialog { width: min(440px, calc(100vw - 16px)); padding: 15px; }
  .annual-dialog .dialog-heading { margin-bottom: 6px; }
  .annual-dialog .button-primary { width: 100%; }
  .compare-dialog { width: min(520px, calc(100vw - 12px)); padding: 12px; }
  #compareTable thead strong { font-size: 13px; }
  #compareTable th, #compareTable td { padding-block: 5px; }
  #compareTable th[scope="row"] { line-height: 1.25; }
  #compareTable td[data-chart="xuankong"] { font-size: 12px; }
  body:has(#chartDeck:not([hidden])) .sidebar { max-height: min(28dvh, 218px); }
}
@media (max-width: 800px) and (max-height: 540px) and (orientation: landscape) {
  body:has(#chartDeck:not([hidden])) .app-header { height: 44px; }
  .chart-signature { padding-block: 3px max(3px,env(safe-area-inset-bottom,0px)); }
  body:has(#chartDeck:not([hidden])) .app-layout { flex-direction: row; }
  body:has(#chartDeck:not([hidden])) .sidebar { width: 185px; max-height: 100%; border-inline-start: 1px solid var(--line); }
  .chart-entry { gap: 4px; }
  .chart-action { grid-template-columns: minmax(0,1fr) auto; column-gap: 4px; }
  .chart-action .layer-dot { display: none; }
  .chart-action span { grid-area: 1 / 1; white-space: nowrap; }
  .chart-action .chart-action-label { grid-area: 1 / 2; padding: 3px 4px; }
  .chart-action small { grid-area: 2 / 1 / 3 / -1; margin-top: 2px; word-break: keep-all; overflow-wrap: anywhere; }
  .chart-entry .layer-switch { min-width: 44px; gap: 3px; }
}
@media (min-width: 640px) and (max-width: 800px) and (max-height: 540px) and (orientation: landscape) {
  .chart-deck {
    display: grid; grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "tabs edit" "summary summary"; gap: 0 8px;
  }
  .chart-view-row { grid-area: tabs; }
  .chart-context { display: contents; }
  .chart-context > div {
    grid-area: summary; display: flex; flex-wrap: wrap; align-items: baseline;
    column-gap: 10px; padding: 1px 0 3px;
  }
  .chart-context .xk-key { margin: 0; }
  .chart-edit { grid-area: edit; }

  /* Expanded landscape keeps the full height of the frame available to the dial. */
  .canvas-expanded:has(#chartDeck:not([hidden])) .app-header { display: none; }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) {
    display: grid; grid-template-columns: 184px minmax(0,1fr); grid-template-rows: auto minmax(0,1fr);
  }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) .workspace-topbar {
    grid-area: 1 / 1; display: grid; grid-template-columns: 1fr 1fr;
    height: auto; padding: 5px 8px; gap: 4px;
  }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) .workspace-label { display: none; }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) .button-export { grid-column: 1 / -1; }
  .canvas-expanded #chartDeck {
    grid-area: 2 / 1; display: flex; flex-direction: column; align-items: stretch;
    justify-content: flex-start; gap: 3px; padding: 4px 8px; overflow: auto;
  }
  .canvas-expanded .chart-view-row { grid-template-columns: 1fr; gap: 3px; }
  .canvas-expanded .chart-views button { padding-inline: 2px; font-size: 12px; }
  .canvas-expanded .chart-context { display: flex; flex-direction: column; align-items: stretch; margin: 0; }
  .canvas-expanded .chart-context > div { padding: 0; }
  .canvas-expanded .chart-edit-face { width: 100%; }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) .canvas-container { grid-area: 1 / 2 / -1 / 3; }
  .canvas-expanded .workspace:has(#chartDeck:not([hidden])) .canvas-toolbar { bottom: max(5px, env(safe-area-inset-bottom, 0px)); }
}

@media (max-width:350px) {
  .chart-signature { --signature-gap:4px; padding-inline:4px; }
  .compare-dialog .chart-signature { display:grid;grid-template-columns:auto auto;align-items:baseline;justify-content:center; }
  .compare-dialog .signature-account { grid-area:1 / 2; }
  .compare-dialog .signature-verse { grid-area:2 / 1 / 3 / -1; text-align:center;border:0;padding:0; }
}
