/* A continuous Horizon shell around the existing cream buddy groups. */
body.fm-horizon-theme #desktop #win-buddy > .buddy-body {
  background:linear-gradient(155deg,var(--horizon-dark),var(--horizon-mid) 65%,color-mix(in srgb,var(--horizon-light) 75%,var(--horizon-dark))) !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-shell {
  min-width:0;
  min-height:0;
  background:transparent !important;
  border-color:transparent !important;
  box-shadow:none !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-well { box-shadow:none !important; }

/* One cream search capsule, with a quiet theme tint and an integrated icon. */
body.fm-horizon-theme #desktop #win-buddy .buddy-search-wrap {
  position:relative;
  padding:0;
  border-radius:16px;
  background:linear-gradient(115deg,color-mix(in srgb,var(--horizon-mid) 12%,#fffaf3),#fffaf3 60%,color-mix(in srgb,var(--horizon-light) 24%,#fffaf3)) !important;
  border-color:transparent !important;
  box-shadow:0 3px 12px #071b2514 !important;
  color-scheme:light;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-search-wrap::before {
  content:"";
  position:absolute;
  left:14px;
  top:50%;
  width:16px;
  height:16px;
  transform:translateY(-50%);
  background:var(--horizon-mid,#326a76);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events:none;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-search {
  height:42px !important;
  min-height:42px !important;
  padding:0 14px 0 40px !important;
  border:0 !important;
  border-radius:15px !important;
  background:transparent !important;
  color:#302d2a !important;
  font-size:12px;
  box-shadow:none !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-search::placeholder { color:#625951 !important; opacity:1 !important; }
body.fm-horizon-theme #desktop #win-buddy .buddy-search-wrap:focus-within { outline:2px solid var(--horizon-light); outline-offset:3px; }
body.fm-horizon-theme #desktop #win-buddy .buddy-search:focus { outline:none !important; }

/* The old independent tray gradient caused the seam below the buttons. */
body.fm-horizon-theme #desktop #win-buddy .buddy-actions {
  background:transparent !important;
  background-image:none !important;
  border-color:transparent !important;
  box-shadow:none !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-actions button {
  border:0 !important;
  border-radius:12px !important;
  background:linear-gradient(145deg,#fffaf3,color-mix(in srgb,var(--horizon-light) 18%,#f7f3ed)) !important;
  color:#302d2a !important;
  box-shadow:none !important;
  text-shadow:none !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-actions button :is(span,i,svg) { color:inherit !important; }
body.fm-horizon-theme #desktop #win-buddy .buddy-actions button:hover:not(:disabled) { background:#fffdf8 !important; }
body.fm-horizon-theme #desktop #win-buddy .buddy-actions button:disabled { background:#e5e0d9 !important; color:#827c74 !important; opacity:.72 !important; cursor:default; }
body.fm-horizon-theme #desktop #win-buddy .buddy-actions button:focus-visible { outline:2px solid #fffaf3 !important; outline-offset:3px; }

/* Reset presence-dot sizing on LIVE badges, including the directory/profile. */
body.fm-horizon-theme .fm-live-badge {
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  width:auto !important;
  min-width:max-content;
  height:18px !important;
  margin:0 !important;
  padding:2px 5px !important;
  border:0 !important;
  border-radius:5px !important;
  background:#fff0ef !important;
  color:#9d2030 !important;
  font-size:9px !important;
  font-weight:800;
  font-style:normal;
  line-height:14px !important;
  letter-spacing:.04em;
  white-space:nowrap;
  box-sizing:border-box;
  text-shadow:none !important;
  vertical-align:middle;
  animation:fm-live-readable-pulse 2.4s ease-in-out infinite !important;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-name-line { min-width:0; align-items:center; }
body.fm-horizon-theme #desktop #win-buddy .buddy-name-line > .buddy-name { flex:0 1 auto; }
body.fm-horizon-theme #desktop #win-buddy .buddy-name-line > :is(.buddy-badges,.fm-live-badge) { flex-shrink:0; }
@keyframes fm-live-readable-pulse { 0%,100% { opacity:1; } 50% { opacity:.85; } }
@media(prefers-reduced-motion:reduce) { body.fm-horizon-theme .fm-live-badge { animation:none !important; } }

/* Titles sit directly on the chrome, including windows outside #desktop. */
body.fm-horizon-theme .fm-window > .titlebar > div:first-child,
body.fm-horizon-theme #desktop .fm-window > .titlebar > div:first-child {
  background:transparent !important;
  border-color:transparent !important;
  box-shadow:none !important;
  backdrop-filter:none !important;
  color:#ffffff !important;
  font-weight:650;
  text-shadow:0 1px 2px #0009 !important;
}
body.fm-horizon-theme .fm-window > .titlebar > div:first-child :is(.room-title-name-text,i,svg),
body.fm-horizon-theme #desktop .fm-window > .titlebar .room-title-name-text {
  color:#ffffff !important;
  text-shadow:0 1px 2px #0009 !important;
}
/* Keep the center of light title bars deep enough for unboxed white type. */
body.fm-horizon-theme:not(.fm-horizon-night) .fm-window > .titlebar,
body.fm-horizon-theme:not(.fm-horizon-night) #desktop .fm-window > .titlebar,
body.fm-horizon-theme:not(.fm-horizon-night) #win-sounds > .titlebar {
  background:linear-gradient(110deg,var(--horizon-dark),var(--horizon-mid) 65%,var(--horizon-light)) !important;
}


/* Keep native scrollbar controls inside the cream panel's curved silhouette.
   The frame owns the curve; the existing well remains the scroll viewport. */
.buddy-well-frame { display:contents; }
body.fm-horizon-theme #desktop #win-buddy .buddy-well-frame {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  box-sizing:border-box;
  padding:12px 6px;
  border-radius:22px;
  overflow:hidden;
  background:var(--horizon-paper,var(--fm-menu-card,#f7f3ed));
}
body.fm-horizon-theme #desktop #win-buddy .buddy-well-frame > .buddy-well {
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  box-sizing:border-box;
  padding:0 10px 0 6px !important;
  border:0 !important;
  border-radius:0 !important;
  clip-path:none !important;
  background:transparent !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  overscroll-behavior:contain;
}
body.fm-horizon-theme #desktop #win-buddy .buddy-well-frame > .buddy-well::-webkit-scrollbar-track {
  margin:0 !important;
}
