:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --ink: #4a3f46;
  --muted: #8a7d86;
  --line: #f0dfe9;
  --paper: #fff9ee;
  --panel: rgba(255, 255, 255, 0.88);
  --green: #8bcfb1;
  --red: #ff9e9a;
  --ochre: #f4c982;
  --silver: #b9bdd7;
  --blue: #9bc7ee;
  --peach: #ffb7aa;
  --cream: #fff7da;
  --mint: #dbf5e8;
  --lavender: #efe7ff;
  --shadow: 0 18px 42px rgba(168, 121, 143, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, #fff0ed 0%, #fff8dc 30%, #e4f8ee 64%, #edf6ff 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 40px;
}

.intro {
  min-height: 190px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 2px 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #d9788b;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  line-height: 0.94;
  color: #5d4955;
  text-shadow: 0 5px 0 rgba(255, 255, 255, 0.7);
}

h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.badge {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 158, 154, 0.38);
  border-radius: 8px;
  padding: 9px 14px;
  color: #a85f6e;
  background: rgba(255, 247, 218, 0.8);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(255, 183, 170, 0.18);
}

.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.form-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 238, 0.9)),
    var(--panel);
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

label {
  display: grid;
  gap: 7px;
  color: #66545e;
  font-weight: 700;
  font-size: 0.92rem;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #eed8e5;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input:focus {
  outline: 3px solid rgba(155, 199, 238, 0.28);
  border-color: #9bc7ee;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #ffbdb2, #ff958e);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(255, 149, 142, 0.26);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

button:hover {
  filter: saturate(1.06);
  transform: translateY(-1px);
  box-shadow: 0 15px 28px rgba(255, 149, 142, 0.32);
}

button:disabled {
  cursor: progress;
  filter: grayscale(0.12);
  transform: none;
}

.result-panel {
  min-height: 520px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 231, 255, 0.42)),
    var(--panel);
}

.empty-state {
  min-height: 470px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
}

.hidden {
  display: none;
}

.pet-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(240, 223, 233, 0.86);
}

.pet-face {
  width: 92px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #fff8d8, #e1f7ee);
  font-size: 2.4rem;
  font-weight: 900;
  color: #7d6674;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 12px 24px rgba(155, 199, 238, 0.22);
}

.pet-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.pillar {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  padding: 14px 10px;
  text-align: center;
  background: linear-gradient(180deg, #fff9ee, #fff2f3);
  box-shadow: 0 8px 18px rgba(168, 121, 143, 0.08);
}

.pillar span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pillar strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
  color: #6a5362;
}

.element-bars {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.bar-row {
  display: grid;
  grid-template-columns: 34px 1fr 26px;
  gap: 10px;
  align-items: center;
  color: #66545e;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(240, 223, 233, 0.9);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.tasks {
  margin-top: 22px;
}

.reading {
  margin-top: 24px;
}

.reading-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.reading-card {
  min-height: 142px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 249, 238, 0.88), rgba(232, 243, 255, 0.68));
  box-shadow: 0 8px 18px rgba(168, 121, 143, 0.08);
}

.reading-card:nth-child(2n) {
  background: linear-gradient(180deg, rgba(225, 247, 238, 0.82), rgba(255, 242, 243, 0.7));
}

.reading-card h3 {
  margin: 0 0 8px;
  color: #6a5362;
  font-size: 0.98rem;
}

.reading-card p {
  margin: 0;
  color: #756771;
  font-size: 0.92rem;
  line-height: 1.68;
}

.task {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid rgba(240, 223, 233, 0.8);
}

.task:last-child {
  border-bottom: 0;
}

.task input {
  min-height: 20px;
  accent-color: #8bcfb1;
}

.task.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.chat {
  margin-top: 18px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(225, 247, 238, 0.46)),
    var(--panel);
}

.chat-log {
  display: grid;
  gap: 10px;
  min-height: 132px;
  max-height: 260px;
  overflow: auto;
  padding: 12px 0;
}

.bubble {
  max-width: min(720px, 92%);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.65;
  box-shadow: 0 8px 18px rgba(168, 121, 143, 0.08);
}

.bubble.pet {
  background: #e1f7ee;
  color: #4e645c;
}

.bubble.user {
  justify-self: end;
  background: #e8f3ff;
  color: #4c5f72;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
}

[data-element="木"] {
  --element-color: var(--green);
}

[data-element="火"] {
  --element-color: var(--red);
}

[data-element="土"] {
  --element-color: var(--ochre);
}

[data-element="金"] {
  --element-color: var(--silver);
}

[data-element="水"] {
  --element-color: var(--blue);
}

[data-element] .bar-fill,
.bar-fill[data-element] {
  background: var(--element-color);
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 680px);
    padding: 18px 0;
  }

  .intro,
  .workspace,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: 150px;
    align-items: start;
    display: grid;
  }

  .badge {
    width: fit-content;
  }

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

  .reading-grid {
    grid-template-columns: 1fr;
  }
}
