/* 自定义无框标题栏：默认收起，顶部热区 hover 如抽屉滑出 */
#sf-titlebar-shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100000;
  height: 10px; /* 收起时热区 */
  pointer-events: auto;
}
#sf-titlebar-shell:hover,
#sf-titlebar-shell:focus-within,
#sf-titlebar-shell.is-pinned,
#sf-titlebar-shell.is-open {
  height: 40px;
}
#sf-titlebar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 6px;
  background: linear-gradient(180deg, rgba(28, 22, 14, 0.94), rgba(18, 14, 10, 0.82));
  border-bottom: 1px solid rgba(180, 140, 70, 0.28);
  color: var(--ss-sand-soft,#f0e2c0);
  font: 600 13px/1 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  transform: translateY(-100%);
  transition: transform 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
  will-change: transform;
}
#sf-titlebar-shell:hover #sf-titlebar,
#sf-titlebar-shell:focus-within #sf-titlebar,
#sf-titlebar-shell.is-pinned #sf-titlebar,
#sf-titlebar-shell.is-open #sf-titlebar,
#sf-titlebar.is-open {
  transform: translateY(0);
}
/* 顶部细线（收起时可见的抽屉沿） */
#sf-titlebar-shell::after {
  content: "";
  position: absolute;
  left: 20%; right: 20%;
  top: 0;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 75, 0.55), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#sf-titlebar-shell:hover::after,
#sf-titlebar-shell:focus-within::after,
#sf-titlebar-shell.is-pinned::after {
  opacity: 0;
}
#sf-titlebar .sf-tb-drag {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  min-width: 0;
}
#sf-titlebar .sf-tb-title {
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
#sf-titlebar .sf-tb-icon {
  width: 28px; height: 28px;
  margin-right: 8px;
  border-radius: 4px;
  flex: 0 0 auto;
  pointer-events: none;
  object-fit: contain;
  image-rendering: auto;
  background: transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.55));
}
#sf-titlebar .sf-tb-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 100%;
}
#sf-titlebar .sf-tb-btn {
  width: 36px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #e8dcc0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
#sf-titlebar .sf-tb-btn:hover {
  background: rgba(255, 220, 150, 0.14);
}
#sf-titlebar .sf-tb-btn.sf-tb-close:hover {
  background: rgba(180, 40, 40, 0.85);
  color: #fff;
}
#sf-titlebar .sf-tb-btn svg {
  width: 11px; height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* Windows：左标题，右 Win 顺序控件 */
#sf-titlebar[data-platform="windows"] {
  flex-direction: row;
}
#sf-titlebar[data-platform="windows"] .sf-tb-drag {
  justify-content: flex-start;
  padding-left: 6px;
}
#sf-titlebar[data-platform="windows"] .sf-tb-controls {
  order: 2;
}

/* macOS：左交通灯，标题居中 */
#sf-titlebar[data-platform="macos"] {
  flex-direction: row;
  padding-left: 10px;
}
#sf-titlebar[data-platform="macos"] .sf-tb-controls {
  order: 0;
  gap: 8px;
  padding-right: 8px;
}
#sf-titlebar[data-platform="macos"] .sf-tb-drag {
  justify-content: center;
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
}
#sf-titlebar[data-platform="macos"] .sf-tb-drag .sf-tb-title {
  pointer-events: none;
}
#sf-titlebar[data-platform="macos"] .sf-tb-icon { display: none; }
#sf-titlebar[data-platform="macos"] .sf-tb-btn {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #555;
  color: transparent;
  position: relative;
  z-index: 2;
}
#sf-titlebar[data-platform="macos"] .sf-tb-btn svg { display: none; }
#sf-titlebar[data-platform="macos"] .sf-tb-btn.sf-tb-close { background: #ff5f57; }
#sf-titlebar[data-platform="macos"] .sf-tb-btn.sf-tb-min { background: #febc2e; }
#sf-titlebar[data-platform="macos"] .sf-tb-btn.sf-tb-max { background: #28c840; }
#sf-titlebar[data-platform="macos"] .sf-tb-btn:hover {
  filter: brightness(1.08);
  background: inherit;
}
#sf-titlebar[data-platform="macos"] .sf-tb-btn.sf-tb-close:hover { background: #ff5f57; }

#sf-titlebar[data-platform="linux"],
#sf-titlebar:not([data-platform]) {
  flex-direction: row;
}

@media (prefers-reduced-motion: reduce) {
  #sf-titlebar { transition: none; }
}

/* Maximize disabled: min 760x465, max 1520x930 */
#sf-titlebar .sf-tb-max{display:none!important;}
