/* A quiet sky behind the existing Dreamy V5 world. */
.celestial {position:absolute;z-index:0;pointer-events:none;width:clamp(84px,10vw,140px);aspect-ratio:1;top:13vh;animation:celestialRise 5.5s cubic-bezier(.17,.76,.22,1) both;}
.celestial span {position:absolute;inset:0;border-radius:50%;animation:celestialBreathe 12s ease-in-out infinite alternate;}
.celestial-sun {right:9vw;top:14vh;}
.celestial-sun span {background:radial-gradient(circle at 44% 42%,#fff8d7 0 23%,#f7d98f 54%,rgba(247,217,143,.15) 68%,transparent 72%);box-shadow:0 0 36px 12px rgba(252,217,138,.24),0 0 100px 36px rgba(250,225,166,.13);}
.celestial-moon {display:none;right:9vw;top:14vh;width:clamp(70px,8vw,108px);}
.celestial-moon span {display:grid;place-items:center;background:none;}
.celestial-moon span::after {content:'☾';font:clamp(98px,11vw,146px)/1 Georgia,serif;color:#f8e9bd;text-shadow:0 0 20px rgba(255,242,201,.66),0 0 62px rgba(210,228,215,.36);transform:translateY(-5%);}
@keyframes celestialRise {from {transform:translateY(62vh) scale(.86);opacity:0;} to {transform:translateY(0) scale(1);opacity:1;}}
@keyframes celestialBreathe {from {filter:brightness(.95);} to {filter:brightness(1.08);}}

/* Two symbols share one compact, keyboard accessible control. */
.theme-toggle {display:grid;place-items:center;position:relative;overflow:hidden;background:linear-gradient(145deg,#dcae69,#eecb87);color:#3d5359;font-size:23px;}
.theme-toggle span {grid-area:1/1;line-height:1;transition:opacity .3s ease,transform .4s ease;}
.theme-toggle .theme-moon {opacity:0;transform:rotate(-70deg) scale(.55);}
html[data-theme="night"] .theme-toggle {background:linear-gradient(145deg,#365572,#243b56);color:#f9e6bc;box-shadow:0 7px 21px rgba(2,12,28,.28),inset 0 1px 0 rgba(255,255,255,.17);}
html[data-theme="night"] .theme-toggle .theme-sun {opacity:0;transform:rotate(70deg) scale(.55);}
html[data-theme="night"] .theme-toggle .theme-moon {opacity:1;transform:rotate(0) scale(1);}
@media(max-width:620px) {.topbar-actions {gap:5px;}.topbar-actions .icon-btn {width:38px;height:38px;border-radius:13px;}.topbar-actions .reader-pill {min-height:38px;padding:0 8px;}.theme-toggle {font-size:21px;}}
@media(max-width:390px) {.brand-copy strong {font-size:13px;}.topbar {padding-left:8px;padding-right:8px;}.topbar-actions {gap:4px;}.topbar-actions .icon-btn {width:36px;height:36px;}}

html[data-theme="night"] body {
  --ink:#e7f1ee;--muted:#bbcdc9;--paper:#142934;--paper-2:#213a43;--cream:#243d43;
  --plum:#a9d1c2;--plum-deep:#446b73;--rose:#e0b798;--sage:#709b88;--gold:#efd48f;
  --shadow:0 24px 65px rgba(2,10,23,.36);--soft-shadow:0 12px 34px rgba(1,11,22,.24);
  color:var(--ink);color-scheme:dark;
  background:radial-gradient(circle at 79% 12%,rgba(86,131,153,.32),transparent 30%),radial-gradient(circle at 16% 15%,rgba(57,103,95,.24),transparent 34%),linear-gradient(180deg,#152838 0%,#1c3441 53%,#14282e 100%);
}
html[data-theme="night"] body::before {opacity:.36;background-image:radial-gradient(circle at 20% 35%,rgba(243,237,203,.55) 0 1px,transparent 1.5px),radial-gradient(circle at 78% 28%,rgba(237,246,239,.5) 0 1px,transparent 1.6px),radial-gradient(circle at 62% 70%,rgba(255,238,180,.42) 0 1px,transparent 1.5px);}
html[data-theme="night"] body::after {opacity:.1;}
html[data-theme="night"] .celestial-sun {display:none;}
html[data-theme="night"] .celestial-moon {display:block;}
html[data-theme="night"] .dream-cloud {background:rgba(181,208,211,.09);opacity:.6;}
html[data-theme="night"] .dream-hill-back {background:linear-gradient(180deg,rgba(68,108,103,.58),rgba(42,81,80,.88));opacity:.73;}
html[data-theme="night"] .dream-hill-front {background:linear-gradient(180deg,#315750,#1c403e);}
html[data-theme="night"] .dreamscape::after {background:linear-gradient(180deg,transparent 57%,rgba(3,21,31,.25));}
html[data-theme="night"] .ambient-one {background:#527d8c;opacity:.22;}
html[data-theme="night"] .ambient-two {background:#89a680;opacity:.17;}
html[data-theme="night"] .world-layer {filter:brightness(.78) saturate(.82);}
html[data-theme="night"] .floating-charm {color:rgba(226,231,207,.62);background:rgba(194,220,211,.08);}

html[data-theme="night"] .glass,html[data-theme="night"] .glass-soft,html[data-theme="night"] .topbar,html[data-theme="night"] .bottom-nav,html[data-theme="night"] .toolbar,html[data-theme="night"] .book-card,html[data-theme="night"] .memory-card,html[data-theme="night"] .stat-card,html[data-theme="night"] .reader-reading-panel,html[data-theme="night"] .memory-banner {
  background:rgba(32,58,67,.78);border-color:rgba(183,218,207,.18)!important;box-shadow:0 16px 42px rgba(3,15,27,.22);
}
html[data-theme="night"] .hero {background:linear-gradient(135deg,rgba(28,54,64,.87),rgba(38,69,73,.82));border-color:rgba(191,224,207,.2);box-shadow:var(--shadow);}
html[data-theme="night"] .hero::after,html[data-theme="night"] .reader-reading-panel::after {opacity:.35;}
html[data-theme="night"] .hero-copy h2 span,html[data-theme="night"] .eyebrow,html[data-theme="night"] .text-link {color:#c1dfc9;}
html[data-theme="night"] .hero-copy>p:not(.eyebrow),html[data-theme="night"] .memory-banner p:not(.eyebrow),html[data-theme="night"] .reader-panel-head small {color:var(--muted);}
html[data-theme="night"] .reader-pill,html[data-theme="night"] .search-wrap,html[data-theme="night"] .chip,html[data-theme="night"] .btn-secondary,html[data-theme="night"] .btn-light,html[data-theme="night"] .back-button {background:#294550;color:#e9f3ef;border-color:rgba(200,227,213,.18);}
html[data-theme="night"] .btn-primary,html[data-theme="night"] .nav-add,html[data-theme="night"] .music-settings-actions button:first-child {background:linear-gradient(135deg,#5d978d,#406d77);color:#fff;}
html[data-theme="night"] .settings-top-btn {background:linear-gradient(135deg,#496e72,#34525f);}
html[data-theme="night"] .nav-item {color:#c4d5d0;}
html[data-theme="night"] .nav-item.active,html[data-theme="night"] .chip.active,html[data-theme="night"] .reader-tab.active {background:rgba(141,197,177,.2);color:#f2f6e8;}
html[data-theme="night"] .stat-icon,html[data-theme="night"] .option-icon {background:#314d50;}
html[data-theme="night"] .empty-state,html[data-theme="night"] .status-badge,html[data-theme="night"] .meta-pill {background:rgba(78,119,116,.22);border-color:rgba(179,217,201,.25);color:#d8e9df;}
html[data-theme="night"] .empty-state h4,html[data-theme="night"] .reader-empty strong {color:var(--ink);}
html[data-theme="night"] .floating-note {background:#304d53;color:#e0ece3;border-color:rgba(208,231,213,.2);}
html[data-theme="night"] .book-cover,html[data-theme="night"] .memory-thumb,html[data-theme="night"] .detail-cover,html[data-theme="night"] .cover-preview {background:linear-gradient(160deg,#385957,#263f49);color:#e6e9d9;}
html[data-theme="night"] .book-a {background:linear-gradient(180deg,#557b73,#315a60)!important;}
html[data-theme="night"] .book-b {background:linear-gradient(180deg,#ae8e6d,#79624e)!important;}
html[data-theme="night"] .book-c {background:linear-gradient(180deg,#729889,#416f6e)!important;}

html[data-theme="night"] .sheet,html[data-theme="night"] .popover,html[data-theme="night"] .flow-card {background:linear-gradient(170deg,#243d47,#1a303c);color:var(--ink);border-color:rgba(193,222,208,.16);}
html[data-theme="night"] .option-card,html[data-theme="night"] .flow-card .option-card,html[data-theme="night"] .record-card,html[data-theme="night"] .detail-hero,html[data-theme="night"] .form-page-card .cover-editor,html[data-theme="night"] .music-settings-card {background:rgba(51,78,83,.62);border-color:rgba(193,222,208,.17)!important;color:var(--ink);}
html[data-theme="night"] .flow-top h2,html[data-theme="night"] .flow-card .option-card strong,html[data-theme="night"] .music-url-label {color:#e6f1e9;}
html[data-theme="night"] .settings-list button,html[data-theme="night"] .import-label,html[data-theme="night"] .reader-tab,html[data-theme="night"] .music-settings-actions button,html[data-theme="night"] .sheet-close,html[data-theme="night"] .mini-btn {background:#304d55;border-color:rgba(201,227,214,.17);color:#e7f1ed;}
html[data-theme="night"] .music-url-label input,html[data-theme="night"] input,html[data-theme="night"] textarea,html[data-theme="night"] select {background:#19333f;color:#eaf3ee;border-color:rgba(201,227,214,.25);}
html[data-theme="night"] input::placeholder,html[data-theme="night"] textarea::placeholder {color:#a7bbb8;}
html[data-theme="night"] .memory-card blockquote,html[data-theme="night"] .detail-meta {color:#ceded5;}
html[data-theme="night"] .toast {background:#29464f;color:#fff;}
html[data-theme="night"] .cursor-glow {background:radial-gradient(circle,rgba(255,240,192,.46),rgba(156,216,213,.17) 42%,transparent 70%);}

@media(prefers-reduced-motion:reduce) {.celestial,.celestial span {animation:none;}.celestial {opacity:1;transform:none;}.theme-toggle span {transition:none;}}

/* Small lights hovering just above the hill in night mode. */
.night-fireflies {display:none;position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden;}
html[data-theme="night"] .night-fireflies {display:block;}
.night-fireflies span {position:absolute;left:var(--x);bottom:var(--y);width:4px;height:4px;border-radius:50%;background:#fff0af;box-shadow:0 0 5px 2px rgba(255,233,148,.7),0 0 17px 5px rgba(255,214,116,.26);opacity:0;animation:fireflyDrift var(--time) ease-in-out var(--delay) infinite alternate;}
.night-fireflies span:nth-child(1) {--x:8%;--y:19vh;--time:5.6s;--delay:-1s;}
.night-fireflies span:nth-child(2) {--x:17%;--y:25vh;--time:6.3s;--delay:-3s;}
.night-fireflies span:nth-child(3) {--x:28%;--y:14vh;--time:5.1s;--delay:-2s;}
.night-fireflies span:nth-child(4) {--x:37%;--y:29vh;--time:6.8s;--delay:-5s;}
.night-fireflies span:nth-child(5) {--x:46%;--y:19vh;--time:5.7s;--delay:-4s;}
.night-fireflies span:nth-child(6) {--x:57%;--y:27vh;--time:7s;--delay:-1.8s;}
.night-fireflies span:nth-child(7) {--x:67%;--y:16vh;--time:5.4s;--delay:-3.4s;}
.night-fireflies span:nth-child(8) {--x:76%;--y:24vh;--time:6.5s;--delay:-.6s;}
.night-fireflies span:nth-child(9) {--x:86%;--y:13vh;--time:5.9s;--delay:-4.7s;}
.night-fireflies span:nth-child(10) {--x:94%;--y:21vh;--time:6.1s;--delay:-2.7s;}
@keyframes fireflyDrift {0%{opacity:.1;transform:translate3d(-7px,4px,0) scale(.7);}45%{opacity:.84;}100%{opacity:.18;transform:translate3d(10px,-13px,0) scale(1.1);}}
@media(prefers-reduced-motion:reduce) {.night-fireflies span {animation:none;opacity:.45;}}

/* A handful of little butterflies flutter over the daytime hills. */
.day-butterflies {position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden;}
html[data-theme="night"] .day-butterflies {display:none;}
.day-butterfly {position:absolute;left:var(--x);bottom:var(--y);width:var(--size);height:auto;opacity:.9;--wing:#d7a882;--wing-soft:#ebc99f;filter:drop-shadow(0 2px 3px rgba(88,111,93,.2));animation:butterflyDrift var(--time) ease-in-out var(--delay) infinite alternate;}
.day-butterfly svg {display:block;width:100%;height:auto;overflow:visible;}
.day-butterfly .wing {transform-box:fill-box;transform-origin:center center;animation:butterflyWings .7s ease-in-out infinite alternate;}
.day-butterfly .wing-right {animation-delay:-.35s;}
.day-butterfly:nth-child(1) {--x:10%;--y:24vh;--size:30px;--time:12s;--delay:-3s;--wing:#d5a787;--wing-soft:#f0c6a2;}
.day-butterfly:nth-child(2) {--x:27%;--y:17vh;--size:25px;--time:10s;--delay:-7s;--wing:#adadb8;--wing-soft:#d7cbd1;}
.day-butterfly:nth-child(3) {--x:49%;--y:29vh;--size:29px;--time:13s;--delay:-9s;--wing:#e3c381;--wing-soft:#f2dcaa;}
.day-butterfly:nth-child(4) {--x:72%;--y:21vh;--size:24px;--time:11s;--delay:-2s;--wing:#9bb9af;--wing-soft:#c6d9c7;}
.day-butterfly:nth-child(5) {--x:88%;--y:27vh;--size:27px;--time:14s;--delay:-6s;--wing:#cda1aa;--wing-soft:#eac4bd;}
@keyframes butterflyDrift {0%{transform:translate3d(-12px,6px,0) rotate(-8deg);}50%{transform:translate3d(12px,-14px,0) rotate(8deg);}100%{transform:translate3d(32px,-4px,0) rotate(-4deg);}}
@keyframes butterflyWings {from{transform:scaleX(.45);}to{transform:scaleX(1);}}
@media(prefers-reduced-motion:reduce) {.day-butterfly,.day-butterfly .wing {animation:none;}}
