/*
 * Alice Reader — dream theme outer chrome.
 *
 * The reading card, story text, illustrations, video, audio timing and quest
 * content deliberately stay under the chapter's existing styles. This layer
 * only softens the surrounding application chrome and settings surfaces.
 */
html[data-alice-theme="dream"] {
  --bg0: #fffafc;
  --bg1: #fff4f8;
  --bg2: #efffff;
  --panel: rgba(255, 255, 255, .90);
  --panel2: rgba(255, 250, 242, .94);
  --line: rgba(210, 112, 154, .28);
  --line2: rgba(118, 94, 108, .15);
  --text: #4a3442;
  --soft: #684f5e;
  --muted: #796573;
  --gold: #cf8047;
  --gold2: #a95f45;
  --blue: #77bfc7;
  --cyan: #9ae1e3;
  --shadow: 0 24px 64px rgba(109, 77, 95, .15);
  color-scheme: light;
}

html[data-alice-theme="dream"],
html[data-alice-theme="dream"] body {
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 184, 219, .68), transparent 34%),
    radial-gradient(circle at 88% 16%, rgba(255, 237, 184, .74), transparent 36%),
    radial-gradient(circle at 76% 88%, rgba(204, 255, 255, .78), transparent 38%),
    linear-gradient(145deg, #fffafd 0%, #fff9e9 54%, #edffff 100%);
  color: var(--text);
}

html[data-alice-theme="dream"] .app,
html[data-alice-theme="dream"] body .app {
  border-color: rgba(210, 112, 154, .24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 249, 237, .92) 52%, rgba(238, 255, 255, .92));
  box-shadow:
    0 26px 70px rgba(110, 75, 94, .14),
    inset 0 1px 0 rgba(255, 255, 255, .92);
}

html[data-alice-theme="dream"] .btn,
html[data-alice-theme="dream"] button {
  border-color: rgba(202, 123, 156, .27);
  color: #563e4c;
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 244, 237, .91));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .96),
    0 7px 18px rgba(109, 75, 93, .10);
}

html[data-alice-theme="dream"] button:hover,
html[data-alice-theme="dream"] .btn:hover {
  border-color: rgba(210, 112, 154, .52);
}

html[data-alice-theme="dream"] .primary,
html[data-alice-theme="dream"] .pill.active {
  border-color: rgba(219, 142, 86, .42);
  color: #513725;
  background: linear-gradient(135deg, #ffe6aa, #ffc4d9 56%, #d9ffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .72),
    0 8px 20px rgba(180, 111, 102, .15);
}

html[data-alice-theme="dream"] .blue,
html[data-alice-theme="dream"] .guideBtns button.active {
  border-color: rgba(94, 177, 184, .40);
  color: #35535c;
  background: linear-gradient(135deg, #d9ffff, #e6efff 54%, #ffe2ef);
}

html[data-alice-theme="dream"] #loading.screen.active,
html[data-alice-theme="dream"] .statusRow,
html[data-alice-theme="dream"] .preview,
html[data-alice-theme="dream"] .previewText {
  color: #5c4654;
}

html[data-alice-theme="dream"] .statusRow {
  border-color: rgba(210, 112, 154, .20);
  background:
    linear-gradient(90deg, rgba(255, 227, 239, .91), rgba(255, 248, 215, .88) 52%, rgba(224, 255, 255, .91));
}

html[data-alice-theme="dream"] #count,
html[data-alice-theme="dream"] #time {
  color: #5c4654;
}

html[data-alice-theme="dream"] .progress {
  background: rgba(174, 113, 141, .16);
  box-shadow: inset 0 1px 2px rgba(109, 75, 93, .15);
}

html[data-alice-theme="dream"] .bar {
  background: linear-gradient(90deg, #ef9fc4, #f4d36f 52%, #8ed9df);
  box-shadow: 0 0 10px rgba(239, 159, 196, .28);
}

html[data-alice-theme="dream"] .preview {
  border-color: rgba(210, 112, 154, .22);
  background: linear-gradient(135deg, rgba(255, 245, 249, .94), rgba(244, 255, 255, .92));
}

html[data-alice-theme="dream"] .label,
html[data-alice-theme="dream"] .chapterLabel,
html[data-alice-theme="dream"] .eyebrow,
html[data-alice-theme="dream"] .settingsLabel,
html[data-alice-theme="dream"] .settingsPanel h2,
html[data-alice-theme="dream"] .answerPanel h2,
html[data-alice-theme="dream"] #volumeValue {
  color: #a95f45;
}

html[data-alice-theme="dream"] .chapterLabel {
  border-left-color: rgba(169, 95, 69, .28);
}

html[data-alice-theme="dream"] .controls {
  border-color: rgba(210, 112, 154, .20);
  background:
    linear-gradient(90deg, rgba(255, 242, 248, .96), rgba(255, 250, 230, .95) 52%, rgba(236, 255, 255, .96));
  box-shadow: 0 -12px 28px rgba(109, 75, 93, .08);
}

html[data-alice-theme="dream"] #readerSettingsBtn {
  color: #a95f45;
  border-color: rgba(210, 112, 154, .34);
  background: linear-gradient(145deg, #fff, #ffe5ef 48%, #e3ffff);
}

html[data-alice-theme="dream"] .settingsPanel {
  border-color: rgba(210, 112, 154, .28);
  color: #513d49;
  background:
    radial-gradient(circle at top right, rgba(204, 255, 255, .76), transparent 42%),
    radial-gradient(circle at 0 100%, rgba(255, 184, 219, .34), transparent 42%),
    linear-gradient(155deg, rgba(255, 255, 255, .98), rgba(255, 249, 232, .98));
  box-shadow: 0 22px 52px rgba(109, 75, 93, .18);
}

html[data-alice-theme="dream"] .settingsPanel hr {
  border-top-color: rgba(210, 112, 154, .20);
}

html[data-alice-theme="dream"] .volumeControl {
  border-color: rgba(210, 112, 154, .22);
  color: #5c4654;
  background: rgba(255, 255, 255, .66);
}

html[data-alice-theme="dream"] .volumeControl input[type="range"] {
  accent-color: #df8ab2;
}

html[data-alice-theme="dream"] .alice-reader-theme-setting {
  padding-top: 12px;
  border-top: 1px solid rgba(210, 112, 154, .18);
}

html[data-alice-theme="dream"] .guideTop,
html[data-alice-theme="dream"] .questKeySummary {
  color: #513d49;
}

html[data-alice-theme="dream"] .alicePanel,
html[data-alice-theme="dream"] .answerPanel {
  border-color: rgba(210, 112, 154, .24);
  color: #513d49;
  background:
    radial-gradient(circle at 100% 0, rgba(204, 255, 255, .60), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(255, 247, 229, .94));
  box-shadow: 0 14px 34px rgba(109, 75, 93, .10);
}

html[data-alice-theme="dream"] .answerText,
html[data-alice-theme="dream"] .answerText p,
html[data-alice-theme="dream"] .answerText li,
html[data-alice-theme="dream"] .storyEventLine,
html[data-alice-theme="dream"] .storyEventLineFallback,
html[data-alice-theme="dream"] .storyEventHint {
  color: #513d49;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .storyEventSpeaker,
html[data-alice-theme="dream"] #guide.storyEventMode.recapInterludeMode .storyEventSpeaker {
  color: #4eabb7 !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .storyRecapLabel,
html[data-alice-theme="dream"] #guide.storyEventMode.recapInterludeMode .storyRecapLabel {
  color: #a95f45 !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .storyRecapContinue,
html[data-alice-theme="dream"] #guide.storyEventMode.recapInterludeMode .storyRecapContinue {
  border-color: rgba(210, 112, 154, .34) !important;
  color: #513d49 !important;
  background: linear-gradient(135deg, rgba(255, 229, 239, .94), rgba(255, 246, 210, .94)) !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .storyRecapReplay,
html[data-alice-theme="dream"] #guide.storyEventMode.recapInterludeMode .storyRecapReplay {
  border-color: rgba(94, 177, 184, .34) !important;
  color: #45616a !important;
  background: rgba(225, 255, 255, .72) !important;
}

html[data-alice-theme="dream"] .choice {
  color: #513d49;
  border-color: rgba(210, 112, 154, .22);
  background: rgba(255, 255, 255, .72);
}

html[data-alice-theme="dream"] .choice.correct {
  border-color: rgba(68, 164, 118, .34);
  background: rgba(191, 241, 211, .54);
}

html[data-alice-theme="dream"] .choice.wrong {
  border-color: rgba(205, 105, 119, .30);
  background: rgba(255, 210, 219, .58);
}

html[data-alice-theme="dream"] #guide.recapInterludeMode,
html[data-alice-theme="dream"] #guide.recapInterludeMode .guideLayout {
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 184, 219, .42), transparent 34%),
    radial-gradient(circle at 88% 10%, rgba(255, 237, 184, .48), transparent 38%),
    linear-gradient(145deg, #fffafd, #efffff) !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .answerPanel,
html[data-alice-theme="dream"] #guide.recapInterludeMode .storyRecapInterlude {
  border-color: rgba(210, 112, 154, .24) !important;
  color: #513d49 !important;
  background:
    radial-gradient(circle at 100% 0, rgba(204, 255, 255, .68), transparent 40%),
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(255, 247, 229, .96)) !important;
  box-shadow: 0 16px 38px rgba(109, 75, 93, .12) !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .answerPanel::before,
html[data-alice-theme="dream"] #guide.recapInterludeMode .answerPanel::after {
  opacity: .12 !important;
}

html[data-alice-theme="dream"] #guide.recapInterludeMode .storyEventLine,
html[data-alice-theme="dream"] #guide.recapInterludeMode .storyEventLineFallback,
html[data-alice-theme="dream"] #guide.recapInterludeMode .storyEventHint,
html[data-alice-theme="dream"] #guide.recapInterludeMode h1,
html[data-alice-theme="dream"] #guide.recapInterludeMode h2,
html[data-alice-theme="dream"] #guide.recapInterludeMode p {
  color: #513d49 !important;
  text-shadow: none !important;
}

/* Media cards keep their dark stage so images and chapter videos do not flash white. */
html[data-alice-theme="dream"] .readerCard.imageCard,
html[data-alice-theme="dream"] .readerCard.illustrationMode,
html[data-alice-theme="dream"] .imageCardBody,
html[data-alice-theme="dream"] .sceneVideo {
  color-scheme: dark;
}

/* The companion bubble follows the soft app chrome in dream mode. */
html[data-alice-theme="dream"] .alice-auto-coach-avatar {
  border-color: rgba(210, 112, 154, .42);
  background: linear-gradient(145deg, #ffe2ef, #fff3c9 54%, #d9ffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .92),
    0 12px 28px rgba(109, 75, 93, .18);
}

html[data-alice-theme="dream"] .alice-auto-coach-avatar:hover {
  border-color: rgba(210, 112, 154, .68);
}

html[data-alice-theme="dream"] .alice-auto-coach-bubble,
html[data-alice-theme="dream"] .alice-auto-coach.is-visual-card .alice-auto-coach-bubble {
  border-color: rgba(210, 112, 154, .30);
  color: #513d49;
  background:
    radial-gradient(circle at 100% 0, rgba(204, 255, 255, .72), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(255, 244, 224, .97));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .94),
    0 16px 36px rgba(109, 75, 93, .18);
  opacity: 1;
}

html[data-alice-theme="dream"] .alice-auto-coach-bubble::before {
  border-left-color: rgba(210, 112, 154, .30);
  border-bottom-color: rgba(210, 112, 154, .30);
  background: linear-gradient(135deg, #fff7ed, #efffff);
}

html[data-alice-theme="dream"] .alice-auto-coach-name {
  color: #a95f45;
}

html[data-alice-theme="dream"] .alice-auto-coach-message {
  color: #513d49;
}

html[data-alice-theme="dream"] .alice-auto-coach-dot {
  background: #df8ab2;
  box-shadow: 0 0 0 3px rgba(223, 138, 178, .20);
}

html[data-alice-theme="dream"] .alice-auto-coach-setting select {
  border-color: rgba(210, 112, 154, .28);
  color: #513d49;
  background: rgba(255, 255, 255, .88);
}

/* The finish decision stays calm and readable instead of returning to navy. */
html[data-alice-theme="dream"] .today-finish-prompt {
  color-scheme: light;
  background: rgba(98, 73, 88, .22);
  backdrop-filter: blur(10px) saturate(1.06);
}

html[data-alice-theme="dream"] .today-finish-card {
  border-color: rgba(210, 112, 154, .30);
  color: #513d49;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 184, 219, .46), transparent 36%),
    radial-gradient(circle at 94% 12%, rgba(255, 237, 184, .62), transparent 40%),
    radial-gradient(circle at 82% 94%, rgba(204, 255, 255, .76), transparent 44%),
    linear-gradient(145deg, rgba(255, 255, 255, .99), rgba(255, 249, 232, .98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .96),
    0 28px 76px rgba(109, 75, 93, .24);
}

html[data-alice-theme="dream"] .today-finish-card h2 {
  color: #a95f45;
}

html[data-alice-theme="dream"] .today-finish-card p {
  color: #513d49;
}

html[data-alice-theme="dream"] .today-finish-quote {
  color: #9a5a47;
}

html[data-alice-theme="dream"] .today-finish-record-note {
  border-color: rgba(94, 177, 184, .28);
  color: #46616a;
  background: rgba(225, 255, 255, .66);
}

html[data-alice-theme="dream"] .today-finish-recap {
  border-color: rgba(210, 112, 154, .30);
  color: #674354;
  background: linear-gradient(135deg, rgba(255, 229, 239, .94), rgba(255, 246, 210, .94));
}

html[data-alice-theme="dream"] .today-finish-secondary {
  border-color: rgba(94, 177, 184, .38);
  color: #35535c;
  background: linear-gradient(135deg, #d9ffff, #e6efff 54%, #ffe2ef);
}

html[data-alice-theme="dream"] .today-finish-menu {
  border-color: rgba(202, 123, 156, .24);
  color: #5c4654;
  background: rgba(255, 255, 255, .72);
}

html[data-alice-theme="dream"] .today-finish-guide-link {
  color: #6b5562;
}

html[data-alice-theme="dream"] .today-finish-guide-link:hover,
html[data-alice-theme="dream"] .today-finish-guide-link:focus-visible {
  color: #a95f45;
}

/* Keep the two-question story chat inside the same soft dream palette. */
html[data-alice-theme="dream"] .story-recap-talk {
  color-scheme: light;
  background: rgba(98, 73, 88, .24);
  backdrop-filter: blur(10px) saturate(1.06);
}

html[data-alice-theme="dream"] .story-recap-card {
  border-color: rgba(210, 112, 154, .30);
  color: #513d49;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 184, 219, .48), transparent 36%),
    radial-gradient(circle at 94% 10%, rgba(255, 237, 184, .64), transparent 41%),
    radial-gradient(circle at 84% 96%, rgba(204, 255, 255, .78), transparent 46%),
    linear-gradient(145deg, rgba(255, 255, 255, .99), rgba(255, 249, 232, .98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .96),
    0 28px 76px rgba(109, 75, 93, .24);
}

html[data-alice-theme="dream"] .story-recap-kicker {
  color: #4f8f98;
}

html[data-alice-theme="dream"] .story-recap-head h2 {
  color: #a95f45;
}

html[data-alice-theme="dream"] .story-recap-meta {
  color: #6b5562;
}

html[data-alice-theme="dream"] .story-recap-close {
  border-color: rgba(210, 112, 154, .30);
  color: #8c536a;
  background: rgba(255, 255, 255, .76);
}

html[data-alice-theme="dream"] .story-recap-excerpt {
  border-color: rgba(94, 177, 184, .26);
  background: rgba(225, 255, 255, .62);
}

html[data-alice-theme="dream"] .story-recap-excerpt strong {
  color: #4f8f98;
}

html[data-alice-theme="dream"] .story-recap-excerpt p {
  color: #513d49;
}

html[data-alice-theme="dream"] .story-recap-excerpt small,
html[data-alice-theme="dream"] .story-recap-bubble small {
  color: #6b5562;
}

html[data-alice-theme="dream"] .story-recap-alice {
  border-color: rgba(94, 177, 184, .28);
  color: #3e5962;
  background: linear-gradient(135deg, rgba(220, 255, 255, .86), rgba(236, 248, 255, .88));
}

html[data-alice-theme="dream"] .story-recap-user {
  border-color: rgba(210, 112, 154, .27);
  color: #674354;
  background: linear-gradient(135deg, rgba(255, 226, 239, .90), rgba(255, 240, 222, .88));
}

html[data-alice-theme="dream"] .story-recap-progress {
  color: #a95f45;
}

html[data-alice-theme="dream"] .story-recap-choice {
  border-color: rgba(202, 123, 156, .25);
  color: #513d49;
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 8px 20px rgba(109, 75, 93, .08);
}

html[data-alice-theme="dream"] .story-recap-choice strong {
  color: #513d49;
}

html[data-alice-theme="dream"] .story-recap-choice small {
  color: #6b5562;
}

html[data-alice-theme="dream"] .story-recap-choice:hover,
html[data-alice-theme="dream"] .story-recap-choice:focus-visible {
  border-color: rgba(210, 112, 154, .50);
  color: #513d49;
  background: linear-gradient(135deg, rgba(255, 226, 239, .94), rgba(255, 246, 210, .94));
}

html[data-alice-theme="dream"] .story-recap-actions button {
  border-color: rgba(202, 123, 156, .25);
  color: #5c4654;
  background: rgba(255, 255, 255, .78);
}

html[data-alice-theme="dream"] .story-recap-actions .story-recap-finish {
  border-color: rgba(94, 177, 184, .38);
  color: #35535c;
  background: linear-gradient(135deg, #d9ffff, #e6efff 54%, #ffe2ef);
}

/* Encouragement videos are a cinematic pause, so both themes use the dark stage. */
html[data-alice-theme="dream"] .alice-encouragement-overlay {
  color-scheme: dark;
  color: #fff;
  background: rgba(1, 3, 10, .94);
}

html[data-alice-theme="dream"] .alice-encouragement-video {
  background: #000;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .62);
}

html[data-alice-theme="dream"] .alice-encouragement-skip {
  border-color: rgba(255, 255, 255, .42);
  color: #fff;
  background: rgba(3, 5, 14, .72);
  box-shadow: none;
}

html[data-alice-theme="dream"] .alice-encouragement-label {
  color: #f7e9b8;
  background: rgba(3, 5, 14, .66);
}

html[data-alice-theme="dream"] .alice-encouragement-loading {
  color: #eef6ff;
}

/* Orientation guidance is still prominent, but no longer breaks dream mode. */
html[data-alice-theme="dream"] .alice-landscape-warning {
  color-scheme: light;
  color: #513d49;
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 184, 219, .78), transparent 38%),
    radial-gradient(circle at 88% 14%, rgba(255, 237, 184, .82), transparent 40%),
    radial-gradient(circle at 76% 90%, rgba(204, 255, 255, .88), transparent 42%),
    linear-gradient(145deg, #fffafd, #fff9e9 54%, #edffff);
}

html[data-alice-theme="dream"] .alice-landscape-warning-card {
  border: 1px solid rgba(210, 112, 154, .26);
  background: rgba(255, 255, 255, .82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .94),
    0 22px 54px rgba(109, 75, 93, .18);
}

html[data-alice-theme="dream"] .alice-landscape-warning-card h2 {
  color: #a95f45;
}

html[data-alice-theme="dream"] .alice-landscape-warning-card p {
  color: #5c4654;
}

@media (max-width: 700px) {
  html[data-alice-theme="dream"] .app,
  html[data-alice-theme="dream"] body .app {
    border-color: transparent;
    background: rgba(255, 252, 247, .98);
  }

  html[data-alice-theme="dream"] .settingsPanel.mobileBottomSheet {
    border-color: rgba(210, 112, 154, .24);
    background:
      radial-gradient(circle at 100% 0, rgba(204, 255, 255, .72), transparent 38%),
      linear-gradient(155deg, #fff, #fff7e7);
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-alice-theme="dream"] .bar {
    transition: none;
  }
}
