/* ==========================================================================
   而安工具仓 (erantoolkit.space) — Unified Arcane Design Tokens
   Harmonized with Eran's Arcane Cabinet:
     - Light (Marauder's Parchment): 暖旧羊皮纸 × 复古黄铜 × 棕褐墨水
     - Dark (Candlelit Obsidian):    黑曜石书阁 × 暗夜鎏金 × 烛火微光
   ========================================================================== */

:root {
  /* Light Theme — Marauder's Parchment */
  --bg: #f3ead6;
  --bg-elevated: #fbf6ea;
  --bg-subtle: #e9dec6;
  --bg-glass: rgba(243, 234, 214, 0.86);

  --ink-primary: #271e15;
  --ink-secondary: #5c4b39;
  --ink-muted: #8a7862;
  --ink-inverse: #fbf6ea;

  --border: rgba(122, 92, 46, 0.2);
  --border-strong: rgba(122, 92, 46, 0.36);
  --border-hover: rgba(154, 111, 36, 0.62);

  /* Brand & Semantic Accents */
  --accent: #9a6f24;
  --accent-hover: #7c5616;
  --accent-soft: rgba(154, 111, 36, 0.13);

  --cat-ai: #1d4ed8;
  --cat-ai-soft: rgba(29, 78, 216, 0.1);
  --cat-game: #9e2a2b;
  --cat-game-soft: rgba(158, 42, 43, 0.12);
  --cat-util: #047857;
  --cat-util-soft: rgba(4, 120, 87, 0.1);

  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;

  /* Typography */
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    Georgia, "Palatino Linotype", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Monaco,
    Consolas, monospace;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(48, 34, 16, 0.06);
  --shadow-sm: 0 4px 12px rgba(48, 34, 16, 0.08);
  --shadow-md: 0 14px 34px -8px rgba(48, 34, 16, 0.15);
  --shadow-lg: 0 24px 60px -12px rgba(48, 34, 16, 0.24);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-base: 240ms;
  --duration-slow: 420ms;

  /* Layout */
  --container-max: 1180px;
  --header-height: 64px;
}

[data-theme="dark"] {
  /* Dark Theme — Candlelit Obsidian */
  --bg: #0e0d14;
  --bg-elevated: #17151f;
  --bg-subtle: #211e2d;
  --bg-glass: rgba(14, 13, 20, 0.84);

  --ink-primary: #f3ecdc;
  --ink-secondary: #b8af9c;
  --ink-muted: #7f7768;
  --ink-inverse: #17130b;

  --border: rgba(212, 175, 94, 0.18);
  --border-strong: rgba(212, 175, 94, 0.34);
  --border-hover: rgba(242, 213, 139, 0.62);

  --accent: #d4af5e;
  --accent-hover: #eccb7d;
  --accent-soft: rgba(212, 175, 94, 0.15);

  --cat-ai: #60a5fa;
  --cat-ai-soft: rgba(96, 165, 250, 0.15);
  --cat-game: #f87171;
  --cat-game-soft: rgba(248, 113, 113, 0.15);
  --cat-util: #34d399;
  --cat-util-soft: rgba(52, 211, 153, 0.14);

  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 38px -8px rgba(0, 0, 0, 0.62);
  --shadow-lg: 0 28px 68px -12px rgba(0, 0, 0, 0.78);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--ink-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
}

/* Shared Toast Notification */
.eran-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 200ms var(--ease-out), transform 240ms var(--ease-out);
}

.eran-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
