:root {
  color-scheme: dark;
  --paper: #080807;
  --surface: #141412;
  --surface-muted: #1b1b18;
  --surface-soft: #20201c;
  --surface-raised: #292923;
  --ink: #e4e1cf;
  --ink-strong: #f4f0de;
  --ink-soft: #c8c4b3;
  --muted: #969283;
  --line: rgba(228, 225, 207, 0.14);
  --line-strong: rgba(228, 225, 207, 0.3);
  --cinnabar: #d06a4f;
  --cinnabar-soft: rgba(208, 106, 79, 0.14);
  --jade: #75ad92;
  --jade-soft: rgba(117, 173, 146, 0.13);
  --brass: #c6a86f;
  --brass-soft: rgba(198, 168, 111, 0.14);
  --violet: #aa91c8;
  --danger: #e0746b;
  --radius: 6px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--paper);
}

body {
  min-width: 0;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(228, 225, 207, 0.024) 1px, transparent 1px),
    linear-gradient(180deg, rgba(228, 225, 207, 0.024) 1px, transparent 1px);
  background-size: 72px 72px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button,
input,
select,
a,
[tabindex] {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only,
.clipboard-helper {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #090908;
  background: var(--ink-strong);
  border-radius: var(--radius);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 188px;
  min-height: 188px;
  overflow: hidden;
  background-color: #0d0d0b;
  background-image:
    linear-gradient(90deg, rgba(228, 225, 207, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(228, 225, 207, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  border-bottom: 1px solid var(--line-strong);
}

.brand-banner-art,
.brand-banner-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.brand-banner-art {
  z-index: 0;
  opacity: 0.88;
}

.brand-banner-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.brand-banner-canvas {
  z-index: 1;
}

.app-header-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  width: min(1760px, calc(100% - 28px));
  height: 100%;
  margin: 0 auto;
  padding: 22px 0;
}

.brand-block,
.brand-subtitle,
.header-signals,
.status-strip,
.panel-actions,
.action-row,
.option-line,
.check-line,
.date-stepper,
.transit-toolbar {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(17, 17, 15, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.brand-orbit {
  position: absolute;
  width: 47px;
  height: 27px;
  border: 1px solid rgba(117, 173, 146, 0.55);
  border-radius: 50%;
  transform: rotate(-28deg);
  animation: brand-orbit-turn 18s linear infinite;
}

.brand-core {
  position: relative;
  z-index: 1;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #10100e;
  background: var(--ink-strong);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
}

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

.brand-title {
  color: var(--ink-strong);
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 2px 16px var(--paper);
}

.brand-title sup {
  margin-left: 3px;
  color: var(--cinnabar);
  font-family: var(--sans);
  font-size: 13px;
}

.brand-subtitle {
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-credit {
  padding-left: 9px;
  color: var(--brass);
  border-left: 1px solid var(--line-strong);
  text-transform: none;
}

.header-signals {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: min(580px, 48vw);
  min-width: 0;
}

.status-strip {
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(20, 20, 18, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--muted);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(150, 146, 131, 0.09);
}

.status-dot.ready {
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-soft);
}

.status-dot.working {
  background: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 116, 107, 0.12);
}

.toast {
  flex: 1 1 auto;
  width: max-content;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 13px;
  color: var(--ink-strong);
  background: #20201c;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--jade);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(740px, 1fr) minmax(360px, 410px);
  gap: 10px;
  align-items: start;
  width: min(1760px, calc(100% - 28px));
  margin: 10px auto 22px;
}

.control-panel,
.chart-panel,
.reading-panel {
  min-width: 0;
  background: rgba(16, 16, 14, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: panel-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.control-panel {
  position: sticky;
  top: 10px;
  padding: 17px;
}

.chart-panel,
.reading-panel {
  height: clamp(760px, calc(100dvh - 108px), 900px);
  min-height: 0;
  padding: 13px;
}

.chart-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.reading-panel {
  position: sticky;
  top: 10px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: 900px;
  animation-delay: 90ms;
}

.section-heading,
.panel-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  display: block;
  margin-bottom: 16px;
}

.panel-toolbar {
  min-height: 44px;
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.eyebrow span {
  margin-right: 7px;
  color: var(--cinnabar);
}

h1,
h2 {
  margin: 0;
  color: var(--ink-strong);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.25;
}

.input-form {
  display: grid;
  gap: 12px;
}

.segmented-field,
.lunar-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: #0d0d0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented-field legend,
.lunar-fields legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.segmented-field label {
  position: relative;
  min-width: 0;
}

.segmented-field input {
  position: absolute;
  opacity: 0;
}

.segmented-field span {
  display: grid;
  min-height: 44px;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.segmented-field input:checked + span {
  color: var(--ink-strong);
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.segmented-field input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field > span,
.transit-date-field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.field input,
.field select,
.transit-date-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 11px;
  color: var(--ink-strong);
  background: #0e0e0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
}

.field input:hover,
.field select:hover,
.transit-date-field input:hover {
  border-color: var(--line-strong);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.82) sepia(0.1);
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.birth-meta-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(66px, 0.42fr);
}

.lunar-fields {
  display: grid;
  grid-template-columns: minmax(80px, 1.25fr) minmax(66px, 1fr) minmax(58px, 0.8fr);
  gap: 7px;
}

.option-line {
  position: relative;
  min-height: 44px;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  background: #0e0e0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.check-line {
  gap: 8px;
  min-height: 44px;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.check-line input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--jade);
}

.info-wrap {
  position: relative;
  display: inline-flex;
}

.info-button {
  display: grid;
  width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
}

.info-button::before {
  display: grid;
  width: 20px;
  height: 20px;
  content: "";
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.info-button {
  text-indent: -999px;
}

.info-button::after {
  position: absolute;
  content: "i";
  text-indent: 0;
}

.info-tooltip {
  position: absolute;
  z-index: 30;
  right: -8px;
  bottom: calc(100% + 8px);
  width: 230px;
  padding: 10px 11px;
  visibility: hidden;
  color: var(--ink-soft);
  background: #252520;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.65;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.info-wrap:hover .info-tooltip,
.info-wrap:focus-within .info-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.action-row {
  gap: 8px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.primary-action {
  flex: 1 1 auto;
  color: #11110f;
  background: var(--ink-strong);
  border: 1px solid var(--ink-strong);
}

.secondary-action {
  flex: 0 1 94px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.primary-action:hover:not(:disabled) {
  background: #fffced;
}

.secondary-action:hover:not(:disabled) {
  color: var(--ink-strong);
  background: var(--surface-soft);
}

.primary-action svg,
.secondary-action svg,
.icon-action svg,
.date-step svg,
.today-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-list {
  display: grid;
  gap: 0;
  margin: 17px 0 0;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.stat-list > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(228, 225, 207, 0.07);
}

.stat-list dt,
.stat-list dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.stat-list dt {
  color: var(--muted);
}

.stat-list dd {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  text-align: right;
}

.model-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 9px;
  color: var(--jade);
  background: var(--jade-soft);
  border: 1px solid rgba(117, 173, 146, 0.32);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.transit-toolbar {
  min-width: 0;
  justify-content: center;
  gap: 5px;
  margin-bottom: 6px;
  padding: 4px;
  background: #0d0d0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.date-stepper {
  flex: 0 0 auto;
  gap: 3px;
}

.date-step,
.today-action,
.icon-action {
  display: grid;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.date-step:hover:not(:disabled),
.today-action:hover:not(:disabled),
.icon-action:hover:not(:disabled) {
  color: var(--ink-strong);
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.transit-date-field {
  display: grid;
  flex: 0 1 178px;
  min-width: 150px;
  gap: 3px;
}

.transit-date-field > span {
  text-align: center;
}

.transit-date-field input {
  min-height: 44px;
  text-align: center;
}

.scope-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 5px;
  padding: 2px;
  background: #0d0d0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scope-tabs button {
  min-width: 0;
  min-height: 44px;
  padding: 0 7px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.scope-tabs button:hover {
  color: var(--ink-soft);
  background: var(--surface);
}

.scope-tabs button[aria-selected="true"] {
  color: var(--ink-strong);
  background: var(--surface-soft);
  border-color: var(--line-strong);
  box-shadow: inset 0 -2px 0 var(--cinnabar);
}

.scope-summary {
  min-height: 24px;
  padding: 3px 8px;
  color: var(--brass);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
}

.chart-shell {
  height: auto;
  min-height: 0;
  padding: 6px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #090908;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scrollbar-color: var(--surface-raised) transparent;
  scrollbar-width: thin;
}

.palace-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  grid-template-rows: repeat(4, minmax(160px, auto));
  grid-auto-flow: row;
  gap: 4px;
  min-width: 740px;
  min-height: 700px;
}

.palace-cell,
.chart-center {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.palace-cell {
  position: relative;
  display: grid;
  gap: 3px;
  align-content: start;
  min-height: 160px;
  padding: 6px;
  overflow: hidden;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.palace-cell:hover {
  z-index: 2;
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.palace-cell.life {
  border-color: rgba(208, 106, 79, 0.62);
  box-shadow: inset 2px 0 0 var(--cinnabar);
}

.palace-cell.body {
  border-color: rgba(117, 173, 146, 0.58);
  box-shadow: inset -2px 0 0 var(--jade);
}

.palace-cell.life.body {
  box-shadow: inset 2px 0 0 var(--cinnabar), inset -2px 0 0 var(--jade);
}

.palace-cell.scope-origin {
  background: #1c1b17;
  outline: 1px solid rgba(198, 168, 111, 0.58);
  outline-offset: -3px;
}

.palace-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.palace-top > div:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.palace-name {
  color: var(--ink-strong);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.palace-branch {
  margin-top: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.palace-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
}

.palace-tag {
  display: inline-grid;
  min-width: 21px;
  min-height: 21px;
  padding: 0 3px;
  place-items: center;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
}

.life-tag {
  color: #f4a58f;
  border-color: rgba(208, 106, 79, 0.52);
}

.body-tag {
  color: #9bd2b7;
  border-color: rgba(117, 173, 146, 0.52);
}

.original-tag {
  color: var(--brass);
  border-color: rgba(198, 168, 111, 0.5);
}

.scope-palace {
  display: flex;
  min-height: 22px;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  color: var(--ink-soft);
  background: rgba(198, 168, 111, 0.07);
  border-left: 2px solid rgba(198, 168, 111, 0.48);
  font-size: 11px;
  font-weight: 700;
}

.scope-palace span {
  color: var(--brass);
  font-size: 10px;
}

.scope-palace.current {
  color: var(--ink-strong);
  background: var(--brass-soft);
  border-left-color: var(--brass);
}

.star-group,
.flow-stars,
.adjective-stars,
.twelve-gods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
}

.star-item {
  display: inline-flex;
  min-height: 19px;
  align-items: center;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.major-stars .star-name {
  color: var(--ink-strong);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
}

.minor-stars .soft .star-name,
.flow-stars .soft .star-name {
  color: #99c5b0;
}

.minor-stars .tough .star-name,
.flow-stars .tough .star-name {
  color: #e4917c;
}

.minor-stars .flower .star-name,
.flow-stars .flower .star-name {
  color: #d1a4bd;
}

.minor-stars .lucun .star-name,
.flow-stars .lucun .star-name,
.minor-stars .tianma .star-name,
.flow-stars .tianma .star-name {
  color: var(--brass);
}

.star-item small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.mutagen {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: #10100e;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.mutagen-禄 {
  background: #92be80;
}

.mutagen-权 {
  background: #d4906f;
}

.mutagen-科 {
  background: #82aecd;
}

.mutagen-忌 {
  color: var(--ink-strong);
  background: #765e84;
}

.borrowed {
  color: var(--muted);
  font-size: 11px;
}

.flow-stars {
  padding: 3px 4px;
  background: rgba(117, 173, 146, 0.055);
  border: 1px solid rgba(117, 173, 146, 0.13);
  border-radius: 3px;
}

.group-label {
  color: var(--jade);
  font-size: 9px;
  font-weight: 800;
}

.flow-star .star-name {
  color: #a8d2bd;
  font-weight: 700;
}

.adjective-stars span,
.twelve-gods span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.adjective-stars span::after,
.twelve-gods span::after {
  margin-left: 4px;
  content: "·";
  color: rgba(228, 225, 207, 0.22);
}

.adjective-stars span:last-child::after,
.twelve-gods span:last-child::after {
  content: "";
}

.twelve-gods {
  padding-top: 2px;
  border-top: 1px solid rgba(228, 225, 207, 0.07);
}

.twelve-gods .flow-god {
  color: var(--brass);
}

.palace-footer {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding-top: 3px;
  color: var(--muted);
  border-top: 1px solid rgba(228, 225, 207, 0.07);
  font-size: 11px;
  line-height: 1.35;
}

.palace-footer .ages {
  overflow-wrap: anywhere;
  color: #aaa694;
}

.chart-center {
  position: relative;
  display: grid;
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  gap: 8px;
  align-content: center;
  padding: 14px;
  overflow: hidden;
  background-color: #11110f;
  background-image:
    linear-gradient(45deg, transparent 49.7%, rgba(208, 106, 79, 0.18) 50%, transparent 50.3%),
    linear-gradient(-45deg, transparent 49.7%, rgba(117, 173, 146, 0.16) 50%, transparent 50.3%);
}

.center-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.center-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  color: #11110e;
  background: var(--ink-strong);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
}

.center-heading strong,
.center-heading span {
  display: block;
}

.center-heading strong {
  color: var(--ink-strong);
  font-family: var(--serif);
  font-size: 20px;
}

.center-heading div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.center-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 12px;
  width: min(100%, 450px);
  margin: 0 auto;
}

.center-details > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 7px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(228, 225, 207, 0.08);
}

.center-details dt,
.center-details dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.center-details dt {
  color: var(--muted);
}

.center-details dd {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}

.center-scopes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: min(100%, 450px);
  margin: 0 auto;
}

.center-scopes span {
  min-width: 0;
  padding: 6px 7px;
  overflow-wrap: anywhere;
  color: var(--muted);
  background: rgba(20, 20, 18, 0.84);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

.center-scopes span.active {
  color: var(--ink-strong);
  background: var(--brass-soft);
  border-color: rgba(198, 168, 111, 0.45);
}

.center-scopes b {
  margin-right: 4px;
  color: var(--brass);
}

.panel-actions {
  gap: 4px;
}

.danger-action {
  color: var(--danger);
}

.stage-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
}

.stage-item {
  display: flex;
  min-width: 0;
  min-height: 31px;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  overflow: hidden;
  color: var(--muted);
  background: #0e0e0c;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-index {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.stage-item.running {
  color: var(--ink-soft);
  border-color: rgba(198, 168, 111, 0.38);
}

.stage-item.running .stage-index {
  color: #11110e;
  background: var(--brass);
  border-color: var(--brass);
  animation: pulse 1.35s ease-in-out infinite;
}

.stage-item.complete {
  color: #9bd2b7;
  border-color: rgba(117, 173, 146, 0.32);
}

.stage-item.complete .stage-index {
  color: #10100e;
  background: var(--jade);
  border-color: var(--jade);
}

.stage-item.error,
.stage-item.cancelled {
  color: #e7a39c;
  border-color: rgba(224, 116, 107, 0.34);
}

.stage-item.error .stage-index,
.stage-item.cancelled .stage-index {
  color: #12100f;
  background: var(--danger);
  border-color: var(--danger);
}

.reading-state,
.reading-content {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.reading-state {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.reading-state p {
  max-width: 260px;
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}

.empty-mark {
  position: relative;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.empty-mark::before,
.empty-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 1px;
  content: "";
  background: var(--line-strong);
  transform-origin: center;
}

.empty-mark::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.empty-mark::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.reading-state.loading .empty-mark {
  border-color: rgba(198, 168, 111, 0.5);
  border-top-color: var(--brass);
  animation: spin 1.1s linear infinite;
}

.reading-state.error .empty-mark {
  border-color: rgba(224, 116, 107, 0.52);
}

.reading-content {
  max-height: calc(100dvh - 160px);
  padding: 17px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.8;
  scrollbar-color: var(--surface-raised) transparent;
  scrollbar-width: thin;
}

.reading-content > :first-child {
  margin-top: 0;
}

.reading-content h1,
.reading-content h2,
.reading-content h3,
.reading-content h4,
.reading-content h5,
.reading-content h6 {
  color: var(--ink-strong);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.45;
}

.reading-content h1 {
  margin: 0 0 16px;
  font-size: 21px;
}

.reading-content h2 {
  margin: 25px 0 11px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 19px;
}

.reading-content h3 {
  margin: 21px 0 9px;
  font-size: 17px;
}

.reading-content h3::before {
  display: inline-block;
  width: 11px;
  height: 2px;
  margin-right: 7px;
  vertical-align: middle;
  content: "";
  background: var(--cinnabar);
}

.reading-content h4 {
  margin: 17px 0 7px;
  color: var(--brass);
  font-size: 15px;
}

.reading-content p {
  margin: 0 0 12px;
}

.reading-content ul,
.reading-content ol {
  margin: 0 0 14px;
  padding-left: 21px;
}

.reading-content li {
  margin: 5px 0;
}

.reading-content li::marker {
  color: var(--brass);
}

.reading-content strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.reading-content em {
  color: var(--brass);
  font-family: var(--serif);
}

.reading-content a {
  color: #e28b72;
  font-weight: 700;
  text-underline-offset: 3px;
}

.reading-content blockquote {
  margin: 13px 0 16px;
  padding: 10px 12px;
  color: var(--ink-soft);
  background: rgba(117, 173, 146, 0.07);
  border-left: 2px solid rgba(117, 173, 146, 0.58);
}

.reading-content blockquote > :last-child {
  margin-bottom: 0;
}

.reading-content hr {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
  border: 0;
}

.reading-content code {
  padding: 1px 5px;
  color: var(--ink-strong);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.reading-content pre {
  margin: 13px 0 16px;
  padding: 12px;
  overflow: auto;
  background: #0b0b0a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.reading-content pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

.reading-content table {
  width: 100%;
  min-width: 420px;
  margin: 13px 0 16px;
  border-collapse: collapse;
  font-size: 12px;
}

.reading-content th,
.reading-content td {
  padding: 8px 9px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.reading-content th {
  color: var(--ink-strong);
  background: var(--surface-soft);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes brand-orbit-turn {
  from { transform: rotate(-28deg); }
  to { transform: rotate(332deg); }
}

@media (max-width: 1439px) {
  .app-header {
    height: 172px;
    min-height: 172px;
  }

  .workspace {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .chart-panel {
    height: clamp(760px, calc(100dvh - 108px), 820px);
  }

  .reading-panel {
    position: static;
    grid-column: 2;
    height: auto;
    min-height: 650px;
    max-height: none;
  }

  .reading-state,
  .reading-content {
    min-height: 570px;
  }

  .reading-content {
    max-height: 860px;
  }
}

@media (max-width: 900px) {
  .field input,
  .field select,
  .transit-date-field input {
    font-size: 16px;
  }

  .app-header {
    height: 164px;
    min-height: 164px;
  }

  .brand-banner-art {
    opacity: 0.7;
  }

  .app-header-inner {
    align-items: stretch;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    width: calc(100% - 20px);
    padding: 16px 0 14px;
  }

  .header-signals {
    flex-wrap: nowrap;
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .status-strip {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .toast {
    width: auto;
    max-width: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 20px);
  }

  .control-panel,
  .reading-panel {
    position: static;
  }

  .control-panel,
  .chart-panel,
  .reading-panel {
    height: auto;
    min-height: 0;
  }

  .chart-panel,
  .reading-panel {
    padding: 11px;
  }

  .chart-shell {
    height: clamp(500px, 68dvh, 600px);
    min-height: 0;
  }

  .reading-panel {
    grid-column: auto;
  }

  .reading-state,
  .reading-content {
    min-height: 500px;
    max-height: 720px;
  }
}

@media (max-width: 620px) {
  .brand-banner-art {
    opacity: 0.62;
  }

  .brand-title {
    font-size: 26px;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }

  .brand-orbit {
    width: 40px;
    height: 23px;
  }

  .brand-core {
    width: 33px;
    height: 33px;
    font-size: 19px;
  }

  .brand-subtitle {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    font-size: 10px;
  }

  .brand-credit {
    padding-left: 0;
    border-left: 0;
  }

  .header-signals {
    gap: 6px;
  }

  .status-strip {
    min-height: 36px;
    padding: 0 9px;
    font-size: 11px;
  }

  .toast {
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.35;
  }

  .transit-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 5px;
  }

  .transit-date-field {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .today-action {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .date-stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(44px, 1fr));
  }

  .date-stepper:first-child {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .date-stepper:last-child {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .date-step {
    width: auto;
  }

  .scope-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scope-summary {
    min-height: 39px;
    white-space: normal;
  }

  .stage-progress {
    grid-template-columns: minmax(0, 1fr);
  }

  .lunar-fields {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }

  .lunar-day-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 390px) {
  .app-header {
    height: 156px;
    min-height: 156px;
  }

  .workspace,
  .app-header-inner {
    width: calc(100% - 14px);
  }

  .app-header-inner {
    padding: 12px 0 11px;
  }

  .brand-block {
    gap: 11px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
  }

  .brand-title {
    font-size: 25px;
  }

  .status-strip {
    max-width: 158px;
  }

  .control-panel {
    padding: 14px;
  }

  .birth-meta-grid {
    grid-template-columns: minmax(0, 1fr) minmax(64px, 0.4fr);
  }

  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-action {
    flex-basis: auto;
  }

  .panel-toolbar {
    gap: 8px;
  }

  h1,
  h2 {
    font-size: 19px;
  }

  .model-chip {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reading-content {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
