* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

main { min-height: calc(100svh - 9.5rem); }
[data-page-view][hidden] { display: none !important; }
[data-method-list][hidden] { display: none !important; }

body {
  --motion-x: 0px;
  --motion-y: 0px;
  --motion-scroll: 0px;
  --motion-far-x: 0px;
  --motion-far-y: 0px;
  --motion-near-x: 0px;
  --motion-near-y: 0px;
  --motion-scroll-far: 0px;
  --motion-scroll-near: 0px;
  position: relative;
  isolation: isolate;
  min-width: 320px;
  margin: 0;
  padding-left: var(--sidebar-width);
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Serif CJK SC", "Songti SC", STSong, serif;
  font-size: 16px;
  line-height: 1.65;
}

main, .site-footer { position: relative; z-index: 1; }

.ink-atmosphere {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ink-layer {
  position: absolute;
  inset: -8%;
  background-image: url("assets/divination-ink-yinyang.webp");
  background-repeat: no-repeat;
  background-position: center right;
  background-size: cover;
  filter: contrast(1.04);
  mix-blend-mode: multiply;
  will-change: transform;
}

.ink-layer-far {
  opacity: var(--atmosphere-far-opacity);
  /* 真实 GPU（Metal）实测该全屏层动画为 60 FPS，无性能问题，故保留漂移。 */
  animation: ink-drift-far 24s ease-in-out infinite alternate;
  contain: paint;
}

.ink-layer-near {
  opacity: var(--atmosphere-near-opacity);
  background-position: 78% 52%;
  animation: ink-drift-near 18s ease-in-out infinite alternate;
  contain: paint;
}

.ink-taiji-spin {
  position: absolute;
  top: clamp(-8.4rem, -9vw, -4.6rem);
  right: clamp(-4rem, -3vw, -1rem);
  width: clamp(27rem, 47vw, 40rem);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-image: url("assets/divination-bg-taiji-actual.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: grayscale(1) contrast(1.02);
  transform-origin: 50% 50%;
  will-change: transform;
}

@keyframes ink-drift-far {
  from { transform: translate3d(var(--motion-far-x), calc(var(--motion-far-y) + var(--motion-scroll-far)), 0) scale(1.03); }
  to { transform: translate3d(calc(var(--motion-far-x) + 16px), calc(var(--motion-far-y) + var(--motion-scroll-far) - 10px), 0) scale(1.065); }
}

@keyframes ink-drift-near {
  from { transform: translate3d(var(--motion-near-x), calc(var(--motion-near-y) + var(--motion-scroll-near)), 0) scale(1.08); }
  to { transform: translate3d(calc(var(--motion-near-x) - 22px), calc(var(--motion-near-y) + var(--motion-scroll-near) + 12px), 0) scale(1.12); }
}

@keyframes taiji-breathe {
  from { transform: rotate(-2deg) scale(1); }
  to { transform: rotate(2deg) scale(1.012); }
}

@keyframes ink-taiji-turn {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1); }
}


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

a { color: inherit; }

button, input, textarea { font: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(245, 241, 232, 0.96), 0 0 0 7px rgba(165, 68, 45, 0.36);
}

main:focus { outline: 0; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.5rem 0.8rem;
  color: var(--white);
  background: var(--jade-dark);
  transform: translateY(-300%);
}

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

.site-sidebar {
  position: fixed;
  z-index: 8;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  height: 100svh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(245, 241, 232, 0.96);
  backdrop-filter: blur(10px);
}

.section-wrap {
  width: min(100% - 2rem, 1100px);
  margin-inline: auto;
}

.sidebar-head {
  display: grid;
  gap: 0.85rem;
  padding: 1.4rem 1.2rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--jade-dark);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--white);
  background: var(--vermilion);
  font-size: 1rem;
  animation: seal-breathe 4.8s ease-in-out infinite;
}

@keyframes seal-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 71, 52, 0); transform: translateY(0); }
  50% { box-shadow: 0 0 0 5px rgba(168, 71, 52, 0.09); transform: translateY(-1px); }
}

.header-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.mobile-topbar, .sidebar-close { display: none; }

.line-sidebar {
  --accent-color: var(--vermilion);
  --text-color: var(--muted);
  --marker-color: #8a918b;
  --marker-length: 44px;
  --marker-gap: 12px;
  --tick-scale: 0.5;
  --max-shift: 14px;
  --item-gap: 22px;
  --font-size: 1.05rem;
  --smoothing: 100ms;
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.line-sidebar--markers { padding-left: calc(var(--marker-length) + var(--marker-gap)); }

.line-sidebar__list {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: var(--item-gap);
  margin: 0;
  padding: 1rem 0;
  list-style: none;
}

.line-sidebar__item {
  position: relative;
  min-height: 2.75rem;
  cursor: pointer;
}

.line-sidebar__item::before {
  position: absolute;
  content: "";
  inset: -6px -48px;
}

.line-sidebar__item a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  text-decoration: none;
}

.line-sidebar__label {
  display: inline-flex;
  align-items: baseline;
  color: var(--text-color);
  font-size: var(--font-size);
  line-height: 1.2;
  transform: translateX(calc(var(--effect, 0) * var(--max-shift)));
  color: color-mix(in srgb, var(--accent-color) calc(var(--effect, 0) * 100%), var(--text-color));
}

.line-sidebar__index {
  margin-right: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78em;
  opacity: calc(0.55 + var(--effect, 0) * 0.45);
}

.line-sidebar__text { font-weight: 700; }

.line-sidebar__marker {
  position: absolute;
  top: 50%;
  left: calc(-1 * var(--marker-length) - var(--marker-gap));
  width: var(--marker-length);
  height: 1px;
  background: var(--marker-color);
  background: color-mix(in srgb, var(--accent-color) calc(var(--effect, 0) * 100%), var(--marker-color));
  transform: translateY(-50%) scaleX(calc(0.7 + var(--effect, 0) * 0.5));
  transform-origin: left center;
}

.line-sidebar--markers .line-sidebar__item:not(:last-child)::after {
  position: absolute;
  top: calc(100% + var(--item-gap) / 2);
  left: calc(-1 * var(--marker-length) - var(--marker-gap));
  width: calc(var(--marker-length) * var(--tick-scale));
  height: 1px;
  content: "";
  background: var(--marker-color);
  opacity: 0.5;
  transform: translateY(-50%);
}

.line-sidebar--scale-tick .line-sidebar__item:not(:last-child)::after {
  transform: translateY(-50%) scaleX(calc(0.7 + var(--effect, 0) * 0.6));
  transform-origin: left center;
}

/* 选中/悬停态背景为深绿实心（--jade-dark），标签须用高对比色。
   原用朱红 --vermilion 叠深绿仅 2.92:1，不可读。 */
.line-sidebar__item:has(a.is-current) .line-sidebar__label,
.line-sidebar__item a:hover .line-sidebar__label,
.line-sidebar__item a:focus-visible .line-sidebar__label { color: var(--white); }

.sidebar-backdrop { display: none; }
.sidebar-backdrop[hidden] { display: none !important; }

@media (max-width: 800px) {
  body { padding-left: 0; }

  .mobile-topbar {
    position: sticky;
    z-index: 7;
    top: 0;
    display: grid;
    grid-template-columns: 2.7rem minmax(0, 1fr) auto;
    align-items: center;
    min-height: 3.75rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--line);
    background: rgba(245, 241, 232, 0.97);
    backdrop-filter: blur(10px);
  }

  .sidebar-toggle, .sidebar-close {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--jade-dark);
    background: transparent;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 1.25rem;
    line-height: 1;
  }

  .mobile-brand {
    justify-self: start;
    color: var(--jade-dark);
    font-weight: 700;
    text-decoration: none;
  }

  .mobile-date { margin: 0; color: var(--muted); font-size: 0.78rem; }

  .site-sidebar {
    width: var(--sidebar-mobile-width);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .site-sidebar { transform: translateX(0); }
  .sidebar-head { grid-template-columns: minmax(0, 1fr) auto; }
  .sidebar-head .header-date { grid-column: 1 / -1; }
  .sidebar-close { justify-self: end; }

  .sidebar-backdrop {
    position: fixed;
    z-index: 7;
    inset: 0;
    display: block;
    background: rgba(29, 41, 39, 0.48);
  }

  .line-sidebar { --max-shift: 10px; }
}

.section-wrap { padding-block: 3.5rem; }

.page-view:not([hidden]) { animation: page-arrive var(--page-enter-duration) cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.page-view:not([hidden]) .section-heading { animation: content-rise var(--content-enter-duration) 60ms cubic-bezier(0.2, 0.75, 0.2, 1) both; }

@keyframes page-arrive {
  from { opacity: 0; transform: translateY(var(--page-enter-distance)); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes content-rise {
  from { opacity: 0; transform: translateY(var(--content-enter-distance)); }
  to { opacity: 1; transform: translateY(0); }
}

.intro { padding-top: 3rem; }

.eyebrow, .method-kicker {
  margin: 0 0 0.45rem;
  color: var(--caption-color, #7d4a22);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1, h2, h3 {
  margin-top: 0;
  color: var(--jade-dark);
  line-height: 1.24;
}

h1 { margin-bottom: 1rem; font-size: 2.35rem; }
h2 { margin-bottom: 0.7rem; font-size: 1.65rem; }
h3 { margin-bottom: 0.45rem; font-size: 1.25rem; }

.intro-copy {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
}

.daily-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 2rem 0 0;
  border-block: 1px solid var(--line);
}

.daily-notes div { padding: 0.9rem 0.8rem; }
.daily-notes div { transition: color 180ms ease, background-color 180ms ease, transform 180ms ease; }
.daily-notes div:hover { color: var(--jade-dark); background: rgba(219, 230, 221, 0.58); transform: translateY(-2px); }
.daily-notes div + div { border-left: 1px solid var(--line); }
.daily-notes dt { color: var(--caption-color); font-size: 0.82rem; }
.daily-notes dd { margin: 0.18rem 0 0; font-size: 0.9rem; }

.inquiry-section { border-top: 1px solid var(--line); }

.section-heading {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.7rem;
}

.section-heading > div > :last-child, .section-heading > p { margin-bottom: 0; }
.section-heading > p { max-width: 31rem; color: var(--muted); }
.section-actions { display: grid; justify-items: start; gap: 0.7rem; }
.section-actions p { max-width: 31rem; margin: 0; color: var(--muted); }
.section-actions button { min-height: 2.75rem; padding: 0.35rem 0.7rem; font-size: 0.86rem; }

.inquiry-form, .review-form {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-form);
  backdrop-filter: blur(var(--surface-blur));
  box-shadow: var(--shadow);
}

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend, label > span, .review-form label { font-weight: 700; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.choice-card {
  position: relative;
  display: block;
  min-width: 0;
  border-radius: 4px;
  cursor: pointer;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.choice-card span {
  display: block;
  min-height: 3.1rem;
  padding: 0.72rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.choice-card:hover span { border-color: #a6b6ae; color: var(--jade-dark); }

.choice-card input:checked + span {
  border-color: var(--jade);
  color: var(--jade-dark);
  background: var(--jade-pale);
  box-shadow: inset 0 0 0 1px var(--jade);
}

.choice-card--settling span { animation: choice-card-settle 360ms cubic-bezier(0.18, 0.76, 0.2, 1) both; }

@keyframes choice-card-settle {
  0% { transform: scale(0.985); box-shadow: inset 0 0 0 1px var(--jade), 0 0 0 0 rgba(202, 168, 105, 0); }
  55% { transform: scale(1.012); box-shadow: inset 0 0 0 1px var(--jade), 0 0 0 4px rgba(202, 168, 105, 0.16); }
  100% { transform: scale(1); box-shadow: inset 0 0 0 1px var(--jade), 0 0 0 0 rgba(202, 168, 105, 0); }
}

.choice-card input:focus-visible + span {
  outline: 3px solid var(--vermilion);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(245, 241, 232, 0.96), 0 0 0 7px rgba(165, 68, 45, 0.36);
}

.form-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.form-grid label { display: grid; gap: 0.48rem; min-width: 0; }

textarea, input[type="text"], input[type="date"], input[type="datetime-local"], input[type="number"], select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #fffefa;
}

textarea, input, select { transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease; }
textarea:focus, input:focus, select:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(44, 98, 89, 0.1); }

input[type="time"] {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #fffefa;
}

textarea { min-height: 7rem; padding: 0.75rem; resize: vertical; }
input[type="text"], input[type="date"], input[type="datetime-local"], input[type="number"], select { min-height: 2.85rem; padding: 0.55rem 0.7rem; }
textarea::placeholder, input::placeholder { color: #7d837d; opacity: 1; }

.form-footer {
  display: grid;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.form-footer p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.form-message { margin: 0.8rem 0 0; padding: 0.7rem; border-left: 3px solid var(--vermilion); color: #7a2f23; background: var(--vermilion-pale); }

.profile-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.profile-details summary { color: var(--jade-dark); cursor: pointer; font-weight: 700; }
.profile-details .profile-fields { padding-top: 0.85rem; }
.consent-control { display: flex; align-items: start; gap: 0.55rem; margin-top: 0.9rem; color: var(--ink); }
.consent-control input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin-top: 0.12rem; }
.storage-status { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.86rem; }

button {
  min-height: 2.85rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--jade-dark);
  border-radius: 4px;
  color: var(--white);
  background: var(--jade-dark);
  font-weight: 700;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

button:hover { background: var(--jade); box-shadow: 0 8px 18px rgba(23, 62, 56, 0.12); transform: translateY(-1px); }
button:active { box-shadow: none; transform: translateY(0) scale(0.985); }
.secondary-button { border-color: var(--line); color: var(--jade-dark); background: transparent; }
.secondary-button:hover { color: var(--white); background: var(--jade); }

.recommendation-section { border-top: 1px solid var(--line); }

.method-list { display: grid; gap: 0.9rem; }

.method-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-panel-soft);
  backdrop-filter: blur(var(--surface-blur));
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.method-card:hover { border-color: #aab7ae; box-shadow: 0 14px 28px rgba(40, 48, 40, 0.1); transform: translateY(var(--card-hover-lift)); }

.method-card.is-recommended { border-left-color: var(--vermilion); }
.method-card h3, .method-card p { margin-top: 0; }
.method-card p:last-of-type { margin-bottom: 0; color: var(--muted); font-size: 0.94rem; }

.method-mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid var(--jade);
  color: var(--jade-dark);
  font-size: 1.25rem;
}

.method-card a {
  grid-column: 2;
  justify-self: start;
  margin-top: 0.15rem;
  color: var(--jade-dark);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.method-card a span { padding-left: 0.3rem; }

.method-card button {
  grid-column: 2;
  justify-self: start;
  min-height: 2.75rem;
  padding: 0.35rem 0.75rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
}

.result-section { color: var(--white); background: var(--jade-dark); }
.result-section h2, .result-section h3 { color: var(--white); }
.result-section .eyebrow { color: #e7b4a7; }
.result-section .section-heading > p { color: #d2dfd8; }

.result-layers {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid rgba(255, 253, 248, 0.3);
}

.result-layers li { padding: 1.2rem; }
.result-layers li + li { border-top: 1px solid rgba(255, 253, 248, 0.3); }
.result-layers p { margin-bottom: 0; color: #dfe9e3; }
.layer-index { margin-top: 0; color: #e7b4a7 !important; font-size: 0.9rem; font-weight: 700; }

.charts-section { border-bottom: 1px solid var(--line); }
.chart-grid { display: grid; gap: 1rem; }
.method-scope { min-width: 0; margin: 1.25rem 0; padding-inline: clamp(0.85rem, 2.8vw, 1.15rem); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.method-scope__heading { display: grid; gap: 0.55rem; padding: 0.95rem 0.1rem; }
.method-scope__heading h3, .method-scope__heading p { margin: 0; }
.method-scope__heading > p { max-width: 44rem; color: var(--muted); font-size: 0.9rem; }
.method-scope__list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.method-scope__item { min-width: 0; border-bottom: 1px solid var(--line); }
.method-scope__item:last-child { border-bottom: 0; }
.method-scope__item details { min-width: 0; }
.method-scope__item summary { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 3.25rem; padding: 0.72rem 0.2rem; cursor: pointer; }
.method-scope__item summary::-webkit-details-marker { display: none; }
.method-scope__summary-text { display: grid; min-width: 0; gap: 0.05rem; }
.method-scope__summary-text strong { color: var(--jade-dark); }
.method-scope__summary-text span { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.method-scope__status { align-self: center; white-space: nowrap; }
.method-scope__status[data-state="available"] { border-color: var(--jade); color: var(--jade-dark); background: var(--jade-pale); }
.method-scope__status[data-state="partial"] { border-color: #b5955f; color: #73572c; background: #f7efd9; }
.method-scope__status[data-state="unsupported"] { border-color: var(--line); color: var(--muted); background: #f3f0e8; }
.method-scope__content { display: grid; gap: 0.75rem; padding: 0 0.2rem 0.95rem; }
.method-scope__content section { min-width: 0; }
.method-scope__content h4 { margin: 0 0 0.25rem; color: var(--jade-dark); font-size: 0.88rem; }
.method-scope__content ul { display: grid; gap: 0.28rem; margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.88rem; }
.method-scope__content li { min-width: 0; overflow-wrap: anywhere; }
.method-scope__boundary { margin: 0; padding-left: 0.65rem; border-left: 2px solid var(--vermilion); color: var(--muted); font-size: 0.82rem; }
.evidence-panel { display: grid; min-width: 0; gap: 0.75rem; margin-top: 1rem; padding: 1rem; border-top: 2px solid var(--jade-dark); background: var(--jade-pale); }
.evidence-panel h3, .evidence-panel p { margin: 0; }
.evidence-panel > p { color: var(--muted); }
.evidence-panel ol { display: grid; gap: 0.55rem; margin: 0; padding-left: 1.25rem; }
.evidence-panel li { min-width: 0; padding-left: 0.2rem; }
.evidence-panel b { overflow-wrap: anywhere; word-break: break-word; }
.evidence-path { display: block; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; overflow-wrap: anywhere; }

.replay-panel { display: grid; gap: 0.85rem; margin-top: 1rem; padding: 1rem; border-top: 2px solid var(--vermilion); background: var(--surface-panel-soft); }
.replay-panel h3, .replay-panel p { margin: 0; }
.replay-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.7rem; }
.replay-controls label { display: grid; min-width: 0; gap: 0.38rem; color: var(--jade-dark); font-weight: 700; }
.replay-controls select { min-width: 0; }
.replay-controls button { min-height: 2.55rem; }
.replay-output { display: grid; gap: 0.45rem; padding: 0.75rem; border-left: 3px solid var(--line); background: rgba(255, 254, 250, 0.72); }
.replay-output[data-state="verified"] { border-left-color: var(--jade); }
.replay-output[data-state="mismatch"] { border-left-color: var(--vermilion); }
.replay-output[data-state="not_replayable"] { border-left-color: #9f7a43; }
.replay-output .status-tag { justify-self: start; }
.status-tag[data-state="verified"] { border-color: var(--jade); color: var(--jade-dark); background: var(--jade-pale); }
.status-tag[data-state="mismatch"] { border-color: var(--vermilion); color: #7a2f23; background: var(--vermilion-pale); }
.status-tag[data-state="not_replayable"] { border-color: #b5955f; color: #73572c; background: #f7efd9; }
.replay-boundary { color: var(--muted); font-size: 0.82rem; line-height: 1.55; }

.chart-shell {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-panel);
  backdrop-filter: blur(var(--surface-blur));
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.chart-shell:hover { border-color: #aab7ae; box-shadow: 0 14px 30px rgba(40, 48, 40, 0.09); transform: translateY(var(--panel-hover-lift)); }

.motion-pulse .engine-result-item,
.motion-pulse .palace-cell,
.motion-pulse .coin-line { animation: result-ink-in var(--result-enter-duration) cubic-bezier(0.2, 0.75, 0.2, 1) both; }
.motion-pulse .engine-result-item:nth-child(2), .motion-pulse .palace-cell:nth-child(2) { animation-delay: 35ms; }
.motion-pulse .engine-result-item:nth-child(3), .motion-pulse .palace-cell:nth-child(3) { animation-delay: 70ms; }
.motion-pulse .engine-result-item:nth-child(4), .motion-pulse .palace-cell:nth-child(4) { animation-delay: 105ms; }

@keyframes result-ink-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes button-glare {
  from { transform: translateX(-110%); }
  to { transform: translateX(110%); }
}

.system-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.system-tab {
  width: 100%;
  min-height: 2.55rem;
  border-color: var(--line);
  color: var(--jade-dark);
  background: var(--white);
}

.system-tab[aria-selected="true"] { border-color: var(--jade-dark); color: var(--white); background: var(--jade-dark); }
.system-panel { grid-column: 1 / -1; }
.system-panel[hidden] { display: none; }
.panel-copy { color: var(--muted); }
.panel-notice { margin-top: 1rem; padding: 0.8rem; border-left: 3px solid var(--vermilion); background: var(--vermilion-pale); }
.engine-form { display: grid; gap: 0.75rem; margin-top: 1rem; }
.engine-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.engine-form label { display: grid; gap: 0.38rem; min-width: 0; color: var(--jade-dark); font-weight: 700; }
.engine-form button { justify-self: start; }
.engine-result { display: grid; gap: 0.65rem; margin-top: 1rem; }
.engine-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.engine-result-item { min-width: 0; padding: 0.65rem; border: 1px solid var(--line); background: #fffefa; }
.engine-result-item b { display: block; margin-bottom: 0.2rem; color: var(--jade-dark); }
.palace-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; margin-top: 1rem; }
.palace-cell { min-height: 5.4rem; aspect-ratio: 1; padding: 0.55rem; overflow-wrap: anywhere; border: 1px solid var(--line); background: #fffefa; }
.palace-cell b { display: block; color: var(--vermilion); }
.palace-cell span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.86rem; }
.qimen-full-board .palace-cell { aspect-ratio: 1; min-height: 0; }
.qimen-full-board .palace-cell span { font-size: 0.76rem; line-height: 1.25; }
.ziwei-shadow-board-ring {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "a b c d"
    "l center center e"
    "k center center f"
    "j i h g";
}
.ziwei-shadow-board-ring .palace-cell { aspect-ratio: auto; min-height: 7rem; }
.ziwei-shadow-board-ring .palace-cell span { line-height: 1.35; }
.ziwei-shadow-board__cell { position: relative; }
.ziwei-shadow-board__cell--life {
  border-color: rgba(35, 67, 60, 0.45);
  background: linear-gradient(135deg, rgba(239, 247, 242, 0.96), rgba(255, 254, 250, 0.9));
}
.ziwei-shadow-board__cell--body {
  border-color: rgba(173, 124, 55, 0.4);
  box-shadow: inset 0 0 0 1px rgba(173, 124, 55, 0.16);
}
.ziwei-shadow-board__cell--current {
  border-color: rgba(156, 64, 45, 0.42);
  background: linear-gradient(135deg, rgba(255, 248, 244, 0.96), rgba(255, 254, 250, 0.9));
}
.ziwei-shadow-board__cell--life::after,
.ziwei-shadow-board__cell--body::after,
.ziwei-shadow-board__cell--current::after {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.08rem 0.32rem;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
}
.ziwei-shadow-board__cell--life::after {
  content: "命";
  color: var(--jade-dark);
  background: rgba(35, 67, 60, 0.12);
}
.ziwei-shadow-board__cell--body::after {
  content: "身";
  color: rgb(139, 94, 31);
  background: rgba(173, 124, 55, 0.14);
}
.ziwei-shadow-board__cell--current::after {
  content: "今";
  color: rgb(130, 43, 28);
  background: rgba(156, 64, 45, 0.12);
}
.ziwei-shadow-board__cell--a { grid-area: a; }
.ziwei-shadow-board__cell--b { grid-area: b; }
.ziwei-shadow-board__cell--c { grid-area: c; }
.ziwei-shadow-board__cell--d { grid-area: d; }
.ziwei-shadow-board__cell--e { grid-area: e; }
.ziwei-shadow-board__cell--f { grid-area: f; }
.ziwei-shadow-board__cell--g { grid-area: g; }
.ziwei-shadow-board__cell--h { grid-area: h; }
.ziwei-shadow-board__cell--i { grid-area: i; }
.ziwei-shadow-board__cell--j { grid-area: j; }
.ziwei-shadow-board__cell--k { grid-area: k; }
.ziwei-shadow-board__cell--l { grid-area: l; }
.ziwei-shadow-board__center {
  grid-area: center;
  display: grid;
  gap: 0.4rem;
  align-content: center;
  padding: 0.9rem;
  border: 1px solid rgba(35, 67, 60, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 252, 246, 0.88), rgba(238, 232, 218, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}
.ziwei-shadow-board__center strong,
.ziwei-shadow-board__center span,
.ziwei-shadow-board__center p { display: block; margin: 0; }
.ziwei-shadow-board__center strong { color: var(--jade-dark); font-size: 0.92rem; }
.ziwei-shadow-board__center span { color: var(--caption-color); font-size: 0.78rem; font-weight: 700; }
.ziwei-shadow-board__center p { color: var(--ink); font-size: 0.82rem; line-height: 1.4; }
.question-guided-reading { display: grid; gap: 0.65rem; margin-top: 1rem; padding: 0.8rem; border: 1px solid var(--jade-dark); border-left: 4px solid var(--vermilion); background: #f3f7f0; }
.question-guided-reading h3, .question-guided-reading p { margin: 0; }
.question-guided-reading h3 { color: var(--jade-dark); font-size: 1.02rem; }
.question-guided-reading__answer { color: var(--ink); font-size: 0.94rem; line-height: 1.65; }
.question-guided-reading__details { display: grid; gap: 0.65rem; }
.question-guided-reading__details > summary {
  cursor: pointer;
  list-style: none;
  color: var(--jade-dark);
  font-size: 0.88rem;
  font-weight: 700;
}
.question-guided-reading__details > summary::-webkit-details-marker { display: none; }
.question-guided-reading__details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--vermilion);
  transition: transform 160ms ease;
}
.question-guided-reading__details[open] > summary::before { transform: rotate(90deg); }
.question-guided-reading__evidence { display: grid; gap: 0.55rem; padding-top: 0.65rem; border-top: 1px solid rgba(35, 67, 60, 0.18); }
.question-guided-reading__evidence h4 { margin: 0; color: var(--jade-dark); font-size: 0.92rem; letter-spacing: 0.04em; }
.question-guided-reading__evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; }
.question-guided-reading__evidence-card { min-width: 0; padding: 0.72rem; border: 1px solid rgba(35, 67, 60, 0.18); border-radius: 12px; background: rgba(255, 252, 246, 0.76); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58); }
.question-guided-reading__evidence-card strong,
.question-guided-reading__evidence-card span,
.question-guided-reading__evidence-card p { display: block; margin: 0; }
.question-guided-reading__evidence-card strong { color: var(--jade-dark); font-size: 0.86rem; }
.question-guided-reading__evidence-card span { margin-top: 0.25rem; color: var(--caption-color); font-size: 0.78rem; font-weight: 700; }
.question-guided-reading__evidence-card p { margin-top: 0.42rem; color: var(--ink); font-size: 0.82rem; line-height: 1.55; overflow-wrap: anywhere; }
.question-guided-reading__basis { padding-top: 0.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.question-guided-reading__basis--ok { color: var(--jade-dark); }
.question-guided-reading__basis--warn {
  padding-left: 0.65rem;
  border-left: 3px solid var(--vermilion);
  color: rgb(130, 43, 28);
  background: rgba(255, 248, 244, 0.58);
}
.question-guided-reading__basis--unknown { color: var(--muted); }
.question-guided-reading__action { color: var(--jade-dark); font-size: 0.88rem; font-weight: 700; line-height: 1.55; }
.question-guided-reading__ai { display: grid; gap: 0.55rem; padding: 0.72rem; border: 1px solid rgba(173, 124, 55, 0.26); border-radius: 14px; background: linear-gradient(135deg, rgba(255, 252, 246, 0.86), rgba(238, 232, 218, 0.62)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62); }
.question-guided-reading__ai h4,
.question-guided-reading__ai p,
.question-guided-reading__ai small { margin: 0; }
.question-guided-reading__ai h4 { color: var(--jade-dark); font-size: 0.92rem; letter-spacing: 0.04em; }
.question-guided-reading__ai > p { color: var(--muted); font-size: 0.84rem; line-height: 1.6; }
.question-guided-reading__ai > small { display: block; color: rgba(35, 67, 60, 0.58); font-size: 0.72rem; letter-spacing: 0.08em; }
.question-guided-reading__ai--loading { position: relative; overflow: hidden; }
.question-guided-reading__ai--loading::after { content: ""; position: absolute; inset: 0; transform: translateX(-110%); background: linear-gradient(100deg, transparent, rgba(202, 168, 105, 0.18), transparent); animation: button-glare 1.5s ease-in-out infinite; pointer-events: none; }
.question-guided-reading__ai--error { border-color: rgba(156, 64, 45, 0.22); background: rgba(255, 250, 245, 0.74); }
.question-guided-reading__ai-list { display: grid; gap: 0.5rem; }
.question-guided-reading__ai-list article { min-width: 0; padding: 0.58rem 0.62rem; border: 1px solid rgba(35, 67, 60, 0.12); border-radius: 10px; background: rgba(255, 254, 250, 0.68); }
.question-guided-reading__ai-list strong { display: block; color: var(--caption-color); font-size: 0.78rem; letter-spacing: 0.04em; }
.question-guided-reading__ai-list p { margin-top: 0.28rem; color: var(--ink); font-size: 0.84rem; line-height: 1.58; overflow-wrap: anywhere; }
.field-list { display: grid; gap: 0.65rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.field-list li { padding: 0.65rem; border: 1px solid var(--line); background: #fffefa; }
.field-list strong { display: inline-block; min-width: 4.8rem; color: var(--jade-dark); }
.release-task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr)); gap: 0.55rem; margin-top: 0.85rem; }
.release-task-grid article { min-width: 0; padding: 0.65rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 252, 246, 0.72); }
.release-task-grid strong, .release-task-grid span { display: block; }
.release-task-grid strong { color: var(--jade-dark); font-size: 0.84rem; }
.release-task-grid span { margin-top: 0.25rem; color: var(--caption-color); font-size: 0.82rem; }
.qimen-insights { display: grid; gap: 0.55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.qimen-insights h3, .qimen-insights > p { margin: 0; }
.qimen-insights h3 { color: var(--jade-dark); font-size: 1.05rem; }
.qimen-insights > p { color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.observational-guidance { display: grid; gap: 0; border: 1px solid var(--jade-dark); background: #f3f7f0; }
.observational-guidance h4 { margin: 0; padding: 0.65rem 0.7rem; color: var(--white); background: var(--jade-dark); font-size: 0.9rem; }
.observational-guidance__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.observational-guidance__list article { min-width: 0; padding: 0.7rem; }
.observational-guidance__list article:first-child { grid-column: 1 / -1; background: #e6efe2; }
.observational-guidance__list article + article { border-left: 1px solid var(--line); }
.observational-guidance__list article:first-child + article { border-left: 0; }
.observational-guidance__list strong { color: var(--jade-dark); font-size: 0.84rem; }
.observational-guidance__list p { margin: 0.35rem 0 0; color: var(--ink); font-size: 0.86rem; line-height: 1.55; overflow-wrap: anywhere; }
.qimen-plain-language { display: grid; gap: 0; border-top: 1px solid var(--jade-dark); border-bottom: 1px solid var(--jade-dark); background: #fffefa; }
.qimen-plain-language article { min-width: 0; padding: 0.72rem 0.15rem; }
.qimen-plain-language article + article { border-top: 1px solid var(--line); }
.qimen-plain-language strong { color: var(--jade-dark); font-size: 0.9rem; }
.qimen-plain-language p { margin: 0.3rem 0 0; color: var(--ink); font-size: 0.9rem; line-height: 1.6; overflow-wrap: anywhere; }
.qimen-insights__technical { min-width: 0; border: 1px solid var(--line); background: #fffefa; }
.qimen-insights__technical summary { padding: 0.7rem; color: var(--jade-dark); cursor: pointer; font-size: 0.88rem; font-weight: 700; }
.qimen-insights__technical summary::-webkit-details-marker { display: none; }
.qimen-insights__technical[open] summary { border-bottom: 1px solid var(--line); }
.qimen-insights__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.qimen-insights__technical .qimen-insights__list { border-top: 0; border-left: 0; }
.qimen-insights__list article { min-width: 0; padding: 0.7rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fffefa; }
.qimen-insights__list strong { color: var(--jade-dark); font-size: 0.88rem; }
.qimen-insights__list p { margin: 0.35rem 0 0; color: var(--ink); font-size: 0.84rem; line-height: 1.55; overflow-wrap: anywhere; }
.plain-insights { display: grid; gap: 0.55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.plain-insights h3, .plain-insights > p { margin: 0; }
.plain-insights h3 { color: var(--jade-dark); font-size: 1.05rem; }
.plain-insights > p { color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.plain-insights__list { display: grid; gap: 0; border-top: 1px solid var(--jade-dark); border-bottom: 1px solid var(--jade-dark); background: #fffefa; }
.plain-insights__list article { min-width: 0; padding: 0.72rem 0.15rem; }
.plain-insights__list article + article { border-top: 1px solid var(--line); }
.plain-insights__list strong { color: var(--jade-dark); font-size: 0.9rem; }
.plain-insights__list p { margin: 0.3rem 0 0; color: var(--ink); font-size: 0.9rem; line-height: 1.6; overflow-wrap: anywhere; }
.plain-insights__technical { min-width: 0; border: 1px solid var(--line); background: #fffefa; }
.plain-insights__technical summary { padding: 0.7rem; color: var(--jade-dark); cursor: pointer; font-size: 0.88rem; font-weight: 700; }
.plain-insights__technical summary::-webkit-details-marker { display: none; }
.plain-insights__technical[open] summary { border-bottom: 1px solid var(--line); }
.plain-insights__technical-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plain-insights__technical-list article { min-width: 0; padding: 0.7rem; border-bottom: 1px solid var(--line); }
.plain-insights__technical-list article + article { border-left: 1px solid var(--line); }
.plain-insights__technical-list strong { color: var(--jade-dark); font-size: 0.88rem; }
.plain-insights__technical-list p { margin: 0.35rem 0 0; color: var(--ink); font-size: 0.84rem; line-height: 1.55; overflow-wrap: anywhere; }
.coin-lines { display: grid; gap: 0.45rem; margin-top: 1rem; }
.coin-line { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line); background: #fffefa; }
.coin-line b { color: var(--vermilion); }

.chart-shell-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.chart-shell-head .eyebrow, .chart-shell-head h3 { margin-bottom: 0; }

.status-tag {
  flex: 0 0 auto;
  padding: 0.18rem 0.48rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.75rem;
}

.bazi-table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 27rem; border-collapse: collapse; text-align: center; }
caption { padding-bottom: 0.75rem; color: var(--muted); text-align: left; font-size: 0.88rem; }
th, td { padding: 0.58rem 0.4rem; border: 1px solid var(--line); }
thead th, tbody th { color: var(--jade-dark); background: var(--jade-pale); font-weight: 700; }

.hexagram-placeholder {
  display: grid;
  min-height: 15.5rem;
  place-items: center;
  align-content: center;
  gap: 1.25rem;
  padding: 1rem;
  border: 1px dashed #aab7ae;
  background: #fbfaf5;
}

.hexagram-placeholder p { max-width: 18rem; margin: 0; color: var(--muted); text-align: center; }
.gua-lines { display: grid; gap: 0.5rem; width: min(100%, 13rem); }
.gua-lines i { display: block; height: 0.45rem; background: var(--jade-dark); }
.gua-lines i:nth-child(2), .gua-lines i:nth-child(5) { background: linear-gradient(to right, var(--jade-dark) 0 44%, transparent 44% 56%, var(--jade-dark) 56%); }

.review-section { background: var(--paper-deep); }
.review-layout { display: grid; gap: 1.5rem; }
.review-layout > div p:last-child { margin-bottom: 0; color: var(--muted); }
.review-form { display: grid; gap: 0.5rem; align-content: start; }
.review-form label:not(:first-child) { margin-top: 0.5rem; }
.review-form button { margin-top: 0.6rem; }
.review-action-templates, .local-action-review { display: grid; min-width: 0; gap: 0.65rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.review-action-templates[hidden] { display: none; }
.review-action-templates h3, .review-action-templates p, .local-action-review h3, .local-action-review p { margin: 0; }
.review-action-templates__buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.review-action-templates__buttons button { margin-top: 0; min-height: 2.25rem; font-size: 0.84rem; }
.local-action-review > p { color: var(--muted); font-size: 0.88rem; }
.local-action-review__list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.local-action-review__list li { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0.75rem; row-gap: 0.25rem; padding: 0.75rem 0.15rem; border-bottom: 1px solid var(--line); }
.local-action-review__text { color: var(--ink) !important; overflow-wrap: anywhere; }
.local-action-review__meta { color: var(--muted); font-size: 0.82rem; }
.local-action-review__list .status-tag { align-self: start; grid-column: 2; grid-row: 1 / span 2; }
.local-action-review__commands { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: 0.45rem; }
.local-action-review__commands button { min-height: 2.2rem; margin-top: 0; padding: 0.35rem 0.65rem; font-size: 0.82rem; }

.notice-grid { display: grid; gap: 1rem; }
.notice { padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow 200ms ease, transform 200ms ease; }
.notice:hover { box-shadow: 0 12px 26px rgba(40, 48, 40, 0.08); transform: translateY(-2px); }
.notice h2 { font-size: 1.22rem; }
.notice p:last-child { margin-bottom: 0; color: var(--muted); }
.notice-privacy { background: var(--jade-pale); }
.notice-risk { border-color: #cf9a8c; background: var(--vermilion-pale); }
.notice-risk .eyebrow { color: #8c3325; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.privacy-actions button { min-height: 2.75rem; padding: 0.4rem 0.7rem; font-size: 0.84rem; }
.account-panel { grid-column: 1 / -1; display: grid; gap: 1rem; padding: 1.1rem; border: 1px solid var(--line); background: var(--surface-panel); backdrop-filter: blur(var(--surface-blur)); }
.account-panel p { margin-bottom: 0; color: var(--muted); }
.account-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); }
.account-status div { min-width: 0; padding: 0.7rem; }
.account-status div + div { border-left: 1px solid var(--line); }
.account-status dt { color: var(--caption-color); font-size: 0.78rem; }
.account-status dd { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.account-actions button { min-height: 2.4rem; padding: 0.4rem 0.75rem; font-size: 0.86rem; }
.account-panel [data-sync-message][data-status="error"] { color: var(--vermilion); }
.local-account-card { display: grid; min-width: 0; gap: 0.7rem; padding: 0.95rem; border: 1px solid var(--line); background: rgba(255, 252, 246, 0.64); }
.local-account-card h3, .local-account-card p { margin: 0; }
.local-account-card > p { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.local-account-form { display: grid; gap: 0.7rem; }
.local-account-form label { display: grid; gap: 0.25rem; min-width: 0; color: var(--jade-dark); font-weight: 700; }
.local-account-form input { width: 100%; min-height: 2.65rem; padding: 0.48rem 0.62rem; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: rgba(255, 253, 248, 0.92); }
.local-account-form span { font-size: 0.82rem; }
.local-account-form__grid { display: grid; gap: 0.65rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.local-account-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.local-account-actions button { min-height: 2.75rem; padding: 0.4rem 0.75rem; font-size: 0.86rem; }
.local-account-message { min-height: 1.4rem; color: var(--muted); font-size: 0.84rem; }
.local-account-message[data-status="ok"] { color: var(--jade-dark); }
.local-account-message[data-status="error"] { color: var(--vermilion); }
.consent-receipt { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.sync-scope-preview { display: grid; min-width: 0; gap: 0.65rem; padding-top: 0.95rem; border-top: 1px solid var(--line); }
.sync-scope-preview h3, .sync-scope-preview p { margin: 0; }
.sync-scope-preview > p { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.sync-scope-preview__metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sync-scope-preview__metrics div { min-width: 0; padding: 0.6rem 0.55rem; }
.sync-scope-preview__metrics div + div { border-left: 1px solid var(--line); }
.sync-scope-preview__metrics dt { color: var(--caption-color); font-size: 0.76rem; }
.sync-scope-preview__metrics dd { margin: 0.18rem 0 0; color: var(--jade-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
.local-data-boundary { display: grid; min-width: 0; gap: 0.65rem; padding-top: 0.95rem; border-top: 1px solid var(--line); }
.local-data-boundary h3, .local-data-boundary p { margin: 0; }
.local-data-boundary ul { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.local-data-boundary li { display: grid; min-width: 0; gap: 0.18rem; padding: 0.6rem 0.15rem; border-bottom: 1px solid var(--line); }
.local-data-boundary li:last-child { border-bottom: 0; }
.local-data-boundary strong { color: var(--jade-dark); font-size: 0.84rem; }
.local-data-boundary span { color: var(--muted); font-size: 0.83rem; line-height: 1.55; overflow-wrap: anywhere; }
.settings-boundary { display: grid; min-width: 0; gap: 0.7rem; padding-top: 0.95rem; border-top: 1px solid var(--line); }
.settings-boundary h3, .settings-boundary p { margin: 0; }
.settings-boundary > p { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.settings-boundary__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.settings-boundary__grid article { min-width: 0; padding: 0.72rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 252, 246, 0.64); }
.settings-boundary__grid strong, .settings-boundary__grid span { display: block; }
.settings-boundary__grid strong { color: var(--jade-dark); font-size: 0.86rem; }
.settings-boundary__grid span { margin-top: 0.32rem; color: var(--muted); font-size: 0.82rem; line-height: 1.55; overflow-wrap: anywhere; }
.local-result-verification { display: grid; min-width: 0; gap: 0.65rem; padding-top: 0.95rem; border-top: 1px solid var(--line); }
.local-result-verification h3, .local-result-verification p { margin: 0; }
.local-result-verification__summary { color: var(--jade-dark) !important; font-weight: 700; }
.local-result-verification > p:last-of-type { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.local-result-verification__metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.local-result-verification__metrics div { min-width: 0; padding: 0.6rem 0.55rem; }
.local-result-verification__metrics div + div { border-left: 1px solid var(--line); }
.local-result-verification__metrics dt { color: var(--caption-color); font-size: 0.76rem; }
.local-result-verification__metrics dd { margin: 0.18rem 0 0; color: var(--jade-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }

.repeat-dialog {
  width: min(calc(100% - 2rem), 34rem);
  max-height: calc(100svh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow);
}

.repeat-dialog::backdrop { background: rgba(29, 41, 39, 0.58); }
.repeat-dialog form { padding: 1.25rem; }
.repeat-dialog h2 { font-size: 1.45rem; }
.repeat-reasons { display: grid; gap: 0.55rem; margin: 1rem 0; padding: 0; border: 0; }
.repeat-reasons legend { margin-bottom: 0.55rem; font-weight: 700; }
.repeat-reasons label { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.65rem; border: 1px solid var(--line); }
.repeat-reasons input { margin-top: 0.32rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.danger-button { border-color: #8c3325; color: #8c3325; background: transparent; }
.danger-button:hover { color: var(--white); background: #8c3325; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2rem, 1100px);
  margin: 0 auto;
  padding-block: 1.5rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer p { margin: 0; }

@media (min-width: 680px) {
  .section-wrap, .site-footer { width: min(100% - 3.5rem, 1100px); }
  .section-wrap { padding-block: 4.5rem; }
  h1 { font-size: 3.7rem; }
  .section-heading { grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.55fr); align-items: end; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-footer { grid-template-columns: minmax(0, 1fr) auto; }
  .method-card { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
  .method-card a { grid-column: 3; align-self: center; justify-self: end; }
  .result-layers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-layers li + li { border-top: 0; border-left: 1px solid rgba(255, 253, 248, 0.3); }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-scope__heading { grid-template-columns: minmax(0, 0.8fr) minmax(16rem, 1fr); align-items: end; gap: 1.5rem; }
  .method-scope__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.25rem; }
  .method-scope__item:nth-last-child(-n + 2) { border-bottom: 0; }
  .review-layout { grid-template-columns: minmax(0, 1fr) minmax(19rem, 0.8fr); align-items: start; }
  .notice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .header-date { display: none; }
  .site-footer { display: grid; }
  .account-status { grid-template-columns: 1fr; }
  .account-status div + div { border-top: 1px solid var(--line); border-left: 0; }
  .local-account-card { padding: 0.85rem; }
  .local-account-form__grid { grid-template-columns: 1fr; }
  .local-account-actions { display: grid; }
  .local-account-actions button { width: 100%; }
  .sync-scope-preview__metrics { grid-template-columns: 1fr; }
  .sync-scope-preview__metrics div + div { border-top: 1px solid var(--line); border-left: 0; }
  .local-result-verification__metrics { grid-template-columns: 1fr; }
  .local-result-verification__metrics div + div { border-top: 1px solid var(--line); border-left: 0; }
  .settings-boundary__grid { grid-template-columns: 1fr; }
  .account-actions { display: grid; }
  .dialog-actions { display: grid; }
  .section-wrap { padding-block: 2rem; }
  .inquiry-form { padding: 0.9rem; }
  textarea { min-height: 5.5rem; }
  .engine-form-grid, .engine-result-grid { grid-template-columns: 1fr; }
  .qimen-insights__list { grid-template-columns: 1fr; }
  .question-guided-reading__evidence-grid { grid-template-columns: 1fr; }
  .ziwei-shadow-board-ring {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "a b"
      "c d"
      "center center"
      "e f"
      "g h"
      "i j"
      "k l";
  }
  .observational-guidance__list { grid-template-columns: 1fr; }
  .observational-guidance__list article + article { border-top: 1px solid var(--line); border-left: 0; }
  .plain-insights__technical-list { grid-template-columns: 1fr; }
  .plain-insights__technical-list article + article { border-top: 1px solid var(--line); border-left: 0; }
  .review-action-templates__buttons, .local-action-review__commands { display: grid; grid-template-columns: 1fr; }
  .local-action-review__commands button { width: 100%; }
  .method-scope__list { grid-template-columns: 1fr; }
  .method-scope__item:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .method-scope__item:last-child { border-bottom: 0; }
  .replay-controls { grid-template-columns: 1fr; }
  .replay-controls button { width: 100%; }
  .palace-cell { min-height: 0; padding: 0.3rem; font-size: 0.78rem; line-height: 1.12; }
  .palace-cell span { margin-top: 0.1rem; font-size: 0.72rem; line-height: 1.12; }
  .qimen-full-board .palace-cell { min-height: 0; }
  .qimen-full-board .palace-cell span { font-size: 0.65rem; line-height: 1.2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .ink-layer { transform: none !important; }
  .ink-taiji-spin { animation: none !important; transform: none !important; }
}

body[data-ui-theme="shanhai-design"] {
  --paper: #f7f3ea;
  --paper-deep: #eee8db;
  --ink: #1e201f;
  --muted: #6a685f;
  --line: #ddd6c6;
  --jade: #2f5e54;
  --jade-dark: #23433c;
  --jade-pale: rgba(226, 233, 225, 0.92);
  --vermilion: #b07942;
  --caption-color: #7d4a22;
  --vermilion-pale: rgba(243, 234, 221, 0.92);
  --white: #fffdf7;
  --radius: 10px;
  --shadow: 0 16px 36px rgba(64, 60, 45, 0.08);
  --surface-panel: rgba(255, 252, 245, 0.92);
  --surface-panel-soft: rgba(255, 252, 245, 0.88);
  --surface-form: rgba(255, 252, 245, 0.94);
}

body[data-ui-theme="shanhai-design"] {
  padding-left: 7.6rem;
  background: #f7f3ea;
}

/* 暗色模式暂缓：设计令牌已可翻转，但 40+ 处硬编码浅色面板表面与水墨底图
   尚未收编进令牌，先前仅翻转令牌会让系统暗色用户看到"假暗色"（实测无感）。
   待表面收编与暗色底图就绪后再恢复 @media (prefers-color-scheme: dark)。 */

body[data-active-page="today"] [data-page-view]:not([data-page-view="today"]),
body[data-active-page="inquiry"] [data-page-view]:not([data-page-view="inquiry"]),
body[data-active-page="charts"] [data-page-view]:not([data-page-view="charts"]),
body[data-active-page="review"] [data-page-view]:not([data-page-view="review"]),
body[data-active-page="profile"] [data-page-view]:not([data-page-view="profile"]) {
  display: none !important;
}

body[data-ui-theme="shanhai-design"] .ink-atmosphere {
  opacity: 0.88;
}

body[data-ui-theme="shanhai-design"] .ink-layer {
  background-image: url("assets/divination-bg-shanhai-rotatable-base.webp");
  background-position: center right;
  background-size: cover;
  filter: grayscale(1) contrast(1.02) saturate(0.85);
}

body[data-ui-theme="shanhai-design"] .ink-layer-far {
  opacity: 0.82;
}

body[data-ui-theme="shanhai-design"] .ink-layer-near {
  opacity: 0.16;
  background-position: 74% 52%;
  /* 移除 blur：它迫使动画层每帧重做全屏模糊合成。 */
  filter: grayscale(1) contrast(1.08);
}

body[data-ui-theme="shanhai-design"] .ink-taiji-spin {
  /* 真实 GPU 实测：96s 连续旋转会把页面压到 36.8 FPS（其余动画层均 60 FPS），
     故改为 120s 周期的缓慢呼吸（±2° 微旋 + 1.2% 缩放），保留气韵流动而不持续合成。 */
  opacity: 0.72;
  animation: taiji-breathe 120s ease-in-out infinite alternate;
  contain: paint;
}

body[data-ui-theme="shanhai-design"] .site-sidebar {
  width: 7.6rem;
  border-right: 1px solid rgba(218, 211, 196, 0.88);
  background: rgba(247, 243, 234, 0.84);
}

body[data-ui-theme="shanhai-design"] .sidebar-head {
  gap: 0.35rem;
  padding: 1rem 0.75rem 0.85rem;
}

body[data-ui-theme="shanhai-design"] .brand {
  justify-content: center;
  font-size: 1.34rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

body[data-ui-theme="shanhai-design"] .brand-seal { display: none; }
body[data-ui-theme="shanhai-design"] .header-date { display: none; }

body[data-ui-theme="shanhai-design"] .line-sidebar {
  --accent-color: var(--jade-dark);
  --text-color: var(--jade-dark);
  --marker-color: transparent;
  --marker-length: 0;
  --marker-gap: 0;
  --tick-scale: 0;
  --max-shift: 0;
  --item-gap: 0.65rem;
  --font-size: 0.84rem;
  display: block;
  padding: 0 0.45rem;
}

body[data-ui-theme="shanhai-design"] .line-sidebar--markers { padding-left: 0.45rem; }
body[data-ui-theme="shanhai-design"] .line-sidebar__list { gap: 0.5rem; padding: 0.45rem 0; }
body[data-ui-theme="shanhai-design"] .line-sidebar__item { min-height: auto; }
body[data-ui-theme="shanhai-design"] .line-sidebar__item::before,
body[data-ui-theme="shanhai-design"] .line-sidebar__marker,
body[data-ui-theme="shanhai-design"] .line-sidebar--markers .line-sidebar__item:not(:last-child)::after {
  display: none;
}

body[data-ui-theme="shanhai-design"] .line-sidebar__item a {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
}

body[data-ui-theme="shanhai-design"] .nav-icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  color: currentColor;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

body[data-ui-theme="shanhai-design"] .nav-icon--today {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5 12 4l8 6.5'/%3E%3Cpath d='M6 9.5V20h12V9.5'/%3E%3Cpath d='M10 20v-6h4v6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5 12 4l8 6.5'/%3E%3Cpath d='M6 9.5V20h12V9.5'/%3E%3Cpath d='M10 20v-6h4v6'/%3E%3C/svg%3E");
}
body[data-ui-theme="shanhai-design"] .nav-icon--inquiry {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7.5'/%3E%3Cpath d='M12 7.5v4.3l2.8 2.2'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7.5'/%3E%3Cpath d='M12 7.5v4.3l2.8 2.2'/%3E%3C/svg%3E");
}
body[data-ui-theme="shanhai-design"] .nav-icon--charts {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='1.5'/%3E%3Cpath d='M9 5v14M15 5v14M5 9h14M5 15h14'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='1.5'/%3E%3Cpath d='M9 5v14M15 5v14M5 9h14M5 15h14'/%3E%3C/svg%3E");
}
body[data-ui-theme="shanhai-design"] .nav-icon--review {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7.5 12 5l8 2.5-8 2.5-8-2.5Z'/%3E%3Cpath d='M4 9.5v7l8 2.5 8-2.5v-7'/%3E%3Cpath d='M12 7.5v11'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7.5 12 5l8 2.5-8 2.5-8-2.5Z'/%3E%3Cpath d='M4 9.5v7l8 2.5 8-2.5v-7'/%3E%3Cpath d='M12 7.5v11'/%3E%3C/svg%3E");
}
body[data-ui-theme="shanhai-design"] .nav-icon--profile {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9' r='3.2'/%3E%3Cpath d='M5.5 19a6.5 6.5 0 0 1 13 0'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9' r='3.2'/%3E%3Cpath d='M5.5 19a6.5 6.5 0 0 1 13 0'/%3E%3C/svg%3E");
}
body[data-ui-theme="shanhai-design"] .nav-icon--settings {
  width: 0.9rem;
  height: 0.9rem;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 3.5v3M12 17.5v3M3.5 12h3M17.5 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 3.5v3M12 17.5v3M3.5 12h3M17.5 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1'/%3E%3C/svg%3E");
}

body[data-ui-theme="shanhai-design"] .line-sidebar__label {
  color: var(--jade-dark);
  transform: none;
}

body[data-ui-theme="shanhai-design"] .line-sidebar__index { display: none; }
body[data-ui-theme="shanhai-design"] .line-sidebar__text { font-size: 0.9rem; font-weight: 500; }

body[data-ui-theme="shanhai-design"] .line-sidebar__item a.is-current,
body[data-ui-theme="shanhai-design"] .line-sidebar__item a:hover,
body[data-ui-theme="shanhai-design"] .line-sidebar__item a:focus-visible {
  background: var(--jade-dark);
  color: var(--white);
}

body[data-ui-theme="shanhai-design"] .sidebar-foot {
  display: grid;
  gap: 0.55rem;
  margin-top: auto;
  padding: 1rem 0.85rem 1.15rem;
  border-top: 1px solid rgba(220, 214, 201, 0.9);
  color: var(--muted);
  font-size: 0.72rem;
}

body[data-ui-theme="shanhai-design"] .sidebar-foot p { margin: 0; line-height: 1.55; }

body[data-ui-theme="shanhai-design"] .desktop-masthead {
  position: fixed;
  z-index: 6;
  inset: 0 0 auto 7.6rem;
  display: flex;
  align-items: center;
  min-height: 3.1rem;
  padding: 0 1.35rem;
  border-bottom: 1px solid rgba(221, 214, 199, 0.88);
  background: rgba(250, 247, 240, 0.58);
  backdrop-filter: blur(8px);
}

body[data-ui-theme="shanhai-design"] .desktop-masthead p {
  margin: 0;
  color: var(--ink);
  font-size: 0.86rem;
}

body[data-ui-theme="shanhai-design"] main {
  padding-top: 3.1rem;
}

body[data-ui-theme="shanhai-design"] .page-view:not([hidden]),
body[data-ui-theme="shanhai-design"] .page-view:not([hidden]) .section-heading {
  animation: none;
}

body[data-ui-theme="shanhai-design"] .section-wrap {
  width: min(100% - 3rem, 1200px);
  padding-block: 2rem;
}

body[data-ui-theme="shanhai-design"] .section-heading {
  margin-bottom: 1rem;
}

/* 可读性防线（2026-09-28 实测）：标题区原先直接压在水墨背景层上。
   实测「问局副说明」背后最暗像素处对比度仅 2.22:1（WCAG AA 需 4.5:1）。
   仅加深文字无法解决（水墨局部过深时深字同样糊底），故给标题区加实体纸底，
   使文字背后恒为浅色底。 */
body[data-ui-theme="shanhai-design"] .section-heading {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 252, 245, 0.96);
  backdrop-filter: blur(8px);
}

/* 副文案色加深：原 #6a685f 在纸底上仅 5.05:1，叠加轻微背景扰动即跌破 AA。 */
body[data-ui-theme="shanhai-design"] {
  --muted: #555b53;
}

body[data-ui-theme="shanhai-design"] .intro {
  padding-top: 2rem;
}

body[data-ui-theme="shanhai-design"] .today-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.42fr) minmax(18rem, 0.58fr);
}

body[data-ui-theme="shanhai-design"] .today-hero-card,
body[data-ui-theme="shanhai-design"] .progress-card,
body[data-ui-theme="shanhai-design"] .hint-card,
body[data-ui-theme="shanhai-design"] .timeline-card,
body[data-ui-theme="shanhai-design"] .inquiry-form,
body[data-ui-theme="shanhai-design"] .review-form,
body[data-ui-theme="shanhai-design"] .notice,
body[data-ui-theme="shanhai-design"] .account-panel,
body[data-ui-theme="shanhai-design"] .chart-shell,
body[data-ui-theme="shanhai-design"] .method-scope,
body[data-ui-theme="shanhai-design"] .evidence-panel,
body[data-ui-theme="shanhai-design"] .replay-panel {
  border-radius: 8px;
}

body[data-ui-theme="shanhai-design"] .today-hero-card {
  display: grid;
  grid-template-columns: minmax(16rem, 0.82fr) minmax(18rem, 1fr);
  min-height: 23rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.88);
  box-shadow: var(--shadow);
}

body[data-ui-theme="shanhai-design"] .today-calendar {
  display: grid;
  gap: 1.1rem;
  padding: 1.1rem 1.2rem;
  border-right: 1px solid var(--line);
}

body[data-ui-theme="shanhai-design"] .today-calendar > div p {
  margin: 0;
  font-size: 1rem;
}

body[data-ui-theme="shanhai-design"] .today-calendar > div span {
  /* 农历行在浅底上原用 --muted(#6a685f) 显浅，改用更深中性色。 */
  color: #4a544c;
  font-size: 0.84rem;
}

body[data-ui-theme="shanhai-design"] .today-calendar dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

body[data-ui-theme="shanhai-design"] .today-calendar dl div {
  padding: 0 0.5rem;
}

body[data-ui-theme="shanhai-design"] .today-calendar dt {
  color: #4a544c;
  font-size: 0.75rem;
  font-weight: 600;
}

body[data-ui-theme="shanhai-design"] .today-calendar dd {
  margin: 0.18rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
}

body[data-ui-theme="shanhai-design"] .today-callout {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.9rem;
  padding: 1.3rem 1rem;
  text-align: center;
}

body[data-ui-theme="shanhai-design"] .today-callout h1 {
  margin: 0;
  font-size: 2rem;
}

body[data-ui-theme="shanhai-design"] .today-callout .intro-copy {
  max-width: 18rem;
}

body[data-ui-theme="shanhai-design"] .today-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

body[data-ui-theme="shanhai-design"] .primary-cta,
body[data-ui-theme="shanhai-design"] .ghost-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--jade-dark);
  border-radius: 4px;
  text-decoration: none;
}

body[data-ui-theme="shanhai-design"] .primary-cta {
  color: var(--white);
  background: linear-gradient(135deg, #3f7d6e, #34685c);
}

body[data-ui-theme="shanhai-design"] .ghost-cta {
  color: var(--jade-dark);
  background: transparent;
}

body[data-ui-theme="shanhai-design"] .today-side {
  display: grid;
  gap: 0.85rem;
}

body[data-ui-theme="shanhai-design"] .progress-card,
body[data-ui-theme="shanhai-design"] .hint-card,
body[data-ui-theme="shanhai-design"] .timeline-card {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.88);
  box-shadow: var(--shadow);
}

body[data-ui-theme="shanhai-design"] .progress-card h2,
body[data-ui-theme="shanhai-design"] .hint-card h2,
body[data-ui-theme="shanhai-design"] .timeline-card h2 {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

body[data-ui-theme="shanhai-design"] .progress-card {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

body[data-ui-theme="shanhai-design"] .progress-card h2 {
  grid-column: 1 / -1;
}

body[data-ui-theme="shanhai-design"] .progress-ring {
  --progress-size: 5rem;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--progress-size);
  height: var(--progress-size);
  border-radius: 50%;
  background:
    conic-gradient(var(--jade-dark) calc(var(--progress) * 1%), #d9e1d8 0);
}

body[data-ui-theme="shanhai-design"] .progress-ring::before {
  position: absolute;
  inset: 0.45rem;
  border-radius: 50%;
  content: "";
  background: var(--white);
}

body[data-ui-theme="shanhai-design"] .progress-ring span {
  position: relative;
  z-index: 1;
  color: var(--jade-dark);
  font-size: 1.1rem;
  font-weight: 700;
}

body[data-ui-theme="shanhai-design"] .progress-card dl,
body[data-ui-theme="shanhai-design"] .timeline-card ol {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

body[data-ui-theme="shanhai-design"] .progress-card dl {
  border-left: 1px solid var(--line);
  padding-left: 0.9rem;
}

body[data-ui-theme="shanhai-design"] .progress-card dt,
body[data-ui-theme="shanhai-design"] .timeline-card time {
  /* 浅底上 --muted(#6a685f) 视觉偏灰；改用更深的中性色提升可读性。 */
  color: #4a544c;
  font-size: 0.76rem;
}

body[data-ui-theme="shanhai-design"] .progress-card dd,
body[data-ui-theme="shanhai-design"] .timeline-card span {
  margin: 0.12rem 0 0;
  font-size: 0.92rem;
  color: #1e201f;
  font-weight: 600;
}

body[data-ui-theme="shanhai-design"] .hint-card p,
body[data-ui-theme="shanhai-design"] .timeline-card li {
  color: #3a443d;
}

body[data-ui-theme="shanhai-design"] .timeline-card ol {
  padding-left: 1rem;
}

body[data-ui-theme="shanhai-design"] .timeline-card li {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: baseline;
}

/* 说明型条目（不含 <time> 时间戳）为纯文本，占满整行；否则文字会被挤进 4rem 序号列。 */
body[data-ui-theme="shanhai-design"] .timeline-card li:not(:has(time)) {
  grid-template-columns: minmax(0, 1fr);
}

body[data-ui-theme="shanhai-design"] .stepper {
  display: flex;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
}

body[data-ui-theme="shanhai-design"] .stepper li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

body[data-ui-theme="shanhai-design"] .stepper span {
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}

body[data-ui-theme="shanhai-design"] .stepper .is-active {
  color: var(--jade-dark);
  font-weight: 700;
}

body[data-ui-theme="shanhai-design"] .stepper .is-active span {
  color: var(--white);
  border-color: var(--jade-dark);
  background: var(--jade-dark);
}

body[data-ui-theme="shanhai-design"] .choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-ui-theme="shanhai-design"] .inquiry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem);
  column-gap: 1rem;
  align-items: start;
}

body[data-ui-theme="shanhai-design"] .inquiry-form fieldset,
body[data-ui-theme="shanhai-design"] .inquiry-form .form-footer,
body[data-ui-theme="shanhai-design"] .inquiry-form .form-message,
body[data-ui-theme="shanhai-design"] .inquiry-form .profile-details {
  grid-column: 1 / -1;
}

body[data-ui-theme="shanhai-design"] .choice-card span {
  display: grid;
  gap: 0.2rem;
  min-height: 6rem;
  padding: 0.8rem 0.7rem;
  text-align: left;
}

body[data-ui-theme="shanhai-design"] .choice-card b {
  font-size: 1rem;
}

body[data-ui-theme="shanhai-design"] .choice-card small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

body[data-ui-theme="shanhai-design"] .choice-card input:checked + span {
  background: rgba(225, 236, 228, 0.95);
}

body[data-ui-theme="shanhai-design"] .question-assist {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.84);
}

body[data-ui-theme="shanhai-design"] .question-assist h3,
body[data-ui-theme="shanhai-design"] .question-assist p {
  margin: 0;
}

body[data-ui-theme="shanhai-design"] .question-assist p {
  color: var(--muted);
  font-size: 0.86rem;
}

body[data-ui-theme="shanhai-design"] .form-grid {
  grid-column: 1;
  margin-top: 1rem;
}

body[data-ui-theme="shanhai-design"] .inquiry-form > .question-assist {
  grid-column: 2;
  grid-row: 2;
}

body[data-ui-theme="shanhai-design"] .inquiry-form,
body[data-ui-theme="shanhai-design"] .review-form,
body[data-ui-theme="shanhai-design"] .account-panel,
body[data-ui-theme="shanhai-design"] .notice,
body[data-ui-theme="shanhai-design"] .chart-shell,
body[data-ui-theme="shanhai-design"] .method-scope,
body[data-ui-theme="shanhai-design"] .evidence-panel,
body[data-ui-theme="shanhai-design"] .replay-panel {
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.9);
  box-shadow: var(--shadow);
}

body[data-ui-theme="shanhai-design"] .section-heading > p,
body[data-ui-theme="shanhai-design"] .intro-copy,
body[data-ui-theme="shanhai-design"] .panel-copy,
body[data-ui-theme="shanhai-design"] .panel-notice,
body[data-ui-theme="shanhai-design"] .method-scope__heading > p,
body[data-ui-theme="shanhai-design"] .evidence-panel > p,
body[data-ui-theme="shanhai-design"] .replay-boundary,
body[data-ui-theme="shanhai-design"] .plain-insights > p,
body[data-ui-theme="shanhai-design"] .qimen-insights > p {
  color: var(--muted);
}

body[data-ui-theme="shanhai-design"] .charts-section .section-heading {
  margin-bottom: 1.2rem;
}

body[data-ui-theme="shanhai-design"] .system-tabs {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  overflow: hidden;
}

body[data-ui-theme="shanhai-design"] .system-tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  min-height: 3rem;
  background: rgba(255, 252, 246, 0.96);
}

body[data-ui-theme="shanhai-design"] .system-tab:last-child { border-right: 0; }

body[data-ui-theme="shanhai-design"] .system-tab[aria-selected="true"] {
  color: var(--jade-dark);
  background: rgba(224, 233, 227, 0.98);
}

body[data-ui-theme="shanhai-design"] .chart-shell {
  padding: 1rem;
}

body[data-ui-theme="shanhai-design"] .chart-grid {
  display: block;
}

body[data-ui-theme="shanhai-design"] .system-panel {
  display: block;
}

body[data-ui-theme="shanhai-design"] .system-panel[hidden] {
  display: none !important;
}

body[data-ui-theme="shanhai-design"] .evidence-panel,
body[data-ui-theme="shanhai-design"] .replay-panel {
  padding: 1rem;
}

body[data-ui-theme="shanhai-design"] .evidence-panel {
  border-top-color: rgba(35, 67, 60, 0.45);
}

body[data-ui-theme="shanhai-design"] .result-section {
  background: transparent;
}

body[data-ui-theme="shanhai-design"] .result-layers {
  border-color: rgba(35, 67, 60, 0.22);
}

body[data-ui-theme="shanhai-design"] .result-layers li {
  background: rgba(27, 50, 46, 0.92);
}

body[data-ui-theme="shanhai-design"] .review-layout,
body[data-ui-theme="shanhai-design"] .notice-grid {
  gap: 1rem;
}

body[data-ui-theme="shanhai-design"] .notice h2 {
  font-size: 1.35rem;
}

body[data-ui-theme="shanhai-design"] .account-status,
body[data-ui-theme="shanhai-design"] .sync-scope-preview__metrics,
body[data-ui-theme="shanhai-design"] .local-result-verification__metrics {
  border-color: var(--line);
}

body[data-ui-theme="shanhai-design"] .account-actions,
body[data-ui-theme="shanhai-design"] .privacy-actions {
  gap: 0.5rem;
}

body[data-ui-theme="shanhai-design"] .account-actions button,
body[data-ui-theme="shanhai-design"] .privacy-actions button,
body[data-ui-theme="shanhai-design"] .review-form button,
body[data-ui-theme="shanhai-design"] .replay-controls button,
body[data-ui-theme="shanhai-design"] .method-card button,
body[data-ui-theme="shanhai-design"] .method-card a,
body[data-ui-theme="shanhai-design"] .primary-cta,
body[data-ui-theme="shanhai-design"] .ghost-cta {
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

body[data-ui-theme="shanhai-design"] .site-footer {
  width: min(100% - 1.5rem, 1180px);
  padding-block: 1.2rem 1.5rem;
}

@media (max-width: 800px) {
  body[data-ui-theme="shanhai-design"] {
    padding-left: 0;
  }

  body[data-ui-theme="shanhai-design"] .site-sidebar {
    width: var(--sidebar-mobile-width);
  }

  body[data-ui-theme="shanhai-design"] .sidebar-head {
    padding-inline: 1rem;
  }

  body[data-ui-theme="shanhai-design"] .brand {
    justify-content: flex-start;
    font-size: 1.2rem;
    white-space: nowrap;
  }

  body[data-ui-theme="shanhai-design"] .line-sidebar,
  body[data-ui-theme="shanhai-design"] .line-sidebar--markers {
    padding-inline: 0.8rem;
  }

  body[data-ui-theme="shanhai-design"] .desktop-masthead {
    inset-inline-start: 0;
  }

  body[data-ui-theme="shanhai-design"] .today-layout,
  body[data-ui-theme="shanhai-design"] .today-hero-card,
  body[data-ui-theme="shanhai-design"] .inquiry-form,
  body[data-ui-theme="shanhai-design"] .chart-grid,
  body[data-ui-theme="shanhai-design"] .system-panel {
    grid-template-columns: 1fr;
  }

  body[data-ui-theme="shanhai-design"] .inquiry-form > .question-assist {
    grid-column: 1;
    grid-row: auto;
  }

  body[data-ui-theme="shanhai-design"] .system-panel > *:last-child { grid-column: 1; }

  body[data-ui-theme="shanhai-design"] .choice-grid,
  body[data-ui-theme="shanhai-design"] .system-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-ui-theme="shanhai-design"] .desktop-masthead {
    display: none;
  }
}

@media (max-width: 520px) {
  body[data-ui-theme="shanhai-design"] .choice-grid {
    grid-template-columns: 1fr;
  }

  body[data-ui-theme="shanhai-design"] .today-hero-card {
    min-height: auto;
  }

  body[data-ui-theme="shanhai-design"] .today-callout h1 {
    font-size: 1.6rem;
  }
}

/* ===== 体验报告修复批次（2026-09-25）===== */

/* 顶部纸雾：页头标题与说明直接叠在手绘太极水墨上，右上黑团会吞字
   （含高风险拦截文案）。此层垫在内容之下、墨画之上，不动排版。 */
body[data-ui-theme="shanhai-design"] main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 17rem;
  background: linear-gradient(
    to bottom,
    rgba(247, 243, 234, 0.9) 0%,
    rgba(247, 243, 234, 0.72) 52%,
    rgba(247, 243, 234, 0) 100%
  );
  pointer-events: none;
  z-index: -1;
}

/* 程序性切页焦点（非键盘停留点）：不显示粗框，保留可聚焦语义。 */
.page-view h1[tabindex="-1"]:focus,
.page-view h2[tabindex="-1"]:focus {
  outline: none;
}

/* 侧栏底注与步骤条未激活项：原 --muted 在纸底上偏浅，加深一档。 */
body[data-ui-theme="shanhai-design"] .sidebar-foot {
  color: #575b53;
}

body[data-ui-theme="shanhai-design"] .stepper {
  color: #575b53;
}

/* 今日卡左栏：日期块与四柱原被 min-height 拉开成大空腔，改为垂直居中聚拢。 */
body[data-ui-theme="shanhai-design"] .today-calendar {
  align-content: center;
}

/* 自定义墨点光标轻微降不透明度：悬停按钮/文字时减轻遮挡，同时保留轨迹感。 */
.target-cursor__ink-yinyang { opacity: 0.86; }

/* 六爻卦画：置于爻位列表上方，作为传统读卦入口。 */
.hexagram-figure {
  display: grid;
  justify-items: start;
  gap: 0.32rem;
  padding: 0.8rem 0.2rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

.hexagram-figure__line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.06rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  color: var(--ink);
}

.hexagram-figure__line--moving i {
  font-style: normal;
  margin-left: 0.45rem;
  color: var(--vermilion);
}

.hexagram-figure__caption {
  margin: 0.5rem 0 0;
  color: #575b53;
  font-size: 0.82rem;
}

/* 侧栏"设置"由装饰文本改为指向"我的"页的真实链接。 */
.sidebar-foot__settings {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
}

.sidebar-foot__settings:hover { text-decoration: underline; }

/* 勾选型 consent-control 始终保持"框+文字"横排：表单的网格 label 规则
   （.local-account-form label 等）会把它拆成两行，勾选框孤立（实测缺陷）。 */
form label.consent-control {
  display: flex;
  align-items: start;
  gap: 0.55rem;
  font-weight: 400;
}

form label.consent-control input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  flex: 0 0 auto;
  margin-top: 0.15rem;
}


/* ===== 「我的」页：分节式排版（无盒子堆叠，留白+细线分层） ===== */
.profile-page {
  display: block;
  max-width: 46rem;
  margin-inline: auto;
}

.profile-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.2rem 1.3rem;
}

.profile-hero__id { display: flex; align-items: center; gap: 0.9rem; }

.profile-avatar {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: var(--jade-dark);
  color: #f8f4e8;
  font-size: 1.3rem;
  font-weight: 700;
}

.profile-hero__name { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.profile-hero__msg { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--muted); }

.profile-hero__actions { display: flex; align-items: center; gap: 0.55rem; }

.profile-cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  background: var(--jade-dark);
  color: #f8f4e8;
  font-weight: 700;
  text-decoration: none;
}
.profile-cta[hidden] { display: none; }

.profile-section {
  border-top: 1px solid var(--line);
  padding: 1.35rem 0.2rem 1.45rem;
  display: grid;
  gap: 0.85rem;
}

.profile-section__head { display: grid; gap: 0.3rem; }
.profile-section__head h3 { margin: 0; font-size: 1.02rem; color: var(--ink); }
.profile-section__head p { margin: 0; color: #575b53; font-size: 0.86rem; line-height: 1.6; }

.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }

.profile-quiet {
  border: none;
  background: none;
  padding: 0.3rem 0.2rem;
  color: var(--jade-dark);
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 0;
}
.profile-quiet:disabled { color: var(--muted); text-decoration: none; }
.profile-quiet--danger { color: #a03d2d; }
.profile-quiet--danger:disabled { color: var(--muted); }

.profile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  margin: 0;
  padding: 0.1rem 0.2rem;
}
.profile-facts > div { display: flex; gap: 0.35rem; align-items: baseline; }
.profile-facts dt { color: var(--muted); font-size: 0.76rem; }
.profile-facts dd { margin: 0; font-size: 0.78rem; font-weight: 600; color: var(--ink); }

.profile-fine { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.6; }
.profile-verification-summary { color: var(--ink); font-size: 0.86rem; font-weight: 600; }

.profile-chips-block { display: grid; gap: 0.45rem; }
.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
}
.profile-chips > div {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  background: rgba(47, 94, 84, 0.08);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
}
.profile-chips dt { color: #4a544c; font-size: 0.72rem; }
.profile-chips dd { margin: 0; font-size: 0.76rem; font-weight: 700; color: var(--jade-dark); }

.profile-footnotes {
  border-top: 1px solid var(--line);
  margin-top: 0.4rem;
  padding: 1.2rem 0.2rem 1rem;
  display: grid;
  gap: 0.9rem;
}
.profile-footnotes h4 { margin: 0; font-size: 0.86rem; color: var(--ink); letter-spacing: 0.06em; }
.profile-footnotes ul { margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.profile-footnotes ul li { list-style: none; padding-left: 1rem; position: relative; color: var(--muted); font-size: 0.78rem; line-height: 1.6; }
.profile-footnotes ul li::before { content: "\00b7 "; position: absolute; left: 0.25rem; color: var(--jade-dark); font-weight: 700; }

.profile-risk { border-left: 3px solid var(--vermilion); padding: 0.4rem 0 0.4rem 0.8rem; display: grid; gap: 0.3rem; }
.profile-risk strong { color: var(--ink); font-size: 0.8rem; }
.profile-risk p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.65; }

.profile-switch span { font-size: 0.88rem; color: var(--ink); }

.local-account-form { display: grid; gap: 0.7rem; border-top: 1px dashed var(--line); padding-top: 0.8rem; }
.local-account-form__grid { display: grid; gap: 0.65rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.local-account-form label { display: grid; gap: 0.25rem; min-width: 0; color: var(--jade-dark); font-weight: 600; font-size: 0.8rem; }
.local-account-form input { width: 100%; min-height: 2.5rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: rgba(255, 253, 248, 0.92); font: inherit; }
.local-account-form label span { font-size: 0.78rem; }
.local-account-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.local-account-actions button { min-height: 2.5rem; padding: 0.35rem 0.8rem; font-size: 0.84rem; }

@media (max-width: 640px) {
  .local-account-form__grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; align-items: flex-start; }
}

.local-account-form { display: grid; gap: 0.7rem; border-top: 1px dashed var(--line); padding-top: 0.8rem; }
.local-account-form__grid { display: grid; gap: 0.65rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.local-account-form label { display: grid; gap: 0.25rem; min-width: 0; color: var(--jade-dark); font-weight: 600; font-size: 0.8rem; }
.local-account-form input { width: 100%; min-height: 2.5rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: rgba(255, 253, 248, 0.92); font: inherit; }
.local-account-form label span { font-size: 0.78rem; }
.local-account-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.local-account-actions button { min-height: 2.5rem; padding: 0.35rem 0.8rem; font-size: 0.84rem; }

@media (max-width: 640px) {
  .local-account-form__grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; align-items: flex-start; }
}

/* data-server-only：仅公网模式显示；data-local-only：仅本机预览模式显示。 */
body[data-auth-mode="local"] [data-server-only] { display: none; }
body[data-auth-mode="public"] [data-local-only] { display: none; }

/* ===== 独立登录/注册页（auth.html） ===== */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(247, 243, 234, 0.86), rgba(240, 235, 223, 0.94)),
    url("assets/divination-bg-shanhai-rotatable-base.webp");
  background-size: cover;
  background-position: center right;
  filter: grayscale(1);
  pointer-events: none;
}

.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem;
}

.auth-card {
  width: min(26.5rem, 100%);
  border: 1px solid rgba(221, 214, 198, 0.9);
  border-radius: 10px;
  background: rgba(255, 252, 246, 0.94);
  box-shadow: 0 24px 60px rgba(31, 42, 38, 0.16);
  padding: 2.4rem 2.2rem 1.6rem;
  display: grid;
  gap: 1.1rem;
}

.auth-card__head { display: grid; gap: 0.4rem; text-align: center; }
.auth-card__brand {
  margin: 0;
  color: var(--jade-dark);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
}
.auth-card__tagline {
  margin: 0;
  color: var(--caption-color);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
}
.auth-card__title { margin: 0.9rem 0 0; font-size: 1.3rem; color: var(--ink); font-weight: 700; }
.auth-card__copy { margin: 0 auto; color: #575b53; font-size: 0.84rem; line-height: 1.7; max-width: 20rem; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin-top: 0.4rem;
}
.auth-tabs button {
  min-height: 2.7rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  position: relative;
  padding: 0 0 0.55rem;
}
.auth-tabs button.is-active { color: var(--jade-dark); }
.auth-tabs button.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 2.6rem;
  height: 2px;
  transform: translateX(-50%);
  background: var(--vermilion);
  border-radius: 2px;
}

.auth-form { display: grid; gap: 0.85rem; margin-top: 0.35rem; }
.auth-form label { display: grid; gap: 0.35rem; font-size: 0.82rem; color: #4a544c; font-weight: 600; }
.auth-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.96);
  transition: border-color 160ms ease;
}
.auth-form input:not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(47, 94, 84, 0.12);
}
.auth-form button[type="submit"] {
  min-height: 2.9rem;
  margin-top: 0.2rem;
  border: none;
  border-radius: 6px;
  background: var(--jade-dark);
  color: #f8f4e8;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}
.auth-form button[type="submit"]:hover { background: #23433c; }

.auth-form__message { margin: 0; min-height: 1.2rem; font-size: 0.82rem; text-align: center; color: var(--muted); }
.auth-form__message[data-status="error"] { color: #a03d2d; }
.auth-form__message[data-status="ok"] { color: var(--jade-dark); }

.auth-form__assist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  font-size: 0.8rem;
  margin-top: -0.4rem;
}
.auth-form__assist button {
  border: none;
  background: none;
  padding: 0;
  color: var(--jade-dark);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-form__assist a { color: var(--muted); text-decoration: none; }
.auth-form__assist a:hover { color: var(--jade-dark); text-decoration: underline; }

.auth-card__foot {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.4rem;
}
.auth-card__foot p { margin: 0; color: var(--muted); font-size: 0.74rem; line-height: 1.7; text-align: center; }

.auth-page [hidden] { display: none !important; }

/* ===== 政策与流程文本页（privacy.html / rights.html）=====
   复用 auth-card 的纸底与圆角，但放宽宽度以适配长文本阅读。 */
.policy-doc {
  width: min(46rem, 100%);
  /* grid 子项默认 min-width:auto 会被宽表格撑破，导致移动端横向溢出。 */
  min-width: 0;
  gap: 1.4rem;
  color: var(--ink);
}
.policy-doc .auth-card__title { font-size: 1.5rem; }
/* 政策文本含 production-privacy-v1 等长标识，移动端需允许断行，否则撑破容器。 */
.policy-doc .auth-card__head,
.policy-doc .auth-card__head p,
.policy-doc .auth-card__copy { min-width: 0; overflow-wrap: anywhere; }
.policy-doc code, .policy-doc strong { overflow-wrap: anywhere; }
.policy-doc h2 {
  margin: 0.4rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
  color: var(--jade-dark);
}
.policy-doc h3 { margin: 0.9rem 0 0; font-size: 0.92rem; color: var(--ink); }
.policy-doc p, .policy-doc li { font-size: 0.88rem; line-height: 1.85; }
.policy-doc p { margin: 0; color: var(--ink); }
.policy-doc ul, .policy-doc ol { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.3rem; }
.policy-doc section { display: grid; gap: 0.6rem; }
.policy-doc a { color: var(--jade-dark); text-underline-offset: 3px; }
.policy-doc strong { color: var(--ink); }

.policy-toc {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 243, 234, 0.7);
  padding: 0.9rem 1.1rem;
}
.policy-toc ol { padding-left: 1.2rem; display: grid; gap: 0.25rem; }
.policy-toc a { font-size: 0.84rem; }

.policy-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  /* 表格用原生 table 布局并允许容器横向滚动；改成 display:block 会让
     宽表格的 min-content 撑破外层 grid，导致移动端整页横向溢出。 */
  display: table;
  table-layout: fixed;
}
.policy-table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* grid 轨道默认按子项 min-content 取宽；显式单列约束避免宽表格撑破整页。 */
.policy-doc { grid-template-columns: minmax(0, 1fr); }
.policy-doc > section { min-width: 0; }
.policy-table th, .policy-table td { overflow-wrap: anywhere; }
.policy-table caption { text-align: left; font-size: 0.78rem; color: var(--muted); padding-bottom: 0.4rem; }
.policy-table th, .policy-table td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}
.policy-table th { background: rgba(247, 243, 234, 0.85); color: var(--jade-dark); font-weight: 600; }

.policy-note {
  border-left: 3px solid var(--vermilion);
  padding: 0.4rem 0 0.4rem 0.8rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.policy-back { margin-top: 0.6rem; font-size: 0.84rem; }

/* 「我的」→ 边界与声明：政策与流程文本入口 */
.profile-policy-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; }
.profile-policy-links a { color: var(--jade-dark); font-size: 0.84rem; text-underline-offset: 3px; }

@media (max-width: 640px) {
  /* 窄屏政策表格卡片化：三列表在 390px 下需要横向滚动才能读到第三列，
     改为「标签在上、内容在下」的堆叠卡片，无需拖动即可读完。 */
  .policy-table-wrap { overflow-x: visible; }
  /* min-width:auto 在 table 上会解析为表格 intrinsic 宽度（实测 432px），
     显式归零才能让卡片模式真正贴合容器。 */
  .policy-table { display: block; border: none; min-width: 0; }
  .policy-table thead { display: none; }
  /* 单列轨道必须 minmax(0,1fr)：默认 auto 轨道按含长句单元格的
     max-content 取宽，会把整页顶出 84px 横向溢出（实测）。 */
  .policy-table tbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
  .policy-table tbody tr {
    display: grid;
    /* tr 自身也是 grid 容器：隐式列默认 max-content，会被长句撑宽整页。 */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 252, 245, 0.9);
    padding: 0.7rem 0.8rem;
  }
  .policy-table tbody td {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    border: none;
    padding: 0;
    overflow-wrap: anywhere;
  }
  .policy-table tbody td::before {
    content: attr(data-label);
    color: var(--jade-dark);
    font-size: 0.72rem;
    font-weight: 600;
  }
  .policy-table caption { display: block; padding-bottom: 0.5rem; }
}

@media (max-width: 480px) {
  .auth-card { padding: 1.8rem 1.3rem 1.3rem; }
  .auth-card__brand { font-size: 1.3rem; }
  .policy-doc p, .policy-doc li { font-size: 0.86rem; }
}

/* ===== 「我的」页：导航中枢模式 ===== */
.profile-menu { display: grid; gap: 0.6rem; margin-top: 1.2rem; }

.profile-menu__item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.9);
  padding: 0.9rem 1rem;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.profile-menu__item:hover { border-color: var(--jade); transform: translateY(-1px); }

.profile-menu__icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  background: rgba(47, 94, 84, 0.1);
  color: var(--jade-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  flex: 0 0 auto;
}

.profile-menu__body { display: grid; gap: 0.15rem; min-width: 0; flex: 1; }
.profile-menu__body strong { color: var(--ink); font-size: 0.94rem; }
.profile-menu__body small { color: var(--muted); font-size: 0.78rem; }

.profile-menu__arrow { color: var(--muted); font-size: 1rem; }

/* 导航中枢（profile.html 无 data-profile-section）：只显示菜单；
   子节页（body 带属性）：隐藏菜单与 hero，只显示匹配面板。 */
.profile-page > [data-profile-panel] { display: none; }
body[data-profile-section] .profile-menu { display: none; }
body[data-profile-section] .profile-hero { display: none; }
body[data-profile-section="account"] .profile-page > [data-profile-panel="account"],
body[data-profile-section="sync"] .profile-page > [data-profile-panel="sync"],
body[data-profile-section="local"] .profile-page > [data-profile-panel="local"],
body[data-profile-section="boundaries"] .profile-page > [data-profile-panel="boundaries"] { display: grid; }

.profile-back {
  justify-self: start;
  color: var(--jade-dark);
  font-size: 0.84rem;
  text-decoration: none;
}
.profile-back:hover { text-decoration: underline; }
/* ===== 移动端适配补丁（390/360/320） ===== */
@media (max-width: 640px) {
  .auth-page { padding: 1.5rem 0.9rem; }
  .auth-card, .auth-page__card { padding: 1.5rem 1.1rem 1.2rem; gap: 0.7rem; }
  .auth-card__brand, .auth-page__brand { font-size: 1.25rem; }
  .auth-card__title, .auth-page__title { font-size: 1.15rem; }
  .auth-card__copy, .auth-page__copy { font-size: 0.8rem; line-height: 1.6; max-width: 100%; }
  .auth-form input:not([type="checkbox"]) { min-height: 2.5rem; font-size: 16px; }
  .auth-form button[type="submit"] { min-height: 2.6rem; font-size: 0.92rem; letter-spacing: 0.2em; }
  .auth-tabs button { font-size: 0.88rem; letter-spacing: 0.1em; }
  .profile-hero { flex-direction: column; align-items: flex-start; gap: 0.7rem; padding: 0.5rem 0.15rem 1rem; }
  .profile-avatar { width: 2.6rem; height: 2.6rem; font-size: 1.1rem; }
  .profile-hero__name { font-size: 1.05rem; }
  .profile-section { padding: 1rem 0.15rem 1.1rem; gap: 0.65rem; }
  .profile-section__head h3 { font-size: 0.94rem; }
  .profile-section__head p { font-size: 0.8rem; }
  .profile-menu { gap: 0.45rem; margin-top: 0.8rem; }
  .profile-menu__item { padding: 0.7rem 0.8rem; gap: 0.6rem; }
  .profile-menu__icon { width: 2.1rem; height: 2.1rem; font-size: 0.7rem; }
  .profile-menu__body strong { font-size: 0.88rem; }
  .profile-menu__body small { font-size: 0.72rem; }
  .profile-cta { min-height: 2.3rem; padding: 0.35rem 0.9rem; font-size: 0.82rem; }
  .profile-actions { flex-wrap: wrap; gap: 0.4rem; }
  .profile-actions button { min-height: 2.3rem; padding: 0.35rem 0.6rem; font-size: 0.8rem; }
  .profile-facts { gap: 0.15rem 0.8rem; }
  .profile-chips { gap: 0.3rem; }
  .profile-chips > div { padding: 0.2rem 0.5rem; }
  .policy-doc { padding: 1.5rem 1rem 1.2rem; gap: 0.9rem; }
  .policy-doc h2 { font-size: 0.95rem; }
  .policy-doc p, .policy-doc li { font-size: 0.84rem; }
  .policy-toc { padding: 0.7rem 0.8rem; }
  .auth-form__assist, .auth-page__foot { flex-direction: column; gap: 0.5rem; align-items: center; }
}
@media (max-width: 390px) {
  .auth-page { padding: 1rem 0.6rem; }
  .auth-card, .auth-page__card, .policy-doc { padding: 1.2rem 0.9rem 1rem; }
  .profile-hero__name { font-size: 0.95rem; }
  .profile-section__head p { font-size: 0.76rem; }
}