:root {
  color-scheme: light;
  --page: #f6f7f2;
  --page-soft: #fbfbf8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-muted: #eef2ed;
  --ink: #202629;
  --ink-soft: #4e5a58;
  --muted: #7c8580;
  --line: rgba(35, 47, 43, 0.12);
  --line-strong: rgba(178, 31, 45, 0.26);
  --cinnabar: #b21f2d;
  --cinnabar-soft: #fff0ef;
  --jade: #466f64;
  --gold: #b88a4d;
  --shadow: 0 22px 70px rgba(33, 42, 39, 0.1);
  --shadow-soft: 0 12px 34px rgba(33, 42, 39, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(246, 247, 242, 0.72)),
    linear-gradient(180deg, #ffffff 0%, var(--page) 54%, #eef2ef 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: auto -8vw 0 -8vw;
  height: 30vh;
  pointer-events: none;
  background:
    linear-gradient(160deg, transparent 18%, rgba(70, 111, 100, 0.08) 18.5%, transparent 28%),
    linear-gradient(22deg, transparent 28%, rgba(70, 111, 100, 0.08) 28.5%, transparent 40%);
  opacity: 0.55;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 78px minmax(0, 1fr) auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 44px);
  border-bottom: 1px solid rgba(35, 47, 43, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fffaf2;
  background: linear-gradient(145deg, #c92f38, #951b28);
  box-shadow: 0 10px 24px rgba(178, 31, 45, 0.2);
  font-size: 23px;
  font-weight: 850;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 850;
}

.ghost-button,
.soft-button,
.small-primary,
.mode-button,
.round-button,
.send-button,
.choice-grid button,
.manual-group button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.ghost-button {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(33, 42, 39, 0.06);
}

.message-list {
  width: min(900px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 34px clamp(16px, 3.5vw, 28px) 28px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.message-list::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  display: none;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.message.assistant::before {
  content: "九";
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fffaf2;
  background: var(--cinnabar);
  font-weight: 850;
  margin-top: 3px;
  box-shadow: 0 8px 18px rgba(178, 31, 45, 0.16);
}

.message.user {
  justify-content: flex-end;
}

.message.user::after {
  content: "";
  flex: 0 0 34px;
}

.bubble,
.choice-card,
.direction-card,
.cast-card,
.progress-card,
.manual-card,
.bazi-profile-card,
.reading-card {
  min-width: 0;
  max-width: min(680px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.bubble {
  padding: 16px 18px;
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--ink);
  font-size: 15px;
}

.message.user .bubble {
  max-width: min(640px, 84%);
  background: #fff5f3;
  border-color: rgba(178, 31, 45, 0.16);
  box-shadow: 0 12px 28px rgba(178, 31, 45, 0.08);
}

.thinking-bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  width: auto;
  min-width: 54px;
  padding: 15px 18px;
}

.thinking-bubble.has-text {
  gap: 8px;
}

.thinking-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(178, 31, 45, 0.55);
  animation: thinkingDot 1s ease-in-out infinite;
}

.thinking-bubble span:nth-child(2) {
  animation-delay: 0.14s;
}

.thinking-bubble span:nth-child(3) {
  animation-delay: 0.28s;
}

.thinking-bubble p {
  margin: 0 0 0 4px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
}

.choice-card,
.direction-card,
.cast-card,
.progress-card,
.manual-card,
.bazi-profile-card,
.reading-card {
  width: min(680px, 100%);
  padding: 18px;
}

.message.assistant .choice-card,
.message.assistant .direction-card,
.message.assistant .cast-card,
.message.assistant .progress-card,
.message.assistant .manual-card,
.message.assistant .bazi-profile-card,
.message.assistant .reading-card {
  flex: 1 1 0;
  width: auto;
}

.choice-card p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.choice-grid button {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border-radius: 16px;
  text-align: left;
}

.choice-grid span {
  color: var(--ink);
  font-weight: 760;
}

.choice-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.choice-grid button:hover,
.mode-menu button:hover,
.manual-group button:hover {
  border-color: var(--line-strong);
  background: var(--cinnabar-soft);
}

.direction-card {
  display: grid;
  gap: 16px;
}

.direction-intro {
  display: grid;
  gap: 7px;
}

.direction-intro p:first-child {
  color: var(--ink);
  font-size: 16px;
  font-weight: 780;
}

.direction-intro p:last-child {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.direction-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.direction-option {
  position: relative;
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(35, 47, 43, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.direction-option:not(:disabled):hover {
  border-color: var(--line-strong);
  background: var(--cinnabar-soft);
}

.direction-card.has-selection .direction-option:not(.selected):not(.disabled) {
  opacity: 0.54;
}

.direction-option.selected {
  border-color: rgba(178, 31, 45, 0.42);
  background: linear-gradient(180deg, #fff7f6, #ffffff);
  box-shadow: 0 14px 28px rgba(178, 31, 45, 0.1);
}

.direction-option.disabled {
  background: rgba(242, 244, 240, 0.72);
  color: #8b948f;
  filter: grayscale(0.2);
  cursor: not-allowed;
}

.direction-option-head {
  display: grid;
  gap: 6px;
  padding-right: 28px;
}

.direction-option-head strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 820;
}

.direction-option-head i {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(70, 111, 100, 0.09);
  color: var(--jade);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.direction-option.selected .direction-option-head i {
  background: rgba(178, 31, 45, 0.1);
  color: var(--cinnabar);
}

.direction-option > span:not(.direction-option-head),
.direction-option small {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.matter-scene-card,
.next-action-card {
  display: grid;
  gap: 14px;
}

.scene-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.scene-option {
  min-height: 74px;
  display: grid;
  gap: 5px;
  align-content: start;
  padding: 10px;
  border: 1px solid rgba(35, 47, 43, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.scene-option:hover {
  border-color: var(--line-strong);
  background: var(--cinnabar-soft);
}

.matter-scene-card.has-selection .scene-option:not(.selected) {
  opacity: 0.56;
}

.scene-option.selected {
  border-color: rgba(178, 31, 45, 0.42);
  background: linear-gradient(180deg, #fff7f6, #ffffff);
  box-shadow: 0 12px 24px rgba(178, 31, 45, 0.1);
}

.scene-option strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.scene-option span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.next-action-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.next-action-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.next-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.direction-option small {
  color: var(--muted);
}

.direction-option-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid rgba(178, 31, 45, 0.34);
  background: rgba(255, 255, 255, 0.88);
  color: transparent;
  font-size: 14px;
  line-height: 1;
  opacity: 1;
  transform: scale(1);
  transition: opacity 140ms ease, transform 140ms ease;
}

.direction-option.selected .direction-option-check::before {
  content: "✓";
}

.direction-option.selected .direction-option-check {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: #fffaf2;
}

.direction-option.disabled .direction-option-check {
  border-color: rgba(138, 148, 143, 0.24);
  background: rgba(242, 244, 240, 0.72);
}

.direction-status {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 7px 12px;
  border: 1px solid rgba(70, 111, 100, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--jade);
  font-size: 13px;
  font-weight: 760;
  box-shadow: 0 8px 22px rgba(33, 42, 39, 0.06);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-head h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
}

.card-head p,
.cast-foot,
.manual-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card-head strong {
  color: var(--cinnabar);
}

.soft-tag {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef5f1;
  color: var(--jade);
  font-size: 12px;
  font-weight: 760;
}

.coin-strip {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(244, 247, 244, 0.72)),
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(70, 111, 100, 0.04) 28px 29px);
  border: 1px solid rgba(35, 47, 43, 0.08);
}

.coin-chip {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #4d351c;
  background: linear-gradient(145deg, #f0c56f, #bd8540);
  border: 1px solid rgba(103, 65, 27, 0.18);
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(138, 96, 50, 0.16);
}

.coin-chip.yin {
  color: #45524f;
  background: linear-gradient(145deg, #e7ebe7, #bac5be);
}

.coin-strip.shaking .coin-chip {
  animation: coinShake 0.72s ease-in-out;
}

.coin-strip.shaking .coin-chip:nth-child(2) {
  animation-delay: 0.06s;
}

.coin-strip.shaking .coin-chip:nth-child(3) {
  animation-delay: 0.12s;
}

@keyframes coinShake {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  25% { transform: translate(-10px, -8px) rotate(90deg) scale(1.06); }
  50% { transform: translate(12px, 7px) rotate(180deg) scale(0.96); }
  75% { transform: translate(-5px, 5px) rotate(270deg) scale(1.04); }
  100% { transform: translate(0, 0) rotate(360deg) scale(1); }
}

.cast-lines {
  display: grid;
  gap: 7px;
}

.cast-line {
  display: grid;
  grid-template-columns: 52px 112px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 9px;
  border-radius: 12px;
}

.cast-line.moving {
  background: rgba(178, 31, 45, 0.055);
}

.cast-line.empty {
  color: var(--muted);
}

.cast-line span:first-child,
.cast-line em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.yao {
  position: relative;
  display: block;
  width: 92px;
  height: 10px;
  border-radius: 999px;
  background: var(--cinnabar);
}

.yao.yin {
  background: #9ba9a2;
}

.yao.yin i {
  position: absolute;
  left: 39px;
  top: -2px;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #fbfbf8;
}

.yao.pending {
  background: #dce3de;
}

.cast-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.progress-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.progress-card h2 {
  font-size: 15px;
  line-height: 1.35;
}

.progress-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progress-elapsed {
  display: block;
  margin-top: 6px;
  color: var(--jade);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.progress-orbit {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef5f1;
  border: 1px solid rgba(70, 111, 100, 0.14);
}

.progress-orbit span {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 999px;
  border: 3px solid rgba(70, 111, 100, 0.18);
  border-top-color: var(--cinnabar);
  animation: progressSpin 0.9s linear infinite;
}

.progress-card[data-status="done"] .progress-orbit span {
  width: 16px;
  height: 9px;
  border: 0;
  border-left: 3px solid var(--jade);
  border-bottom: 3px solid var(--jade);
  border-radius: 0;
  transform: rotate(-45deg);
  animation: none;
}

.progress-card[data-status="error"] .progress-orbit {
  background: var(--cinnabar-soft);
}

.progress-card[data-status="error"] .progress-orbit span {
  width: 16px;
  height: 3px;
  border: 0;
  border-radius: 999px;
  background: var(--cinnabar);
  animation: none;
}

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

@keyframes thinkingDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.small-primary,
.send-button {
  color: #fffaf2;
  background: var(--cinnabar);
  border-color: rgba(178, 31, 45, 0.2);
  box-shadow: 0 12px 26px rgba(178, 31, 45, 0.14);
  font-weight: 760;
}

.small-primary {
  min-height: 38px;
  padding: 0 16px;
}

.manual-lines {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.manual-row {
  display: grid;
  grid-template-columns: 52px 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.manual-row > span {
  color: var(--muted);
  font-size: 13px;
}

.manual-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.manual-group button {
  min-height: 34px;
  font-size: 13px;
}

.manual-group button.active {
  color: var(--cinnabar);
  border-color: var(--line-strong);
  background: var(--cinnabar-soft);
  font-weight: 760;
}

.overline {
  display: block;
  margin-bottom: 5px;
  color: var(--jade);
  font-size: 12px;
  font-weight: 780;
}

.pending-interpretation {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  margin: -2px 0 14px;
  border-radius: 13px;
  color: var(--jade);
  background: #eef5f1;
  border: 1px solid rgba(70, 111, 100, 0.12);
}

.pending-interpretation span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(70, 111, 100, 0.22);
  border-top-color: var(--cinnabar);
  animation: progressSpin 0.9s linear infinite;
}

.pending-interpretation p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.reading-copy {
  display: grid;
  gap: 12px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.reading-report-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid rgba(178, 31, 45, 0.16);
  border-radius: 15px;
  background:
    linear-gradient(90deg, rgba(178, 31, 45, 0.08), rgba(255, 248, 237, 0.88)),
    rgba(255, 255, 255, 0.72);
}

.reading-report-download div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.reading-report-download strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 820;
}

.reading-report-download span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.reading-report-download a {
  min-height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #fff;
  background: var(--cinnabar);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(178, 31, 45, 0.18);
}

.reading-section {
  min-width: 0;
  padding: 13px 14px 14px;
  border: 1px solid rgba(35, 47, 43, 0.08);
  border-left: 4px solid rgba(70, 111, 100, 0.34);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.58);
}

.reading-section header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.reading-section header span {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--jade);
  background: #eef5f1;
  font-size: 11px;
  font-weight: 820;
}

.reading-section-body {
  display: grid;
  gap: 8px;
}

.reading-section-conclusion {
  border-left-color: rgba(178, 31, 45, 0.48);
  background: linear-gradient(90deg, rgba(255, 240, 239, 0.72), rgba(255, 255, 255, 0.58));
}

.reading-section-conclusion header span {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.reading-section-timing {
  border-left-color: rgba(184, 138, 77, 0.48);
}

.reading-section-timing header span {
  color: var(--gold);
  background: #fff7e8;
}

.reading-section-advice {
  border-left-color: rgba(70, 111, 100, 0.52);
  background: linear-gradient(90deg, rgba(238, 245, 241, 0.72), rgba(255, 255, 255, 0.58));
}

.reading-section-conflict,
.reading-section-uncertain {
  border-left-color: rgba(124, 133, 128, 0.42);
  background: rgba(248, 249, 245, 0.76);
}

.reading-copy h3,
.reading-copy h4,
.reading-copy p,
.reading-copy ul {
  margin: 0;
}

.reading-copy h3 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 820;
}

.reading-copy h4 {
  color: var(--jade);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 800;
}

.reading-copy ul {
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.reading-copy li {
  position: relative;
  padding-left: 16px;
}

.reading-copy li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--cinnabar);
}

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

.soft-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--jade);
  font-size: 13px;
}

.traditional-chart {
  display: grid;
  gap: 10px;
  margin: 16px 0 14px;
  padding: 12px;
  border: 1px solid rgba(35, 47, 43, 0.1);
  border-radius: 16px;
  background: rgba(248, 249, 245, 0.86);
}

.traditional-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.traditional-grid {
  display: grid;
  gap: 6px;
}

.traditional-row {
  display: grid;
  grid-template-columns: 46px 92px minmax(0, 1.2fr) 38px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink-soft);
  font-size: 12px;
}

.traditional-row-head {
  min-height: 28px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
}

.traditional-row span {
  min-width: 0;
}

.daliuren-chart-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 8px;
}

.daliuren-panel {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.daliuren-panel h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 780;
}

.daliuren-panel pre {
  margin: 0;
  overflow-x: auto;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.daliuren-transmissions {
  grid-column: 1 / -1;
}

.daliuren-transmissions div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.daliuren-transmissions p {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(248, 249, 245, 0.86);
}

.daliuren-transmissions p span {
  color: var(--muted);
  font-size: 11px;
}

.daliuren-transmissions p strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}

.bazi-profile-card {
  display: grid;
  gap: 14px;
}

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

.bazi-form-grid label,
.bazi-time-field,
.bazi-form-toggles label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.ziwei-focus-field {
  grid-column: 1 / -1;
}

.bazi-form-grid label em,
.bazi-time-field em {
  min-height: 15px;
  color: color-mix(in srgb, var(--muted) 86%, var(--ink));
  font-style: normal;
  font-weight: 560;
  line-height: 1.45;
}

.bazi-form-grid input:not([type="checkbox"]),
.bazi-form-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(35, 47, 43, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
}

.bazi-time-field {
  grid-column: 1 / -1;
}

.bazi-time-selects {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.bazi-form-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bazi-form-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.bazi-form-toggles label:has(input:disabled) {
  opacity: 0.58;
}

.bazi-time-toggle {
  margin-top: 2px;
}

.bazi-time-toggle label {
  width: fit-content;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(35, 47, 43, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1;
  font-weight: 720;
}

.bazi-time-toggle input[type="checkbox"] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--cinnabar);
}

.bazi-form-error {
  margin: 0;
  color: var(--cinnabar);
  font-size: 13px;
}

.bazi-chart {
  gap: 12px;
}

.bazi-calendar-line {
  color: var(--jade);
  font-size: 13px;
  font-weight: 800;
}

.bazi-summary-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.bazi-summary-cards div {
  min-width: 0;
  padding: 9px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(26, 32, 28, 0.06);
}

.bazi-summary-cards span,
.bazi-summary-cards em {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
}

.bazi-summary-cards b {
  display: block;
  margin: 2px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 860;
  line-height: 1.25;
}

.bazi-pillar-table {
  display: grid;
  gap: 5px;
}

.bazi-pillar-row {
  display: grid;
  grid-template-columns: 48px repeat(4, minmax(0, 1fr));
  gap: 5px;
  align-items: stretch;
}

.bazi-pillar-row > span,
.bazi-pillar-row > strong {
  min-width: 0;
  padding: 8px 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.68);
  text-align: center;
  line-height: 1.35;
}

.bazi-pillar-row > span {
  color: var(--muted);
  font-size: 11px;
}

.bazi-pillar-row > strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.bazi-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 8px;
}

.bazi-chart-grid-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bazi-panel,
.bazi-shensha {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.bazi-panel h3,
.bazi-shensha h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.bazi-panel p,
.bazi-shensha p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.bazi-dayun-list,
.bazi-liunian-list,
.bazi-mini-list {
  display: grid;
  gap: 6px;
}

.bazi-dayun-list span,
.bazi-liunian-list span,
.bazi-mini-list span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(248, 249, 245, 0.86);
}

.bazi-dayun-list span.current {
  border: 1px solid rgba(169, 29, 43, 0.32);
  background: rgba(255, 246, 246, 0.9);
}

.bazi-dayun-list b,
.bazi-liunian-list b,
.bazi-mini-list b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.bazi-dayun-list em,
.bazi-liunian-list em,
.bazi-dayun-list i,
.bazi-liunian-list i,
.bazi-mini-list em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  line-height: 1.35;
}

.ziwei-chart {
  gap: 14px;
}

.ziwei-palace-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ziwei-palace {
  min-height: 116px;
  border: 1px solid rgba(121, 38, 54, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}

.ziwei-palace-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 8px;
}

.ziwei-palace-head strong {
  color: var(--ink);
  font-size: 14px;
}

.ziwei-palace-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.ziwei-palace p {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 8px;
}

.ziwei-palace p b,
.ziwei-palace p em {
  color: var(--accent);
  font-size: 13px;
  font-style: normal;
  line-height: 1.35;
}

.ziwei-palace small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.beast,
.fushen,
.movement,
.gua-line strong,
.gua-line b {
  white-space: nowrap;
}

.fushen {
  color: var(--muted);
}

.gua-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.gua-line strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
}

.gua-line i {
  min-width: 16px;
  color: var(--cinnabar);
  font-style: normal;
  font-weight: 760;
}

.gua-line b {
  color: var(--jade);
  font-size: 14px;
  line-height: 1;
}

.gua-line em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.movement {
  color: var(--cinnabar);
  font-weight: 800;
  text-align: center;
}

.changed strong {
  color: var(--ink-soft);
}

.chart-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.chart-line {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  background: #f7f8f5;
  color: var(--muted);
  font-size: 13px;
}

.chart-line strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.chart-line em {
  color: var(--jade);
  font-style: normal;
  font-size: 12px;
}

.composer-area {
  position: relative;
  z-index: 2;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 12px clamp(14px, 3.5vw, 28px) 22px;
  background: linear-gradient(180deg, rgba(246, 247, 242, 0), rgba(246, 247, 242, 0.94) 34%, rgba(246, 247, 242, 0.98));
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.system-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(35, 47, 43, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(31, 39, 35, 0.08);
  backdrop-filter: blur(16px);
}

.system-switch button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
}

.system-switch button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(178, 31, 45, 0.12), 0 8px 18px rgba(178, 31, 45, 0.1);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(35, 47, 43, 0.1);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.mode-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 760;
  white-space: nowrap;
  border-color: rgba(35, 47, 43, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.mode-button.locked {
  color: var(--muted);
  cursor: default;
}

.mode-button.locked .chevron {
  display: none;
}

.chevron {
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 44px;
  max-height: 128px;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  padding: 11px 2px;
  line-height: 1.45;
  font-size: 16px;
}

textarea::placeholder {
  color: #9aa39d;
}

textarea:disabled {
  cursor: not-allowed;
  color: #9aa39d;
  -webkit-text-fill-color: #9aa39d;
}

.composer.input-disabled {
  background: rgba(248, 247, 244, 0.86);
}

.composer.input-disabled .send-button {
  opacity: 0.52;
  cursor: not-allowed;
}

.round-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-weight: 760;
}

.round-button.active {
  color: var(--cinnabar);
  border-color: var(--line-strong);
  background: var(--cinnabar-soft);
}

.send-button {
  height: 44px;
}

.mode-menu {
  position: absolute;
  left: clamp(14px, 3.5vw, 28px);
  bottom: 138px;
  z-index: 5;
  width: 280px;
  padding: 8px;
  border: 1px solid rgba(35, 47, 43, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mode-menu button {
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.mode-menu button span,
.mode-menu button small {
  display: block;
}

.mode-menu button span {
  font-weight: 760;
}

.mode-menu button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.mode-menu button.active {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  font-weight: 760;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-rows: 68px minmax(0, 1fr) auto;
  }

  .app-header {
    padding: 0 16px;
  }

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

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

  .ghost-button {
    width: auto;
    min-width: 64px;
    height: 40px;
    padding: 0 12px;
    justify-content: center;
  }

  .ghost-button span:last-child {
    display: none;
  }

  .message-list {
    padding: 22px 14px 96px;
  }

  .message {
    gap: 8px;
    margin-bottom: 17px;
  }

  .message.assistant::before {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .bubble,
  .choice-card,
  .direction-card,
  .matter-scene-card,
  .next-action-card,
  .cast-card,
  .progress-card,
  .manual-card,
  .bazi-profile-card,
  .reading-card {
    border-radius: 18px;
  }

  .bubble {
    padding: 14px 15px;
    font-size: 14px;
  }

  .message.user .bubble {
    max-width: 82%;
  }

  .choice-card,
  .direction-card,
  .cast-card,
  .progress-card,
  .manual-card,
  .bazi-profile-card,
  .reading-card {
    padding: 14px;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .direction-options {
    grid-template-columns: 1fr;
  }

  .scene-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .next-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .direction-option {
    min-height: 0;
    gap: 7px;
    padding: 12px 13px;
    border-radius: 16px;
  }

  .direction-option-head {
    gap: 5px;
  }

  .direction-option-head strong {
    font-size: 14px;
  }

  .direction-option > span:not(.direction-option-head),
  .direction-option small {
    font-size: 12.5px;
    line-height: 1.46;
  }

  .direction-option-check {
    top: 11px;
    right: 11px;
    width: 22px;
    height: 22px;
  }

  .choice-grid button {
    min-height: 68px;
  }

  .cast-line {
    grid-template-columns: 44px 92px minmax(0, 1fr);
    gap: 7px;
  }

  .yao {
    width: 78px;
  }

  .yao.yin i {
    left: 33px;
  }

  .manual-row {
    grid-template-columns: 44px 1fr;
  }

  .manual-group[data-field="moving"] {
    grid-column: 2;
  }

  .traditional-chart {
    padding: 10px;
    border-radius: 14px;
  }

  .reading-report-download {
    align-items: stretch;
    flex-direction: column;
  }

  .reading-report-download a {
    width: 100%;
  }

  .traditional-meta {
    display: grid;
    justify-content: stretch;
  }

  .traditional-row {
    grid-template-columns: 34px 68px minmax(78px, 1fr) 28px minmax(76px, 1fr);
    gap: 4px;
    padding: 7px 5px;
    font-size: 11px;
  }

  .traditional-row-head {
    font-size: 10px;
  }

  .daliuren-chart-grid,
  .daliuren-transmissions div,
  .bazi-form-grid,
  .bazi-summary-cards,
  .bazi-chart-grid,
  .ziwei-palace-grid {
    grid-template-columns: 1fr;
  }

  .daliuren-transmissions {
    grid-column: auto;
  }

  .bazi-time-selects {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .bazi-form-grid input:not([type="checkbox"]),
  .bazi-form-grid select {
    min-height: 40px;
    padding: 0 8px;
    font-size: 13px;
  }

  .bazi-pillar-row {
    grid-template-columns: 40px repeat(4, minmax(54px, 1fr));
    gap: 4px;
  }

  .bazi-pillar-row > span,
  .bazi-pillar-row > strong {
    padding: 7px 4px;
    font-size: 10.5px;
  }

  .gua-line {
    gap: 3px;
  }

  .gua-line strong {
    font-size: 11px;
  }

  .gua-line b {
    font-size: 13px;
  }

  .gua-line em {
    display: none;
  }

  .chart-line {
    grid-template-columns: 44px 1fr;
  }

  .chart-line em {
    grid-column: 2;
  }

  .composer-area {
    padding: 10px 10px 14px;
  }

  .composer-toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .system-switch {
    flex: 1 1 auto;
    min-width: 0;
  }

  .system-switch button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 8px;
    border-radius: 22px;
    padding: 10px;
  }

  .mode-button {
    min-height: 46px;
    flex: 0 0 auto;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 13px;
  }

  textarea {
    font-size: 15px;
  }

  .round-button {
    width: 42px;
    height: 42px;
  }

  .send-button {
    height: 42px;
  }

  .mode-menu {
    left: 10px;
    right: 10px;
    bottom: 126px;
    width: auto;
  }
}

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