/* BioStudio AI — Windows desktop polish.
   Scoped so macOS theme / Mac host chrome is untouched. */

html.os-windows #os.theme-windows,
html.os-windows #os:not(.theme-macos):not(.theme-bs1):not(.theme-bs2):not(.theme-bs3):not(.theme-bs4):not(.theme-bs5):not(.theme-nebula):not(.theme-pulse):not(.theme-vector):not(.theme-lumen) {
  --win-bg: #f3f3f3;
  --win-body-bg: #f9f9fb;
  --win-border: rgba(0, 0, 0, 0.08);
  --win-border-focus: rgba(0, 0, 0, 0.14);
  --titlebar-bg: #f3f3f3;
  --win-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --win-shadow-focus: 0 16px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --taskbar-bg: rgba(243, 243, 243, 0.94);
  --flyout-bg: rgba(243, 243, 243, 0.96);
}

html.os-windows #os.theme-windows.dark,
html.os-windows #os.dark:not(.theme-macos):not(.theme-bs1):not(.theme-bs2):not(.theme-bs3):not(.theme-bs4):not(.theme-bs5):not(.theme-nebula):not(.theme-pulse):not(.theme-vector):not(.theme-lumen) {
  --win-bg: #202020;
  --win-body-bg: #1c1c1c;
  --win-border: rgba(255, 255, 255, 0.08);
  --win-border-focus: rgba(255, 255, 255, 0.14);
  --titlebar-bg: #2c2c2c;
  --win-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --win-shadow-focus: 0 16px 40px rgba(0, 0, 0, 0.55);
  --taskbar-bg: rgba(32, 32, 32, 0.94);
  --flyout-bg: rgba(44, 44, 44, 0.96);
}

html.os-windows #os:not(.theme-macos) .window {
  background: var(--win-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 8px;
}

html.os-windows #os:not(.theme-macos) .window-titlebar {
  background: var(--titlebar-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.os-windows #os:not(.theme-macos) .taskbar {
  background: var(--taskbar-bg);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
}

html.os-windows #os:not(.theme-macos) .start-menu {
  background: var(--flyout-bg);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  max-height: min(76vh, calc(100dvh - var(--taskbar-h) - 24px));
}

html.os-windows #os:not(.theme-macos) .toast,
html.os-windows body:not(.theme-macos) .user-flyout {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* Common Windows laptop heights (1080p @ 125–150%). */
@media (max-height: 820px) {
  html.os-windows:not(.shell-mobile) {
    --shell-scale: 0.88;
  }
  html.os-windows #os:not(.theme-macos) .start-menu {
    padding: 16px 18px 10px;
    gap: 10px;
  }
  html.os-windows #os:not(.theme-macos) .start-grid,
  html.os-windows #os:not(.theme-macos) .start-cat-grid,
  html.os-windows #os:not(.theme-macos) .start-account-section {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-height: 700px) {
  html.os-windows:not(.shell-mobile) {
    --shell-scale: 0.82;
  }
}

@media (max-width: 1100px) {
  html.os-windows #os:not(.theme-macos) .start-grid,
  html.os-windows #os:not(.theme-macos) .start-cat-grid,
  html.os-windows #os:not(.theme-macos) .start-account-section {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 820px) {
  html.os-windows #os:not(.theme-macos) .start-menu {
    width: min(100vw - 12px, 640px);
    left: 50%;
    bottom: calc(var(--taskbar-h) + 8px);
  }
  html.os-windows #os:not(.theme-macos) .start-grid,
  html.os-windows #os:not(.theme-macos) .start-cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  html.os-windows #os:not(.theme-macos) .toast {
    width: min(340px, calc(100vw - 24px));
  }
}

html.os-windows #os:not(.theme-macos) .win-btn {
  min-width: var(--window-control-w);
}

html.os-windows #os:not(.theme-macos) .window-body {
  overscroll-behavior: contain;
}

/* Firefox doesn't paint the WebKit scrollbar thumb the same way. */
@-moz-document url-prefix() {
  html.os-windows #os:not(.theme-macos) .window-body,
  html.os-windows #os:not(.theme-macos) .start-categorized,
  html.os-windows #os:not(.theme-macos) .start-all {
    scrollbar-width: thin;
  }
}
