/* =========================================================
   AI 解梦查号 — 深红圣殿 + 金色月相
   与全站 crimson / gold / cream 变量保持一致
   ========================================================= */

.dream-page {
  background:
    radial-gradient(1200px 480px at 50% -220px, rgba(215, 181, 109, 0.16), transparent 70%),
    var(--cream);
  padding-bottom: 72px;
}

/* ---------- Hero ---------- */

.dream-hero {
  position: relative;
  overflow: hidden;
  padding: 64px 0 132px;
  color: var(--cream);
  background:
    radial-gradient(860px 420px at 80% 8%, rgba(215, 181, 109, 0.22), transparent 64%),
    radial-gradient(720px 520px at 6% 100%, rgba(165, 25, 49, 0.52), transparent 66%),
    linear-gradient(138deg, #280710 0%, #4c0e1a 52%, #6d1322 100%);
}

.dream-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 18% 28%, rgba(242, 212, 147, 0.55), transparent 100%),
    radial-gradient(1.2px 1.2px at 72% 18%, rgba(242, 212, 147, 0.42), transparent 100%),
    radial-gradient(1.6px 1.6px at 88% 62%, rgba(242, 212, 147, 0.36), transparent 100%),
    radial-gradient(1.1px 1.1px at 38% 76%, rgba(242, 212, 147, 0.3), transparent 100%),
    radial-gradient(1.2px 1.2px at 6% 58%, rgba(242, 212, 147, 0.26), transparent 100%);
  pointer-events: none;
}

.dream-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: center;
}

.dream-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding: 7px 14px;
  border: 1px solid rgba(215, 181, 109, 0.36);
  border-radius: 999px;
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dream-hero .eyebrow::before {
  content: "✦";
  color: var(--gold);
  font-size: 12px;
}

.dream-hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.16;
  letter-spacing: 0.01em;
  color: var(--white);
}

.dream-hero-desc {
  margin: 0;
  max-width: 620px;
  color: rgba(250, 245, 232, 0.76);
  font-size: 15.5px;
  line-height: 1.85;
}

.dream-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.dream-hero-tags li {
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.07);
  border: 1px solid rgba(215, 181, 109, 0.24);
  color: rgba(250, 245, 232, 0.82);
  font-size: 12.5px;
}

.dream-hero-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 280px;
  height: 280px;
  margin-left: auto;
}

.dream-hero-art .moon {
  font-size: 92px;
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 42px rgba(242, 212, 147, 0.45);
}

.dream-hero-art b {
  position: absolute;
  font-family: var(--font-thai);
  font-size: 46px;
  color: rgba(250, 245, 232, 0.9);
}

.dream-hero-art small {
  position: absolute;
  bottom: 46px;
  color: rgba(242, 212, 147, 0.6);
  font-size: 12px;
  letter-spacing: 0.32em;
}

.dream-hero-art .ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(215, 181, 109, 0.34);
}

.dream-hero-art .ring-a {
  inset: 8px;
  animation: dream-spin 34s linear infinite;
}

.dream-hero-art .ring-b {
  inset: 42px;
  border-style: solid;
  border-color: rgba(215, 181, 109, 0.16);
}

@keyframes dream-spin {
  to { transform: rotate(360deg); }
}

/* ---------- 主体 ---------- */

.dream-main {
  position: relative;
  margin-top: -84px;
}

.dream-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 28px 24px;
  box-shadow: 0 30px 70px -34px rgba(46, 8, 15, 0.5);
}

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

.dream-card-head > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dream-step {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--crimson-900);
  color: var(--gold-bright);
  font-family: var(--font-thai);
  font-size: 13px;
  font-weight: 700;
}

.dream-card-head h2 {
  margin: 0;
  font-size: 19px;
  color: var(--ink);
}

.dream-ai-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
}

.dream-ai-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.dream-ai-state.is-on {
  color: #2f6b45;
  background: #edf7f0;
  border-color: rgba(47, 107, 69, 0.28);
}

.dream-ai-state.is-on::before { background: #3f9b64; }

.dream-ai-state.is-off {
  color: var(--gold-deep);
  background: #fff8e6;
  border-color: rgba(168, 135, 63, 0.34);
}

.dream-ai-state.is-off::before { background: var(--gold); }

#dreamText {
  width: 100%;
  min-height: 118px;
  padding: 16px 18px;
  border: 1px solid var(--line-ink);
  border-radius: 14px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.8;
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#dreamText::placeholder { color: var(--ink-faint); }

#dreamText:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 4px rgba(215, 181, 109, 0.18);
}

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

.dream-hint {
  color: var(--ink-faint);
  font-size: 12.5px;
}

.dream-run {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #2a0710;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(168, 135, 63, 0.8);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.dream-run:hover { transform: translateY(-1px); }

.dream-run:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.dream-samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-faint);
}

.dream-samples button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.dream-samples button:hover {
  border-color: var(--gold);
  color: var(--crimson-800);
  background: #fff8e8;
}

/* ---------- 结果 ---------- */

.dream-result {
  margin-top: 26px;
  padding: 26px 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 20px;
  box-shadow: 0 24px 60px -38px rgba(46, 8, 15, 0.45);
  animation: dream-rise 0.45s var(--ease);
}

@keyframes dream-rise {
  from { opacity: 0; transform: translateY(14px); }
}

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

.dres-title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--ink);
}

.dres-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.dres-source.is-ai {
  background: #edf7f0;
  border-color: rgba(47, 107, 69, 0.26);
  color: #2f6b45;
}

.dres-summary {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.dres-omens {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.dres-omen {
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf7, #faf3e2);
  border: 1px solid var(--line);
}

.dres-omen-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.dres-omen-top b {
  font-size: 15.5px;
  color: var(--ink);
}

.dres-omen-top em {
  font-style: normal;
  color: var(--ink-faint);
  font-size: 12.5px;
}

.dres-tone {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(215, 181, 109, 0.18);
  color: var(--gold-deep);
}

.dres-tone.is-good { background: #eaf6ee; color: #2f6b45; }
.dres-tone.is-warn { background: #fdeeee; color: #a51931; }

.dres-omen p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.dres-group + .dres-group { margin-top: 22px; }

.dres-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 11px;
}

.dres-group-head h3 {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink);
}

.dres-group-head span {
  font-size: 12px;
  color: var(--ink-faint);
}

.dres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 11px;
}

.dres-num {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, #f7efdc);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s, box-shadow 0.18s;
}

.dres-num:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 14px 28px -20px rgba(168, 135, 63, 0.7);
}

.dres-num b {
  font-family: var(--font-thai);
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0.12em;
  color: var(--crimson-800);
}

.dres-num span {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.7;
}

.dres-num i {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-deep);
}

.dres-num.is-saved {
  border-color: var(--gold);
  background: #fff8e6;
}

.dres-num.is-saved i { color: #2f6b45; }

.dres-advice {
  margin: 22px 0 0;
  padding: 12px 15px;
  border-radius: 12px;
  background: rgba(215, 181, 109, 0.12);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.75;
}

.dres-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 14px;
}

.dres-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(215, 181, 109, 0.35);
  border-top-color: var(--gold-deep);
  animation: dream-spin 0.9s linear infinite;
}

/* ---------- 热门梦境 ---------- */

.dream-section {
  margin-top: 40px;
}

.dream-sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dream-sec-head h2 {
  margin: 0;
  font-size: 22px;
  color: var(--ink);
}

.dream-sec-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

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

.dream-cat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, #fffdf7, #f6edda);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s;
}

.dream-cat:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.dream-cat b {
  font-size: 16px;
  color: var(--ink);
}

.dream-cat small {
  color: var(--ink-faint);
  font-size: 12px;
}

.dream-cat span {
  margin-top: 6px;
  color: var(--gold-deep);
  font-size: 11.5px;
  font-weight: 600;
}

/* ---------- 古籍出处栏 ---------- */

.dream-lore {
  margin-top: 40px;
  padding: 24px 28px 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 60px -38px rgba(46, 8, 15, 0.4);
}

.dream-lore-body .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--gold-deep);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dream-lore-body .eyebrow::before {
  content: "✦";
}

.dream-lore-body h2 {
  margin: 0 0 12px;
  font-size: 20px;
  color: var(--ink);
}

.dream-lore-body p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.9;
}

.dream-lore-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.dream-lore-body li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.dream-lore-body li::before {
  content: "❖";
  position: absolute;
  left: 0;
  color: var(--gold-deep);
  font-size: 11px;
}

/* ---------- 梦境插图（随解析内容动态出现） ---------- */

.dres-omen-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.dres-omen-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 2px rgba(215, 181, 109, 0.14);
}

.dres-omen-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dres-no-match {
  margin-bottom: 24px;
  padding: 18px;
  text-align: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf7, #faf3e2);
  border: 1px dashed var(--line-strong);
}

.dres-no-match p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.dres-no-icon {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  opacity: 0.9;
}

.dres-no-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dream-cat-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 2px rgba(215, 181, 109, 0.14);
}

.dream-cat-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dream-cat {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.dream-cat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dream-cat b {
  font-size: 16px;
  color: var(--ink);
}

/* ---------- 历史记录 ---------- */

.dream-history {
  margin-top: 40px;
  padding: 24px 26px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.dream-clear {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.dream-clear:hover { color: var(--crimson-700); border-color: rgba(165, 25, 49, 0.35); }

.dream-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dream-history-list li {
  display: flex;
  align-items: stretch;
  gap: 10px;
  border-bottom: 1px dashed var(--line);
}

.dream-history-list li:last-child { border-bottom: none; }

.dh-main {
  flex: 1;
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.dh-main time {
  color: var(--ink-faint);
  font-size: 12px;
}

.dh-main p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13.5px;
}

.dh-main span {
  color: var(--gold-deep);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dh-main:hover p { color: var(--crimson-800); }

.dh-del {
  align-self: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.dh-del:hover { background: #fbecec; color: var(--crimson-700); }

.dream-history-empty {
  margin: 8px 0 2px;
  color: var(--ink-faint);
  font-size: 13px;
}

/* ---------- FAQ ---------- */

.dream-faq {
  margin-top: 40px;
}

.dream-faq details {
  border-bottom: 1px solid var(--line);
  padding: 16px 2px;
}

.dream-faq summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}

.dream-faq summary::-webkit-details-marker { display: none; }

.dream-faq summary::after {
  content: "+";
  float: right;
  color: var(--gold-deep);
  font-weight: 400;
}

.dream-faq details[open] summary::after { content: "−"; }

.dream-faq p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.85;
}

.dream-disclaimer {
  margin-top: 28px;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1024px) {
  .dream-hero-inner { grid-template-columns: minmax(0, 1fr) 220px; }
  .dream-hero-art { width: 210px; height: 210px; }
  .dream-hero-art .moon { font-size: 68px; }
  .dream-hero-art b { font-size: 34px; }
  .dream-cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .dream-hero { padding: 42px 0 108px; }
  .dream-hero-inner { grid-template-columns: 1fr; gap: 18px; }
  .dream-hero-art { display: none; }
  .dream-hero h1 { font-size: clamp(27px, 8vw, 36px); }
  .dream-hero-desc { font-size: 14.5px; }
  .dream-main { margin-top: -72px; }
  .dream-card { padding: 20px 18px; border-radius: 18px; }
  .dream-input-foot { flex-direction: column; align-items: stretch; gap: 12px; }
  .dream-run { justify-content: center; width: 100%; }
  .dream-result { padding: 20px 18px; }
  .dres-head { flex-direction: column; gap: 10px; }
  .dres-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dres-num b { font-size: 26px; }
  .dream-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dream-lore { padding: 18px; }
  .dream-history { padding: 18px; }
  .dh-main { grid-template-columns: 84px minmax(0, 1fr); }
  .dh-main span { display: none; }
  .dream-sec-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 400px) {
  .dres-grid { grid-template-columns: 1fr; }
}
