:root {
  --bg: #f4ecdd;
  --bg-deep: #e5d5b2;
  --panel: rgba(255, 251, 243, 0.78);
  --panel-strong: rgba(255, 248, 236, 0.92);
  --ink: #2b2316;
  --ink-soft: rgba(43, 35, 22, 0.72);
  --gold: #a47a2a;
  --gold-soft: rgba(164, 122, 42, 0.2);
  --gold-strong: #d0a64b;
  --line: rgba(92, 67, 21, 0.18);
  --shadow: 0 28px 80px rgba(89, 65, 24, 0.14);
  --radius: 24px;
  --font-display: "STKaiti", "Kaiti SC", "KaiTi", serif;
  --font-body: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(214, 173, 89, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f1e5 0%, #f1e5cf 48%, #ecdcc1 100%);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.88);
  color: var(--ink);
  border-radius: 18px;
  padding: 16px 18px;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

textarea:focus,
input:focus {
  border-color: rgba(164, 122, 42, 0.7);
  box-shadow: 0 0 0 4px rgba(164, 122, 42, 0.12);
  transform: translateY(-1px);
}

#app {
  min-height: 100vh;
}

.app-frame {
  position: relative;
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.bg-aura {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(14px);
  opacity: 0.42;
  pointer-events: none;
  animation: auraFloat 14s ease-in-out infinite;
}

.bg-aura-one {
  width: 220px;
  height: 220px;
  top: 10%;
  left: -40px;
  background: radial-gradient(circle, rgba(212, 174, 94, 0.34), transparent 70%);
}

.bg-aura-two {
  width: 280px;
  height: 280px;
  right: -90px;
  bottom: 12%;
  background: radial-gradient(circle, rgba(154, 115, 39, 0.2), transparent 72%);
  animation-delay: -5s;
}

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  background-image:
    linear-gradient(transparent 0 50%, rgba(80, 60, 18, 0.08) 50% 51%, transparent 51%),
    linear-gradient(90deg, transparent 0 50%, rgba(80, 60, 18, 0.06) 50% 51%, transparent 51%);
  background-size: 3px 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 8px 0;
}

.topbar-result {
  top: max(8px, env(safe-area-inset-top));
  padding: 12px 14px;
  border-radius: 24px;
  border: 1px solid rgba(164, 122, 42, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.84), rgba(247, 238, 220, 0.68));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 14px 36px rgba(89, 65, 24, 0.08);
}

.topbar-home {
  justify-content: flex-end;
  margin-bottom: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 245, 220, 0.98), rgba(231, 208, 155, 0.72));
  border: 1px solid rgba(164, 122, 42, 0.34);
  color: var(--gold);
  font-size: 22px;
  font-family: var(--font-display);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 8px 18px rgba(164, 122, 42, 0.1);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.brand-copy strong,
.hero h1,
.subhead h1,
.result-copy h1,
.method-card h2,
.note-panel h3,
.interpretation-panel h2,
.ai-panel h2,
.hex-head h2,
.toss-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
}

.brand-copy strong {
  font-size: 20px;
  letter-spacing: 0.04em;
}

.brand-copy small {
  color: var(--ink-soft);
}

.screen {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 880px;
  margin: 0 auto;
}

.screen-home {
  max-width: 760px;
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(164, 122, 42, 0.16);
  background: linear-gradient(180deg, rgba(255, 251, 243, 0.92), rgba(250, 242, 227, 0.78));
  box-shadow: 0 18px 44px rgba(89, 65, 24, 0.1);
}

.hero,
.subhead,
.result-hero,
.form-panel,
.context-panel,
.interpretation-panel,
.ai-panel,
.note-panel {
  padding: 22px 20px;
}

.hero {
  display: grid;
  gap: 12px;
}

.hero-home {
  padding: 12px 2px 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  justify-items: center;
  text-align: center;
}

.hero-brand {
  margin: 0;
  color: rgba(164, 122, 42, 0.88);
  font-size: 13px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.hero-ornament {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.hero-line {
  width: 54px;
  max-width: 18vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(164, 122, 42, 0.7), transparent);
}

.hero-seal {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(164, 122, 42, 0.34);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 18px;
  background: rgba(255, 248, 236, 0.72);
}

.hero h1,
.subhead h1,
.result-copy h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 56px);
  line-height: 1.06;
  letter-spacing: 0.03em;
}

.hero-home h1 {
  color: rgba(43, 35, 22, 0.94);
  display: inline-grid;
  gap: 4px;
  line-height: 1.12;
  justify-items: center;
}

.hero-home h1 span {
  display: block;
}

.hero-copy,
.subhead p,
.reading-block,
.inline-note,
.hero p,
.note-panel p,
.context-item span,
.context-item strong,
.hex-head p,
.hex-foot span,
.toss-meta {
  line-height: 1.8;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.24em;
  font-size: 12px;
  text-transform: uppercase;
}

.hero-tags,
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-tags span,
.result-stats span,
.method-meta,
.progress-chip,
.history-method {
  border: 1px solid rgba(164, 122, 42, 0.18);
  background: rgba(251, 245, 231, 0.72);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

.method-grid,
.hexagram-grid {
  display: grid;
  gap: 14px;
}

.method-card {
  position: relative;
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 22px 20px;
  text-align: left;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(251, 246, 236, 0.98), rgba(244, 234, 212, 0.94));
  border: 1px solid rgba(164, 122, 42, 0.22);
  box-shadow: 0 16px 36px rgba(97, 70, 17, 0.09);
  color: var(--ink);
  transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
  isolation: isolate;
}

.screen-home .method-grid {
  margin-top: 4px;
}

.method-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(212, 176, 96, 0.14), transparent 38%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.24), transparent 35%);
  opacity: 0.9;
  z-index: -2;
}

.method-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 16px;
  border: 1px solid rgba(164, 122, 42, 0.1);
  opacity: 0.7;
  z-index: -1;
}

.method-card:hover,
.method-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(97, 70, 17, 0.13);
  border-color: rgba(164, 122, 42, 0.36);
}

.method-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 34px;
}

.method-title-group {
  display: grid;
  gap: 4px;
  flex: 1;
}

.method-crest {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
}

.method-crest-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(164, 122, 42, 0.18);
  background: linear-gradient(145deg, #e6cf95 0%, #c9a14d 100%);
  color: #fff9ee;
  font-family: var(--font-display);
  font-size: 28px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 8px 20px rgba(164, 122, 42, 0.18);
}

.method-crest-aura {
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  background: rgba(207, 171, 89, 0.16);
  filter: blur(10px);
}

.method-order {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.72;
}

.method-name {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.method-card h2,
.note-panel h3,
.hex-head h2,
.interpretation-panel h2,
.ai-panel h2,
.toss-card h3 {
  margin: 0;
  font-size: 28px;
}

.method-card p,
.note-panel p,
.ai-panel p,
.interpretation-panel p,
.subhead p,
.hero-copy {
  margin: 0;
  color: var(--ink-soft);
}

.home-history {
  display: grid;
  gap: 14px;
  padding: 8px 0 2px;
}

.home-history-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.home-history-header p {
  margin: 0;
  color: rgba(164, 122, 42, 0.88);
  font-size: 13px;
  letter-spacing: 0.24em;
}

.home-history-line {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(164, 122, 42, 0.48), transparent);
}

.home-history-entry {
  display: grid;
  gap: 4px;
  justify-items: center;
  width: 100%;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(164, 122, 42, 0.16);
  background: rgba(255, 248, 236, 0.56);
  color: var(--ink);
  transition: transform 220ms ease, border-color 220ms ease, background-color 220ms ease;
}

.home-history-entry span {
  font-family: var(--font-display);
  font-size: 22px;
}

.home-history-entry small {
  color: var(--ink-soft);
  font-size: 13px;
}

.home-history-entry:hover,
.home-history-entry:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(164, 122, 42, 0.3);
  background: rgba(255, 248, 236, 0.78);
}

.method-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.method-arrow {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(164, 122, 42, 0.18);
  color: var(--gold);
  font-size: 16px;
  transition: transform 220ms ease, background-color 220ms ease;
}

.method-card:hover .method-arrow,
.method-card:focus-visible .method-arrow {
  transform: translate(2px, -2px);
  background: rgba(164, 122, 42, 0.08);
}

.method-card-meihua {
  background:
    radial-gradient(circle at 100% 0%, rgba(216, 183, 112, 0.18), transparent 28%),
    rgba(255, 250, 242, 0.94);
}

.method-card-meihua::after {
  background:
    radial-gradient(circle, transparent 58%, rgba(164, 122, 42, 0.08) 58% 61%, transparent 61%),
    radial-gradient(circle, transparent 20%, rgba(164, 122, 42, 0.1) 20% 22%, transparent 22%);
}

.method-card-liuyao {
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(248, 238, 220, 0.94));
}

.method-card-liuyao::after {
  background:
    linear-gradient(180deg, rgba(164, 122, 42, 0.06), rgba(164, 122, 42, 0.06)) 18px 18px / calc(100% - 36px) 1px no-repeat,
    linear-gradient(180deg, rgba(164, 122, 42, 0.06), rgba(164, 122, 42, 0.06)) 18px 35px / calc(100% - 36px) 1px no-repeat,
    linear-gradient(180deg, rgba(164, 122, 42, 0.06), rgba(164, 122, 42, 0.06)) 18px 52px / calc(100% - 36px) 1px no-repeat,
    linear-gradient(180deg, rgba(164, 122, 42, 0.06), rgba(164, 122, 42, 0.06)) 18px 69px / calc(100% - 36px) 1px no-repeat;
}

.note-panel {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  color: var(--ink-soft);
  font-size: 14px;
}

.form-panel,
.context-panel,
.interpretation-panel,
.ai-panel {
  display: grid;
  gap: 18px;
}

.panel-inline {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(164, 122, 42, 0.08);
  color: var(--ink-soft);
  line-height: 1.7;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  transition: transform 220ms ease, opacity 220ms ease, border-color 220ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #c89b45, #a97926);
  color: #fff8eb;
  box-shadow: 0 18px 34px rgba(164, 122, 42, 0.24);
}

.ai-trigger {
  gap: 0;
}

.ai-trigger-dots {
  display: none;
}

.ai-trigger.is-loading {
  gap: 10px;
}

.ai-trigger.is-loading .ai-trigger-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-trigger.is-loading .ai-trigger-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 248, 235, 0.82);
  animation: aiDotPulse 1s ease-in-out infinite;
}

.ai-trigger.is-loading .ai-trigger-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.ai-trigger.is-loading .ai-trigger-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

.ghost-button {
  color: var(--ink);
  border: 1px solid rgba(164, 122, 42, 0.24);
  background: rgba(255, 250, 239, 0.74);
}

.topbar-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  flex: none;
}

.topbar-history {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  background: rgba(255, 249, 238, 0.5);
}

.primary-button:hover,
.ghost-button:hover,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.liuyao-toolbar {
  display: grid;
  gap: 16px;
}

.progress-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  width: fit-content;
}

.progress-chip strong {
  font-size: 22px;
  color: var(--gold);
}

.toolbar-actions,
.result-actions,
.ai-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.toss-list {
  display: grid;
  gap: 14px;
}

.toss-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.coins {
  display: flex;
  gap: 12px;
}

.coin {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 18px;
  animation: coinPop 540ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--delay, 0s);
}

.coin-yang {
  background: radial-gradient(circle at 30% 30%, #fceac0, #be8f34 70%);
  color: #fff7ea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64), 0 12px 26px rgba(164, 122, 42, 0.2);
}

.coin-yin {
  background: radial-gradient(circle at 30% 30%, #fff8ea, #d2b074 74%);
  color: #77551d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 12px 24px rgba(126, 97, 33, 0.16);
}

.result-hero {
  display: grid;
  gap: 18px;
}

.result-copy {
  display: grid;
  gap: 10px;
}

.result-copy p:last-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.hex-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.hex-head {
  display: grid;
  gap: 8px;
}

.hex-lines {
  display: grid;
  gap: 12px;
  min-height: 232px;
  justify-items: center;
  align-content: center;
}

.line-row {
  display: grid;
  place-items: center;
  width: 100%;
  animation: lineRise 680ms ease both;
  animation-delay: var(--line-delay, 0s);
}

.yang-line,
.yin-line {
  display: flex;
  justify-content: space-between;
  width: min(100%, 260px);
  height: 12px;
}

.yang-line {
  border-radius: 999px;
  background: linear-gradient(90deg, #8f6722 0%, #d7ae5a 50%, #8f6722 100%);
  box-shadow: 0 6px 18px rgba(164, 122, 42, 0.22);
}

.yin-line i {
  display: block;
  width: calc(50% - 10px);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8f6722 0%, #d7ae5a 50%, #8f6722 100%);
  box-shadow: 0 6px 18px rgba(164, 122, 42, 0.22);
}

.line-moving {
  position: relative;
}

.line-moving::after {
  content: "";
  position: absolute;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-strong);
  box-shadow: 0 0 0 7px rgba(208, 166, 75, 0.15);
}

.hex-foot,
.context-grid {
  display: grid;
  gap: 10px;
}

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

.context-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.8);
  border: 1px solid rgba(164, 122, 42, 0.12);
}

.context-item span {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
}

.context-item strong {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.advice-list {
  display: grid;
  gap: 12px;
}

.advice-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(164, 122, 42, 0.08);
}

.advice-item p {
  margin: 0;
  color: var(--ink);
}

.advice-dot {
  width: 8px;
  height: 8px;
  margin-top: 11px;
  border-radius: 999px;
  background: var(--gold);
  flex: none;
}

.ai-copy {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.84);
  border: 1px solid rgba(164, 122, 42, 0.12);
  line-height: 1.9;
  color: var(--ink);
}

.ai-copy > :first-child {
  margin-top: 0;
}

.ai-copy > :last-child {
  margin-bottom: 0;
}

.ai-copy h1,
.ai-copy h2,
.ai-copy h3,
.ai-copy h4 {
  margin: 1.1em 0 0.5em;
  font-family: var(--font-display);
  line-height: 1.3;
}

.ai-copy h1 {
  font-size: 26px;
}

.ai-copy h2 {
  font-size: 22px;
}

.ai-copy h3,
.ai-copy h4 {
  font-size: 18px;
}

.ai-copy p,
.ai-copy ul,
.ai-copy ol,
.ai-copy blockquote,
.ai-copy pre {
  margin: 0 0 14px;
}

.ai-copy ul,
.ai-copy ol {
  padding-left: 1.4em;
}

.ai-copy li + li {
  margin-top: 8px;
}

.ai-copy blockquote {
  padding: 10px 14px;
  border-left: 3px solid rgba(164, 122, 42, 0.42);
  background: rgba(164, 122, 42, 0.08);
  color: rgba(43, 35, 22, 0.84);
}

.ai-copy blockquote p {
  margin: 0;
}

.ai-copy hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid rgba(164, 122, 42, 0.18);
}

.ai-copy a {
  color: #8c6115;
  text-decoration: underline;
  text-decoration-color: rgba(140, 97, 21, 0.34);
  text-underline-offset: 3px;
}

.ai-copy strong {
  color: rgba(43, 35, 22, 0.96);
}

.ai-copy code {
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(164, 122, 42, 0.12);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.92em;
}

.ai-copy pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(51, 39, 18, 0.92);
  color: #f7ecdb;
}

.ai-copy pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.ai-loading {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(164, 122, 42, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.94), rgba(245, 235, 214, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 14px 30px rgba(89, 65, 24, 0.08);
}

.ai-loading-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-loading-seal {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 18px;
  background: linear-gradient(145deg, #d9b56a 0%, #b07a25 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 12px 24px rgba(164, 122, 42, 0.16);
}

.ai-loading-seal::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 24px;
  border: 1px solid rgba(164, 122, 42, 0.24);
  animation: aiSealPulse 1.9s ease-out infinite;
}

.ai-loading-seal::after {
  content: "推";
  position: relative;
  color: #fff8eb;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
}

.ai-loading-copy {
  display: grid;
  gap: 4px;
}

.ai-loading-copy strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.ai-loading-copy p {
  margin: 0;
  color: var(--ink-soft);
}

.ai-loading-waves {
  display: grid;
  gap: 10px;
}

.ai-loading-waves span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(164, 122, 42, 0.16), rgba(164, 122, 42, 0.5), rgba(164, 122, 42, 0.16));
  transform-origin: left center;
  animation: aiWavePulse 1.4s ease-in-out infinite;
}

.ai-loading-waves span:nth-child(1) {
  width: 88%;
}

.ai-loading-waves span:nth-child(2) {
  width: 100%;
  animation-delay: 0.16s;
}

.ai-loading-waves span:nth-child(3) {
  width: 72%;
  animation-delay: 0.32s;
}

.result-actions {
  justify-content: center;
  padding-bottom: 24px;
}

.result-note {
  margin-top: -6px;
}

.share-stage {
  position: fixed;
  top: 0;
  left: -200vw;
  width: 1080px;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
}

.share-card {
  position: relative;
  overflow: hidden;
  width: 1080px;
  padding: 54px;
  border-radius: 42px;
  background:
    radial-gradient(circle at 12% 0%, rgba(212, 176, 96, 0.2), transparent 28%),
    radial-gradient(circle at 100% 20%, rgba(153, 112, 29, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf5ea 0%, #f4e8cf 100%);
  color: var(--ink);
  box-shadow: 0 40px 100px rgba(89, 65, 24, 0.14);
}

.share-card-aura {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.55;
}

.share-card-aura-one {
  top: 36px;
  right: 48px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(214, 175, 90, 0.34), transparent 72%);
}

.share-card-aura-two {
  left: -30px;
  bottom: 120px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(155, 116, 40, 0.18), transparent 74%);
}

.share-card-head,
.share-card-foot,
.share-card-grid {
  position: relative;
  z-index: 1;
}

.share-card-head {
  display: grid;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(164, 122, 42, 0.16);
}

.share-card-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.share-card-seal {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: linear-gradient(145deg, #ddbd78, #bb8a30);
  color: #fff9ef;
  font-family: var(--font-display);
  font-size: 38px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 16px 30px rgba(164, 122, 42, 0.18);
}

.share-card-brand h1,
.share-reading-panel h2,
.share-foot-copy h3,
.share-hex-head h3 {
  margin: 0;
  font-family: var(--font-display);
}

.share-card-brand h1 {
  font-size: 60px;
  line-height: 1.08;
}

.share-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.share-card-meta span {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(164, 122, 42, 0.18);
  background: rgba(255, 248, 236, 0.7);
  color: var(--ink-soft);
  font-size: 24px;
}

.share-card-question,
.share-reading-panel,
.share-ai-panel,
.share-advice-panel {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding: 24px 26px;
  border-radius: 28px;
  border: 1px solid rgba(164, 122, 42, 0.14);
  background: rgba(255, 250, 241, 0.78);
}

.share-card-question p:last-child,
.share-reading-panel p,
.share-advice-item p,
.share-foot-copy p,
.share-foot-copy small,
.share-hex-head p {
  margin: 0;
  line-height: 1.8;
}

.share-card-question p:last-child,
.share-reading-panel p,
.share-advice-item p,
.share-foot-copy p,
.share-foot-copy small,
.share-hex-head p {
  color: var(--ink-soft);
}

.share-card-question p:last-child {
  font-size: 32px;
  color: var(--ink);
}

.share-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.share-hex-card {
  padding: 26px;
  border-radius: 30px;
  border: 1px solid rgba(164, 122, 42, 0.14);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.94), rgba(247, 238, 220, 0.9));
}

.share-hex-head {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.share-hex-head h3 {
  font-size: 40px;
}

.share-hex-head p,
.share-foot-copy small,
.share-qr-panel span {
  font-size: 22px;
}

.share-hex-lines {
  display: grid;
  gap: 16px;
  min-height: 320px;
  align-content: center;
  justify-items: center;
}

.share-card .line-row,
.share-card .coin {
  animation: none;
}

.share-card .yang-line,
.share-card .yin-line {
  width: min(100%, 320px);
  height: 14px;
}

.share-card .yin-line i {
  height: 14px;
}

.share-card .line-moving::after {
  right: 10px;
  width: 10px;
  height: 10px;
}

.share-reading-panel h2 {
  margin-bottom: 14px;
  font-size: 40px;
}

.share-reading-panel p + p {
  margin-top: 12px;
}

.share-ai-copy {
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(164, 122, 42, 0.12);
  background: rgba(255, 248, 236, 0.82);
  color: var(--ink);
  line-height: 1.85;
}

.share-ai-copy > :first-child {
  margin-top: 0;
}

.share-ai-copy > :last-child {
  margin-bottom: 0;
}

.share-ai-copy h1,
.share-ai-copy h2,
.share-ai-copy h3,
.share-ai-copy h4 {
  margin: 1em 0 0.45em;
  font-family: var(--font-display);
  line-height: 1.3;
  color: var(--ink);
}

.share-ai-copy h1 {
  font-size: 34px;
}

.share-ai-copy h2 {
  font-size: 30px;
}

.share-ai-copy h3,
.share-ai-copy h4 {
  font-size: 26px;
}

.share-ai-copy p,
.share-ai-copy ul,
.share-ai-copy ol,
.share-ai-copy blockquote,
.share-ai-copy pre {
  margin: 0 0 14px;
}

.share-ai-copy ul,
.share-ai-copy ol {
  padding-left: 1.4em;
}

.share-ai-copy li + li {
  margin-top: 8px;
}

.share-ai-copy blockquote {
  padding: 12px 16px;
  border-left: 4px solid rgba(164, 122, 42, 0.42);
  background: rgba(164, 122, 42, 0.08);
  color: rgba(43, 35, 22, 0.86);
}

.share-ai-copy blockquote p {
  margin: 0;
}

.share-ai-copy hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid rgba(164, 122, 42, 0.18);
}

.share-ai-copy a {
  color: #8c6115;
  text-decoration: underline;
  text-decoration-color: rgba(140, 97, 21, 0.34);
  text-underline-offset: 3px;
}

.share-ai-copy strong {
  color: rgba(43, 35, 22, 0.96);
}

.share-ai-copy code {
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(164, 122, 42, 0.12);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.92em;
}

.share-ai-copy pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(51, 39, 18, 0.92);
  color: #f7ecdb;
}

.share-ai-copy pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.share-advice-list {
  display: grid;
  gap: 14px;
}

.share-advice-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(164, 122, 42, 0.08);
}

.share-advice-dot {
  width: 10px;
  height: 10px;
  margin-top: 12px;
  flex: none;
  border-radius: 999px;
  background: var(--gold);
}

.share-card-foot {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  align-items: end;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(164, 122, 42, 0.16);
}

.share-foot-copy {
  display: grid;
  gap: 10px;
}

.share-foot-copy h3 {
  font-size: 36px;
  line-height: 1.4;
}

.share-qr-panel {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.share-qr-panel span {
  color: var(--ink-soft);
}

.share-qr-image {
  width: 188px;
  height: 188px;
  border-radius: 20px;
  border: 10px solid rgba(255, 251, 244, 0.92);
  background: #fffaf0;
  box-shadow: 0 18px 34px rgba(89, 65, 24, 0.12);
}

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 24, 12, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 20;
}

.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(92vw, 420px);
  height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  background: linear-gradient(180deg, rgba(251, 245, 232, 0.98), rgba(244, 235, 216, 0.96));
  border-left: 1px solid rgba(164, 122, 42, 0.18);
  box-shadow: -18px 0 48px rgba(83, 58, 15, 0.16);
  transform: translateX(104%);
  transition: transform 260ms ease;
  z-index: 21;
}

.history-panel.is-open,
.history-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.history-panel.is-open {
  transform: translateX(0);
}

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

.history-header h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 32px;
}

.history-body {
  display: grid;
  gap: 12px;
  min-width: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  align-content: start;
  padding: 16px;
  border-radius: 20px;
  text-align: left;
  border: 1px solid rgba(164, 122, 42, 0.12);
  background: rgba(255, 249, 238, 0.88);
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease;
}

.history-item:hover,
.history-item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(164, 122, 42, 0.3);
}

.history-item strong,
.history-empty p {
  font-size: 20px;
  font-family: var(--font-display);
}

.history-item .history-method,
.history-item strong,
.history-item p,
.history-empty small,
.history-item small {
  display: block;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--ink-soft);
  line-height: 1.6;
}

.history-item strong {
  color: var(--ink);
  line-height: 1.4;
}

.history-empty {
  padding: 24px 0;
  text-align: center;
}

.wide-button {
  width: 100%;
}

.placeholder-card {
  min-height: 180px;
  place-content: center;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: revealUp 720ms cubic-bezier(0.18, 0.8, 0.22, 1) forwards;
}

.delay-1 {
  animation-delay: 0.08s;
}

.delay-2 {
  animation-delay: 0.16s;
}

.delay-3 {
  animation-delay: 0.24s;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes coinPop {
  0% {
    opacity: 0;
    transform: translateY(8px) rotateY(0deg) scale(0.82);
  }
  50% {
    transform: translateY(-2px) rotateY(180deg) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateY(360deg) scale(1);
  }
}

@keyframes lineRise {
  0% {
    opacity: 0;
    transform: translateY(8px) scaleX(0.92);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleX(1);
  }
}

@keyframes auraFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -18px, 0);
  }
}

@keyframes aiDotPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.9);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08);
  }
}

@keyframes aiSealPulse {
  0% {
    opacity: 0.7;
    transform: scale(0.92);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@keyframes aiWavePulse {
  0%,
  100% {
    opacity: 0.42;
    transform: scaleX(0.92);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@media (min-width: 720px) {
  .app-frame {
    padding-left: 24px;
    padding-right: 24px;
  }

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

  .liuyao-toolbar {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

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

@media (max-width: 719px) {
  .brand-copy strong {
    font-size: 18px;
  }

  .toolbar-actions .ghost-button,
  .toolbar-actions .primary-button,
  .result-actions .ghost-button,
  .result-actions .primary-button,
  .ai-head .ghost-button,
  .ai-head .primary-button {
    width: 100%;
  }

  .toolbar-actions,
  .result-actions,
  .ai-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-result {
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-aura,
  .coin,
  .line-row,
  .reveal,
  .ai-trigger.is-loading .ai-trigger-dots i,
  .ai-loading-seal::before,
  .ai-loading-waves span {
    animation: none !important;
  }
}
