/* =====================================================================
   หน้าทำนายฝัน (dream.html) + ส่วนที่ใช้ร่วมกับหน้าบันทึกความฝัน (journal.html)
   ===================================================================== */
.pt-0 { padding-top: 0 !important; }

/* ---------- Hero ภาพพระจันทร์ + เมฆ ---------- */
.dream-hero { padding-top: 22px; }
.dream-art { width: min(300px, 78vw); height: auto; margin: -4px auto 4px; overflow: visible; }
.dream-art .da-moon { animation: floatY 7s ease-in-out infinite; transform-origin: center; }
.dream-art .da-cloud1 { animation: dmDrift 9s ease-in-out infinite; }
.dream-art .da-cloud2 { animation: dmDrift 11s ease-in-out infinite reverse; }
.dream-art .da-cloud3 { animation: dmDrift 13s ease-in-out infinite; }
.dream-art .tw1 { animation: twinkle 3.2s ease-in-out infinite; }
.dream-art .tw2 { animation: twinkle 4.1s ease-in-out infinite .6s; }
.dream-art .tw3 { animation: twinkle 2.7s ease-in-out infinite 1.2s; }
@keyframes dmDrift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

/* วงเหรียญไอคอน (หน้าหมวด / หน้าคำทำนาย) */
.dream-medal { position: relative; width: 112px; height: 112px; margin: 0 auto 10px; display: grid; place-items: center; }
.dream-medal .dm-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spinSlow 60s linear infinite; }
.dream-medal .dm-ic {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(circle at 30% 25%, rgba(245, 223, 166, .3), rgba(93, 58, 150, .45) 60%, rgba(18, 8, 31, .5));
  box-shadow: 0 0 0 1px var(--line-2), 0 0 44px -6px var(--gold-glow);
}
.dream-medal .dm-ic svg { width: 36px; height: 36px; }

/* ---------- ช่องค้นหาความฝัน ---------- */
.dream-search-wrap { max-width: 640px; margin: 20px auto 0; text-align: left; }
.dream-search-wrap.sm { margin-top: 14px; }
.dream-search { position: relative; }
.ds-wrap { position: relative; }
.ds-wrap > svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.ds-input {
  width: 100%; height: 54px; border-radius: 999px; border: 0; padding: 0 52px 0 50px;
  background: var(--cream); color: var(--ink); font-size: 1rem; box-shadow: var(--shadow-gold); -webkit-appearance: none; appearance: none;
}
.ds-input::-webkit-search-cancel-button { display: none; }
.ds-input::placeholder { color: var(--ink-3); }
.ds-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(227, 194, 122, .55), 0 18px 50px -20px rgba(227, 194, 122, .45); }
.dream-search.lg .ds-input { height: 60px; font-size: 1.05rem; }
.ds-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(42, 22, 64, .08); color: var(--ink-2); display: grid; place-items: center; }
.ds-clear svg { width: 16px; height: 16px; }
.ds-clear[hidden] { display: none; }
.ds-hint { font-size: .8rem; text-align: center; margin: 10px 0 0; }
.ds-results { display: grid; gap: 8px; margin-top: 12px; }
.ds-results:empty { display: none; }
.ds-count { font-size: .8rem; padding: 0 4px; }
.ds-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; min-height: 56px;
  background: rgba(27, 13, 49, .82); border: 1px solid var(--line-soft); color: var(--text); transition: .2s; backdrop-filter: blur(6px);
}
.ds-item:first-of-type { border-color: var(--line-2); }
.ds-item:hover { color: var(--text); border-color: var(--line-2); background: rgba(58, 29, 99, .8); }
.ds-ic, .dc-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(227, 194, 122, .12); color: var(--gold); flex: none; }
.ds-ic svg, .dc-ic svg { width: 19px; height: 19px; }
.ds-txt { flex: 1; min-width: 0; line-height: 1.35; }
.ds-txt b { display: block; font-weight: 500; }
.ds-txt small { display: block; color: var(--text-3); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-item .badge { flex: none; }
.ds-chev { width: 16px; height: 16px; color: var(--gold); opacity: .7; flex: none; }
@media (max-width: 400px) { .ds-item .badge { display: none; } }
.ds-none { padding: 16px; border-radius: 18px; background: rgba(27, 13, 49, .82); border: 1px solid var(--line-soft); text-align: center; }
.ds-none p { margin: 0 0 6px; color: var(--text-2); }
.ds-sub { font-size: .8rem; color: var(--text-3); margin: 10px 0 6px; }
.ds-none .chip-row { padding-bottom: 0; }
.chip svg { width: 15px; height: 15px; color: var(--gold); }
.chip.is-active svg { color: var(--ink); }

.dream-quick { margin-top: 14px; align-items: center; }
.dream-quick .dim { font-size: .84rem; }
.dream-quick .chip { padding: 6px 13px; font-size: .84rem; }

/* ---------- การ์ดหมวด ---------- */
.dream-cats { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .dream-cats { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .dream-cats { grid-template-columns: repeat(3, 1fr); } .dream-cats .cat-card:nth-child(4) { grid-column: auto; } }
.cat-card { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.cat-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(227, 194, 122, .14), transparent 70%); pointer-events: none; }
.cc-head { display: flex; align-items: center; gap: 12px; }
.cc-head h3 { margin: 0; }
.cc-head small { display: block; font-size: .8rem; line-height: 1.3; }
.cc-ic { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(circle at 32% 26%, rgba(255, 236, 186, .28), rgba(144, 103, 198, .28) 55%, rgba(18, 8, 31, .5));
  box-shadow: inset 0 0 0 1.5px rgba(227, 194, 122, .55); }
.cc-ic svg { width: 26px; height: 26px; }
.cat-card p { margin: 0; color: var(--text-2); font-size: .92rem; line-height: 1.7; }
.cc-samples { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-samples span { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-soft); }
.dc-more { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-size: .88rem; font-weight: 400; }
.dc-more svg { width: 15px; height: 15px; transition: transform .2s; }
.link-card:hover .dc-more svg { transform: translateX(3px); }

/* ---------- ฝันแห่งวัน ---------- */
.dod { overflow: hidden; }
.dod::before { content: ''; position: absolute; inset: 0; background: radial-gradient(420px 200px at 85% 0%, rgba(227, 194, 122, .16), transparent 70%); pointer-events: none; border-radius: inherit; }
.dod-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; position: relative; }
.dod-head .badge svg { width: 13px; height: 13px; }
.dod-date { font-size: .84rem; }
.dod-body { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; position: relative; }
.dod-body h2 { margin-bottom: .25em; }
.dod-ic { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2);
  background: radial-gradient(circle at 30% 25%, rgba(245, 223, 166, .3), rgba(93, 58, 150, .45) 60%, rgba(18, 8, 31, .5)); box-shadow: 0 0 0 1px var(--line-2), 0 0 30px -6px var(--gold-glow); }
.dod-ic svg { width: 34px; height: 34px; }
.dod-badges { margin-bottom: 8px; }
.dod-num-note { font-size: .76rem; flex-basis: 100%; }
@media (max-width: 480px) { .dod-body { grid-template-columns: 1fr; } .dod-ic { width: 58px; height: 58px; } }

/* ฝันยอดนิยม */
.dream-popular .tile { min-height: 112px; justify-content: flex-start; }
@media (max-width: 420px) { .dream-popular { grid-template-columns: repeat(3, 1fr); } }

/* CTA บันทึกฝัน */
.dream-cta .cta-ic { width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; color: var(--gold); background: rgba(227, 194, 122, .1); box-shadow: 0 0 0 1px var(--line-2); }
.dream-cta .cta-ic svg { width: 28px; height: 28px; }
.dream-cta p { max-width: 520px; margin: 0 auto 18px; }
.dream-cta .btn { white-space: normal; }

/* ---------- บทความ ฝันตอนไหนแม่น ---------- */
.dream-article h3 { display: flex; align-items: center; gap: 8px; color: var(--gold-2); }
.dream-article h3 svg { width: 20px; height: 20px; }
.dream-times { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 0; position: relative; }
.dream-times::before { content: ''; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 1px; background: linear-gradient(180deg, var(--line), var(--gold)); }
.dream-times li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 10px 0; position: relative; }
.dream-times .dt-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #21103a; color: var(--lav); box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.dream-times .dt-ic svg { width: 20px; height: 20px; }
.dream-times b { font-family: var(--font-head); font-size: 1.05rem; }
.dream-times small { display: block; color: var(--text-3); font-size: .8rem; margin-bottom: 4px; }
.dream-times p { margin: 0; color: var(--text-2); font-size: .93rem; line-height: 1.7; }
.dream-times li.is-best .dt-ic { background: var(--gold-grad); color: var(--ink); box-shadow: 0 0 20px -2px var(--gold-glow); }
.dream-times li.is-best b { color: var(--gold-2); }
.dream-types { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .dream-types { grid-template-columns: 1fr 1fr; } }
.dream-types > div { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-soft); }
.dream-types b { color: var(--gold-2); font-weight: 500; }
.dream-types p { margin: 4px 0 0; font-size: .9rem; color: var(--text-2); line-height: 1.65; }

/* ---------- หน้าหมวด ---------- */
.dream-cat-top { padding-top: 0; padding-bottom: 14px; }
.dream-cat-chips { justify-content: flex-start; }
@media (min-width: 900px) { .dream-cat-chips { justify-content: center; flex-wrap: wrap; } }
.dream-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; margin-bottom: 14px; }
.dream-card { display: flex; flex-direction: column; gap: 6px; }
.dream-card .dc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.dream-card h3 { margin: 0; font-size: 1.1rem; }
.dream-card p { margin: 0; color: var(--text-2); font-size: .9rem; line-height: 1.65; }
.dream-card .dc-more { margin-top: 8px; }
.dream-related .dream-card { padding: 16px; }
.dream-related .dream-card h3 { font-size: 1rem; }
@media (max-width: 400px) { .dream-related .dream-card .badge { font-size: .7rem; padding: 2px 8px; } }

/* ---------- หน้าคำทำนาย ---------- */
.dream-detail-hero { padding-bottom: 20px; }
.dream-tone { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; font-size: .88rem; }
.dream-tone .badge { font-size: .86rem; padding: 4px 14px; }
.dream-summary { position: relative; padding-top: 26px; text-align: center; }
.dream-summary .ds-q { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); font-family: var(--font-head); font-size: 4rem; line-height: 1; color: var(--gold-3); opacity: .6; }
.dream-summary p { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.12rem; line-height: 1.8; color: var(--ink); }
@media (min-width: 720px) { .dream-summary p { font-size: 1.25rem; } }
.dream-meaning h3 { margin-top: 0; }
.dm-tag { display: inline-block; margin-right: 8px; padding: 1px 10px; border-radius: 999px; font-size: .74rem; font-weight: 500; vertical-align: 2px; background: rgba(227, 194, 122, .14); color: var(--gold-2); border: 1px solid var(--line); font-family: var(--font-body); }
.dm-tag.lav { background: rgba(185, 150, 236, .16); color: var(--lav); border-color: rgba(185, 150, 236, .3); }
.dream-h2 { font-size: clamp(1.2rem, 3.2vw, 1.6rem); margin-bottom: 12px; }
.dream-h2-sub { margin: -6px 0 12px; font-size: .86rem; }
.dream-topics .topic-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

.dream-variants { display: grid; gap: 8px; }
.dream-variants details { border-radius: 16px; background: var(--surface); border: 1px solid var(--line-soft); transition: border-color .2s, background .2s; }
.dream-variants details[open] { border-color: var(--line-2); background: var(--surface-2); }
.dream-variants summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 52px; }
.dream-variants summary::-webkit-details-marker { display: none; }
.dv-n { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .8rem; font-weight: 500; color: var(--ink); background: var(--gold-grad); }
.dv-q { flex: 1; font-weight: 400; }
.dv-chev { width: 18px; height: 18px; color: var(--gold); flex: none; transition: transform .2s; }
.dream-variants details[open] .dv-chev { transform: rotate(180deg); }
.dream-variants details p { margin: 0; padding: 0 16px 14px 54px; color: var(--text-2); font-size: .95rem; line-height: 1.75; }

.dream-bottom .card h3 { display: flex; align-items: center; gap: 8px; color: var(--gold-2); }
.dream-bottom .card h3 svg { width: 20px; height: 20px; }
.dream-numbers .num-row { gap: 12px; }
.dream-numbers p { font-size: .82rem; }
.dream-advice { background: linear-gradient(160deg, rgba(227, 194, 122, .12), rgba(27, 13, 49, .7)); }
.dream-advice p { color: var(--text); line-height: 1.8; }
.dream-actions { display: flex; justify-content: center; }
.dream-actions .btn { white-space: normal; }
.dream-note { font-size: .78rem; margin: 16px 0 0; }

/* ดูต่อ */
.dream-more .dm-link { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.dream-more .dm-link b { font-weight: 500; line-height: 1.35; }
.dream-more .dm-link small { color: var(--text-3); font-size: .8rem; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  .dream-art *, .dream-medal .dm-ring { animation: none !important; }
}
.page-hero .date-pill svg { width: 16px; height: 16px; flex: none; }
.cat-journal { background: radial-gradient(360px 200px at 80% 0%, rgba(227, 194, 122, .22), transparent 70%), linear-gradient(160deg, #3d1f6b, #1c0d33); border-color: var(--line-2); }
#dream-root [hidden] { display: none !important; }
