/* Сны: страница дневника. Все изменения ограничены этим разделом. */
.page--dreams { gap: 22px; }
.dream-guide { display: none; }
.home[data-screen="dreams"] .home__side > :not(.dream-guide) { display: none; }
.home[data-screen="dreams"] .dream-guide { display: flex; flex-direction: column; }
/* Липнет к шапке (84px) с тем же отступом, что у ленты сверху (22px): верх
   колонки на одной линии с обложкой слева */
.home[data-screen="dreams"] .home__side { position: sticky; top: 106px; align-self: start; }

.dream-intro {
  position: relative; isolation: isolate; overflow: hidden; min-height: 258px;
  border: 1px solid var(--line); border-radius: 18px; background: #EEE1CE;
}
.dream-intro__art {
  position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 48%;
}
.dream-intro::after {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(90deg, rgba(245, 235, 219, .68), rgba(245, 235, 219, .1) 58%, transparent 75%);
}
.dream-intro__text { padding: 30px 34px 32px; max-width: 62%; }
.dream-intro__title {
  margin: 14px 0 12px; font: 500 43px/1.02 var(--serif); letter-spacing: -.025em;
  color: var(--ink); text-wrap: balance;
}
.dream-intro__lead { font-size: 13px; line-height: 1.7; color: var(--ink-2); }

.page--dreams .panel { padding: 28px 30px; border-radius: 18px; box-shadow: none; }
.dreambox__intro { padding-right: 38px; }
.dreambox__title { margin-top: 8px; font: 500 33px/1.15 var(--serif); letter-spacing: -.015em; }
.dreambox__note { margin-top: 8px; max-width: 64ch; color: var(--body); font-size: 13px; line-height: 1.7; }
.page--dreams .help-btn { top: 25px; right: 27px; width: 34px; height: 34px; font-size: 20px; }
.dreambox:not([data-state="form"]) > .dreambox__intro,
.dreambox:not([data-state="form"]) > .help-btn { display: none; }
.page--dreams .dreambox[data-state="waiting"] { padding: 0; }
.page--dreams .dream__form { margin-top: 6px; gap: 0; }
.dream-editor {
  padding: 16px 20px 13px; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--panel-2); transition: border-color .2s ease, box-shadow .2s ease;
}
.dream-editor:focus-within { border-color: var(--gold-mid); box-shadow: 0 0 0 3px rgba(163, 134, 99, .12); }
.dream-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dream-editor__label { color: var(--gold-deep); font-size: 11px; font-weight: 600; }
.dream-editor__count { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.page--dreams .dream__text {
  display: block; min-height: 145px; padding: 14px 0 8px; border: 0; border-radius: 2px;
  background: transparent; box-shadow: none; font-size: 15px; line-height: 1.8;
}
.page--dreams .dream__text:focus-visible { outline: 0; }
.page--dreams .dream__text::placeholder { color: #8A7A69; font: italic 24px/1.5 var(--serif); }
.dream-editor__note { color: var(--muted); font-size: 11px; }
.dream-prompts { margin: 10px 0 21px; }
.dream-prompts__toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 36px; cursor: pointer; list-style: none; color: var(--gold-deep);
  font-size: 12px; border-radius: 4px; touch-action: manipulation;
}
.dream-prompts__toggle::-webkit-details-marker { display: none; }
.dream-prompts__toggle > span { font-size: 20px; transition: transform .2s ease; }
.dream-prompts[open] .dream-prompts__toggle > span { transform: rotate(45deg); }
.dream-prompts__toggle:hover { color: var(--ink); }
.dream-prompts__toggle:focus-visible { outline: 2px solid var(--gold-mid); outline-offset: 3px; }
.dream-prompts__body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 10px 0 9px; }
.dream-prompts__body p { font-size: 12px; line-height: 1.65; color: var(--body); }
.dream-prompts__body b { display: block; margin-bottom: 3px; color: var(--ink-2); font-weight: 600; }
.page--dreams .dream__foot { align-items: flex-end; padding-top: 18px; border-top: 1px solid var(--line); }
.dream-date { display: flex; flex-direction: column; gap: 9px; }
.dream-date__label { color: var(--body); font-size: 11px; }
.page--dreams .dream__when .chip { min-height: 42px; box-shadow: none; font-size: 12px; }
.page--dreams .chip:focus-visible { outline: 2px solid var(--gold-mid); outline-offset: 3px; }
.page--dreams .dream__foot .btn { min-height: 45px; padding-inline: 25px; font-size: 13px; }
.page--dreams .cmp__hint:not(:empty), .page--dreams .dream__left { margin-top: 12px; }
.page--dreams .dream__result { overflow-wrap: anywhere; }
.page--dreams .dream__entry { max-width: 760px; width: 100%; margin-inline: auto; }
.page--dreams .dream__title { font-size: 31px; line-height: 1.15; }
.page--dreams .dream__par { font-size: 15px; line-height: 1.85; }

.dream-diary .diary__head { align-items: center; }
.dream-diary .diary__title { margin: 8px 0; font-size: 32px; }
.dream-diary .cmp__note { max-width: 54ch; color: var(--body); font-size: 12px; }
.dream-diary .hist__bar { flex-direction: column; align-items: flex-end; gap: 8px; }
.dream-diary .hist__where { font-size: 11px; }
.dream-diary .hist__cal { min-height: 38px; font-size: 12px; box-shadow: none; }
.dream-diary .hist { gap: 12px; margin-top: 10px; }
.dream-diary .histday { box-shadow: none; gap: 0; }
.dream-diary .histday__pic { width: 106px; }
.dream-diary .histday__meta { padding-block: 20px; }
.dream-diary .histday__when { font-size: 9px; letter-spacing: .14em; }
.dream-diary .histday__date { font-size: 24px; line-height: 1.1; overflow-wrap: anywhere; }
.dream-diary .histday__count { margin-top: 4px; font-size: 11px; overflow-wrap: anywhere; }
.dream-diary .histday__acts { gap: 8px; padding-right: 14px; }
.dream-diary .histday__acts .dream__open { font-size: 11px; text-decoration: none; min-height: 42px; }
.dream-diary .histday__more { width: 36px; height: 40px; }
.dream-diary .histday__body { padding: 26px; }
.dream-diary .histday__body .dream__told { margin-bottom: 20px; }
.dream-diary .histday__body .dream__entry { margin-top: 16px; }
.dream-diary .hist__empty { color: var(--body); line-height: 1.7; }
.dream-empty {
  display: flex; align-items: center; gap: 22px; padding: 24px 0 4px;
  border-top: 1px solid var(--line-soft);
}
.dream-empty__icon {
  display: grid; place-items: center; flex: none; width: 66px; height: 76px;
  border: 1px solid var(--gold-soft); border-radius: 4px 12px 12px 4px;
  background: var(--gold-tint); box-shadow: inset 5px 0 rgba(163, 134, 99, .1);
  color: var(--gold-deep); font: 28px var(--serif);
}
.dream-empty__title { margin-bottom: 5px; font: 500 24px/1.15 var(--serif); }
.dream-empty__text { max-width: 46ch; font-size: 12px; line-height: 1.7; color: var(--body); }
.dream-empty__start { margin-top: 10px; font-size: 12px; min-height: 28px; }
.dream-diary .link:focus-visible { outline: 2px solid var(--gold-mid); outline-offset: 4px; border-radius: 3px; }
.dream-diary .dream-retry { align-self: flex-start; min-height: 36px; font-size: 12px; }

.home[data-screen="dreams"] .dream-guide {
  padding: 22px 24px 20px; gap: 0; border-radius: 18px; box-shadow: none;
  background: linear-gradient(155deg, #FCF7EF, #F5EBDC); text-align: center;
}
.dream-guide__moon {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px;
  border: 1px solid var(--gold-soft); border-radius: 50%; color: var(--gold-mid);
  font: 32px/1 var(--serif); outline: 1px solid var(--line-soft); outline-offset: 6px;
}
.dream-guide .eyebrow { font-size: 9px; }
.dream-guide__title { margin: 10px 0 8px; font: 500 27px/1.08 var(--serif); text-wrap: balance; }
.dream-guide__lead { font-size: 12px; line-height: 1.65; color: var(--body); }
.dream-guide__steps { margin-top: 14px; text-align: left; }
.dream-guide__steps li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dream-guide__steps li > span { padding-top: 4px; font-size: 10px; color: var(--gold-deep); font-variant-numeric: tabular-nums; }
.dream-guide__steps h3 { margin-bottom: 3px; font: 500 19px/1.15 var(--serif); }
.dream-guide__steps p { color: var(--body); font-size: 12.5px; line-height: 1.6; }
.dream-guide__help {
  display: flex; justify-content: center; gap: 14px; align-items: center; min-height: 40px; margin-top: 6px;
  padding: 10px 14px; border: 1px solid var(--gold-soft); border-radius: 30px;
  background: transparent; color: var(--gold-deep); font-size: 12px; cursor: pointer;
  touch-action: manipulation; transition: background .2s ease;
}
.dream-guide__help:hover { background: var(--gold-tint); }
.dream-guide__help:focus-visible { outline: 2px solid var(--gold-mid); outline-offset: 3px; }
.dream-guide__foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.dream-guide__foot p { font: italic 18px/1.3 var(--serif); color: var(--gold-deep); }
.dream-guide__foot span { display: block; margin: 5px auto 0; max-width: 25ch; font-size: 10.5px; line-height: 1.6; color: var(--body); }
/* Блок должен помещаться в экран целиком, без прокрутки: на невысоких
   окнах убираем луну и цитату внизу – суть в трёх шагах */
@media (max-height: 820px) {
  .home[data-screen="dreams"] .dream-guide__moon { display: none; }
  .home[data-screen="dreams"] .dream-guide__foot { display: none; }
}

@media (max-width: 1180px) {
  .home[data-screen="dreams"] .home__side { position: static; display: block; }
  .home[data-screen="dreams"] .dream-guide { padding: 26px; }
  .dream-guide__moon { display: none; }
  .dream-guide__lead { max-width: 56ch; align-self: center; }
  .dream-guide__steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .dream-guide__help { align-self: center; padding-inline: 26px; }
  .dream-guide__foot { display: none; }
}
@media (max-width: 600px) {
  .page--dreams { gap: 16px; }
  .dream-intro { min-height: 218px; }
  .dream-intro__art { object-position: 63% center; opacity: .6; }
  .dream-intro::after { background: linear-gradient(90deg, #F1E6D5, rgba(241, 230, 213, .5) 58%, transparent); }
  .dream-intro__text { max-width: 100%; padding: 24px 20px; }
  .dream-intro__title { font-size: clamp(29px, 8vw, 35px); max-width: none; margin-top: 17px; }
  .dream-intro .eyebrow { font-size: 8px; letter-spacing: .17em; }
  .dream-intro__lead { font-size: 11.5px; }
  .page--dreams .panel { padding: 22px 18px; }
  .dreambox__intro { padding-right: 24px; }
  .dreambox__title { font-size: 29px; }
  .dreambox__note { font-size: 12px; }
  .page--dreams .help-btn { top: 18px; right: 14px; width: 32px; height: 32px; }
  .dream-editor { padding: 13px 14px; }
  .page--dreams .dream__text { height: 142px; min-height: 142px; font-size: 16px; }
  .dream-editor__note { font-size: 10px; }
  .dream-prompts { margin-bottom: 12px; }
  .dream-prompts__toggle { font-size: 11px; min-height: 42px; gap: 9px; }
  .dream-prompts__body { grid-template-columns: 1fr; gap: 12px; }
  .page--dreams .dream__foot { align-items: stretch; gap: 18px; }
  .dream-date { width: 100%; }
  .page--dreams .dream__when { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page--dreams .dream__when .chip { justify-content: center; padding: 0 8px; font-size: 11px; }
  .page--dreams .dream__foot .btn { width: 100%; min-height: 48px; }
  .dream-diary .diary__head { flex-direction: column; align-items: stretch; gap: 14px; }
  .dream-diary .diary__title { font-size: 29px; }
  .dream-diary .hist__bar { flex-direction: row; align-items: center; }
  .dream-diary .hist__cal { padding: 0 10px; font-size: 11px; }
  .dream-diary .histday__row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0 12px; }
  .dream-diary .histday__pic { width: 72px; min-height: 96px; grid-row: span 2; }
  .dream-diary .histday__meta { padding: 14px 10px 0 0; }
  .dream-diary .histday__date { font-size: 23px; }
  .dream-diary .histday__acts { grid-column: 2; padding: 0 5px 5px 0; justify-content: space-between; }
  .dream-diary .histday__body { padding: 18px 14px; }
  .dream-empty { align-items: flex-start; gap: 15px; padding-top: 19px; }
  .dream-empty__icon { width: 42px; height: 56px; font-size: 22px; }
  .dream-empty__title { font-size: 22px; }
  .dream-empty__text { font-size: 11px; }
  .dream-guide__steps { grid-template-columns: 1fr; gap: 0; }
  .dream-guide__title { font-size: 30px; }
  .dream-guide__steps li { padding: 16px 0; }
}
