/**
 * Cursor 设计规范 · 平台壳层 Token
 *
 * 参考：cursor.com/agents、Cursor IDE Default Dark / Cursor Light
 * 气质：深色底、低对比描边、13px 正文、紧凑 48px 顶栏、侧栏与主区同色系
 */

:root {
  /* ── 字体 ── */
  --cursor-font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --cursor-font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;

  --cursor-text-xs: 11px;
  --cursor-text-sm: 13px;
  --cursor-text-base: 14px;
  --cursor-text-lg: 16px;
  --cursor-weight-normal: 400;
  --cursor-weight-medium: 500;
  --cursor-weight-semibold: 600;

  /* ── 圆角 ── */
  --cursor-radius-sm: 6px;
  --cursor-radius-md: 8px;
  --cursor-radius-lg: 12px;
  --cursor-radius-xl: 16px;
  --cursor-radius-full: 999px;

  /* ── Light · Cursor Light 近似 ── */
  --cursor-bg: #ffffff;
  --cursor-bg-subtle: #fafafa;
  --cursor-bg-sidebar: #f3f3f3;
  --cursor-bg-elevated: #ffffff;
  --cursor-bg-input: #ffffff;
  --cursor-bg-hover: rgba(0, 0, 0, 0.04);
  --cursor-bg-active: rgba(0, 0, 0, 0.06);
  --cursor-border: rgba(0, 0, 0, 0.08);
  --cursor-border-strong: rgba(0, 0, 0, 0.14);
  --cursor-text: #171717;
  --cursor-text-secondary: #666666;
  --cursor-text-tertiary: #999999;
  --cursor-primary: #171717;
  --cursor-primary-hover: #000000;
  --cursor-primary-fg: #ffffff;
  --cursor-success: #22c55e;
  --cursor-warning: #ca8a04;
  --cursor-danger: #ef4444;
  --cursor-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --cursor-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --cursor-topbar-bg: rgba(255, 255, 255, 0.88);

  /* 平台语义映射 · Light */
  --bg: var(--cursor-bg-subtle);
  --surface: var(--cursor-bg);
  --surface-muted: var(--cursor-bg-sidebar);
  --surface-elevated: var(--cursor-bg-elevated);
  --surface-hover: var(--cursor-bg-hover);
  --surface-active: var(--cursor-bg-active);
  --surface-selected: rgba(0, 0, 0, 0.08);
  --border: var(--cursor-border);
  --text: var(--cursor-text);
  --muted: var(--cursor-text-secondary);
  --primary: var(--cursor-primary);
  --primary-hover: var(--cursor-primary-hover);
  --accent-muted: var(--cursor-text-tertiary);
  --accent-border-strong: var(--cursor-border-strong);
  --success: var(--cursor-success);
  --warning: var(--cursor-warning);
  --danger: var(--cursor-danger);
  --radius: var(--cursor-radius-lg);
  --shadow: var(--cursor-shadow-sm);
  --topbar-bg: var(--cursor-topbar-bg);
  --topbar-h: 48px;
  --sidebar-w: var(--explorer-w, 236px);
  --spine-w: var(--sidebar-w);

  /* ── 编辑器 / 预览组件 · Light ── */
  --editor-bg: #ffffff;
  --editor-chrome-bg: #f3f3f3;
  --editor-tab-bg: #ececec;
  --editor-tab-hover-bg: #f3f3f3;
  --editor-tab-active-bg: #ffffff;
  --editor-tab-text: #616161;
  --editor-tab-active-text: #333333;
  --editor-tab-border: #e5e5e5;
  --editor-accent: #0078d4;
  --editor-accent-hover: #106ebe;
  --editor-empty-bg: #fafafa;
  --prose-bg: #ffffff;
  --prose-text: #1e293b;
  --prose-heading: #0f172a;
  --prose-muted: #64748b;
  --prose-code-bg: #f1f5f9;
  --prose-code-inline: #be123c;
  --prose-pre-bg: #0f172a;
  --prose-pre-text: #e2e8f0;
  --prose-blockquote-bg: #f8fafc;
  --prose-border: #e2e8f0;
  --prose-border-subtle: #f1f5f9;
  --prose-table-hover: #fafafa;
  --preview-wrap-bg: #eef2f6;
  --preview-stage-bg: #ffffff;
  --preview-stage-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  --toggle-track-bg: #e2e8f0;
  --toggle-btn-active-bg: #ffffff;
  --toggle-btn-text: #64748b;
  --toggle-btn-hover-text: #334155;
  --toggle-btn-active-text: #0f172a;
  --code-bg: #f8fafc;

  --agent-chat-bg: var(--cursor-bg);
  --agent-user-bg: rgba(0, 0, 0, 0.045);
  --agent-composer-bg: var(--cursor-bg-elevated);

  --btn-ghost-bg: transparent;
  --btn-ghost-border: var(--border);
  --btn-ghost-hover-bg: var(--surface-hover);
  --btn-ghost-hover-border: var(--accent-border-strong);

  /* ── 状态指示 · Light ── */
  --status-dot-ok: #22c55e;
  --status-dot-warn: #ca8a04;
  --status-dot-error: #ef4444;
  --status-dot-pending: #a3a3a3;
  --status-text-ok: #16a34a;
  --status-text-warn: #a16207;
  --status-text-error: #dc2626;

  color-scheme: light;
}

[data-theme="dark"] {
  /* ── Dark · Cursor Automations / IDE 分层灰（非纯黑） ── */
  --cursor-bg: #181818;
  --cursor-bg-subtle: #181818;
  --cursor-bg-sidebar: #141414;
  --cursor-bg-elevated: #1e1e1e;
  --cursor-bg-input: #252525;
  --cursor-bg-hover: rgba(255, 255, 255, 0.06);
  --cursor-bg-active: rgba(255, 255, 255, 0.09);
  --cursor-border: rgba(255, 255, 255, 0.1);
  --cursor-border-strong: rgba(255, 255, 255, 0.14);
  --cursor-text: #e0e0e0;
  --cursor-text-secondary: #8a8a8a;
  --cursor-text-tertiary: #6a6a6a;
  --cursor-primary: #ffffff;
  --cursor-primary-hover: #f0f0f0;
  --cursor-primary-fg: #181818;
  --cursor-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --cursor-shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
  --cursor-topbar-bg: rgba(24, 24, 24, 0.92);

  --bg: var(--cursor-bg);
  --surface: var(--cursor-bg-elevated);
  --surface-muted: var(--cursor-bg-sidebar);
  --surface-elevated: #252525;
  --surface-hover: var(--cursor-bg-hover);
  --surface-active: var(--cursor-bg-active);
  --surface-selected: rgba(255, 255, 255, 0.1);
  --border: var(--cursor-border);
  --text: var(--cursor-text);
  --muted: var(--cursor-text-secondary);
  --primary: var(--cursor-primary);
  --primary-hover: var(--cursor-primary-hover);
  --topbar-bg: var(--cursor-topbar-bg);
  --shadow: var(--cursor-shadow-sm);

  /* ── 编辑器 / 预览组件 · Dark ── */
  --editor-bg: #181818;
  --editor-chrome-bg: #1a1a1a;
  --editor-tab-bg: #1a1a1a;
  --editor-tab-hover-bg: #222222;
  --editor-tab-active-bg: #181818;
  --editor-tab-text: #8a8a8a;
  --editor-tab-active-text: #e0e0e0;
  --editor-tab-border: rgba(255, 255, 255, 0.08);
  --editor-accent: #4daafc;
  --editor-accent-hover: #6bb8ff;
  --editor-empty-bg: #141414;
  --prose-bg: #181818;
  --prose-text: #d4d4d4;
  --prose-heading: #e0e0e0;
  --prose-muted: #8a8a8a;
  --prose-code-bg: #252525;
  --prose-code-inline: #f87171;
  --prose-pre-bg: #141414;
  --prose-pre-text: #d4d4d4;
  --prose-blockquote-bg: #1e1e1e;
  --prose-border: rgba(255, 255, 255, 0.1);
  --prose-border-subtle: rgba(255, 255, 255, 0.06);
  --prose-table-hover: rgba(255, 255, 255, 0.04);
  --preview-wrap-bg: #141414;
  --preview-stage-bg: #1e1e1e;
  --preview-stage-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --toggle-track-bg: #252525;
  --toggle-btn-active-bg: #2d2d2d;
  --toggle-btn-text: #8a8a8a;
  --toggle-btn-hover-text: #b0b0b0;
  --toggle-btn-active-text: #e0e0e0;
  --code-bg: #252525;

  --agent-chat-bg: var(--cursor-bg);
  --agent-user-bg: rgba(255, 255, 255, 0.06);
  --agent-composer-bg: var(--cursor-bg-elevated);

  --btn-ghost-bg: rgba(255, 255, 255, 0.04);
  --btn-ghost-border: rgba(255, 255, 255, 0.18);
  --btn-ghost-hover-bg: rgba(255, 255, 255, 0.08);
  --btn-ghost-hover-border: rgba(255, 255, 255, 0.26);

  /* ── 状态指示 · Dark ── */
  --status-dot-ok: #4ade80;
  --status-dot-warn: #facc15;
  --status-dot-error: #f87171;
  --status-dot-pending: #6a6a6a;
  --status-text-ok: #4ade80;
  --status-text-warn: #facc15;
  --status-text-error: #f87171;

  color-scheme: dark;
}

html {
  font-family: var(--cursor-font-sans);
  font-size: var(--cursor-text-sm);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--cursor-font-sans);
  font-size: var(--cursor-text-sm);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

code, pre, .path-label, .fp-pathbar {
  font-family: var(--cursor-font-mono);
}
