/* dream.css — new purple/teal dark theme */

.dream-shell {
  background:
    radial-gradient(ellipse at 50% -5%, rgba(155, 109, 255, 0.16) 0%, transparent 55%),
    var(--bg);
}

.dream-main { padding: 0 16px calc(88px + var(--safe-bottom)); }

/* Hero */
.dream-hero {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 20px 0 16px;
}
.dream-emblem {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px rgba(155, 109, 255, 0.5));
}
.dream-hero h1 {
  margin-bottom: 6px;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dream-hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Daily fortune card */
.daily-fortune-card {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(201,168,76,0.07) 0%, rgba(155,109,255,0.05) 100%), var(--panel);
}
.daily-fortune-card__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.daily-fortune-card p { margin: 0; color: var(--text); font-size: 15px; line-height: 1.7; font-style: italic; }

/* Panel */
.dream-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
}
.dream-input { color: var(--muted); font-size: 14px; }
.dream-input textarea { min-height: 110px; font-size: 15px; line-height: 1.6; resize: none; }
.dream-input textarea.dream-input--error {
  border-color: var(--accent);
  animation: shakeInput 0.4s ease;
}
@keyframes shakeInput {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.dream-input-hint { color: var(--accent); font-size: 12px; margin: 6px 0 0; animation: fadeIn 200ms ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dream-actions { display: grid; grid-template-columns: minmax(80px, 0.4fr) 1fr; gap: 10px; }
.dream-clear, .dream-submit { min-height: 46px; }
.dream-example { justify-self: start; border: 0; background: transparent; color: var(--teal); font-size: 13px; padding: 0; cursor: pointer; }
.privacy-note { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.5; text-align: center; }

/* Result */
.dream-result {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
}
.dream-result[hidden] { display: none; }
.dream-result--visible { animation: dreamResultRise 0.5s ease both; }
.dream-result__header { text-align: center; margin-bottom: 16px; }
.dream-result__header p { margin-bottom: 4px; color: var(--purple); font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.dream-result__header h2 { color: var(--text); font-size: 20px; font-weight: 700; }
.dream-result__header h2[hidden] { display: none; }

/* Dream reading content */
.dream-reading p { margin-top: 10px; color: var(--text); font-size: 15px; line-height: 1.85; }
.dream-reading h3, .dream-reading h4 { margin-top: 18px; font-weight: 700; line-height: 1.4; }
.dream-reading h3 { color: var(--teal); font-size: 16px; }
.dream-reading h4 { color: var(--purple); font-size: 15px; }
.dream-reading strong { color: var(--teal); }
.dream-reading em { color: var(--text); font-style: normal; }
.dream-reading ul, .dream-reading ol { margin: 10px 0 0; padding-left: 1.3em; color: var(--muted); font-size: 14px; line-height: 1.9; }
.dream-reading hr { margin: 16px 0 6px; border: 0; border-top: 1px solid var(--line-soft); }
.result-feedback { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); text-align: center; }
.result-feedback[hidden] { display: none; }
.result-feedback p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.result-feedback > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-feedback button { min-height: 42px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.035); color: var(--muted); cursor: pointer; font-size: 13px; transition: all 140ms; }
.result-feedback button.is-selected { border-color: rgba(93,219,184,.55); background: var(--teal-soft); color: var(--text); }
.dream-offer { margin-top: 14px; padding: 16px; border: 1px solid rgba(155,109,255,.32); border-radius: 16px; background: linear-gradient(135deg,rgba(155,109,255,.10),rgba(93,219,184,.05)); }
.dream-offer[hidden] { display: none; }
.dream-offer__label { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.dream-offer h3 { margin: 6px 0 8px; color: var(--text); }
.dream-offer ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.dream-offer__price { margin: 12px 0 !important; color: var(--gold-light) !important; font-weight: 700; }
.interest-modal { position: fixed; inset: 0; z-index: 90; display: grid; align-items: end; background: rgba(0,0,0,.72); }
.interest-modal[hidden] { display: none; }
.interest-modal__panel { position: relative; width: min(100%,430px); margin: 0 auto; padding: 26px 20px calc(20px + var(--safe-bottom)); border: 1px solid rgba(155,109,255,.3); border-radius: 24px 24px 0 0; background: #17132b; text-align: center; }
.interest-modal__close { position: absolute; right: 16px; top: 14px; width: 34px; height: 34px; border: 1px solid var(--line-soft); border-radius: 50%; background: rgba(255,255,255,.04); color: var(--muted); font-size: 22px; }
.interest-modal__icon { font-size: 36px; }
.interest-modal h2 { margin: 10px 24px 8px; font-size: 20px; }
.interest-modal p { color: var(--muted); line-height: 1.6; }
.interest-modal__later { width: 100%; margin-top: 8px; border: 0; background: transparent; color: var(--muted); min-height: 40px; }
.interest-modal__confirmed { color: var(--teal) !important; font-weight: 700; }

/* Quota exhausted state */
.dream-quota-empty { display: grid; justify-items: center; gap: 10px; padding: 28px 20px 24px; text-align: center; }
.dream-quota-empty[hidden] { display: none; }
.dream-quota-empty__icon { font-size: 44px; line-height: 1; filter: drop-shadow(0 0 12px rgba(155,109,255,0.4)); }
.dream-quota-empty__title { margin: 0; color: var(--text); font-size: 17px; font-weight: 700; }
.dream-quota-empty__hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.dream-quota-empty__cta { 
  margin-top: 8px; 
  padding: 12px 24px; 
  border: 1px solid rgba(155, 109, 255, 0.4);
  border-radius: 12px; 
  background: linear-gradient(135deg, rgba(155,109,255,0.1) 0%, rgba(93,219,184,0.05) 100%);
  color: var(--purple); 
  font-size: 14px; 
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms;
}
.dream-quota-empty__cta:hover {
  background: linear-gradient(135deg, rgba(155,109,255,0.15) 0%, rgba(93,219,184,0.08) 100%);
  transform: translateY(-1px);
}

/* Library sections */
.dream-categories, .dream-popular {
  margin-top: 12px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
}
.dream-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dream-section-heading h2 { color: var(--text); font-size: 16px; font-weight: 700; margin: 0; }
.dream-section-heading button { flex: 0 0 auto; min-width: 52px; min-height: 28px; border: 1px solid var(--line-soft); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; }
.dream-collapsible[hidden] { display: none; }
.dream-category-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dream-category-grid button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(255,255,255,0.04); color: var(--muted); font-size: 14px; padding: 6px 13px; transition: all 140ms; }
.dream-category-icon { font-size: 15px; }
.dream-category-grid button.is-active { border-color: rgba(155,109,255,0.45); background: var(--purple-soft); color: var(--text); }
.dream-item-list, .dream-popular-grid { display: grid; gap: 10px; margin-top: 14px; }
.dream-item-list[hidden], .dream-popular[hidden], .dream-modal[hidden] { display: none; }

/* Dream cards */
.dream-card { width: 100%; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255,255,255,0.03); color: var(--text); text-align: left; padding: 12px 14px; transition: background 140ms; }
.dream-card:hover { background: rgba(155,109,255,0.06); }
.dream-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.dream-card__title { color: var(--teal); font-size: 15px; font-weight: 600; }
.dream-card__level { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 12px; font-weight: 600; }
.dream-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Modal */
.dream-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,0.75); }
.dream-modal__panel { position: relative; width: min(100%, 360px); max-height: calc(100dvh - 100px); overflow: auto; border: 1px solid rgba(155,109,255,0.25); border-radius: 20px; background: rgba(18,14,36,0.98); box-shadow: 0 20px 50px rgba(0,0,0,0.6); padding: 22px 18px; overscroll-behavior: contain; }
.dream-modal__close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 1px solid var(--line-soft); border-radius: 50%; background: rgba(255,255,255,0.05); color: var(--muted); font-size: 22px; line-height: 1; }
.dream-modal h2 { padding-right: 32px; color: var(--teal); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.dream-modal p { color: var(--muted); font-size: 14px; line-height: 1.75; margin-bottom: 8px; }
.dream-modal__level { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.dream-modal__ancient { color: var(--muted); font-style: italic; padding: 10px 12px; border-left: 2px solid rgba(201,168,76,0.3); background: rgba(201,168,76,0.05); border-radius: 0 8px 8px 0; }
.dream-modal__ancient strong { color: var(--gold-light); font-style: normal; }
.dream-modal__advice { display: flex; gap: 8px; margin-top: 10px; padding: 12px; border-left: 2px solid rgba(93,219,184,0.4); border-radius: 0 8px 8px 0; background: rgba(93,219,184,0.06); color: var(--teal); font-size: 14px; }

/* Limited free badge */
.limited-free-badge { display: inline-grid; place-items: center; min-height: 28px; margin: 10px 0 0; padding: 4px 14px; border: 1px solid rgba(93,219,184,0.35); border-radius: 999px; background: rgba(93,219,184,0.1); color: var(--teal); font-size: 13px; font-weight: 700; }

@keyframes dreamResultRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Dream loading animation */
.dream-btn-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinBtn 0.6s linear infinite;
}
@keyframes spinBtn {
  to { transform: rotate(360deg); }
}
.dream-loading-anim {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 36px 20px;
}
.dream-loading-anim p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  animation: textFade 2s ease-in-out infinite;
}
@keyframes textFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.dream-loading-orb {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}
.dream-loading-orb__icon {
  font-size: 32px;
  line-height: 1;
  animation: orbPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(155,109,255,0.6));
}
.dream-loading-orb__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(155,109,255,0.4);
  animation: ringExpand 2s ease-out infinite;
}
.dream-loading-orb__ring:nth-child(2) {
  animation-delay: 0.7s;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(155,109,255,0.6)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(155,109,255,0.9)); }
}
@keyframes ringExpand {
  0% { transform: scale(0.6); opacity: 1; border-color: rgba(155,109,255,0.6); }
  100% { transform: scale(1.6); opacity: 0; border-color: rgba(93,219,184,0.3); }
}

.dream-emblem img { display: block; width: 52px; height: 52px; }
.dream-quota-empty__icon img { width: 48px; height: 48px; }
.interest-modal__icon img { width: 44px; height: 44px; }
.dream-loading-orb__icon img { width: 34px; height: 34px; }
.dream-category-icon img { display: block; width: 17px; height: 17px; }
.dream-modal__advice img { flex: 0 0 auto; width: 16px; height: 16px; }
