/* The homepage's two material palettes, shared by every functional screen. */
body[data-theme="black-gold"] {
  --bg: #0c0e10;
  --surface: #17191a;
  --surface-2: #202120;
  --surface-3: #292923;
  --text: #f3e9d6;
  --muted: #c3b69e;
  --subtle: #ad9f88;
  --accent: #e0bd76;
  --accent-strong: #efd59d;
  --accent-contrast: #302516;
  --line: #c4a3654d;
  --line-soft: #c4a36529;
  --soft-accent: #27241d;
  --glow: #d7ad5717;
  --scene-panel: linear-gradient(145deg, #24231ed9, #151719f5 70%);
  --scene-button: linear-gradient(110deg, #dcae5d, #f5d893 42%, #dfb468);
  --scene-shadow: 0 12px 32px #05070936;
  --scene-highlight: #ffe2ab14;
  --scene-pedestal: #38362e;
}
body[data-theme="soft-pink"] {
  --bg: #f3e9e3;
  --surface: #faf3ed;
  --surface-2: #f0e3dd;
  --surface-3: #e8d8d2;
  --text: #60464d;
  --muted: #795b64;
  --subtle: #7e5e66;
  --accent: #934b61;
  --accent-strong: #7d394e;
  --accent-contrast: #fff8f2;
  --line: #a3657547;
  --line-soft: #a3657529;
  --soft-accent: #efdce0;
  --glow: #a96d8015;
  --scene-panel: linear-gradient(145deg, #fffaf4ed, #f8eee7f7 70%);
  --scene-button: linear-gradient(115deg, #874155, #a35a6e 57%, #8c465c);
  --scene-shadow: 0 12px 32px #79515c12;
  --scene-highlight: #fffaf4b3;
  --scene-pedestal: #d8bfb9;
}
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
/* Clip decorative transforms without creating nested scroll containers. */
body .app-shell, #screen-spread { overflow: clip; }
body:not([data-screen="home"]) .app-shell { background: var(--bg); }
body:not([data-screen="home"]) .app-shell::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 780px;
  background: var(--home-scene) center top / 100% auto no-repeat;
  mask-image: linear-gradient(#0008, #0003 58%, transparent);
  opacity: .6;
}
body:not([data-screen="home"]) .main-content {
  width: calc(100% - 40px);
  min-height: calc(100svh - 62px);
  padding: 8px 0 max(112px, calc(env(safe-area-inset-bottom) + 96px));
}
body:not([data-screen="home"]) :is(h2, h3) {
  font-family: var(--home-serif);
  font-weight: 600;
  letter-spacing: .02em;
  text-wrap: balance;
}
body:not([data-screen="home"]) h2 { font-size: clamp(24px, 6.8cqw, 31px); line-height: 1.4; }
.screen-heading, #screen-result .screen-heading {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 18px 0 28px;
}
.screen-heading .eyebrow { display: none; }
.screen-heading h2, #screen-result .screen-heading h2 { font-size: clamp(22px, 5.6cqw, 27px); line-height: 1.45; text-wrap: pretty; }
.step-count { align-self: start; margin-top: 7px; font-family: Georgia, serif; font-size: 11px; letter-spacing: .02em; color: var(--muted); }
.back-button { border-radius: 50%; background: color-mix(in srgb, var(--surface) 65%, transparent); border-color: var(--line-soft); }
.eyebrow { font-family: Georgia, serif; font-weight: 400; }
.section-label, .section-note, .field-meta { font-size: 12px; }
.primary-button {
  border: 1px solid var(--line);
  background: var(--scene-button);
  box-shadow: inset 0 1px 0 var(--scene-highlight), 0 8px 18px var(--glow);
  font-family: var(--home-serif);
  font-size: 16px;
  font-weight: 600;
}
.primary-button:hover { background: var(--scene-button); filter: brightness(1.05); }
.secondary-button { background: var(--scene-panel); border-color: var(--line); font-weight: 500; }
.text-button { min-height: 44px; font-size: 13px; }
:is(button, summary, input, select, textarea, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:is(button, summary, input, select, textarea) { scroll-margin-block: 24px 110px; }
:is(.topic-chip, .filter-chip, .chat-suggestion, .clarification-option, .size-option) { min-height: 44px; }
:is(.topic-chip, .filter-chip, .size-option).is-selected { background: var(--soft-accent); color: var(--accent); border-color: var(--accent); }
button:active { filter: brightness(.96); }

/* Conversation: a quiet opening, one reply, then a generous writing surface. */
#screen-reading .prompt-panel { margin: 0 0 24px; padding: 0 4px 20px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: none; }
#screen-reading .panel-kicker { font-family: var(--home-serif); font-size: 20px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
#screen-reading .prompt-panel p:last-child { font-size: 13px; color: var(--muted); line-height: 1.85; }
.chat-panel { margin-bottom: 28px; }
.chat-avatar { width: 34px; height: 34px; background: var(--scene-panel); box-shadow: 0 0 0 4px var(--glow); }
.chat-message p { border-radius: 0 18px 18px 18px; padding: 16px; background: var(--scene-panel); box-shadow: var(--scene-shadow); font-size: 14px; line-height: 1.85; }
.topic-block { margin-bottom: 24px; }
.topic-chip, .filter-chip, .chat-suggestion { background: color-mix(in srgb, var(--surface) 60%, transparent); border-color: var(--line-soft); }
.concern-input { min-height: 152px; border-radius: 18px; background: var(--scene-panel); padding: 18px; box-shadow: inset 0 1px 0 var(--scene-highlight); font-size: 16px; line-height: 1.9; }
.concern-input::placeholder { color: var(--subtle); }
.field-label { font-weight: 500; font-size: 14px; }
.chat-suggestion { font-size: 12px; }
.primary-button-bottom { margin-top: 12px; }
.clarification-turn { padding: 18px 16px; background: var(--scene-panel); box-shadow: none; border-radius: 18px; }
.clarification-options, .clarification-other { margin-left: 0; }

/* Drawing: the active card transforms and flight paths remain in styles.css. */
#screen-spread .screen-heading { margin-top: 8px; margin-bottom: 16px; }
.blessing-note { border: 0; border-radius: 0; background: transparent; padding: 0 2px 18px; margin-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.blessing-note strong { font-family: var(--home-serif); font-size: 17px; font-weight: 500; }
.blessing-note p { font-size: 13px; line-height: 1.75; }
.blessing-mark { width: 36px; height: 36px; border-color: var(--line); }
.spread-subtitle { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 12px; }
.selection-slots { gap: 10px; }
.selection-slots .spread-card-visual { min-height: 0; aspect-ratio: 2 / 3; padding: 5px; border-radius: 10px; background: var(--scene-panel); box-shadow: var(--scene-shadow); }
.selection-slots .spread-card-visual.is-empty { border-style: solid; border-color: var(--line); background: linear-gradient(160deg, var(--glow), transparent 60%); }
.selection-slots .spread-card-visual.is-empty::before { border-style: solid; opacity: .6; }
.selection-slots .spread-card-name { margin-top: 6px; font-family: var(--home-serif); font-size: 14px; line-height: 1.5; }
.selection-slots .spread-card-position { display: none; }
.selection-slots .flip-card { min-height: 0; height: 100%; aspect-ratio: 2 / 3; }
.selection-slots .spread-card.is-empty .spread-card-name { visibility: hidden; margin-top: 4px; min-height: 0; height: 0; }
.slot-heading strong { font-size: 12px; line-height: 1.5; }
.slot-heading { min-height: 46px; }
.slot-replace { min-height: 44px; }
.arcana-face.has-card-art > :is(span, strong),
.arcana-face.has-card-art::before, .arcana-face.has-card-art::after { display: none; }
.arcana-face.has-card-art { background: var(--surface); }
.card-art-image { object-fit: contain; opacity: 1; filter: none; }
.selection-slots .spread-card-visual.has-card::before { display: none; }
.deck-card { --fan-step: 20cqw; --fan-angle: 34deg; }
.deck-card-grid { min-height: 132px; }
#screen-spread:has(#continue-result:not([hidden])) .deck-card-grid { min-height: 114px; }
.deck-zone { border-color: var(--line-soft); background: radial-gradient(ellipse at 50% 85%, var(--glow), transparent 66%); }
.deck-card-back { background: linear-gradient(135deg, var(--surface-3), var(--surface) 54%, var(--soft-accent)); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line), 0 6px 16px #08090935; }
.deck-card-back::before { border-color: var(--line); }
.deck-counter { top: 8px; color: var(--muted); font-size: 12px; }
.draw-status { min-height: 38px; margin: 8px auto; color: var(--muted); font-size: 13px; }
.draw-actions { flex-direction: row; align-items: center; gap: 12px; margin-top: 8px; }
.draw-actions .primary-button { width: auto; flex: 1; min-width: 0; padding-inline: 14px; }
.draw-actions .reset-draw { flex: none; min-height: 44px; }
.draw-next-button { min-width: 0; }
.ritual-whisper { display: none; }

/* Reading: a letter-like main answer; evidence stays secondary and expandable. */
#screen-result .screen-heading { margin-bottom: 24px; }
.answer-first { margin-bottom: 28px; }
.result-topic { background: var(--soft-accent); border-color: var(--line); color: var(--accent); }
.answer-mirror { max-width: none; font-size: 14px; line-height: 1.85; color: var(--muted); }
.answer-verdict { padding: 24px 20px 16px; border-color: var(--line); border-radius: 20px; background: var(--scene-panel); box-shadow: var(--scene-shadow); }
.answer-verdict::after { width: 32px; height: 1px; top: 0; left: calc(50% - 16px); right: auto; background: var(--accent); border: 0; box-shadow: 0 0 18px var(--accent); opacity: .7; }
.answer-verdict .eyebrow, .life-guide-heading .eyebrow, .ritual-anchor .eyebrow, .recommendation-heading .eyebrow, .report-block .eyebrow { display: none; }
.answer-verdict h3 { font-size: 22px; line-height: 1.5; margin-bottom: 16px; }
.answer-verdict > #answer-verdict { max-width: none; font-size: 15px; line-height: 1.9; }
.answer-synthesis { max-width: none; border: 0; padding-top: 0; font-size: 14px; line-height: 1.85; }
.answer-now { margin-top: 20px; padding-top: 18px; border-color: var(--line-soft); }
.answer-now #action-copy { max-width: none; font-size: 14px; line-height: 1.85; }
.answer-now .answer-follow-up { display: flex; justify-content: space-between; width: 100%; border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 14px; font-size: 14px; }
.drawn-cards { border: 0; margin: 28px 0 32px; padding: 0; }
#result-cards { gap: 10px; align-items: start; }
#result-cards .result-card { border-radius: 10px; background: var(--scene-panel); box-shadow: var(--scene-shadow); }
#result-cards .result-card-name { font-family: var(--home-serif); font-size: 14px; line-height: 1.5; white-space: normal; overflow: visible; text-overflow: clip; }
#result-cards .result-card-detail { font-size: 12px; line-height: 1.5; white-space: normal; overflow: visible; }
#result-cards .result-card-expanded { padding: 10px; }
#result-cards .result-card-expanded :is(.result-card-keywords, .result-card-meaning) { font-size: 13px; line-height: 1.85; }
/* Expanded text spans the row, so evidence never becomes a narrow column. */
#result-cards .result-card[open] { grid-column: 1 / -1; }
#result-cards .result-card[open] > summary { display: grid; grid-template-columns: 92px 1fr; grid-template-rows: 1fr 1fr; align-items: end; column-gap: 8px; }
#result-cards .result-card[open] .result-card-visual { grid-column: 1; grid-row: 1 / 3; }
#result-cards .result-card[open] .result-card-name { grid-area: 1 / 2; font-size: 18px; }
#result-cards .result-card[open] .result-card-detail { grid-area: 2 / 2; align-self: start; }
.life-guide-section { padding: 22px 0; margin-bottom: 24px; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; background: none; box-shadow: none; }
.life-guide-heading h3 { font-size: 22px; }
.life-guide-bridge { max-width: none; font-size: 14px; line-height: 1.8; color: var(--muted); }
.guide-action-card { padding: 16px; border-radius: 16px; border-color: var(--line-soft); background: var(--scene-panel); }
.guide-action-card::before { display: none; }
.guide-card-topline { padding-left: 0; }
.guide-action-card h4, .guide-plain, .guide-cost, .guide-card-footer { margin-left: 0; }
.guide-plain { font-size: 14px; line-height: 1.8; }
.guide-cost, .guide-chapter, .guide-proof p, .life-guide-attribution p { font-size: 12px; }
.guide-save-button.is-saved { color: var(--accent-contrast); }
.ritual-anchor { padding-block: 24px; gap: 16px; }
.ritual-anchor p, .match-panel p { font-size: 14px; line-height: 1.85; }
.ritual-anchor h3 { max-width: none; font-size: 19px; }
.recommendation-heading h3 { font-size: 22px; }
.match-panel { border: 0; background: none; padding: 4px 0 12px; }
.profile-gate, .personal-profile { background: var(--scene-panel); box-shadow: none; border-radius: 16px; }
.result-disclosure > summary { padding-block: 18px; gap: 8px; }
.result-disclosure > summary span { font-weight: 500; line-height: 1.6; }
.result-disclosure > summary small, .profile-form-intro, .profile-auto-note, .profile-status { font-size: 12px; line-height: 1.8; }
.profile-field input, .profile-field select { min-width: 0; min-height: 48px; font-size: 16px; }
.report-block { min-height: 0; padding: 18px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--scene-panel); }
.report-block p:not(.eyebrow) { font-size: 14px; line-height: 1.85; }

/* The boutique: consistent product wells, clear prices, understated labels. */
.shop-header { align-items: end; gap: 12px; margin: 20px 0 24px; }
.shop-header .eyebrow { font-size: 9px; letter-spacing: .2em; margin-bottom: 12px; }
.shop-header p:not(.eyebrow) { font-size: 13px; line-height: 1.8; color: var(--muted); margin: 12px 0 0; }
.shop-filter-label { display: none; }
.shop-filter-row { padding: 0 0 20px; margin-bottom: 6px; gap: 8px; }
.filter-chip { padding-inline: 14px; }
.product-grid { gap: 24px 14px; }
.product-card { border: 0; border-radius: 0; background: none; overflow: visible; box-shadow: none; }
.product-card-button { height: 100%; display: flex; flex-direction: column; border-radius: 16px; }
.product-visual { position: relative; isolation: isolate; width: 100%; min-height: 172px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 16px; background: radial-gradient(ellipse at 50% 42%, var(--scene-highlight), transparent 70%), var(--scene-panel); }
.product-visual::after { content: ""; position: absolute; z-index: -1; width: 75%; height: 26%; left: 12.5%; bottom: 14%; border-radius: 50%; background: var(--scene-pedestal); opacity: .35; filter: blur(12px); }
.product-copy { display: flex; flex: 1; flex-direction: column; width: 100%; padding: 14px 2px 0; }
.product-copy h3 { font-size: 17px; line-height: 1.5; }
.product-copy p { font-size: 13px; line-height: 1.75; color: var(--muted); margin: 7px 0 12px; }
.product-meta { margin-top: auto; flex-wrap: wrap; gap: 8px; }
.product-price { font-family: Georgia, serif; font-size: 19px; font-weight: 400; }
.product-pill { border-color: var(--line-soft); color: var(--muted); background: transparent; font-size: 11px; }
.featured-product .product-card { padding: 14px; border: 1px solid var(--line-soft); border-radius: 18px; background: var(--scene-panel); }
.featured-product .product-copy { padding: 16px 4px 4px; }
.featured-product .product-copy p { font-size: 14px; }
.bracelet-art { width: 150px; height: 140px; transform: rotate(-16deg); flex-shrink: 0; }
.bracelet-art::before { width: 104px; height: 104px; border-width: 2px; opacity: .7; }
.bracelet-art::after { width: 15px; height: 21px; bottom: 7px; border-width: 1px; border-radius: 3px; background: linear-gradient(130deg, var(--metal), var(--bead-a)); box-shadow: 0 4px 7px #17100e35; z-index: 3; }
.bracelet-beads { position: absolute; width: 100%; height: 100%; transform: none; }
.bracelet-bead { position: absolute; left: calc(50% - 12px); top: calc(50% - 12px); width: 24px; height: 24px; border: 1px solid color-mix(in srgb, var(--bead-b) 70%, transparent); background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--bead-b) 60%, #fff9f3), var(--bead-a) 46%, color-mix(in srgb, var(--bead-a) 60%, #191014) 95%); box-shadow: inset -2px -3px 5px #1c131c28, 2px 4px 7px #130e172b; transform: rotate(calc(var(--bead-index) * 40deg)) translateY(-51px); }
.bracelet-bead:nth-child(2n) { background: radial-gradient(circle at 32% 25%, #fff9f399, var(--bead-b) 36%, var(--bead-a) 95%); }
.bracelet-bead:nth-child(4) { background: radial-gradient(circle at 32% 25%, #fff1c8, var(--metal) 45%, #705125); }
.bracelet-bead:nth-child(1) { --bead-index: 0; }
.bracelet-bead:nth-child(2) { --bead-index: 1; }
.bracelet-bead:nth-child(3) { --bead-index: 2; }
.bracelet-bead:nth-child(4) { --bead-index: 3; }
.bracelet-bead:nth-child(5) { --bead-index: 4; }
.bracelet-bead:nth-child(6) { --bead-index: 5; }
.bracelet-bead:nth-child(7) { --bead-index: 6; }
.bracelet-bead:nth-child(8) { --bead-index: 7; }
.bracelet-bead:nth-child(9) { --bead-index: 8; }

/* Personal journal and the minimal animated brand lockup. */
.profile-header { padding-bottom: 24px; border-bottom: 1px solid var(--line-soft); }
.profile-streak strong { color: var(--accent); font-family: Georgia, serif; font-weight: 400; font-size: 40px; }
.profile-streak span { font-size: 12px; color: var(--muted); }
.profile-summary { align-items: start; margin-top: 28px; padding: 24px 20px; background: var(--scene-panel); border-radius: 20px; box-shadow: var(--scene-shadow); }
.summary-icon { border-radius: 50%; background: var(--soft-accent); color: var(--accent); }
.profile-summary strong { font-family: var(--home-serif); font-size: 21px; line-height: 1.6; font-weight: 500; }
.profile-summary p { margin-top: 12px; font-size: 14px; line-height: 1.85; }
.profile-grid { gap: 12px; margin-top: 20px; }
.profile-tile { min-height: 128px; padding: 20px 16px; background: var(--scene-panel); border-color: var(--line-soft); border-radius: 16px; }
.profile-tile strong { font-family: var(--home-serif); font-size: 23px; font-weight: 500; margin-top: 20px; }
.profile-tile strong span { display: inline; margin: 0; font: inherit; color: inherit; }
.soft-note { padding: 22px 0; background: none; border: 0; }
.soft-note p { font-size: 13px; line-height: 1.85; color: var(--muted); }
body[data-screen="brand"] .app-shell::before { height: 100%; opacity: .9; mask-image: none; background-size: 100% 100%; }
.brand-minimal-lockup { padding: 32px 0 48px; }
.brand-logo { width: min(76cqw, 310px); margin-bottom: 40px; }
body[data-screen="brand"] .brand-name { font-family: var(--home-serif); font-size: 48px; font-weight: 500; color: var(--text); }
.brand-english { font-family: Georgia, serif; font-weight: 400; font-size: 10px; letter-spacing: .48em; }
body[data-theme="soft-pink"] .brand-screen { color: var(--text); }

/* Product details use the same palette, including the scrim and sizes. */
.modal-backdrop { background: #0b0c10a8; backdrop-filter: blur(6px); }
.product-modal { width: min(100%, 440px); padding: 20px; border-radius: 24px; background: var(--surface); border-color: var(--line); }
.modal-close { min-width: 44px; min-height: 44px; color: var(--text); background: var(--surface); border-color: var(--line); }
.product-modal #modal-visual { min-height: 240px; background: var(--scene-panel); border: 1px solid var(--line-soft); border-radius: 18px; }
.product-modal .bracelet-art { transform: scale(1.35) rotate(-16deg); }
.modal-copy h3 { font-family: var(--home-serif); font-size: 28px; line-height: 1.5; }
.modal-copy .eyebrow { display: none; }
.modal-meaning { font-size: 14px; line-height: 1.85; }
.modal-price { font-family: Georgia, serif; font-weight: 400; }
.toast { border-color: var(--line); background: var(--surface); color: var(--text); }
@media (max-width: 370px) {
  body:not([data-screen="home"]) .main-content { width: calc(100% - 28px); }
  .screen-heading, #screen-result .screen-heading { gap: 8px; }
  .screen-heading h2, #screen-result .screen-heading h2 { font-size: 21px; }
  .answer-verdict { padding: 20px 16px 14px; }
  #result-cards { gap: 7px; }
  #result-cards .result-card-name { padding-inline: 6px; font-size: 13px; }
  .product-grid { column-gap: 10px; }
  .product-visual { min-height: 154px; }
  .bracelet-art { transform: scale(.9) rotate(-16deg); }
}
@media (prefers-reduced-motion: reduce) {
  .screen, .product-modal { animation: none; }
}

/* Conversation-first reading entry. */
#screen-reading { display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; min-height:0; height:100%; padding-bottom:0; overflow:hidden; }
.conversation-intro { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:0 0 13px; border-bottom:1px solid var(--line-soft); padding:0 2px 13px; }
.conversation-intro p { max-width:33ch; margin:0; color:var(--muted); font-size:12px; line-height:1.65; text-align:right; }
.conversation-status { display:inline-flex; flex:0 0 auto; align-items:center; gap:6px; color:var(--accent); font-size:10px; letter-spacing:.08em; white-space:nowrap; }
.conversation-status i { width:6px; height:6px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px var(--glow); }
.chat-panel-flow { min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; margin:0; padding:4px 0 10px; }
.chat-panel-flow::-webkit-scrollbar { display:none; }
.chat-log { display:grid; gap:13px; padding-bottom:4px; }
.chat-message-user { justify-content:flex-end; padding-left:28px; }
.chat-message-user p { border-color:color-mix(in srgb,var(--accent) 38%,var(--line-soft)); border-radius:15px 4px 15px 15px; color:var(--accent-contrast); background:var(--accent); box-shadow:0 8px 20px color-mix(in srgb,var(--glow) 45%,transparent); }
.chat-message-assistant p { max-width:36ch; }
.chat-message p { overflow-wrap:anywhere; }
.chat-composer { margin-top:8px; padding-bottom:2px; background:var(--bg); }
.chat-composer .field-label { margin-bottom:7px; color:var(--text); font-size:12px; }
.composer-box { position:relative; }
.composer-box .concern-input { min-height:108px; margin:0; padding:14px 58px 43px 14px; border-radius:16px; background:color-mix(in srgb,var(--surface) 96%,transparent); font-size:16px; line-height:1.7; }
.composer-box .concern-input:focus { box-shadow:0 0 0 3px var(--glow),0 10px 28px color-mix(in srgb,var(--glow) 35%,transparent); }
.send-chat-button { position:absolute; right:9px; bottom:9px; display:inline-flex; min-width:74px; min-height:34px; align-items:center; justify-content:center; gap:5px; border:1px solid var(--accent); border-radius:999px; padding:0 11px; color:var(--accent-contrast); background:var(--accent); cursor:pointer; font-size:11px; font-weight:700; box-shadow:0 5px 14px color-mix(in srgb,var(--glow) 50%,transparent); }
.send-chat-button span:first-child { font-size:16px; line-height:1; }
.send-chat-button:active { transform:translateY(1px) scale(.98); }
.chat-composer .field-meta { margin-top:7px; }
.field-meta-count { justify-content:flex-end; }
.chat-guidance { margin:13px 10px 0 34px; padding:12px 13px 11px; border:1px solid color-mix(in srgb,var(--accent) 30%,var(--line-soft)); border-radius:14px 14px 14px 4px; background:linear-gradient(135deg,color-mix(in srgb,var(--surface-2) 95%,transparent),color-mix(in srgb,var(--surface) 90%,transparent)); box-shadow:0 10px 26px color-mix(in srgb,var(--glow) 12%,transparent); animation: chat-next-in .34s ease both; }
.chat-guidance-label { display:block; margin-bottom:4px; color:var(--accent); font-size:10px; letter-spacing:.14em; }
.chat-guidance p { margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.chat-next-step { display:flex; align-items:center; margin:10px 10px 2px 34px; padding:0; border:0; animation: chat-next-in .34s .08s ease both; }
.chat-next-step .primary-button { width:100%; min-height:44px; flex:0 0 auto; padding-inline:15px; font-size:14px; }
@keyframes chat-next-in { from { opacity:1; transform:translateY(7px); } to { opacity:1; transform:none; } }
@media (max-width:420px) {
  .conversation-intro { align-items:flex-start; flex-direction:column; gap:8px; }
  .conversation-intro p { max-width:34ch; text-align:left; }
  .chat-panel-flow { min-height:0; }
  .chat-next-step { align-items:stretch; flex-direction:column; }
  .chat-next-step .primary-button { width:100%; }
}
@media (prefers-reduced-motion: reduce) { .chat-next-step { animation:none; } }

/* A bounded conversation, sized to the visible browser area (including iOS keyboard). */
body[data-screen="reading"] { height:100dvh; min-height:0; overflow:hidden; }
body[data-screen="reading"] .app-shell {
  position:fixed; top:var(--chat-viewport-top, 0px); left:50%; transform:translateX(-50%);
  width:min(100%, 480px); height:var(--chat-viewport-height, 100dvh); min-height:0;
  display:flex; flex-direction:column; overflow:hidden;
}
body[data-screen="reading"] .topbar { flex:0 0 auto; min-height:56px; padding-block:10px; }
body[data-screen="reading"] .main-content {
  flex:1; min-height:0; width:calc(100% - 32px); margin:0 auto;
  padding:0 0 calc(86px + env(safe-area-inset-bottom)); overflow:hidden;
}
body[data-screen="reading"] #screen-reading { display:flex; flex-direction:column; height:100%; min-height:0; margin:0; animation:none; }
#screen-reading > .screen-heading, #screen-reading > .conversation-intro, #screen-reading > .chat-composer { flex:0 0 auto; }
#screen-reading > .chat-panel-flow { flex:1 1 0; }
#screen-reading .screen-heading { margin:4px 0 8px; gap:8px; }
#screen-reading .screen-heading h2 { font-size:23px; line-height:1.3; }
#screen-reading .conversation-intro { margin:0 0 8px; padding:0 2px 8px; }
#screen-reading .chat-panel-flow { margin:0; min-height:0; padding:8px 2px 12px; overflow:auto; }
#screen-reading .chat-message p { font-size:15px; line-height:1.7; padding:12px; white-space:pre-wrap; }
#screen-reading .chat-composer { margin:0; padding:8px 0 0; border-top:1px solid var(--line-soft); background:transparent; }
#screen-reading .chat-composer .field-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#screen-reading .composer-box .concern-input { display:block; height:68px; min-height:68px; max-height:68px; resize:none; padding:10px 88px 10px 12px; font-size:16px; line-height:1.5; }
#screen-reading .send-chat-button { height:44px; min-height:44px; bottom:12px; right:8px; }
#screen-reading .send-chat-button:disabled { opacity:.5; cursor:wait; }
#screen-reading .field-meta { justify-content:flex-end; margin:3px 4px 0; font-size:11px; line-height:16px; }
#screen-reading .chat-guidance { margin:10px 8px 0 34px; }
#screen-reading .chat-next-step { margin:8px 8px 2px 34px; padding:0; border:0; animation:chat-next-in .28s .08s ease both; }
#screen-reading .chat-next-step .primary-button { width:100%; height:44px; min-height:44px; font-size:15px; }
body[data-screen="reading"] .bottom-nav { position:absolute; top:auto; bottom:max(8px, env(safe-area-inset-bottom)); height:62px; min-height:62px; }
.chat-error { display:flex; align-items:center; gap:8px; color:var(--text); font-size:12px; }
.chat-error button { flex-shrink:0; min-height:44px; min-width:60px; color:var(--accent); background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.chat-pending { color:var(--muted); font-size:13px; margin:0 0 8px 43px; }
body[data-screen="reading"][data-chat-keyboard="true"] .bottom-nav { display:none; }
body[data-screen="reading"][data-chat-keyboard="true"] .main-content { padding-bottom:8px; }
body[data-screen="reading"][data-chat-compact="true"] .topbar { display:none; }
body[data-screen="reading"][data-chat-compact="true"] .conversation-intro { display:none; }
body[data-screen="reading"][data-chat-compact="true"] .screen-heading { margin:4px 0; }
body[data-screen="reading"][data-chat-compact="true"] .screen-heading h2 { font-size:19px; }

/* Result reading: cards first, one connected route, then the matching object. */
#screen-result { display:flex; flex-direction:column; gap:0; }
#screen-result > .screen-heading { order:0; }
#screen-result > .answer-first { order:1; }
#screen-result > .reading-route { order:2; }
#screen-result > .card-reading-list { order:3; }
#screen-result > .drawn-cards { order:4; }
#screen-result > .recommendation-section { order:5; }
#screen-result > #profile-details { order:6; }
#screen-result > #reading-basis { order:7; }
#screen-result > .life-guide-section, #screen-result > .ritual-anchor { display:none; }
#screen-result .drawn-cards { margin:0 0 22px; }
#screen-result .drawn-cards .section-note { color:var(--muted); }
#screen-result .answer-first { margin:0 0 22px; }
#screen-result .answer-mirror { margin:0 0 10px; }
#screen-result .answer-verdict { padding:18px 16px 15px; border-radius:16px; }
#screen-result .answer-verdict h3 { margin-bottom:10px; font-size:22px; }
#screen-result .answer-verdict > #answer-verdict { font-size:15px; line-height:1.8; }
#screen-result .answer-synthesis { margin-top:11px; font-size:14px; line-height:1.75; }
#screen-result .answer-now { margin-top:14px; padding-top:13px; }
#screen-result .answer-now #action-copy { font-size:14px; line-height:1.75; }
#screen-result .answer-follow-up { display:inline-flex; }
#screen-result .result-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; overflow:visible; margin:0; padding:0; }
#screen-result .result-card { position:relative; display:block; min-width:0; border:1px solid var(--line-soft); border-radius:12px; padding:7px; background:var(--scene-panel); box-shadow:var(--scene-shadow); }
#screen-result .result-card-visual { position:relative; min-height:0; width:100%; aspect-ratio:2 / 3; padding:4px; border-radius:8px; }
#screen-result .result-card-orientation { position:absolute; top:12px; right:11px; z-index:2; padding:2px 5px; border:1px solid var(--line); border-radius:999px; color:var(--accent-contrast); background:var(--accent); font-size:9px; line-height:1.2; }
#screen-result .result-card-name { display:block; margin:7px 2px 2px; font-family:var(--home-serif); font-size:14px; line-height:1.4; white-space:normal; }
#screen-result .result-card-detail { display:block; margin:0 2px; color:var(--muted); font-size:11px; line-height:1.45; }
.reading-route { margin:0 0 22px; padding:17px 14px 14px; border:1px solid var(--line-soft); border-radius:16px; background:var(--scene-panel); }
.reading-route .eyebrow { margin:0 0 4px; color:var(--accent); font-size:10px; }
.reading-route h3 { margin:0 0 6px; font-size:20px; }
.reading-route > p:not(.eyebrow) { margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.reading-route-track { display:grid; grid-template-columns:1fr 16px 1fr 16px 1fr; align-items:stretch; gap:5px; margin-top:13px; }
.reading-route-node { min-width:0; padding:9px 8px; border:1px solid var(--line-soft); border-radius:10px; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.reading-route-node b { display:block; color:var(--accent); font-size:10px; letter-spacing:.08em; }
.reading-route-node strong { display:block; margin-top:3px; font-family:var(--home-serif); font-size:13px; line-height:1.4; }
.reading-route-node span { display:block; margin-top:4px; color:var(--muted); font-size:10px; line-height:1.45; }
.reading-route-track > i { align-self:center; color:var(--accent); font-style:normal; text-align:center; }
.card-reading-list { margin:0 0 24px; }
.card-reading-list > .section-label-row { margin-bottom:9px; }
#card-reading-items { display:grid; gap:9px; }
.card-reading-item { padding:13px 14px 12px; border:1px solid var(--line-soft); border-radius:14px; background:color-mix(in srgb,var(--surface) 88%,transparent); }
.card-reading-heading { display:flex; align-items:center; gap:10px; }
.card-reading-heading > span { color:var(--accent); font-family:Georgia,serif; font-size:13px; }
.card-reading-heading strong { display:block; font-family:var(--home-serif); font-size:16px; line-height:1.4; }
.card-reading-heading small { display:block; margin-top:2px; color:var(--muted); font-size:11px; }
.card-reading-item > p { margin:9px 0 0; font-size:14px; line-height:1.8; }
#screen-result > .recommendation-section { margin-top:0; }
#screen-result .recommendation-heading { margin-top:0; }
body[data-screen="result"] .bottom-nav { display:none; }
body[data-screen="result"] .main-content { padding-bottom:32px; }
@media (max-width:370px) {
  .reading-route-track { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .reading-route-track > i { display:none; }
  #screen-result .result-card-name { font-size:13px; }
}

/* Draw screen: keep every control inside the phone viewport. The ritual layer
   remains free to animate over the fan, while the content itself never needs a
   sideways swipe or a scroll just to reach the draw button. */
body[data-screen="spread"] { height:100dvh; min-height:0; overflow:hidden; }
body[data-screen="spread"] .app-shell {
  position:fixed; inset:0 auto auto 50%; transform:translateX(-50%);
  width:min(100%,480px); height:100dvh; min-height:0; display:flex; flex-direction:column; overflow:hidden;
}
body[data-screen="spread"] .topbar { flex:0 0 auto; min-height:56px; padding-block:10px; }
body[data-screen="spread"] .main-content { flex:1; min-height:0; width:calc(100% - 28px); margin:0 auto; padding:0 0 76px; overflow:hidden; }
body[data-screen="spread"] #screen-spread { height:100%; min-height:0; margin:0; overflow:hidden; }
body[data-screen="spread"] .mystic-screen-content {
  display:grid; grid-template-rows:auto minmax(126px,1fr) minmax(130px,26vh) auto auto; gap:6px;
  height:100%; min-height:0; overflow:hidden;
}
body[data-screen="spread"] #screen-spread .screen-heading { margin:2px 0 3px; }
body[data-screen="spread"] #screen-spread .screen-heading h2 { font-size:22px; }
body[data-screen="spread"] #screen-spread .blessing-note,
body[data-screen="spread"] #screen-spread .spread-subtitle { display:none; }
body[data-screen="spread"] #screen-spread .selection-slots { min-height:0; gap:7px; }
body[data-screen="spread"] #screen-spread .selection-slots .spread-card { min-width:0; grid-template-rows:auto minmax(0,1fr) auto auto; }
body[data-screen="spread"] #screen-spread .selection-slots .spread-card-visual { min-height:0; height:auto; aspect-ratio:2 / 3; padding:4px; }
body[data-screen="spread"] #screen-spread .slot-heading { min-height:16px; margin:0 2px 3px; }
body[data-screen="spread"] #screen-spread .slot-heading strong { display:none; }
body[data-screen="spread"] #screen-spread .spread-card-name,
body[data-screen="spread"] #screen-spread .spread-card-position { min-height:0; margin:3px 0 0; font-size:10px; line-height:1.25; }
body[data-screen="spread"] #screen-spread .spread-card-position { font-size:8px; }
body[data-screen="spread"] #screen-spread .deck-zone { min-height:0; margin:0; padding:3px 0 0; border-top:1px solid var(--line-soft); border-bottom:0; }
body[data-screen="spread"] #screen-spread .deck-counter { top:5px; right:2px; font-size:9px; }
body[data-screen="spread"] #screen-spread .deck-card-grid { min-height:0; height:100%; margin:0 -8px; }
body[data-screen="spread"] #screen-spread .deck-card { --fan-step:clamp(118px, 34vw, 164px); --fan-angle:26deg; width:clamp(47px, 13vw, 68px); bottom:3px; }
body[data-screen="spread"] #screen-spread .draw-status { margin:0 auto; min-height:18px; font-size:10px; }
body[data-screen="spread"] #screen-spread .draw-actions { margin:0; min-height:42px; }
body[data-screen="spread"] #screen-spread .draw-actions .reset-draw { display:none !important; }
body[data-screen="spread"] #screen-spread .draw-actions .primary-button { width:100%; min-height:42px; }
body[data-screen="spread"] #screen-spread #continue-result { width:100%; min-height:42px; margin:0; }
body[data-screen="spread"] #screen-spread .ritual-whisper { display:none; }
body[data-screen="spread"] .bottom-nav { display:grid; }
@media (max-height:620px) {
  body[data-screen="spread"] .mystic-screen-content { grid-template-rows:auto minmax(108px,1fr) minmax(108px,23vh) auto auto; gap:4px; }
  body[data-screen="spread"] #screen-spread .screen-heading h2 { font-size:19px; }
  body[data-screen="spread"] #screen-spread .deck-card { width:46px; }
}

/* Final mobile pass: keep the three cards close to the title, preserve the fan,
   and reserve the fixed navigation's safe area for the draw action. The draw
   positions are conveyed by the card order and the revealed card artwork; the
   extra numbered labels only compete with the visual ritual. */
body[data-screen="spread"] .mystic-screen-content {
  grid-template-rows: auto auto minmax(128px, 17vh) auto auto;
  gap: 7px;
  padding-bottom: 62px;
  align-content: start;
}
body[data-screen="spread"] #screen-spread .screen-heading {
  margin: 0 0 1px;
}
body[data-screen="spread"] #screen-spread .selection-slots {
  align-self: start;
  height: auto;
  padding: 0;
}
body[data-screen="spread"] #screen-spread .selection-slots .spread-card {
  display: block;
}
body[data-screen="spread"] #screen-spread .slot-heading,
body[data-screen="spread"] #screen-spread .spread-card-name,
body[data-screen="spread"] #screen-spread .spread-card-position {
  display: none !important;
}
body[data-screen="spread"] #screen-spread .selection-slots .spread-card-visual {
  width: 100%;
  min-height: 0;
  max-height: clamp(164px, 28vh, 214px);
  aspect-ratio: 2 / 3;
  padding: 4px;
}
body[data-screen="spread"] #screen-spread .deck-zone {
  align-self: start;
  height: clamp(128px, 17vh, 148px);
  padding-top: 3px;
}
body[data-screen="spread"] #screen-spread .deck-card-grid {
  height: 100%;
}
body[data-screen="spread"] #screen-spread .draw-status {
  min-height: 16px;
  margin: 0 auto;
}
body[data-screen="spread"] #screen-spread .draw-actions {
  min-height: 44px;
  margin: 0;
}

/* Make the model-backed, fact-specific section legible as its own layer. */
#screen-result[data-reading-state="ready"] #answer-synthesis {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
#screen-result[data-reading-state="ready"] #answer-synthesis::before {
  content: "现实解读";
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}
@media (max-height: 620px) {
  body[data-screen="spread"] .mystic-screen-content {
    grid-template-rows: auto auto minmax(120px, 20vh) auto auto;
    gap: 4px;
  }
  body[data-screen="spread"] #screen-spread .selection-slots .spread-card-visual {
    max-height: 158px;
  }
  body[data-screen="spread"] #screen-spread .deck-zone {
    height: 128px;
  }
}

/* Viewport changes must not stretch the composer or leave the old keyboard gap. */
html:has(body[data-screen="reading"]) { height:100%; overflow:hidden; }
body[data-screen="reading"] { overscroll-behavior:none; }
body[data-screen="reading"] .app-shell { left:0; right:0; margin-inline:auto; transform:none; }
body[data-screen="reading"] .main-content { display:flex; flex-direction:column; }
body[data-screen="reading"] #screen-reading { flex:1 1 0; height:auto; }
#screen-reading .concern-input:focus-visible { outline:none; box-shadow:0 0 0 2px var(--glow); }
#screen-result > .reading-gentle-note { order:8; margin:20px 0 0; padding-top:14px; border-top:1px solid var(--line-soft); color:var(--muted); font-size:12px; line-height:1.8; }
.reading-gentle-note p { margin:0 0 6px; }
body[data-screen="spread"] #screen-spread .spread-subtitle { display:block; margin:0; font-size:12px; line-height:1.6; text-align:center; }
body[data-screen="spread"] .mystic-screen-content { grid-template-rows:auto auto auto minmax(128px,17vh) auto auto; padding-bottom:0; }

/* Compact mobile pass: remove secondary disclosures and keep the draw CTA
   visually subordinate to the cards while preserving a comfortable gap. */
#screen-result .result-topic,
#screen-result > #profile-details,
#screen-result > #reading-basis { display: none !important; }

body[data-screen="spread"] .mystic-screen-content { row-gap: 12px; }
body[data-screen="spread"] #screen-spread .deck-zone {
  margin-top: 4px;
  margin-bottom: 4px;
  padding-bottom: 8px;
}
body[data-screen="spread"] #screen-spread .draw-status { margin-top: 2px; }
body[data-screen="spread"] #screen-spread .draw-actions {
  min-height: 44px;
  margin-top: 3px;
  justify-content: center;
}
body[data-screen="spread"] #screen-spread .draw-actions .primary-button {
  width: min(210px, 72%);
  flex: 0 0 auto;
}
body[data-screen="spread"] #screen-spread #continue-result { width: min(240px, 82%); margin-inline: auto; }

/* The topic pill is intentionally empty while the reading is model-backed;
   hiding it prevents a blank capsule from creating a false hierarchy. */
#screen-result .answer-first { margin-top: 0; }

@media (max-width: 420px) {
  body[data-screen="spread"] #screen-spread .draw-actions .primary-button { width: min(204px, 72%); }
}
