index.css 4.23 KB
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --bg: 246 247 250;
    --surface: 255 255 255;
    --elevated: 252 252 254;
    --line: 226 230 238;
    --ink: 24 28 40;
    --muted: 116 125 146;
    --brand: 79 70 229;
    --brand2: 14 165 233;
    --ok: 22 163 74;
    --warn: 217 119 6;
    --bad: 220 38 38;
    --shadow: 0 1px 2px rgb(16 20 35 / 0.05), 0 8px 24px -8px rgb(16 20 35 / 0.12);
  }

  .dark {
    --bg: 12 15 22;
    --surface: 20 24 34;
    --elevated: 27 32 44;
    --line: 42 49 65;
    --ink: 228 233 243;
    --muted: 138 148 170;
    --brand: 129 124 255;
    --brand2: 56 189 248;
    --ok: 52 190 104;
    --warn: 245 175 61;
    --bad: 248 113 113;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -10px rgb(0 0 0 / 0.6);
  }

  * { box-sizing: border-box; }

  html, body, #root { height: 100%; }

  body {
    @apply bg-bg text-ink font-sans antialiased;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: rgb(var(--muted) / 0.28);
    border-radius: 99px;
    border: 3px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: rgb(var(--muted) / 0.5); background-clip: content-box; }

  :focus-visible { outline: 2px solid rgb(var(--brand)); outline-offset: 2px; border-radius: 6px; }
}

@layer components {
  .card {
    @apply bg-surface border border-line rounded-xl;
    box-shadow: var(--shadow);
  }

  .btn {
    @apply inline-flex items-center justify-center gap-1.5 rounded-lg border border-line
           bg-surface px-3 py-1.5 text-[13px] font-medium text-ink
           transition-colors disabled:opacity-50 disabled:pointer-events-none whitespace-nowrap;
  }
  .btn:hover { @apply bg-elevated border-brand/40; }
  .btn-primary {
    @apply bg-brand text-white border-transparent;
  }
  .btn-primary:hover { @apply bg-brand/90 border-transparent; }
  .btn-ghost { @apply border-transparent bg-transparent; }
  .btn-ghost:hover { @apply bg-ink/5; }
  .btn-danger { @apply bg-bad text-white border-transparent; }
  .btn-danger:hover { @apply bg-bad/90; }
  .btn-sm { @apply px-2 py-1 text-xs; }

  .input {
    @apply w-full rounded-lg border border-line bg-surface px-3 py-1.5 text-[13px] text-ink
           placeholder:text-muted/70 transition-colors;
  }
  .input:focus { @apply border-brand outline-none ring-2 ring-brand/20; }

  .chip {
    @apply inline-flex items-center gap-1.5 rounded-full border border-line bg-surface
           px-2.5 py-1 text-xs text-ink transition-colors cursor-pointer select-none;
  }
  .chip-off { @apply opacity-40; }

  .label { @apply block text-xs font-medium text-muted mb-1; }

  .skeleton {
    @apply relative overflow-hidden rounded-md bg-ink/5;
  }
  .skeleton::after {
    content: "";
    @apply absolute inset-0 -translate-x-full animate-shimmer;
    background: linear-gradient(90deg, transparent, rgb(var(--ink) / 0.06), transparent);
  }

  .prose-answer {
    @apply text-[14px] leading-7 text-ink;
  }
  .prose-answer h1, .prose-answer h2, .prose-answer h3 {
    @apply font-semibold mt-5 mb-2 text-[15px];
  }
  .prose-answer p { @apply my-2.5; }
  .prose-answer ul { @apply my-2.5 list-disc pl-5 space-y-1; }
  .prose-answer ol { @apply my-2.5 list-decimal pl-5 space-y-1; }
  .prose-answer code {
    @apply rounded bg-ink/[0.07] px-1.5 py-0.5 font-mono text-[12.5px];
  }
  .prose-answer pre {
    @apply my-3 overflow-x-auto rounded-lg bg-ink/[0.06] p-3 text-[12.5px];
  }
  .prose-answer pre code { @apply bg-transparent p-0; }
  .prose-answer table { @apply my-3 w-full border-collapse text-[13px]; }
  .prose-answer th, .prose-answer td { @apply border border-line px-2.5 py-1.5 text-left; }
  .prose-answer th { @apply bg-ink/[0.04] font-medium; }
  .prose-answer blockquote { @apply my-3 border-l-[3px] border-brand/40 pl-3 text-muted; }
  .prose-answer a { @apply text-brand underline underline-offset-2; }
}

/* Sigma 的 canvas 容器必须显式定位,否则 hover 命中判定会错位 */
.sigma-host { position: relative; width: 100%; height: 100%; }
.sigma-host > .sigma-container { position: absolute; inset: 0; }