:root {
  color-scheme: light dark;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);

  /* Crisp Neutral Light Theme (Matches Figma Desktop Light & Settings) */
  --bg-main: #FFFFFF;
  --bg-sidebar: #F9F9F9;
  --bg-elevated: #FFFFFF;
  --bg-surface: #F4F4F4;
  --bg-subtle: #F2F2F4;
  --bg-hover: #ECECEC;
  --bg-user-bubble: #F4F4F4;
  --bg-code: #F7F7F8;
  --bg-code-header: #EFEFF1;
  --text-primary: #0D0D0D;
  --text-secondary: #5D5D5D;
  --text-muted: #8E8E8E;
  --border-subtle: #E5E5E5;
  --border-strong: #D4D4D4;
  --accent: #0D0D0D;
  --accent-hover: #2A2A2A;
  --accent-contrast: #FFFFFF;
  --success: #16A34A;
  --danger: #DC2626;
  --danger-hover-bg: rgba(220, 38, 38, 0.06);
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --warning-text: #92400E;
  --shadow-popover: 0 8px 28px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.14), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shimmer-base: #737373;
  --shimmer-highlight: #0D0D0D;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-main: #212121;
    --bg-sidebar: #171717;
    --bg-elevated: #2A2A2A;
    --bg-surface: #2F2F2F;
    --bg-subtle: #2A2A2A;
    --bg-hover: #2F2F2F;
    --bg-user-bubble: #2F2F2F;
    --bg-code: #171717;
    --bg-code-header: #262626;
    --text-primary: #ECECEC;
    --text-secondary: #B4B4B4;
    --text-muted: #8E8E8E;
    --border-subtle: #333333;
    --border-strong: #444444;
    --accent: #FFFFFF;
    --accent-hover: #E5E5E5;
    --accent-contrast: #0D0D0D;
    --success: #22C55E;
    --danger: #EF4444;
    --danger-hover-bg: rgba(239, 68, 68, 0.12);
    --warning-bg: rgba(217, 119, 6, 0.12);
    --warning-border: rgba(217, 119, 6, 0.35);
    --warning-text: #FCD34D;
    --shadow-popover: 0 10px 32px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.24);
    --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.56);
    --shimmer-base: #8E8E8E;
    --shimmer-highlight: #FFFFFF;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-main: #212121;
  --bg-sidebar: #171717;
  --bg-elevated: #2A2A2A;
  --bg-surface: #2F2F2F;
  --bg-subtle: #2A2A2A;
  --bg-hover: #2F2F2F;
  --bg-user-bubble: #2F2F2F;
  --bg-code: #171717;
  --bg-code-header: #262626;
  --text-primary: #ECECEC;
  --text-secondary: #B4B4B4;
  --text-muted: #8E8E8E;
  --border-subtle: #333333;
  --border-strong: #444444;
  --accent: #FFFFFF;
  --accent-hover: #E5E5E5;
  --accent-contrast: #0D0D0D;
  --success: #22C55E;
  --danger: #EF4444;
  --danger-hover-bg: rgba(239, 68, 68, 0.12);
  --warning-bg: rgba(217, 119, 6, 0.12);
  --warning-border: rgba(217, 119, 6, 0.35);
  --warning-text: #FCD34D;
  --shadow-popover: 0 10px 32px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.24);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.56);
  --shimmer-base: #8E8E8E;
  --shimmer-highlight: #FFFFFF;
}

:root[data-theme="light"] {
  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.65;
  background-color: var(--bg-main);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.2s var(--ease-smooth), color 0.2s var(--ease-smooth);
}

:root[data-theme="dark"] body {
  letter-spacing: 0.005em;
}

[hidden] {
  display: none !important;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button, [role="button"], a, summary, select, label {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

button svg,
button img,
.logo,
.msg-action-svg {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
