:root {
  --ink: #1e2929;
  --muted: #718078;
  --paper: #f7f8f4;
  --paper-dark: #e9ede6;
  --line: #d8ded5;
  --vermilion: #c84a35;
  --vermilion-dark: #9f3628;
  --jade: #196a61;
  --jade-dark: #174a45;
  --gold: #c99b45;
  --shadow: rgba(18, 44, 39, .12);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; background: #edf1ed; }
button, input, select { font: inherit; }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1440px) / 2)); color: #f6f8f4; background: #173430; border-bottom: 2px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 18px; font-weight: 700; letter-spacing: .4px; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; color: #173430; background: #dcb15c; font-family: "Songti SC", serif; font-size: 21px; border-radius: 3px; }
.brand small { display: inline; margin-left: 8px; color: #a8c0b9; font-family: ui-monospace, monospace; font-size: 9px; font-weight: 500; letter-spacing: 1.5px; }
.topbar-note { color: #b7cac5; font-size: 12px; }
.app-shell { display: grid; grid-template-columns: 310px minmax(0, 1fr); width: min(100%, 1440px); max-width: 1440px; min-height: calc(100vh - 58px); margin: 0 auto; background: #f8faf7; box-shadow: 0 0 0 1px rgba(27, 68, 60, .04); }
.input-panel { position: sticky; top: 0; align-self: start; min-width: 0; min-height: calc(100vh - 58px); padding: 27px 25px 24px; background: #ffffff; border-right: 1px solid #e0e5df; }
.eyebrow { margin: 0 0 7px; color: var(--jade); font: 700 10px ui-monospace, monospace; letter-spacing: 1.35px; }
.panel-heading h1, .chart-toolbar h2 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: 25px; font-weight: 700; letter-spacing: 0; }
.panel-heading > p:last-child { margin: 8px 0 19px; color: var(--muted); font-size: 12px; line-height: 1.65; }
#chart-form { display: grid; gap: 13px; }
.form-section { display: grid; gap: 11px; padding: 13px; background: #f7f9f6; border: 1px solid #e3e9e2; border-radius: 5px; }
.section-label { color: var(--jade); font-size: 11px; font-weight: 700; letter-spacing: .8px; }
.field, fieldset { display: grid; gap: 6px; padding: 0; border: 0; margin: 0; }
.field > span, legend { color: #53635d; font-size: 12px; font-weight: 600; }
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
input[type=date], input[type=text], select { width: 100%; min-height: 38px; padding: 0 10px; color: var(--ink); background: #fff; border: 1px solid #d4ddd5; border-radius: 4px; outline: 0; font-size: 13px; }
input[type=date]:focus, input[type=text]:focus, select:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(25, 106, 97, .1); }
.lunar-summary { display: grid; gap: 2px; padding: 12px 14px; color: #ecf6f0; background: linear-gradient(135deg, #176d62, #24534e); border: 0; border-radius: 5px; box-shadow: 0 6px 14px rgba(22, 86, 77, .14); }
.lunar-label { color: #badbd1; font-size: 10px; }
.lunar-summary strong { font-family: "Songti SC", serif; font-size: 17px; }
.lunar-summary > span:last-child { color: #d8eee7; font-size: 11px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #d4ddd5; border-radius: 4px; overflow: hidden; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid; min-height: 36px; place-items: center; color: #65716c; background: #fff; font-size: 13px; }
.segmented input:checked + span { color: #fff; background: var(--jade); }
.check-row { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 7px; color: #43504b; cursor: pointer; font-size: 12px; }
.check-row input { width: 15px; height: 15px; accent-color: var(--jade); }
.check-row small { color: #8a918d; font-size: 11px; }
.primary-button { min-height: 42px; cursor: pointer; color: #fff; background: var(--jade); border: 1px solid #105950; border-radius: 4px; box-shadow: 0 2px 0 #105950; font-size: 13px; font-weight: 700; }
.primary-button:hover { background: #20776c; }
.method-note { margin-top: 20px; padding: 12px; background: #f4f7f3; border: 1px solid #e0e7df; border-radius: 5px; }
.method-note strong { color: var(--jade); font-size: 12px; }
.method-note p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.chart-area { min-width: 0; padding: 27px clamp(22px, 3vw, 42px) 42px; background: #f6f8f5; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1060px; margin: 0 auto 16px; }
.chart-toolbar h2 { font-size: 25px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.view-tabs { display: flex; padding: 3px; background: #e9eee9; border: 1px solid #d9e1d9; border-radius: 5px; }
.view-tab { min-width: 45px; min-height: 29px; cursor: pointer; color: #6b7873; background: transparent; border: 0; border-radius: 3px; font-size: 12px; }
.view-tab.is-active { color: #fff; background: var(--jade); box-shadow: 0 1px 2px rgba(20, 70, 62, .18); }
.icon-button { display: grid; place-items: center; width: 35px; height: 35px; cursor: pointer; color: var(--jade); background: #fff; border: 1px solid #d9e2da; border-radius: 4px; font-size: 19px; }
.icon-button:hover { color: var(--vermilion); border-color: var(--vermilion); }
.chart-frame { position: relative; max-width: 1060px; margin: auto; padding: 8px; background: #fff; box-shadow: 0 8px 22px var(--shadow); border: 1px solid #d9e1d9; border-radius: 6px; }
.chart-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); min-height: min(72vw, 780px); border: 1px solid #aac7bd; background: #fff; }
.chart-overlay { position: absolute; z-index: 4; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); pointer-events: none; overflow: visible; }
.palace { position: relative; min-width: 0; padding: 10px 10px 8px; cursor: pointer; background: #fff; border: solid #d4e0d6; border-width: 0 1px 1px 0; overflow: hidden; transition: background-color .16s ease, box-shadow .16s ease; }
.palace:hover, .palace:focus-visible { background: #f2f8f5; outline: 0; }
.palace.is-selected { box-shadow: inset 0 0 0 2px var(--jade); background: #eaf5f0; }
.palace:nth-child(4n) { border-right: 0; }
.palace:nth-child(n+13) { border-bottom: 0; }
.palace.is-ming { background: #fff7dc; box-shadow: inset 0 0 0 2px #be8840; }
.palace.is-ming .palace-name::before { content: "本"; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 3px; color: #fff9ec; background: var(--vermilion); border-radius: 50%; font-size: 9px; }
.palace.is-shen::after { content: "身"; position: absolute; right: 7px; bottom: 5px; color: #fff8ea; background: var(--vermilion); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; font-size: 11px; }
.palace-top { display: flex; justify-content: space-between; gap: 5px; color: #776d5b; font-size: 11px; }
.palace-name { color: #263934; font-weight: 700; font-size: 14px; }
.palace-branch { color: var(--vermilion); }
.stars { min-height: 54px; margin-top: 7px; color: #293430; font-size: clamp(12px, 1.4vw, 16px); line-height: 1.55; word-break: break-all; }
.stars .major { color: var(--vermilion); font-weight: 700; }
.stars .transform { color: #92641d; }
.palace-foot { position: absolute; left: 10px; bottom: 7px; color: #857861; font-size: 10px; }
.chart-center { position: absolute; z-index: 3; inset: 25.4% 25.4%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 15px; text-align: center; color: #2d3f39; background: rgba(241, 233, 214, .96); border: 1px solid #b59764; box-shadow: inset 0 0 0 5px #f8f1e1; }
.center-seal { display: grid; place-items: center; width: 62px; height: 62px; color: #fff4de; background: var(--vermilion); border: 3px double #ffd985; border-radius: 50%; font-size: 24px; font-weight: 700; }
.chart-center p { margin: 8px 0 0; font-size: 12px; }
.center-data { display: grid; gap: 2px; margin-top: 10px; color: #5f655e; font-size: 11px; }
.center-roles { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 9px; color: var(--jade); font-size: 11px; }
.center-roles span { padding: 2px 4px; background: #e6eee7; border-radius: 2px; }
.four-pillars { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 10px; color: var(--vermilion-dark); font-size: 13px; font-weight: 700; }
.four-pillars span { padding: 3px 5px; background: #f9ecd4; border: 1px solid #dbc294; }
.self-transform-flow { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 9px; font-size: 11px; font-weight: 700; }
.self-transform-flow[hidden] { display: none; }
.flow-state { display: inline-grid; place-items: center; width: 19px; height: 19px; color: #fff; border-radius: 50%; }
.flow-state.is-lu { background: #33875b; } .flow-state.is-quan { background: #a96827; } .flow-state.is-ke { background: #247fb5; } .flow-state.is-ji { background: #c34b45; }
.self-transform-flow i { color: #89938b; font-style: normal; }
.star-transform, .transform-marker { display: inline-grid; place-items: center; margin-left: 2px; color: #fff; font-style: normal; font-weight: 700; vertical-align: 1px; }
.star-transform { width: 14px; height: 14px; border-radius: 50%; font-size: 9px; }
.transform-marker { width: 15px; height: 15px; border-radius: 2px; font-size: 10px; }
.is-lu { background: #33875b; } .is-quan { background: #a96827; } .is-ke { background: #247fb5; } .is-ji { background: #c34b45; }
.chart-frame[data-mode="feixing"] .chart-center { background: rgba(246, 249, 246, .96); border-color: #92afa5; box-shadow: inset 0 0 0 5px #edf4ef; }
.chart-frame[data-mode="feixing"] .palace-foot { color: #386f8b; }
.chart-frame[data-mode="feixing"] .palace-foot i { color: #8c7d63; font-style: normal; }
.chart-frame[data-mode="transform"] .chart-center { background: rgba(255, 251, 247, .96); border-color: #d49486; box-shadow: inset 0 0 0 5px #fff1eb; }
.chart-frame[data-mode="transform"] .palace { background: #fffefd; }
.chart-frame[data-mode="transform"] .palace.is-selected { background: #fff2ee; box-shadow: inset 0 0 0 2px #c34b45; }
.chart-frame[data-mode="transform"] .palace-foot { color: #a1473f; }
.reading-strip { display: grid; grid-template-columns: .8fr .8fr .8fr 2.3fr; max-width: 980px; margin: 18px auto 0; background: #f9f5ea; border: 1px solid var(--line); }
.reading-strip > div { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--line); }
.reading-strip > div:last-child { border-right: 0; }
.reading-strip span { display: block; color: var(--muted); font-size: 11px; }
.reading-strip strong { display: block; margin-top: 5px; color: var(--jade); font-size: 14px; line-height: 1.55; }
.transform-list { display: flex !important; flex-wrap: wrap; gap: 5px; white-space: normal; }
.transformation-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px; color: #654f2c; background: #f3e6c8; border: 1px solid #dfc48d; border-radius: 2px; font-size: 12px; white-space: nowrap; }
.transformation-chip b { display: inline-grid; place-items: center; width: 16px; height: 16px; color: #fff; background: var(--vermilion); border-radius: 50%; font-size: 10px; }
.transformation-chip.is-禄 b { background: #43845c; }
.transformation-chip.is-权 b { background: #ab6a1e; }
.transformation-chip.is-科 b { background: #3f749c; }
.inspector-panel { display: grid; gap: 10px; max-width: 980px; margin: 18px auto 0; padding: 15px 16px; background: #edf2eb; border: 1px solid #b8c9bc; border-left: 4px solid var(--jade); }
.inspector-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.inspector-heading h3 { margin: 0; font-size: 17px; }
.inspector-heading > span { color: var(--jade); font-size: 12px; font-weight: 700; }
.detail-stars { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-star { padding: 4px 7px; color: #4e5c55; background: #fffdf6; border: 1px solid #d3dfd3; border-radius: 2px; font-size: 13px; }
.detail-star.is-major { color: var(--vermilion); border-color: #e4baad; font-weight: 700; }
.detail-star.is-transform { color: #8a611f; background: #fff1d8; border-color: #d9b36e; }
.detail-copy { margin: 0; color: #607068; font-size: 12px; line-height: 1.65; }
.detail-empty { color: var(--muted); font-size: 13px; }
.timeline-panel { max-width: 980px; margin: 20px auto 0; padding: 16px; background: #f9f5ea; border: 1px solid var(--line); }
.timeline-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 12px; }
.timeline-heading h3 { margin: 0; font-size: 17px; }
.timeline-heading > span { color: var(--muted); font-size: 12px; }
.timeline-scroll { overflow-x: auto; border: 1px solid #d3c6af; }
.timeline-table { width: 100%; min-width: 720px; border-collapse: collapse; background: #fffdf7; table-layout: fixed; }
.timeline-table th, .timeline-table td { padding: 9px 6px; text-align: center; border: solid #ded3be; border-width: 0 1px 1px 0; font-size: 11px; }
.timeline-table tr:last-child > * { border-bottom: 0; }
.timeline-table tr > *:last-child { border-right: 0; }
.timeline-table th { width: 54px; color: #fff7e7; background: #3d6f65; font-size: 12px; }
.timeline-table td { padding: 0; color: #565f59; }
.cycle-cell { width: 100%; min-height: 35px; padding: 7px 5px; cursor: pointer; color: inherit; background: transparent; border: 0; font: inherit; }
.cycle-cell:hover, .cycle-cell:focus-visible { color: var(--vermilion-dark); background: #f7ecd8; outline: 2px solid rgba(182, 64, 42, .36); outline-offset: -2px; }
.cycle-cell.is-selected { color: var(--vermilion-dark); background: #f9dfb5; box-shadow: inset 0 0 0 2px #c28035; font-weight: 700; }
.cycle-detail { margin-top: 12px; padding: 10px 12px; color: #52625a; background: #eef3ee; border-left: 3px solid var(--jade); font-size: 12px; line-height: 1.55; }
@media (max-width: 900px) { .app-shell { grid-template-columns: 1fr; } .input-panel { position: static; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .chart-grid { min-height: 92vw; } .topbar-note { display: none; } }
@media (max-width: 590px) {
  .topbar { min-height: 56px; padding: 0 16px; overflow: hidden; }
  .brand { flex-shrink: 0; font-size: 16px; }
  .brand small, .topbar-note { display: none; }
  .app-shell { display: block; min-width: 0; width: 100%; }
  .input-panel, .chart-area { width: 100%; padding: 22px 16px; }
  .input-panel { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading h1 { font-size: 28px; }
  .panel-heading > p:last-child { margin-bottom: 16px; }
  .form-section { padding: 12px; }
  .time-fields { grid-template-columns: 1fr; }
  .chart-toolbar { align-items: start; }
  .toolbar-actions { align-items: end; flex-direction: column-reverse; }
  .view-tabs { transform: scale(.92); transform-origin: right top; }
  .chart-frame { padding: 5px; }
  .palace { padding: 6px 5px; }
  .palace-top { font-size: 9px; }
  .palace-name { font-size: 11px; }
  .stars { min-height: 28px; font-size: 10px; line-height: 1.35; }
  .palace-foot { left: 5px; bottom: 4px; font-size: 8px; }
  .chart-center { inset: 25.4%; padding: 5px; }
  .center-seal { width: 38px; height: 38px; font-size: 16px; }
  .chart-center p { margin-top: 4px; font-size: 8px; }
  .center-data, .four-pillars, .center-roles { display: none; }
  .self-transform-flow { gap: 2px; margin-top: 5px; font-size: 8px; }
  .flow-state { width: 13px; height: 13px; font-size: 8px; }
  .star-transform, .transform-marker { width: 11px; height: 11px; font-size: 7px; }
  .reading-strip { grid-template-columns: 1fr 1fr; }
  .reading-strip > div:nth-child(2) { border-right: 0; }
  .reading-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .inspector-panel, .timeline-panel { padding: 12px; }
  .inspector-heading, .timeline-heading { align-items: start; flex-direction: column; gap: 5px; }
  .transform-list { gap: 3px; }
  .transformation-chip { font-size: 11px; }
}
@media print { .topbar, .input-panel, .chart-toolbar .icon-button { display: none; } body { background: white; } .app-shell { display: block; } .chart-area { padding: 0; } .chart-toolbar { margin: 0 0 10px; } .chart-frame { box-shadow: none; } }

/* Refined workspace layout */
:root {
  --ink: #172b2b;
  --muted: #74827c;
  --paper: #f5f7f4;
  --line: #dce4de;
  --jade: #176b62;
  --jade-dark: #0f514b;
  --vermilion: #b94836;
  --gold: #c89e4f;
  --shadow: rgba(22, 53, 47, .08);
}
body { background: #eef2ee; color: var(--ink); }
.chart-page {
  background-color: #e8ece8;
  background-image: var(--chart-background-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
.chart-page-shell { background: transparent; }
.topbar { min-height: 52px; padding-inline: clamp(18px, 3vw, 48px); background: #143b38; border-bottom: 1px solid #c69e50; }
.brand { font-size: 16px; }
.brand-mark { width: 28px; height: 28px; font-size: 18px; }
.app-shell { grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 52px); background: #f7f9f6; }
.input-panel { min-height: calc(100vh - 52px); padding: 24px 20px 20px; background: #fbfcfa; border-right: 1px solid #e0e7e1; }
.panel-heading h1 { font-size: 27px; letter-spacing: -.02em; }
.panel-heading > p:last-child { margin: 5px 0 15px; font-size: 11px; }
#chart-form { gap: 10px; }
.form-section { gap: 9px; padding: 12px; background: #f5f8f5; border: 1px solid #e2e9e3; border-radius: 8px; }
.section-label { font-size: 10px; }
.field > span, legend { font-size: 11px; }
input[type=date], input[type=text], select { min-height: 35px; border-color: #d4dfd7; border-radius: 6px; font-size: 12px; }
.lunar-summary { padding: 11px 13px; border-radius: 8px; box-shadow: 0 7px 18px rgba(22, 86, 77, .12); }
.lunar-summary strong { font-size: 16px; }
.segmented span { min-height: 34px; font-size: 12px; }
.check-row { font-size: 11px; }
.primary-button { min-height: 40px; border-radius: 7px; box-shadow: 0 2px 0 #0d554e; }
.method-note { margin-top: 14px; padding: 11px; border-radius: 8px; }
.chart-area { padding: 25px clamp(18px, 3vw, 44px) 38px; background: rgba(241, 244, 241, .84); }
.chart-toolbar { max-width: 1080px; margin-bottom: 12px; }
.chart-toolbar h2 { font-size: 24px; letter-spacing: -.02em; }
.chart-status { display: inline-block; margin-left: 8px; color: var(--jade); font-size: 11px; font-weight: 600; opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease; }
.chart-status.is-visible { opacity: 1; transform: translateY(0); }
.view-tabs { padding: 2px; border-radius: 7px; }
.view-tab { min-height: 28px; border-radius: 5px; }
.icon-button { width: 33px; height: 33px; border-radius: 7px; }
.chart-frame { max-width: 1080px; padding: 6px; border-color: #d4ded7; border-radius: 10px; box-shadow: 0 12px 30px var(--shadow); }
.chart-grid { min-height: min(68vw, 760px); border-color: #b9cec3; }
.chart-grid > .palace { border-width: 0 1px 1px 0; }
.chart-grid > .palace[data-column="4"] { border-right: 0; }
.chart-grid > .palace[data-column="1"],
.chart-grid > .palace[data-column="2"],
.chart-grid > .palace[data-column="3"] { border-right-width: 1px; }
.chart-grid > .palace[data-column="3"]::before { content: ""; position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; width: 1px; background: #d9e4dc; pointer-events: none; }
.chart-grid > .palace[data-row="4"] { border-bottom: 0; }
.chart-grid > .palace[data-row="2"][data-column="2"],
.chart-grid > .palace[data-row="2"][data-column="3"],
.chart-grid > .palace[data-row="3"][data-column="2"],
.chart-grid > .palace[data-row="3"][data-column="3"] { border: 0; }
.chart-frame.is-generating { animation: chartGenerate .78s cubic-bezier(.22,.8,.32,1); }
.chart-frame.is-mode-switch { animation: chartModeSwitch .68s cubic-bezier(.22,.8,.32,1); }
.chart-frame.is-generating .chart-grid > .palace { animation: palaceReveal .48s both; }
.chart-frame.is-generating .chart-grid > .palace:nth-child(2n) { animation-delay: .045s; }
.chart-frame.is-generating .chart-grid > .palace:nth-child(3n) { animation-delay: .09s; }
@keyframes chartGenerate { 0% { opacity: .5; transform: translateY(8px) scale(.985); filter: saturate(.6); } 60% { opacity: 1; transform: translateY(0) scale(1.008); filter: saturate(1.2); } 100% { transform: scale(1); filter: saturate(1); } }
@keyframes chartModeSwitch { 0% { opacity: .65; transform: scale(.992); } 55% { opacity: 1; transform: scale(1.006); } 100% { transform: scale(1); } }
@keyframes palaceReveal { 0% { opacity: 0; transform: translateY(5px); } 100% { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.palace { padding: 9px 9px 7px; border-color: #d9e4dc; }
.palace:hover, .palace:focus-visible { background: #f0f7f3; }
.palace.is-selected { box-shadow: inset 0 0 0 2px var(--jade); }
.palace.is-ming { background: #fff8e6; box-shadow: inset 0 0 0 2px #c8953f; }
.palace.is-cycle { background: #eaf5f1; box-shadow: inset 0 0 0 2px #4f9c8e; }
.palace.is-cycle.is-ming { background: #fff1d0; box-shadow: inset 0 0 0 2px #c68434; }
.palace-top { font-size: 10px; }
.palace-name { font-size: 13px; }
.stars { min-height: 50px; margin-top: 6px; font-size: clamp(11px, 1.25vw, 15px); line-height: 1.45; }
.palace-foot { left: 9px; bottom: 6px; color: #6d7e76; font-size: 9px; }
.palace-foot i { color: #8b7860; font-style: normal; }
.chart-center { inset: 25.4%; padding: 13px; background: rgba(249, 247, 240, .96); border-color: #b8a170; box-shadow: inset 0 0 0 4px #faf4e4; }
.center-seal { width: 56px; height: 56px; font-size: 22px; }
.center-data { margin-top: 8px; font-size: 10px; }
.center-roles { margin-top: 7px; font-size: 10px; }
.four-pillars { margin-top: 8px; font-size: 12px; }
.reading-strip, .inspector-panel, .timeline-panel { max-width: 1000px; border-radius: 8px; }
.reading-strip { margin-top: 15px; background: #fbfaf5; }
.reading-strip > div { padding: 11px 13px; }
.inspector-panel { margin-top: 15px; padding: 13px 14px; background: #f4f8f4; border-color: #c9dbcf; border-left-width: 3px; }
.inspector-heading h3, .timeline-heading h3 { font-size: 16px; }
.detail-star { padding: 3px 6px; font-size: 12px; border-radius: 5px; }
.timeline-panel { margin-top: 16px; padding: 14px; background: #fbfaf5; }
.timeline-heading { padding-bottom: 10px; }
.timeline-scroll { border-color: #ccd9d0; border-radius: 6px; }
.timeline-table { background: #fffefa; }
.timeline-table th { background: #246b62; }
.timeline-table th, .timeline-table td { font-size: 10px; }
.cycle-cell { min-height: 33px; padding: 6px 4px; }
.cycle-cell.is-selected { color: #8f3d2e; background: #f5dfb8; box-shadow: inset 0 0 0 2px #bd8640; }
.cycle-detail { margin-top: 10px; padding: 9px 11px; border-radius: 0 5px 5px 0; font-size: 11px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .input-panel { min-height: auto; padding: 20px clamp(16px, 4vw, 30px); }
  .chart-grid { min-height: 92vw; }
}
@media (max-width: 590px) {
  .input-panel, .chart-area { padding: 18px 16px; }
  .panel-heading h1 { font-size: 25px; }
  .form-section { padding: 11px; }
  .time-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .time-fields select { padding-inline: 7px; font-size: 11px; }
  .chart-toolbar { margin-bottom: 10px; }
  .chart-toolbar h2 { font-size: 21px; }
  .chart-status { display: block; margin: 3px 0 0; font-size: 10px; }
  .chart-frame { padding: 4px; border-radius: 8px; }
  .palace { padding: 5px 4px; }
  .palace-name { font-size: 10px; }
  .stars { min-height: 27px; font-size: 9px; }
  .palace-foot { left: 4px; bottom: 3px; font-size: 7px; }
  .palace.is-cycle { box-shadow: inset 0 0 0 1.5px #4f9c8e; }
  .reading-strip > div { padding: 10px 11px; }
}

/* Separate profile and chart pages */
.profile-shell { display: block; width: 100%; max-width: none; min-height: calc(100vh - 52px); padding: 42px 20px 64px; background: #eef3ef; }
.profile-shell .input-panel { position: static; width: min(100%, 620px); min-height: auto; margin: 0 auto; padding: 30px; border: 1px solid #dce6df; border-radius: 10px; box-shadow: 0 18px 45px rgba(22, 53, 47, .08); }
.profile-shell .panel-heading { text-align: center; }
.profile-shell .panel-heading > p:last-child { margin-bottom: 22px; }
.profile-shell .method-note { margin-bottom: 0; }
.chart-source-data { display: none !important; }
.chart-page-shell { width: min(100%, 1320px); min-height: calc(100vh - 52px); margin: 0 auto; }
.chart-page .chart-area { width: 100%; padding-top: 22px; animation: chartPageEnter .72s cubic-bezier(.22,.8,.32,1) both; }
.chart-page .chart-toolbar, .chart-page .chart-frame { max-width: 1180px; }
.chart-page .reading-strip, .chart-page .inspector-panel, .chart-page .timeline-panel { max-width: 1100px; }
.chart-heading-row { display: flex; align-items: center; gap: 16px; }
.chart-heading-row h1 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: 24px; letter-spacing: 0; }
.back-button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; color: var(--jade); background: #fff; border: 1px solid #cedbd3; border-radius: 7px; text-decoration: none; font-size: 12px; font-weight: 700; transition: background-color .16s ease, border-color .16s ease, transform .16s ease; }
.back-button:hover { background: #edf6f2; border-color: #84ac9f; transform: translateX(-2px); }
.is-leaving-profile .profile-shell .input-panel { animation: profileLeave .36s ease both; }
@keyframes profileLeave { to { opacity: 0; transform: translateY(-8px) scale(.992); } }
@keyframes chartPageEnter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 590px) {
  .profile-shell { padding: 18px 12px 34px; }
  .profile-shell .input-panel { padding: 20px 16px; }
  .chart-heading-row { align-items: flex-start; gap: 9px; }
  .back-button { width: 36px; min-width: 36px; padding: 0; justify-content: center; font-size: 17px; }
  .back-button span { display: none; }
  .chart-heading-row h1 { font-size: 21px; }
}
