/* v24: navigation stays crisp; all top-of-screen veils are removed. */
body .topbar,body .thread-toolbar{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background:transparent!important;box-shadow:none!important}
body .topbar::before,body .topbar::after,body .thread-toolbar::before,body .thread-toolbar::after{display:none!important}
body :is(.topbar .icon-btn,.thread-toolbar .icon-btn){background:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:none!important}
body.thread-active .thread-toolbar{position:relative;z-index:9;transform:translate3d(0,var(--conversation-pan,0px),0);will-change:transform}
body .bottom-nav .tab{position:relative;z-index:3;filter:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
body .liquid-indicator[data-glass-surface]{z-index:1;overflow:hidden}
body .bottom-nav{isolation:isolate}
body #modal.settings-page-dialog{position:fixed;inset:0;width:100%;height:100dvh;max-width:none;max-height:none;margin:0;border:0!important;border-radius:0;padding:calc(env(safe-area-inset-top,0px) + 18px) max(20px,calc((100vw - 650px)/2)) calc(env(safe-area-inset-bottom,0px) + 24px);background:linear-gradient(#ffffffdc,#ffffffdc),var(--theme-background,none),#fff!important;background-size:cover!important;background-position:var(--theme-position,center)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:none!important;overflow-y:auto;overscroll-behavior:contain}
#modal.settings-page-dialog::backdrop{background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}
.settings-page-dialog .modal-head{margin:0 0 24px;align-items:center;position:relative}
.settings-page-dialog .modal-head .eyebrow{display:none}
.settings-page-dialog .modal-head h2{font-size:24px}
.settings-page-dialog .settings-section{background:#ffffffc7;border-radius:18px;padding:12px;margin:16px 0}
.settings-page-dialog .list-row{min-height:48px;padding:12px;background:#ffffff80}
.settings-page-dialog .field input,.settings-page-dialog .field textarea,.settings-page-dialog .field select{background:#ffffffd9}
.reply-mode{border:0;padding:0;margin:18px 0}.reply-mode legend{font-size:14px;font-weight:600}.reply-mode input[type=radio]{accent-color:var(--accent);width:19px;height:19px}
.collection-modes{display:flex;gap:8px;margin-bottom:18px}.collection-modes button{padding:10px 16px;border-radius:20px;background:#ffffff40;font-size:14px}.collection-modes [aria-pressed=true]{background:#ffffffd0;box-shadow:0 2px 9px #10151e09}
.favorite-card{border-radius:20px;padding:15px;margin:12px 0;background:#ffffffba;box-shadow:0 4px 18px #20253008;overflow:hidden}.favorite-card p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;font-size:15px}.favorite-meta{display:flex;align-items:center;justify-content:space-between}.favorite-meta button{width:44px;height:36px;color:var(--accent)}.favorite-meta svg{width:20px;height:20px}.favorite-meta small{font-size:11px;color:var(--muted)}.favorite-images{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.favorite-images button{border-radius:15px;overflow:hidden;padding:0;aspect-ratio:1}.favorite-images img{width:100%;height:100%;object-fit:cover;display:block}
.workstation-entry{display:flex;align-items:center;gap:14px;padding:14px 0;color:var(--text);text-decoration:none}.workstation-entry strong{font-size:16px;font-weight:550}.workstation-entry small{display:block;font-size:12px;margin-top:7px;color:var(--muted)}.workstation-icon{width:62px;height:62px;display:grid;place-items:center;border-radius:18px;background:linear-gradient(135deg,var(--accent-soft),#ffffffc0);flex:none}.workstation-icon svg{width:27px;height:27px}.quota-card{padding:16px;margin:14px 0;border-radius:18px;background:#ffffffc7}.quota-card h3{margin:0 0 12px;font-size:16px}.quota-card p{font-size:13px}.quota-card .button-row{margin-top:12px}
#sidebar-grip{position:absolute;right:0;top:0;bottom:0;width:20px;border:0;padding:0;background:transparent;cursor:ew-resize;touch-action:none}
@media(max-width:800px){body .sidebar{transform:translateX(var(--drawer-offset,-100%));touch-action:pan-y}body.sidebar-open .sidebar{transform:translateX(var(--drawer-offset,0px))}body.sidebar-dragging .sidebar{transition:none!important}body.sidebar-dragging .scrim{transition:none!important;pointer-events:auto}body:not(.thread-active) #app{touch-action:pan-y}}
@media(min-width:801px){#sidebar-grip{display:none}}
@media(max-width:800px){
 body .sidebar{position:fixed;contain:layout paint;transform:translate3d(-100%,0,0);transition:transform 300ms cubic-bezier(0.32,.72,0,1);backdrop-filter:blur(16px)!important;-webkit-backdrop-filter:blur(16px)!important}
 body.sidebar-open .sidebar{transform:translate3d(0,0,0)}
 body .sidebar *,body .sidebar *::before,body .sidebar *::after{animation:none!important;transition:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
 body .scrim{transition:opacity 300ms cubic-bezier(0.32,.72,0,1);backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
}
@media(max-width:800px) and (prefers-reduced-motion:reduce){body .sidebar{transform:none!important;opacity:0;transition:opacity 300ms cubic-bezier(0.32,.72,0,1)}body.sidebar-open .sidebar{opacity:1}}
body .message-tools{flex-wrap:wrap}body .message-tools button{flex:none;min-width:34px;min-height:36px}
.sender-avatar{display:grid;place-items:center;width:30px;height:30px;min-height:30px;border-radius:50%;overflow:hidden;background:#ffffffaa;margin:0 0 5px;font-size:13px;flex:none}.sender-avatar img{width:100%;height:100%;object-fit:cover}.message.user .sender-avatar{align-self:flex-end}.message.assistant .sender-avatar{align-self:flex-start}
body .message:has(.photos-expanded){max-width:100%;width:100%}body .message .photos-expanded{width:100%;max-width:100%}.inline-photo-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:100%;margin-bottom:4px}.inline-photo-grid button{aspect-ratio:1;padding:0;border-radius:22px;overflow:hidden;background:transparent}.inline-photo-grid img{display:block;width:100%;height:100%;object-fit:cover;margin:0!important;border-radius:22px!important}.inline-photo-grid button:last-child:nth-child(3n + 1){grid-column:3}
body dialog.photo-viewer{background:#f6f6f480;color:#25252b;isolation:isolate}
.photo-viewer::backdrop{background:#ffffff18;backdrop-filter:blur(28px);-webkit-backdrop-filter:blur(28px)}
.photo-blurred-backdrop{position:absolute;inset:-35px;background-size:cover;background-position:center;filter:blur(32px);opacity:.24;z-index:-1;pointer-events:none}
body .photo-viewer-tools{padding:calc(env(safe-area-inset-top,0px) + 10px) 16px 12px;background:transparent;color:var(--text);z-index:3}
body .photo-viewer-tools button,body .photo-viewer-tools a{color:var(--text);background:#ffffff50;box-shadow:none;width:44px;height:44px}
body .photo-viewer-tools>span{color:var(--text);font-size:14px;flex:1}.photo-viewer-tools strong{font-size:15px;font-weight:600;display:block}.photo-viewer-tools small{font-size:11px;color:var(--muted);display:block;margin-top:4px}
body .photo-stage{inset:calc(env(safe-area-inset-top,0px) + 78px) 14px calc(env(safe-area-inset-bottom,0px) + 76px);overflow:hidden}
#photo-open-fullscreen{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:0;overflow:hidden;background:transparent}
body .photo-stage img{width:auto;height:auto;max-width:100%;max-height:100%;border-radius:22px;object-fit:contain;}
body .photo-viewer-footer{background:transparent;padding:12px 16px calc(env(safe-area-inset-bottom,0px) + 12px);color:var(--text)}
body .photo-viewer-footer button{color:var(--text);background:#ffffff80;box-shadow:none}body .photo-viewer-footer svg{width:20px;height:20px}
body .photo-viewer.is-fullscreen .photo-stage{inset:0}.is-fullscreen #photo-open-fullscreen{touch-action:pan-x pan-y pinch-zoom}body .photo-viewer.is-fullscreen .photo-stage img{border-radius:0}body .photo-viewer.is-zoomed .photo-stage{overflow:auto}body .photo-viewer.is-zoomed #photo-open-fullscreen{width:200%;height:auto;min-height:100%}body .photo-viewer.is-zoomed .photo-stage img{width:100%;max-width:none;height:auto}
body.thread-active .composer-wrap{padding:3px 12px max(2px,env(safe-area-inset-bottom,0px));display:flex;flex-direction:column}
body.thread-active.keyboard-open .composer-wrap{padding-bottom:0!important;bottom:calc(var(--keyboard-inset,0px) + 6px)}
body.thread-active .chat-connection{order:-1;min-height:18px;padding:0 8px 2px 48px;line-height:16px}
body.thread-active .chat-connection button{margin:0!important;line-height:16px;min-height:16px}
body.thread-active .composer-blur{display:none}
body.thread-active #app,body.thread-active .chat-conversation-page,body.thread-active #app>.main,body.thread-active #page{height:var(--conversation-layout-height,100vh);min-height:0}

/* Fix: splash GPU compositing — isolate from page layout to prevent stutter */
body>.splash{will-change:opacity;contain:layout style;transform:translateZ(0);-webkit-transform:translateZ(0)}
/* Fix: prevent white flash between splash fade-out and app render */
body>.app{background:var(--page-bg,#f5f4f1)}

/* Fix: timestamp floats right — short bubbles stay compact, long bubbles show time at bottom-right */
body .message .bubble-content{padding:var(--chat-padding-y,10px) 12px;line-height:1.35}
body .message .bubble-content>.message-text{display:inline;line-height:inherit}
body .message .bubble-content>.message-text::after{content:'';display:inline-block;width:48px;height:0;vertical-align:baseline}
body .message .bubble-content>.message-meta{float:right;position:static;display:inline-flex;width:auto;height:auto;min-height:0;margin:4px 0 -2px 8px;line-height:12px;white-space:nowrap;font-size:10px;font-weight:400;letter-spacing:0;font-variant-numeric:tabular-nums}
body .topbar,body.has-theme-background .topbar,body.home-active .topbar,body.chat-active .topbar,body .thread-toolbar{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background:transparent!important}
body #modal.settings-page-dialog.appearance-dialog{max-width:none;max-height:none;width:100%;height:100dvh;border-radius:0!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}

/* Every primary page owns one vertical scroller, including empty lists. */
body:not(.thread-active) #page>.scroll-page{position:relative;overflow-y:scroll;touch-action:pan-y}
body:not(.thread-active) #page>.scroll-page::after{content:'';position:absolute;top:calc(100vh + 47px);left:0;width:1px;height:1px;pointer-events:none}
body .sender-avatar{width:36px;height:36px;min-height:36px}
body .sender-avatar img{max-width:none;max-height:none;margin:0;border-radius:inherit}

/* ── Bottom sheet: super-blurred near-opaque backdrop, elevated card ── */
body #modal.bottom-sheet{position:fixed;top:auto;bottom:max(10px,env(safe-area-inset-bottom,0px));margin:0 auto;padding:22px 20px 20px;border-radius:34px;max-height:calc(100dvh - env(safe-area-inset-top,0px) - 28px);width:min(480px,calc(100% - 20px));background:color-mix(in srgb,var(--page-bg) 45%,transparent);backdrop-filter:blur(60px) saturate(1.2);-webkit-backdrop-filter:blur(60px) saturate(1.2);border:1px solid rgb(var(--glass-rgb) / .18);box-shadow:inset 0 1px 0 rgb(255 255 255 / .35),inset 1px 0 1px rgb(20 24 32 / .08),inset -1px 0 1px rgb(20 24 32 / .08),0 -2px 12px rgb(20 24 32 / .04),0 16px 60px rgb(16 18 24 / .18);animation:sheet-up .28s cubic-bezier(.2,.78,.25,1)}
body #modal.bottom-sheet::backdrop{background:transparent;backdrop-filter:blur(50px);-webkit-backdrop-filter:blur(50px)}
.bottom-sheet:before{content:'';display:block;margin:-14px auto 17px;width:42px;height:4px;border-radius:8px;background:#92929b70}
#modal.bottom-sheet .modal-head{margin-bottom:18px;justify-content:center;position:relative}
#modal.bottom-sheet .modal-head .eyebrow{display:none}
#modal.bottom-sheet .modal-head h2{font-size:20px}
#modal.bottom-sheet .modal-head>.icon-btn{position:absolute;right:0;width:30px;height:30px}
#modal.bottom-sheet.closing{animation:sheet-down .2s ease-in forwards}
@keyframes sheet-up{from{opacity:0;transform:translateY(40px) scale(.97)}to{opacity:1;transform:none}}
@keyframes sheet-down{to{opacity:0;transform:translateY(40px) scale(.97)}}
@media(prefers-reduced-motion:reduce){body #modal.bottom-sheet,#modal.bottom-sheet.closing{animation:none}}

/* Page-owned controls move with their page and never cover Chat's add button. */
.page-menu{position:absolute;top:12px;right:14px;z-index:5;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;border:0;padding:0;cursor:pointer;color:var(--text)}
.page-menu svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
body #menu-btn{display:none}
.me-summary{padding-right:28px}
body .bottom-nav .me-avatar{width:26px;height:26px;min-width:26px;font-size:20px;border-radius:50%;box-shadow:none;background:transparent;color:inherit;border:0}

/* ── Sidebar day/night toggle row ── */
.theme-toggle-row{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:14px;cursor:pointer;font-size:14px;color:var(--text);background:rgb(var(--glass-rgb) / .08)}
.theme-toggle-row svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle-row span{flex:1}

/* ── Chat page slide-in transition ── */
@keyframes slide-in-right{from{transform:translateX(35%);opacity:0}to{transform:none;opacity:1}}
body.thread-entering #page{animation:slide-in-right .32s cubic-bezier(.22,.68,0,1)}
@media(prefers-reduced-motion:reduce){body.thread-entering #page{animation:none}}

/* Neutral night surfaces: keep the material opacity, change its base to black. */
body[data-theme=dark]{--material-base:0 0 0;--page-bg:#191919;--surface:#242424;--panel:#2b2b2b;--text:#eaeaea;--muted:#b8b8b8;--line:#ffffff24;--ink:#eaeaea;--inverse:#191919;--home-ink:#eaeaea;--glass-ink:#eaeaea;--glass-rgb:24 24 24;--glass:#00000066;--glass-fill:#00000066;--glass-saturation:1;--accent-soft:#333;--opt-fill:#00000040;--opt-edge:#ffffff40;color-scheme:dark}
body[data-theme=dark] #app:not(.unused){background-image:none!important}
body[data-theme=dark] #app:before{background-image:var(--bg,var(--theme-background,none));filter:blur(var(--theme-blur,0px)) brightness(.55)}
body[data-theme=dark] .chat-conversation-page:before{filter:blur(var(--chat-blur,0px)) brightness(.55)}
body[data-theme=dark] .home-page{background:transparent!important}
body[data-theme=dark] .home-page:before{background:none!important}
body[data-theme=dark] [data-glass-surface]{box-shadow:0 7px 24px #0002,inset 0 1px 0 rgb(255 255 255 / var(--glass-top-light,0)),inset 0 -1px 0 rgb(0 0 0 / var(--glass-bottom-shade,0))!important}
body[data-theme=dark] .learning-liquid{box-shadow:0 7px 24px #0002,inset 0 1px 0 rgb(255 255 255 / var(--rim-highlight,.2)),inset 1px 0 0 #ffffff0e,inset -1px 0 0 #ffffff0e!important;backdrop-filter:blur(var(--optics-backdrop-blur,0px)) saturate(1)!important;-webkit-backdrop-filter:blur(var(--optics-backdrop-blur,0px)) saturate(1)!important}
body[data-theme=dark] .edge-lens{filter:brightness(.55)}
body[data-theme=dark] #modal.settings-page-dialog{background:linear-gradient(#000000dc,#000000dc),var(--theme-background,none),#191919!important;background-size:cover!important;background-position:var(--theme-position,center)!important;color:var(--text)}
body[data-theme=dark] :is(.settings-page-dialog .settings-section,.settings-page-dialog .list-row,.appearance-dialog .list-row,.favorite-card,.quota-card){background:#00000080;color:var(--text)}
body[data-theme=dark] :is(.settings-page-dialog .field input,.settings-page-dialog .field textarea,.settings-page-dialog .field select){background:#000000b0;color:var(--text)}
body[data-theme=dark] :is(.segmented,.ritual-tabs,.steps-period,.collection-modes button){background:#00000040;color:var(--text)}
body[data-theme=dark] :is(.segmented .active,.ritual-tabs button.selected,.steps-period [aria-selected=true],.collection-modes [aria-pressed=true]){background:#00000099!important;color:var(--text);border-color:#ffffff38;box-shadow:inset 0 1px 0 #ffffff40,0 2px 9px #0002}
body[data-theme=dark] :is(.material-choices button,.sender-avatar,.pair-avatar,.me-avatar){background:#242424;color:var(--text)}
body[data-theme=dark] .material-choices button[aria-pressed=true]{background:#0008;border-color:#ffffff50}
body[data-theme=dark] :is(.photo-viewer-tools button,.photo-viewer-tools a,.photo-viewer-footer button){background:#0008;color:var(--text)}
body[data-theme=dark] dialog.photo-viewer{background:#191919bb;color:var(--text)}
body[data-theme=dark] .photo-viewer::backdrop{background:#0003}
body[data-theme=dark] #toast{color:var(--text);background:#000b}
body[data-theme=dark] .nav-blur{background:linear-gradient(transparent,#00000018)}
body[data-theme=dark] :is(.field input,textarea)::placeholder{color:#aaa}
body[data-theme=dark] .quote-original .message-quote{background:#3338}
body[data-theme=dark] .glass-live-preview{background-color:#333}

/* Paired wallpapers, one snap point per day/night set. */
.wallpaper-target{margin:10px 0 18px;width:100%}
.wallpaper-gallery{background:rgb(var(--material-base,255 255 255) / .72);border:1px solid var(--line);border-radius:28px;padding:22px 0 24px;overflow:hidden;text-align:center}
.wallpaper-carousel{position:relative;display:flex;gap:16px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding-inline:7%;padding:0 7%;scrollbar-width:none;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y}
.wallpaper-carousel::-webkit-scrollbar{display:none}
.wallpaper-set{flex:0 0 100%;min-width:0;scroll-snap-align:center;scroll-snap-stop:always}
.wallpaper-set h3{font-size:17px;font-weight:500;color:var(--muted);margin:0 0 22px}
.wallpaper-pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.wallpaper-mode{min-width:0}
.wallpaper-mode>span{display:block;font-size:12px;color:var(--muted);margin-bottom:9px}
.wallpaper-phone{position:relative;display:block;width:100%;aspect-ratio:9/19.5;border-radius:24px;overflow:hidden;border:1px solid var(--line);background:var(--panel);padding:0;isolation:isolate}
.wallpaper-phone-image{position:absolute;inset:0;background-size:cover;transform-origin:center;pointer-events:none}
.wallpaper-customize{position:absolute;bottom:12px;left:18%;right:18%;border-radius:20px;background:rgb(var(--material-base,255 255 255) / .7);padding:8px 0;font-size:12px;color:var(--text);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.wallpaper-placeholder{position:absolute;inset:0;display:grid;place-items:center;font-size:35px;color:var(--muted)}
.wallpaper-replace{font-size:12px;margin-top:5px;min-height:36px}
.wallpaper-set-actions{display:flex;justify-content:center;align-items:center;gap:14px;margin:5px 0 0}
.wallpaper-set-actions .secondary-btn{width:auto;min-width:116px;font-size:13px;background:rgb(var(--material-base,255 255 255) / .6)}
.wallpaper-dots{display:flex;justify-content:center;flex-wrap:wrap;gap:2px;margin:16px 12px}
.wallpaper-dots button{width:26px;height:28px;padding:8px;border:0;background:transparent}
.wallpaper-dots button:before{content:'';display:block;width:9px;height:9px;border-radius:50%;background:var(--muted);opacity:.35}
.wallpaper-dots [aria-current=true]:before{background:var(--text);opacity:1}
#wallpaper-add{border-radius:24px;min-height:44px;width:auto;padding:10px 20px;background:var(--accent);color:var(--accent-ink)}
.wallpaper-empty{width:100%;padding:80px 12px;color:var(--muted);line-height:2;flex:none}
.wallpaper-empty small{font-size:12px}
@media(min-width:700px){.wallpaper-phone{max-height:48dvh;aspect-ratio:9/19.5;width:min(100%,22dvh);margin:auto}.wallpaper-gallery{max-width:620px;margin:auto}}

