/* ============ macOS Sonoma base tokens & reset ============ */
:root {
  --sys-blue: #0a60ff;
  --sys-red: #ff453a;
  --sys-green: #32d74b;
  --sys-yellow: #ffd60a;
  --sys-orange: #ff9f0a;
  --sys-purple: #bf5af2;
  --sys-pink: #ff375f;
  --sys-teal: #6ac4dc;
  --sys-indigo: #7d7aff;
  --sys-gray: #98989d;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono",
    "Roboto Mono", monospace;

  --menubar-h: 25px;
  --radius-window: 10px;
  --radius-menu: 6px;
  --radius-popover: 12px;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-macos: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.05, 1.4, 0.1, 1);
  --dur-fast: 150ms;
  --dur-med: 250ms;
  --dur-slow: 400ms;

  --traffic-red: #ff5f57;
  --traffic-yellow: #febc2e;
  --traffic-green: #28c840;
}

/* Light appearance (default) */
#screen {
  --text: #1d1d1f;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-tertiary: rgba(60, 60, 67, 0.35);
  --window-bg: #ffffff;
  --window-border: rgba(0, 0, 0, 0.12);
  --sidebar-bg: rgba(246, 246, 248, 0.82);
  --sidebar-text: #26282a;
  --sidebar-item-hover: rgba(0, 0, 0, 0.06);
  --toolbar-bg: rgba(246, 246, 248, 0.9);
  --content-bg: #ffffff;
  --content-secondary-bg: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.2);
  --fill-strong: rgba(120, 120, 128, 0.32);
  --sep: rgba(0, 0, 0, 0.1);
  --menu-bg: rgba(255, 255, 255, 0.78);
  --menu-text: #1d1d1f;
  --panel-bg: rgba(246, 246, 248, 0.86);
  --field-bg: rgba(0, 0, 0, 0.05);
  --field-border: rgba(0, 0, 0, 0.15);
  --list-hover: rgba(0, 0, 0, 0.045);
  --shadow-window: 0 22px 70px 4px rgba(0, 0, 0, 0.44);
  --shadow-window-unfocused: 0 12px 32px rgba(0, 0, 0, 0.22);
  --shadow-panel: 0 12px 44px 8px rgba(0, 0, 0, 0.28);
  --accent: var(--sys-blue);
  --accent-selected-bg: var(--sys-blue);
  color-scheme: light;
}

#screen[data-appearance="dark"] {
  --text: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);
  --window-bg: #1e1e20;
  --window-border: rgba(255, 255, 255, 0.12);
  --sidebar-bg: rgba(40, 40, 44, 0.72);
  --sidebar-text: #d6d6d8;
  --sidebar-item-hover: rgba(255, 255, 255, 0.07);
  --toolbar-bg: rgba(56, 56, 60, 0.9);
  --content-bg: #1e1e20;
  --content-secondary-bg: #2a2a2c;
  --fill: rgba(120, 120, 128, 0.32);
  --fill-strong: rgba(120, 120, 128, 0.45);
  --sep: rgba(255, 255, 255, 0.1);
  --menu-bg: rgba(48, 48, 52, 0.78);
  --menu-text: #f5f5f7;
  --panel-bg: rgba(48, 48, 52, 0.82);
  --field-bg: rgba(255, 255, 255, 0.08);
  --field-border: rgba(255, 255, 255, 0.14);
  --list-hover: rgba(255, 255, 255, 0.06);
  --accent-selected-bg: #0a84ff;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

#screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  isolation: isolate;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: default; }
ul, ol { list-style: none; }
img { -webkit-user-drag: none; }
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:active { color: var(--accent); }
svg { display: block; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
body.editing, body.editing * { user-select: text; -webkit-user-select: text; }

/* Vibrancy helper */
.vibrancy {
  backdrop-filter: blur(50px) saturate(1.8);
  -webkit-backdrop-filter: blur(50px) saturate(1.8);
}

/* Overlay scrollbars, Sonoma style */
.scroll-y { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb, rgba(120, 120, 128, 0.4));
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover, rgba(120, 120, 128, 0.6)); }
*::-webkit-scrollbar-corner { background: transparent; }
#screen[data-appearance="dark"] { --scroll-thumb: rgba(200, 200, 204, 0.35); --scroll-thumb-hover: rgba(200, 200, 204, 0.55); }

/* Focus ring */
:focus { outline: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-radius: 5px; }

/* Text fields */
.sys-field {
  background: var(--field-bg);
  border: 0.5px solid var(--field-border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}
.sys-field::placeholder { color: var(--text-tertiary); }
.sys-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Little round icon button used in toolbars */
.tool-btn {
  width: 28px; height: 26px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.tool-btn:hover { background: var(--fill); }
.tool-btn:active { background: var(--fill-strong); }
.tool-btn[disabled] { color: var(--text-tertiary); }
.tool-btn svg { width: 16px; height: 16px; }

.hidden { display: none !important; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
