/* One app palette and navigation, shared by every page. */
:root{--mo-safe-top:env(safe-area-inset-top,0px);--mo-safe-bottom:env(safe-area-inset-bottom,0px);--mo-bg:#e7e7e3;--mo-ink:#262624;--mo-muted:#666761;--mo-line:#d9d9d4;--mo-pane:#f7f7f4;--mo-soft:#e7e7e3;--mo-sheet:#fafaf7;--mo-rose:#a5686a;--mo-rose-soft:#ede0df;--mo-cast:#c8c9c4}
html[data-theme=dark]{--mo-bg:#191918;--mo-ink:#f0eeea;--mo-muted:#a7a6a0;--mo-line:#494946;--mo-pane:#242423;--mo-soft:#363633;--mo-sheet:#232321;--mo-rose:#ca999a;--mo-rose-soft:#433334;--mo-cast:#363837}
html body #tabBar{
 display:flex!important;align-items:stretch;justify-content:space-around;gap:0!important;
 width:min(704px,calc(100% - 24px))!important;height:auto!important;min-height:0!important;
 bottom:calc(10px + var(--mo-safe-bottom))!important;padding:8px!important;
 border:1px solid var(--mo-line)!important;border-radius:28px!important;
 background:linear-gradient(130deg,var(--mo-pane),var(--mo-soft))!important;
 color:var(--mo-ink)!important;box-shadow:none!important;
 backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
}
html body #tabBar .tab{
 display:flex!important;flex:1;min-width:0;min-height:0!important;
 flex-direction:column;align-items:center;justify-content:center;gap:4px!important;
 padding:6px 2px!important;border:0!important;border-radius:22px!important;
 background:transparent!important;color:var(--mo-muted)!important;
 font-size:11px!important;font-weight:400!important;line-height:1.4!important;
 box-shadow:none!important;transition:none!important;
}
html body #tabBar .tab[aria-current=page]{background:var(--mo-pane)!important;color:var(--mo-ink)!important;box-shadow:0 2px 8px #00000008!important}
html body #tabBar .tab-icon{display:none!important}
html body #tabBar .preview-nav-icon{display:block!important}
html body #tabBar svg{width:19px!important;height:19px!important;stroke-width:1.5}

/* The center timestamp has exactly the same surface and type as Thinking. */
html body[data-page=chat] #messages .chat-date-separator{
 display:flex;align-items:center;justify-content:center;width:fit-content;max-width:100%;
 min-height:36px!important;padding:8px 11px!important;margin:6px auto 18px;
 border:1px solid var(--mo-line)!important;border-radius:22px!important;
 background:var(--mo-pane)!important;color:var(--mo-muted)!important;
 font-family:inherit!important;font-size:11px!important;font-weight:400!important;line-height:1.4!important;
 letter-spacing:normal!important;box-shadow:none!important;
 backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
}

/* Utility pages use the home surface, while chat retains its selected photo. */
html body:not([data-page=chat]) #bgLayer{background:var(--mo-bg)!important;background-image:none!important}
html body :is(#memoryPage,#detailPage,#albumPage,#settingsPage,#renderSettingsPage,#mcpPage){
 top:0;bottom:0;padding:calc(18px + var(--mo-safe-top)) 20px calc(104px + var(--mo-safe-bottom));
 background:radial-gradient(ellipse at 95% 8%,var(--mo-pane),transparent 42%),radial-gradient(ellipse at 0 38%,var(--mo-cast),transparent 45%),linear-gradient(133deg,transparent 37%,var(--mo-pane) 50%,transparent 65%),var(--mo-bg)!important;
 color:var(--mo-ink);
}
html body :is(#memoryPage,#detailPage,#albumPage,#settingsPage,#renderSettingsPage,#mcpPage)::before{font:400 48px/1.1 Georgia,'Times New Roman',serif;letter-spacing:-1.8px;color:var(--mo-ink)}
html body :is(
 #homePage .mo-feature,#homePage .mo-calendar-panel,#homePage .mo-day-section,#homePage .mo-month-entry,
 #memoryPage .archive-memory-card,#memoryPage .rolling-memory-card,#memoryPage .local-memory-panel,
 #memoryPage .ombre-memory-head,#memoryPage .mem-card,#memoryPage .local-memory-card,
 #settingsPage>label,#settingsPage>details,#settingsPage>.mcp-section,#settingsPage>.render-settings-entry,
 #renderSettingsPage .render-settings-card,#renderSettingsPage .render-setting-row,
 #mcpPage .mcp-section,#mcpPage .mcp-server-card,#mcpPage .mcp-log,
 #detailPage .detail-content,.memory-empty,
 dialog:not(.moment-dialog),.prompt-item,.conversation-library section,
 .app-input-sheet,.moment-detail,.moment-activity,.thought-sheet,.sticker-tile,
 .login-card,.native-launch-card,.home-card,.mo-sheet,
 .alcove-profile,.alcove-link,.chat-calendar-card,.song-card
){
 border:1px solid var(--mo-line)!important;border-radius:23px!important;
 background:linear-gradient(119deg,var(--mo-pane),var(--mo-soft) 62%,var(--mo-pane))!important;
 box-shadow:inset 0 1px 0 #ffffff35!important;color:var(--mo-ink)!important;
 backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
}
html body #memoryPage :is(.archive-memory-card,.rolling-memory-card,.ombre-memory-head){position:static;margin:0 0 12px;padding:17px}
html body #memoryPage .local-memory-panel{margin:0 0 12px}
html body #memoryPage :is(h3,.local-memory-head strong){font-size:17px;font-weight:500;line-height:1.5;color:var(--mo-ink)}
html body #memoryPage :is(.archive-memory-card p,.rolling-memory-card p){font-size:13px;line-height:1.7;color:var(--mo-muted)}
html body #memoryPage :is(.archive-memory-card small,.rolling-memory-card small,.local-memory-head small,.local-memory-head-actions){font-size:11px;line-height:1.7;color:var(--mo-muted)}
html body #memoryPage :is(.local-memory-open-label,.local-memory-close-label){color:var(--mo-rose)}
html body #memoryPage .mem-title{color:var(--mo-ink);font-size:16px;font-weight:500}
html body #memoryPage :is(.mem-preview,.mem-head,.mem-foot,.local-memory-meta){color:var(--mo-muted)}
html body #memoryPage :is(.primary-button,.rolling-memory-run),html body #settingsPage .primary-button,html body #mcpPage .primary-button{background:var(--mo-ink)!important;color:var(--mo-bg)!important;box-shadow:none!important}
html body #memoryPage :is(.secondary-button,.rolling-memory-reset),html body #settingsPage .secondary-button{background:var(--mo-pane)!important;color:var(--mo-ink)!important;border:1px solid var(--mo-line)!important;box-shadow:none!important}
html body :is(#memoryPage,#settingsPage,#renderSettingsPage,#mcpPage) :is(textarea,select,input:not([type=checkbox]):not([type=range]):not([type=color])){background:var(--mo-pane)!important;color:var(--mo-ink)!important;border:1px solid var(--mo-line)!important;box-shadow:none!important}
html body #memoryPage .mem-chip{background:var(--mo-pane);color:var(--mo-muted);border:1px solid var(--mo-line)}
html body #memoryPage .mem-chip.active{background:var(--mo-ink);color:var(--mo-bg)}
html body #settingsPage>label{padding:17px;margin-bottom:12px;color:var(--mo-muted)!important}
html body #settingsPage :is(.bubble-mode-setting strong,.appearance-assets-settings summary){font-size:15px;font-weight:500;color:var(--mo-ink)}
html body #settingsPage .appearance-assets-settings{padding:17px}
html body #albumPage #albumInput{width:100%;padding:17px;border:1px solid var(--mo-line);border-radius:23px;background:var(--mo-pane);color:var(--mo-muted)}
html body #albumPage .album-grid img{border:1px solid var(--mo-line);border-radius:23px}

/* Only the home overview is fixed. The calendar and diary still scroll. */
html body:not([data-home-view=calendar]) #homePage{overflow:hidden!important;padding-top:calc(18px + var(--mo-safe-top));padding-bottom:calc(92px + var(--mo-safe-bottom));overscroll-behavior:none}
html body:not([data-home-view=calendar]) #homeOverview{
 height:100%;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;
 container-type:size;container-name:home-fit;
}
html body:not([data-home-view=calendar]) #homePage .mo-home-cards{min-height:0;grid-template-rows:repeat(3,minmax(0,1fr));gap:12px}
html body:not([data-home-view=calendar]) #homePage .mo-feature{min-height:0;overflow:hidden}
html body:not([data-home-view=calendar]) #homePage .mo-feature-foot{margin-top:auto;padding-top:10px}
html body:not([data-home-view=calendar]) #homePage .mo-feature-foot>span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html body[data-home-view=calendar] #homePage{overflow-y:auto!important}
@container home-fit (max-height:680px){
 #homePage .mo-hero h1{font-size:48px;margin:4px 0 12px}
 #homePage .mo-couple{margin-top:14px;padding-top:11px}
 #homePage .mo-home-cards{margin-top:16px;gap:10px!important}
 #homePage .mo-feature{padding:14px}
 #homePage .mo-feature-title{font-size:25px;margin:9px 0 4px}
 #homePage .mo-feature-foot{font-size:10px;padding-top:7px!important}
 #homePage .mo-home-note{margin-top:12px;font-size:10px}
}
@container home-fit (max-height:580px){
 #homePage .mo-hero h1{font-size:42px;margin:3px 0 9px}
 #homePage .mo-hero p{font-size:11px;line-height:1.6}
 #homePage .mo-couple{margin-top:10px;padding-top:9px}
 #homePage .mo-home-cards{margin-top:12px;gap:8px!important}
 #homePage .mo-feature{padding:12px}
 #homePage .mo-feature-title{font-size:23px;margin:7px 0 3px}
 #homePage .mo-feature-top{font-size:10px;letter-spacing:1.3px}
 #homePage .mo-feature-cn{font-size:11px}
 #homePage .mo-feature-foot{font-size:9px;padding-top:5px!important}
 #homePage .mo-home-note{display:none}
}
@container home-fit (max-height:480px){
 #homePage .mo-hero h1{font-size:35px;margin:2px 0 6px}
 #homePage .mo-couple{margin-top:7px;padding-top:7px}
 #homePage .mo-home-cards{margin-top:9px;gap:6px!important}
 #homePage .mo-feature{padding:9px 12px}
 #homePage .mo-feature-title{font-size:21px;margin:4px 0 2px}
 #homePage .mo-feature-top{font-size:9px}
 #homePage .mo-feature-foot{padding-top:3px!important}
}

/* Keep the existing handlers; every lower drawer entry uses the icon card. */
.alcove-drawer [hidden]{display:none!important}
html body .alcove-drawer :is(.drawer-more .nav-item,.drawer-recent-button,.drawer-new-chat){
 display:flex;align-items:center;gap:12px;width:100%;min-height:61px;padding:12px!important;
 border:1px solid var(--stroke)!important;border-radius:15px!important;background:var(--glass)!important;
 color:var(--text)!important;text-align:left;font:inherit;white-space:normal;box-shadow:none!important;
}
html body .alcove-drawer :is(.drawer-more .nav-item,.drawer-recent-button,.drawer-new-chat)::before,
html body .alcove-drawer :is(.drawer-more .nav-item,.drawer-recent-button,.drawer-new-chat)::after{content:none!important}
html body .alcove-drawer .drawer-more{gap:8px!important}
html body .alcove-drawer .drawer-footer{display:block}
html body .alcove-drawer .drawer-extra summary{font-size:12px;font-weight:500}
html body .alcove-drawer .drawer-section-title{font-size:12px;font-weight:500}
@media(max-width:360px){html body :is(#memoryPage,#detailPage,#albumPage,#settingsPage,#renderSettingsPage,#mcpPage){padding-inline:15px}}

/* Dialogs and reusable cards share the home surface without changing actions. */
html body #milestoneSettings[hidden]{display:none!important}
html body :is(dialog:not(.moment-dialog),.app-input-sheet) :is(input:not([type=checkbox]):not([type=range]):not([type=color]),textarea,select){background:var(--mo-pane)!important;color:var(--mo-ink)!important;border:1px solid var(--mo-line)!important;box-shadow:none!important}
html body :is(dialog,.app-input-sheet,.moment-detail) :is(.primary-button,.sticker-import){background:var(--mo-ink)!important;color:var(--mo-bg)!important;box-shadow:none!important}
html body :is(dialog,.app-input-sheet,.moment-detail) :is(.secondary-button,.round-control,.sticker-close,.sticker-manage,.moment-close){background:var(--mo-pane)!important;color:var(--mo-ink)!important;border:1px solid var(--mo-line)!important;box-shadow:none!important}
html body .dialog-head strong{font:400 26px/1.2 Georgia,'Times New Roman','Songti SC','PingFang SC','Noto Sans SC',serif;color:var(--mo-ink)}
html body :is(dialog,.app-input-sheet) label,html body #promptSummary{color:var(--mo-muted)}
html body .prompt-list{gap:12px;margin-top:12px}
html body #promptDialog .prompt-item{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:16px}
html body #promptDialog .prompt-use{display:block;width:100%;min-width:0;flex:none;padding:0;border:0;border-radius:0;background:transparent;color:var(--mo-ink);font-size:13px;font-weight:400;line-height:1.65;text-align:left}
html body #promptDialog .prompt-side{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:8px}
html body #promptDialog :is(.prompt-pin,.prompt-del){width:auto;min-width:44px;min-height:32px;flex:none;padding:5px 12px;border:1px solid var(--mo-line);border-radius:999px;background:var(--mo-pane);color:var(--mo-muted);font:inherit;font-size:11px;line-height:1.4}
html body #promptDialog .prompt-pin.on{background:var(--mo-ink);color:var(--mo-pane);border-color:var(--mo-ink)}
html body #promptDialog .prompt-check input{accent-color:var(--mo-ink)}
html body .conversation-library section{padding:14px;margin-top:12px}
html body .conversation-library button{background:var(--mo-pane);color:var(--mo-ink);border:1px solid var(--mo-line)}
html body .alcove-drawer :is(.drawer-more .nav-item,.drawer-recent-button,.drawer-new-chat){border:1px solid var(--mo-line)!important;border-radius:23px!important;background:linear-gradient(119deg,var(--mo-pane),var(--mo-soft) 62%,var(--mo-pane))!important;color:var(--mo-ink)!important;box-shadow:inset 0 1px 0 #ffffff35!important}
html body .alcove-drawer .alcove-link small{color:var(--mo-muted)}
html body .moment-detail::after{content:none}

/* Rendering switches keep their capsule shape despite generic input sizing. */
html body #renderSettingsPage .render-setting-row input[type=checkbox]{
 appearance:none;-webkit-appearance:none;position:relative;justify-self:end;align-self:center;
 box-sizing:border-box;width:48px!important;min-width:48px!important;max-width:48px!important;
 height:28px!important;min-height:28px!important;max-height:28px!important;
 margin:0!important;padding:0!important;border:0!important;border-radius:999px!important;
 background:var(--mo-line)!important;box-shadow:none!important;cursor:pointer;
}
html body #renderSettingsPage .render-setting-row input[type=checkbox]::after{
 content:'';position:absolute;top:3px;left:3px;width:22px;height:22px;
 border:0;border-radius:50%;background:var(--mo-pane)!important;
 box-shadow:0 1px 4px #00000025;transform:translateX(0);
}
html body #renderSettingsPage .render-setting-row input[type=checkbox]:checked{background:var(--mo-ink)!important}
html body #renderSettingsPage .render-setting-row input[type=checkbox]:checked::after{transform:translateX(20px)}
