:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-soft: #f3ede2;
  --ink: #161513;
  --muted: #5d564e;
  --line: #dfd5c5;
  --accent: #9e3b2b;
  --accent-dark: #7d2c1f;
  --gold: #b68b4c;
  --wood: #2b6b4f;
  --fire: #b44230;
  --earth: #9c7134;
  --metal: #5c6670;
  --water: #27597c;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.container {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
}

.notice-strip {
  background: var(--ink);
  color: #e9dfd0;
  font-size: 0.8rem;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.02em;
}

.site-header {
  background: rgba(250, 247, 242, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-seal {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-family: var(--serif);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.header-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.9rem;
}

.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.header-nav a:hover { color: var(--ink); }

.button, .button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.button {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.button-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.button-secondary:hover { border-color: var(--gold); color: var(--accent-dark); }
.button-small { padding: 7px 12px; font-size: 0.84rem; }

.hero {
  padding: 36px 0 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.hero h1 {
  font-size: clamp(1.9rem, 3.3vw, 2.7rem);
  letter-spacing: -0.02em;
  max-width: 720px;
}

.hero p {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 680px;
  font-size: 1rem;
}

.hero-badge {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(22, 21, 19, 0.04);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--ink);
}

.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid rgba(182, 139, 76, 0.35);
  border-color: var(--gold);
}

.row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}

.chart-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chart-banner {
  background: linear-gradient(135deg, #1d1b18 0%, #2c2620 100%);
  color: #faf7f2;
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.chart-banner h2 {
  font-size: 1.5rem;
  color: #faf7f2;
}

.chart-banner .dm-sub {
  color: #dfd0b8;
  font-size: 0.9rem;
  margin-top: 4px;
}

.pill-gold {
  border: 1px solid rgba(214, 189, 148, 0.45);
  background: rgba(182, 139, 76, 0.16);
  color: #f3dfbd;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.pillar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pillar-card.is-day {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(158, 59, 43, 0.12);
}

.pillar-head {
  padding: 7px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface-soft);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.pillar-card.is-day .pillar-head {
  background: var(--accent);
  color: #fff;
}

.pillar-body {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pillar-glyphs {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.glyph-han {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.glyph-pinyin {
  font-size: 0.92rem;
  font-weight: 700;
}

.el-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  width: fit-content;
}

.el-Wood { background: var(--wood); }
.el-Fire { background: var(--fire); }
.el-Earth { background: var(--earth); }
.el-Metal { background: var(--metal); }
.el-Water { background: var(--water); }

.text-Wood { color: var(--wood); }
.text-Fire { color: var(--fire); }
.text-Earth { color: var(--earth); }
.text-Metal { color: var(--metal); }
.text-Water { color: var(--water); }

.pillar-meta {
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid #f0e8da;
  padding-top: 7px;
}

.elements-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.86rem;
  font-weight: 600;
}

.bar-track {
  height: 11px;
  background: #efe7da;
  border-radius: 999px;
  overflow: hidden;
}

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

.guidance-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.87rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.luck-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fcfaf6;
}

.luck-item strong {
  display: block;
  font-size: 0.92rem;
}

.luck-item span {
  display: block;
  font-size: 0.77rem;
  color: var(--muted);
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pro-folio-card {
  background: linear-gradient(180deg, #fffdf9 0%, #f8f1e4 100%);
  border: 1.5px solid #d5bc90;
  border-radius: 14px;
  padding: 24px;
}

.pro-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.pro-price-tag {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent);
}

.folio-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 14px 0 18px;
  padding-left: 18px;
  font-size: 0.9rem;
  color: var(--ink);
}

.reading-output {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reading-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}

.reading-section h4 {
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.reading-section p {
  margin: 0;
  font-size: 0.93rem;
  color: #2e2a25;
}

.followup-panel {
  background: #fcfaf6;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.qa-item {
  border-left: 3px solid var(--wood);
  padding-left: 12px;
  margin-top: 12px;
}

.notice {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-top: 10px;
}
.notice[hidden] { display: none; }
.notice-info { background: #e9f3ee; border: 1px solid #b8d6c6; color: #164b36; }
.notice-error { background: #fbeaea; border: 1px solid #e4b5b5; color: #7a1c1c; }

.studio-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  background: #fff;
  color: var(--ink);
}
.studio-dialog::backdrop { background: rgba(22, 21, 19, 0.64); }
.studio-dialog [hidden] { display: none; }

.dialog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-weight: 700;
}

.close-dialog {
  background: none;
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.dialog-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-section {
  padding: 20px 0 44px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 26px 0 34px;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-main {
  padding: 36px 0 60px;
  max-width: 780px;
}

.legal-main h1 { margin-bottom: 14px; }
.legal-main h2 { margin: 24px 0 8px; font-size: 1.2rem; }
.legal-main p, .legal-main li { color: #342f2a; font-size: 0.95rem; }

@media (max-width: 960px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .pillars-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .elements-layout { grid-template-columns: 1fr; }
  .luck-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .folio-list { grid-template-columns: 1fr; }
  .faq-section { grid-template-columns: 1fr; }
}
