/* Storyverse v36.39 — dark mode + contrast system */
.theme-dark{
  --dark-bg:#111018;
  --dark-bg2:#181521;
  --dark-card:#201c29;
  --dark-card-2:#272231;
  --dark-text:#f5f1fb;
  --dark-muted:#bdb5ca;
  --dark-line:rgba(255,255,255,.12);
  background:linear-gradient(135deg,var(--dark-bg),var(--dark-bg2))!important;
  color:var(--dark-text);
}
.theme-dark.has-wallpaper:after{
  background:linear-gradient(135deg,rgba(15,13,21,.84),rgba(24,20,31,.88))!important;
}
.theme-dark .soft-card,
.theme-dark .composer,
.theme-dark .post,
.theme-dark .profile-hero,
.theme-dark .detail-card,
.theme-dark .universe-card,
.theme-dark .gallery-card,
.theme-dark .dash-card,
.theme-dark .character-card,
.theme-dark .messages-app{
  background:color-mix(in srgb,var(--dark-card) 88%,transparent)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .device-top,
.theme-dark .device-dock,
.theme-dark .admin-topbar,
.theme-dark .admin-sidebar,
.theme-dark .conv-header,
.theme-dark .conversation:hover,
.theme-dark .conversation.active{
  background:color-mix(in srgb,var(--dark-card) 78%,transparent)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .device-top,
.theme-dark .device-dock,
.theme-dark .chat-head,
.theme-dark .message-compose,
.theme-dark .conversation-list,
.theme-dark .admin-topbar{border-color:var(--dark-line)!important}
.theme-dark .btn,
.theme-dark .field input,
.theme-dark .field textarea,
.theme-dark .field select,
.theme-dark .search input,
.theme-dark .message-compose textarea{
  background:var(--dark-card-2)!important;
  color:var(--dark-text)!important;
  border-color:rgba(255,255,255,.14)!important;
}
.theme-dark .btn.soft,
.theme-dark .as-select,
.theme-dark .mini-pill,
.theme-dark .mini-person,
.theme-dark .mini-post,
.theme-dark .stat,
.theme-dark .quick-action,
.theme-dark .chip,
.theme-dark .app-icon-tile{
  background:color-mix(in srgb,var(--dark-card-2) 88%,var(--u-accent) 12%)!important;
  color:var(--dark-text);
  border-color:var(--dark-line);
}
.theme-dark .btn.primary{
  background:var(--u-accent)!important;
  color:#fff!important;
}
.theme-dark .btn.danger{color:#ff9bb0}
.theme-dark .handle,
.theme-dark .muted,
.theme-dark .hint,
.theme-dark .widget-sub,
.theme-dark .app-page-head p,
.theme-dark .greeting-card p,
.theme-dark .post-meta-line span,
.theme-dark .conv-copy span,
.theme-dark .chat-head small,
.theme-dark .bio,
.theme-dark .universe-button small,
.theme-dark .identity-copy small,
.theme-dark .admin-topbar small,
.theme-dark .dash-hero p,
.theme-dark .detail-card h3,
.theme-dark .universe-card h3,
.theme-dark .stat span{
  color:var(--dark-muted)!important;
}
.theme-dark .app-launcher,
.theme-dark .dock-app,
.theme-dark .conversation,
.theme-dark .admin-nav button,
.theme-dark .universe-button,
.theme-dark .quick-action{
  color:var(--dark-text);
}
.theme-dark .bubble{
  background:var(--dark-card-2)!important;
  color:var(--dark-text)!important;
}
.theme-dark .bubble.me{
  background:color-mix(in srgb,var(--u-accent) 34%,var(--dark-card-2))!important;
}
.theme-dark .profile-banner,
.theme-dark .character-banner{
  background-color:var(--dark-card-2);
}
.theme-dark .profile-main>.avatar,
.theme-dark .character-body>.avatar{
  border-color:var(--dark-card)!important;
}
.theme-dark .private-card{
  background:#2a2028!important;
  border-color:rgba(255,170,190,.18)!important;
}
.theme-dark .drawer,
.theme-dark .modal{
  background:#18151f!important;
  color:var(--dark-text)!important;
}
.theme-dark .drawer-head,
.theme-dark .drawer-footer{
  border-color:var(--dark-line)!important;
}
.theme-dark .drawer .form-section>h3,
.theme-dark .modal>p,
.theme-dark .color-field label{
  color:var(--dark-muted)!important;
}
.theme-dark .custom-row input,
.theme-dark .u-custom-row input{
  background:var(--dark-card-2)!important;
  color:var(--dark-text)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .theme-page-preview{
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.16)!important;
}
.theme-dark .theme-mode-row{
  background:rgba(255,255,255,.045)!important;
  border-color:var(--dark-line)!important;
}
.theme-mode-row{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  margin:14px 0;padding:13px 14px;border:1px solid rgba(82,71,105,.10);
  border-radius:18px;background:rgba(255,255,255,.42);
}
.theme-mode-row span{display:grid;gap:3px;min-width:0}
.theme-mode-row strong{font-size:13px}
.theme-mode-row small{font-size:10px;color:var(--muted);line-height:1.4}
.theme-mode-toggle{display:flex;gap:4px;padding:4px;border-radius:13px;background:rgba(0,0,0,.06);flex-shrink:0}
.theme-mode-toggle button{border:0;border-radius:10px;padding:8px 11px;background:transparent;color:var(--muted);font-weight:800;font-size:11px}
.theme-mode-toggle button.active{background:var(--u-accent);color:#fff;box-shadow:0 3px 10px color-mix(in srgb,var(--u-accent) 25%,transparent)}
@media(max-width:600px){
  .theme-mode-row{align-items:flex-start;flex-direction:column}
  .theme-mode-toggle{width:100%}
  .theme-mode-toggle button{flex:1}
}


/* Storyverse v36.43 — make dark mode authoritative over the old light-only layer */
.theme-root.theme-dark{
  --u-bg1:#111018!important;
  --u-bg2:#181521!important;
  --u-text:#f5f1fb!important;
  --u-card:#201c29!important;
  --ink:#f5f1fb!important;
  --muted:#bdb5ca!important;
  --card:#201c29!important;
  color-scheme:dark!important;
}
.theme-root.theme-dark input,
.theme-root.theme-dark textarea,
.theme-root.theme-dark select,
.theme-root.theme-dark button{
  color-scheme:dark!important;
}
.theme-dark .v31-mac-menubar,
.theme-dark .v33-mac-windowbar{
  background:rgba(25,22,33,.78)!important;
  color:var(--dark-text)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .v33-mac-window,
.theme-dark .v33-detached-chat{
  background:color-mix(in srgb,var(--dark-card) 94%,transparent)!important;
  color:var(--dark-text)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .v33-mac-windowcontent,
.theme-dark .app-page,
.theme-dark .admin-main{
  color:var(--dark-text)!important;
}
.theme-dark .v31-mac-dock,
.theme-dark .v36-dock{
  background:rgba(28,24,36,.68)!important;
  border-color:rgba(255,255,255,.14)!important;
}
.theme-dark .v361-control-pop,
.theme-dark .v36-widget,
.theme-dark .v36-pulse{
  background:color-mix(in srgb,var(--dark-card) 88%,transparent)!important;
  color:var(--dark-text)!important;
  border-color:var(--dark-line)!important;
}
.theme-dark .v361-lock-atmosphere,
.theme-root.theme-dark.has-wallpaper .v361-lock-atmosphere{
  background:linear-gradient(180deg,rgba(12,10,18,.58),rgba(18,15,25,.72))!important;
  backdrop-filter:saturate(.9) brightness(.72)!important;
}
.theme-root.theme-dark .v361-mac-lock,
.theme-root.theme-dark.has-wallpaper .v361-mac-lock,
.theme-root.theme-dark .v361-lock-top>span,
.theme-root.theme-dark .v361-lock-top>strong,
.theme-root.theme-dark .v361-lock-top>small,
.theme-root.theme-dark .v361-lock-title{
  color:var(--dark-text)!important;
}
