/* Texora interface refinement. Glass belongs to navigation; reading stays calm. */
html[data-theme=macos] {
  --glass-panel:#f0f4fc;
  --glass-chrome:#e9eef9;
  --glass-edge:rgba(255,255,255,.82);
  --glass-shadow:0 20px 60px #102c5530,inset 0 1px 0 #fff,inset 0 -1px 0 #819ac42b;
}
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  html[data-theme=macos] { --glass-panel:rgba(245,249,255,.72); --glass-chrome:rgba(234,242,255,.68); }
  html[data-theme=macos] :is(.os-window,footer.taskbar,.start-menu,.mac-menubar,.phone-search-dialog,.dictation-dialog) {
    backdrop-filter:blur(28px) saturate(145%); -webkit-backdrop-filter:blur(28px) saturate(145%);
  }
}
html[data-theme=macos] .windows-os {
  background:radial-gradient(ellipse at 96% 97%,#e7cdd4 0,transparent 55%),radial-gradient(ellipse at 12% 82%,#839ed0 0,transparent 60%),linear-gradient(140deg,#102c59 0%,#344c84 48%,#b3a0c7 100%);
}
html[data-device=desktop][data-theme=macos] .windows-os { background:radial-gradient(ellipse at 96% 97%,#e7cdd4 0,transparent 55%),radial-gradient(ellipse at 12% 82%,#839ed0 0,transparent 60%),linear-gradient(140deg,#102c59 0%,#344c84 48%,#b3a0c7 100%); }
html[data-device=desktop][data-theme=macos] .os-desktop { overflow:visible; }
html[data-theme=macos] .os-desktop { background:transparent; }
html[data-theme=macos] .os-desktop::before { background:linear-gradient(125deg,transparent 46%,#c1d9ff15 47%,#ffffff10 55%,transparent 56%); filter:none; }
html[data-theme=macos] .os-window {
  --content-paper:#f7f9fd; --content-soft:#edf2fa; --content-card:#fff;
  --content-ink:#202e44; --content-muted:#53647b; --content-line:#d4deee;
  --content-accent:#235baf; --content-hover:#194a94; --content-tint:#e8f0ff;
  --content-radius:18px; --content-control-radius:12px;
  background:var(--glass-panel); border:1px solid var(--glass-edge); border-radius:22px;
  box-shadow:var(--glass-shadow);
}
html[data-theme=macos] .os-window.is-active { box-shadow:0 28px 80px #13264838,0 2px 8px #1b345b14,inset 0 1px 0 #fff; }
html[data-device=desktop][data-theme=macos] .os-window .os-titlebar {
  background:linear-gradient(115deg,#ffffffad,#f0f5ff4d); min-height:50px; padding:8px 12px; border-bottom:1px solid #aebed83d;
}
html[data-device=desktop][data-theme=macos] .os-window-bottom { background:#e9f1fb94; border-top:1px solid #c2d0e340; color:#50637f; }
html[data-theme=macos] .os-window .window-content { background:#f7f9fdf2; }
html[data-theme=macos] .os-window .window-content :is(.hero-grid,.section-content,.theme-settings,.project-wizard,.wizard-main) { background:transparent; }
html[data-theme=macos] .os-window .window-content :is(.service,.process-grid article,.wizard-summary,.conversation,.theme-option) { box-shadow:0 3px 12px #1c3f6807,inset 0 1px #fff; }
html[data-theme=macos] .os-window .window-content .terminal-window { border-color:#d2ddee; box-shadow:0 12px 32px #23457212; }
html[data-theme=macos] .os-window .window-content .terminal-body { background:linear-gradient(135deg,#243855,#182943); }
html[data-theme=macos] .os-window .window-content .flow-result { background:#ffffff12; border-color:#a9c6ee3b; }
html[data-theme=macos] .os-window .window-content .button.primary { background:linear-gradient(#326bc1,#2456a3); border-color:#2558a4; box-shadow:inset 0 1px #ffffff40,0 3px 8px #17468124; }
html[data-theme=macos] .os-window .window-content .button.primary:hover { background:linear-gradient(#2b61b6,#1c4b96); }
html[data-theme=macos] .os-window .window-content .button:not(.primary) { background:linear-gradient(#ffffff,#f6f9ff); box-shadow:0 1px 3px #213d6310,inset 0 1px #fff; }
html[data-theme=macos] .os-window .window-content .wizard-sidebar { background:#edf2f9c7; }
html[data-theme=macos] .os-window .window-content footer.wizard-footer { background:#f9fbfff0; }
html[data-theme=macos] .os-window .window-content .wizard-choice:has(input:checked) { background:#ecf3ff; }
/* Quietly reflective chrome with complete foreground/background pairs. */
html[data-theme=macos] :is(footer.taskbar,.start-menu,.phone-search-dialog,.dictation-dialog) {
  background:var(--glass-panel); border:1px solid var(--glass-edge); box-shadow:var(--glass-shadow); color:#23334b;
}
html[data-device=desktop][data-theme=macos] .mac-menubar { background:var(--glass-chrome); color:#1f304b; border-bottom:1px solid #ffffff60; box-shadow:0 1px 10px #152a4910; }
html[data-device=desktop][data-theme=macos] footer.taskbar { background:var(--glass-chrome); border:1px solid var(--glass-edge); border-radius:24px; box-shadow:var(--glass-shadow); }
html[data-theme=macos] .start-menu { border-radius:20px; padding:10px; }
html[data-theme=macos] .start-menu-items :is(button,a) { border-radius:10px; margin-bottom:2px; }
html[data-theme=macos] .start-menu-items :is(button,a):hover { background:#fff9; color:#174b96; }
html[data-theme=macos] .start-menu-items :is(button,a):focus-visible { background:#e2edff; color:#174b96; outline:2px solid #235baf; outline-offset:-2px; }
html[data-theme=macos] .phone-search-result { border-color:#d7e1ef; background:#fffffff0; }
html[data-theme=macos] .phone-search-close { background:#e4edfb; color:#244773; }
html[data-theme=macos] .phone-search-dialog input[type=search] { color:#20354e; border-color:#bacce6; }
html[data-theme=macos] .dictation-dialog .dictation-actions { background:#f4f8fc; }
html[data-theme=macos] :is(.dictation-dialog,.phone-search-dialog,#setup-dialog)::backdrop { background:#12234266; backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
html[data-theme=macos] #setup-dialog :is(.setup-footer,.theme-option) { background:#f9fbffeb; }
html[data-theme=macos] .wallpaper-brand img { background:#f9fbffdc; border:1px solid #ffffffb3; box-shadow:0 12px 30px #10254a16,inset 0 1px #fff; }
html[data-theme=macos] .wallpaper-brand { filter:none; }
html[data-theme=macos] .wallpaper-brand span { color:#fff; text-shadow:0 1px 3px #15284e80; }
html[data-device=desktop][data-theme=macos] .desktop-hint { color:#eef4ff; text-shadow:0 1px 3px #15284e90; }
/* Larger click targets retain the small, accurately centered traffic lights. */
html[data-device=desktop][data-theme=macos] .window-controls { gap:0; }
html[data-device=desktop][data-theme=macos] .window-controls button {
  width:28px;min-width:28px;height:28px;min-height:28px;padding:0;border:0;border-radius:50%;box-shadow:none;
  background:radial-gradient(circle,var(--traffic-fill,#c5cddb) 0 6px,var(--traffic-edge,#afbacb) 6px 7px,transparent 7.5px); color:#3b2524;
}
html[data-device=desktop][data-theme=macos] .window-controls [data-action=close] { --traffic-fill:#ff675d; --traffic-edge:#ec584e; }
html[data-device=desktop][data-theme=macos] .window-controls [data-action=minimize] { --traffic-fill:#ffc34b; --traffic-edge:#e9ad35; }
html[data-device=desktop][data-theme=macos] .window-controls [data-action=maximize] { --traffic-fill:#41c762; --traffic-edge:#2cb54e; }
html[data-device=desktop][data-theme=macos] .os-window:not(.is-active) .window-controls button { --traffic-fill:#c5cddb; --traffic-edge:#afbacb; }
html[data-device=desktop][data-theme=macos] .window-controls button:focus-visible { outline:2px solid #235baf; outline-offset:0; }
/* Each mode keeps its own identity; density and feedback are shared. */
html[data-device=desktop][data-theme] .desktop-icon { width:108px; }
html[data-device=desktop]:is([data-theme=macos],[data-theme=modern]) .desktop-icon>span:last-child { font-weight:550; letter-spacing:.005em; }
html[data-theme] .os-window .window-content .knowledge-search input:focus-visible { outline-offset:0; }
html[data-theme] :is(.theme-option,.wizard-choice) { cursor:pointer; }
html[data-theme] .os-window .window-content :is(.button,.knowledge-topics button,.wizard-choice,.theme-option) { transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease; }
html[data-theme] :is(.button,.dictation-button):disabled { cursor:not-allowed; }
html[data-device=desktop][data-theme=modern] .os-window { border-color:#d3dfed; box-shadow:0 20px 65px #071e3533,0 1px 4px #1228401a; }
html[data-device=desktop][data-theme=modern] .os-titlebar { background:#f2f6fc; }
html[data-device=desktop][data-theme=modern] .start-menu { border-color:#c8d6e6; box-shadow:0 20px 60px #081b3438,inset 0 1px #fff; }
html[data-device=desktop][data-theme=modern] .window-content .button.primary { box-shadow:inset 0 1px #ffffff28,0 2px 5px #1c43651c; }
html[data-theme=retro] .os-window .window-content .button:focus-visible { outline:2px dotted var(--content-accent); outline-offset:3px; }
html[data-theme=retro] .os-window .window-content .wizard-choice:has(input:checked) { border-color:var(--content-accent); }
/* Mobile app navigation remains spacious; no blurry scaling on app artwork. */
@media (max-width:600px),(max-width:1000px) and (max-height:600px) and (pointer:coarse) {
  html[data-device=phone][data-theme=macos] .windows-os { background:radial-gradient(ellipse at 100% 92%,#e6c5d9 0,transparent 55%),radial-gradient(ellipse at 5% 60%,#6f95c9 0,transparent 62%),linear-gradient(155deg,#15356a,#665f9b 58%,#b29abc); }
  html[data-device=phone][data-theme=macos] .mac-menubar { background:transparent; backdrop-filter:none; -webkit-backdrop-filter:none; }
  html[data-device=phone][data-theme=macos] footer.taskbar { background:var(--glass-panel); border:1px solid var(--glass-edge); box-shadow:var(--glass-shadow); border-radius:30px; }
  html[data-device=phone][data-theme=macos] .os-window { border-radius:26px 26px 18px 18px; background:var(--glass-panel); }
  html[data-device=phone][data-theme=macos] .os-window .os-titlebar { background:#eff5fbb8; border-bottom:1px solid #b8c8e340; }
  html[data-device=phone][data-theme=macos] .phone-home { color:#2259a5; border-radius:18px; padding-inline:12px; background:#ffffffab; border:1px solid #ffffffc9; box-shadow:0 1px 4px #1439630b; }
  html[data-device=phone][data-theme=macos] .phone-home-search { background:#e8f0facc; color:#203a60; box-shadow:inset 0 1px #ffffffd9,0 3px 10px #14335a12; }
  html[data-device=phone][data-theme=macos] .wallpaper-brand img { border-radius:28px; background:#f5f9ffdf; }
  html[data-device=phone][data-theme] #projekt .wizard-sidebar button { min-height:44px; }
  html[data-device=phone][data-theme] .phone-page-dots { border-radius:22px; }
  html[data-device=phone][data-theme=modern] .os-window { border-color:#e8efdf; box-shadow:0 8px 28px #283d2612; }
  html[data-device=phone][data-theme=modern] .phone-home { border-radius:18px; background:#e5eddc; padding-inline:12px; }
  html[data-device=phone][data-theme=modern] .phone-search-dialog { background:#f8faf4; border-color:#d6e1c9; }
  html[data-device=phone][data-theme=retro] .os-window .window-content { scrollbar-color:#71865e #e7ecd9; }
  html[data-device=phone][data-theme=retro] .phone-home { border:1px solid #71865e; padding-inline:8px; }
  html[data-device=phone][data-theme] .os-titlebar .phone-home { flex-shrink:0; min-height:36px; }
  html[data-device=phone][data-theme] .os-titlebar .drag-handle { min-width:0; overflow:hidden; text-overflow:ellipsis; }
}
@media (max-width:1000px) and (max-height:600px) and (orientation:landscape) and (pointer:coarse) {
  html[data-device=phone][data-theme] #projekt .wizard-sidebar button { min-height:44px; padding:6px; }
  #setup-dialog .setup-heading { padding:12px 20px 0; }
  #setup-dialog .setup-options { padding:12px 20px; }
  #setup-dialog .setup-footer { padding:8px 20px; }
  #setup-dialog .setup-footer p { max-width:65%; }
  html[data-device=phone][data-theme=macos] footer.taskbar { border-radius:22px; }
}
/* No transparency is required for usability. These are deliberate solid fallbacks. */
@media (prefers-reduced-transparency:reduce) {
  html[data-theme=macos] { --glass-panel:#f0f4fc; --glass-chrome:#e9eef9; }
  html[data-theme=macos] :is(.os-window,footer.taskbar,.start-menu,.mac-menubar,.phone-search-dialog,.dictation-dialog) { backdrop-filter:none; -webkit-backdrop-filter:none; }
  html[data-theme=macos] .os-window .window-content { background:#f7f9fd; }
}
@media (prefers-reduced-motion:reduce) {
  html[data-theme] *,html[data-theme] *::before,html[data-theme] *::after { scroll-behavior:auto!important; animation:none!important; transition:none!important; }
}
@media (forced-colors:active) {
  html[data-theme=macos] :is(.os-window,footer.taskbar,.start-menu,.mac-menubar,.phone-search-dialog,.dictation-dialog) { background:Canvas; color:CanvasText; border:1px solid CanvasText; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
  html[data-theme=macos] .window-controls button { background:ButtonFace; border:1px solid ButtonText; color:ButtonText; font-size:12px; }
  html[data-theme=macos] .window-controls button::before { display:none; }
}
/* Notch-safe document gutters, including the LCD theme. */
@media (max-width:600px),(max-width:1000px) and (max-height:600px) and (pointer:coarse) {
  html[data-device=phone][data-theme] .os-window .window-content :is(.hero-grid,.section-content,.theme-settings) { padding-left:max(20px,env(safe-area-inset-left,0px)); padding-right:max(20px,env(safe-area-inset-right,0px)); }
  html[data-device=phone][data-theme] #projekt .wizard-main { padding-left:max(18px,env(safe-area-inset-left,0px)); padding-right:max(18px,env(safe-area-inset-right,0px)); }
  html[data-device=phone][data-theme] #wissen .knowledge-body { padding-left:max(18px,env(safe-area-inset-left,0px)); padding-right:max(18px,env(safe-area-inset-right,0px)); }
  html[data-device=phone][data-theme=retro] .mac-menubar { padding-left:max(23px,env(safe-area-inset-left,0px)); padding-right:max(23px,env(safe-area-inset-right,0px)); }
  html[data-device=phone][data-theme=retro] .os-titlebar { padding-left:max(7px,env(safe-area-inset-left,0px)); padding-right:max(7px,env(safe-area-inset-right,0px)); }
}
html[data-device=desktop][data-theme=macos] footer.taskbar { background:linear-gradient(135deg,#ffffff63,#ffffff12 38%,#ffffff30),var(--glass-chrome); }
html[data-theme=macos] .preview-macos { background:linear-gradient(135deg,#254a7d,#7999c5 56%,#d9becf); }
html[data-theme=macos] .preview-macos:before { background:#f2f6ffb8; border:1px solid #fff9; box-shadow:0 5px 14px #17375f30; }
html[data-device=desktop][data-theme=macos] .os-window:not(.is-active) .window-controls button { background:radial-gradient(circle,#c5cddb 0 6px,#afbacb 6px 7px,transparent 7.5px); }

html[data-theme=macos] #setup-dialog { background:var(--glass-panel); border:1px solid var(--glass-edge); box-shadow:var(--glass-shadow); }
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  html[data-theme=macos] #setup-dialog { backdrop-filter:blur(28px) saturate(145%); -webkit-backdrop-filter:blur(28px) saturate(145%); }
}
@media (prefers-reduced-transparency:reduce),(forced-colors:active) {
  html[data-theme=macos] #setup-dialog { backdrop-filter:none; -webkit-backdrop-filter:none; background:#f0f4fc; }
}
html[data-theme=macos] .dictation-dialog .dictation-actions { border:1px solid #ffffffad; border-radius:16px; padding:12px; background:#f4f8fcf5; }
html[data-theme=macos] .dictation-dialog .dictation-primary { font-weight:600; }
