/* Horizon Night: retain the deep chrome; restore warm, readable inner panels. */
body.fm-horizon-night {
  --horizon-paper:#f7f3ed;
  --horizon-paper-field:#fffdf8;
  --horizon-paper-alt:#eae2d8;
  --horizon-paper-ink:#302d2a;
  --horizon-paper-muted:#625951;
  --horizon-paper-border:#d2c8bd;
}

/* Each inset owns a complete foreground/background pair. Outer palette tokens,
   toolbar gradients, sidebars, titlebars, and primary accents remain intact. */
body.fm-horizon-night :is(
  .chat-main,.room-chat-main,.im-chat-panel,
  .buddy-well,.buddy-group,.buddy-group-content,.ph-well,.ph-group,.ph-group-content,
  .pc2-room-list,.ppl-list,
  #win-player .fmp-view,
  #win-control .ts-card,#win-control .ts-hero,#win-control .fm-theme-card,
  #fmWelcomeDashboard .fm-glass-panel,#fmWelcomeDashboard .fm-dashboard-subpanel,
  #fmWelcomeDashboard .fm-social-sections,#fmWelcomeDashboard .fm-social-list,#fmWelcomeDashboard .fm-social-row,
  .fm-buddy-preview,#win-user-info .user-info-body,
  #win-sounds .fm-sounds-preset-btn,#win-sounds .fm-sounds-preview,
  #win-sounds .fm-sounds-custom-row,#win-sounds .fm-voice-tab-section,#win-sounds .fm-voice-toggle,
  .fm-context-menu,.fm-dropdown,.fm-popover,.buddy-context-menu,.format-popover,
  .profile-dropdown,.attachment-menu,.fm-dashboard-prefs-card,.pc2-whos-popover
) {
  --horizon-card:var(--horizon-paper);
  --horizon-soft:var(--horizon-paper);
  --horizon-field:var(--horizon-paper-field);
  --horizon-raised:var(--horizon-paper-alt);
  --horizon-ink:var(--horizon-paper-ink);
  --horizon-muted:var(--horizon-paper-muted);
  --horizon-border:var(--horizon-paper-border);
  --horizon-link:var(--horizon-mid);
  --horizon-focus:var(--horizon-mid);
  --text:var(--horizon-paper-ink);
  --muted:var(--horizon-paper-muted);
  --list-text:var(--horizon-paper-ink);
  --list-muted:var(--horizon-paper-muted);
  --fm-menu-bg:var(--horizon-paper);
  --fm-menu-card:var(--horizon-paper);
  --fm-menu-sidebar:var(--horizon-paper-alt);
  --fm-menu-field:var(--horizon-paper-field);
  --fm-menu-selected:var(--horizon-paper-alt);
  --fm-menu-border:var(--horizon-paper-border);
  --fm-menu-text:var(--horizon-paper-ink);
  --fm-menu-muted:var(--horizon-paper-muted);
  --fm-menu-scheme:light;
  --fm-blue-selection:linear-gradient(110deg,var(--horizon-paper-alt),var(--horizon-paper-field));
  color:var(--horizon-paper-ink);
  color-scheme:light;
}

body.fm-horizon-night #desktop .fm-window :is(.buddy-well,.ph-well) {
  --fm-menu-scheme:light;
  color-scheme:light;
}
body.fm-horizon-night #desktop .fm-window :is(.chat-main,.room-chat-main,.im-chat-panel,.pc2-room-list,.ppl-list),
body.fm-horizon-night #win-player .fmp-view {
  background:var(--horizon-paper) !important;
  color:var(--horizon-paper-ink) !important;
}
body.fm-horizon-night #win-player .fmp-view :is(.fmp-song-header,.fmp-song-row.selected,.fmp-song-row.playing) {
  background:var(--horizon-paper-alt) !important;
}
body.fm-horizon-night #win-player .fmp-view :is(.fmp-grid-name,.fmp-grid-title,.fmp-card-name,.fmp-artist-name) {color:var(--horizon-paper-ink) !important;}
body.fm-horizon-night #win-player .fmp-view :is(.fmp-grid-sub,.fmp-card-sub,.fmp-artist-count) {color:var(--horizon-paper-muted) !important;}
body.fm-horizon-night :is(.fm-buddy-preview,#win-user-info) .fm-profile-feedback[data-error="true"] {color:#963043;}

/* The room shortcut opens a separate, dynamically created Chat Settings window.
   Its legacy labels use opacity and otherwise inherit the dark theme's pale ink. */
body.fm-horizon-theme #desktop #win-chat-settings > .window-body,
body.fm-horizon-theme .fm-chat-ctx-menu {
  --text:#302d2a; --muted:#625951;
  --fm-menu-bg:#f7f3ed; --fm-menu-card:#fffdf8; --fm-menu-field:#fffdf8;
  --fm-menu-text:#302d2a; --fm-menu-muted:#625951; --fm-menu-border:#d2c8bd;
  --fm-menu-selected:#eae2d8; --fm-menu-scheme:light;
  background:#f7f3ed !important; color:#302d2a !important; color-scheme:light;
}
body.fm-horizon-theme #win-chat-settings .window-body :is(div,label,span) {
  color:#302d2a !important; opacity:1 !important;
}
body.fm-horizon-theme #win-chat-settings .window-body :is(div[style*="font-size:12px"],div[style*="text-transform"]) {
  color:#625951 !important;
}
body.fm-horizon-theme #win-chat-settings input {accent-color:var(--horizon-mid);}
body.fm-horizon-theme .fm-chat-ctx-menu :is(button,label,span,div) {color:#302d2a !important;opacity:1 !important;}
body.fm-horizon-theme .fm-chat-ctx-menu button {background:transparent !important;}
body.fm-horizon-theme .fm-chat-ctx-menu button:is(:hover,:focus-visible) {background:#eae2d8 !important;}
body.fm-horizon-theme .fm-chat-ctx-menu .danger {color:#943949 !important;}

/* Player reading surfaces use the foreground paired with their inset background. */
body.fm-horizon-theme #win-player .fmp-viz-canvas-wrap {
  background:var(--fm-menu-bg,#f7f3ed);
}
body.fm-horizon-theme #win-player :is(.fmp-viz-idle,.fmp-empty) {
  color:var(--fm-menu-muted,#625951) !important;
  opacity:1;
}
body.fm-horizon-theme #win-player :is(.fmp-viz-idle,.fmp-empty) b {
  color:var(--fm-menu-text,#302d2a) !important;
  opacity:1;
}
body.fm-horizon-theme #win-player .fmp-viz-idle b {font-size:16px;line-height:1.4;}
body.fm-horizon-theme #win-player .fmp-viz-idle span {
  color:var(--fm-menu-muted,#625951) !important;
  opacity:1;font-size:14px;line-height:1.6;text-align:center;
  max-width:460px;padding:0 20px;
}
body.fm-horizon-theme #win-player :is(.fmp-viz-idle,.fmp-empty) :is(i,svg) {
  color:var(--fm-menu-muted,#625951) !important;opacity:1;
  width:36px;height:36px;
}
body.fm-horizon-theme #win-player :is(.fmp-eq-freq,.fmp-eq-zero-label,.fmp-adv-eq-footer) {
  color:var(--fm-menu-muted,#625951) !important;opacity:1;
}
body.fm-horizon-theme #win-player .fmp-eq-db {color:var(--fm-menu-text,#302d2a) !important;}
body.fm-horizon-theme #win-player .fmp-viz-mode-btn.fmp-viz-mode-active {
  background:var(--fm-blue-action) !important;
  color:var(--horizon-on-action,var(--fm-menu-on-action,#302d2a)) !important;
}
