:root {
  --font-sans: 'Manrope', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Sora', 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --container: 1220px;
  --transition: 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition-slow: 480ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-height: 74px;
  --grad-brand: linear-gradient(115deg, #7c3aed 0%, #c026d3 55%, #ffd166 108%);
  --grad-brand-soft: linear-gradient(120deg, rgba(124, 58, 237, 0.22), rgba(192, 38, 211, 0.16) 55%, rgba(255, 209, 102, 0.12));
  --grad-cta: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
  --grad-pro: linear-gradient(135deg, #8b5cf6 0%, #c026d3 55%, #ffd166 115%);
  --grad-text: linear-gradient(100deg, #ffffff 10%, #d6c9ff 45%, #f0abfc 75%, #ffd166 100%);
  --shadow-sm: 0 4px 14px rgba(3, 6, 22, 0.5);
  --shadow-md: 0 18px 44px rgba(3, 6, 22, 0.55);
  --shadow-lg: 0 40px 90px rgba(2, 4, 18, 0.68);
  --glow-blue: 0 0 0 1px rgba(139, 92, 246, 0.35), 0 12px 40px rgba(124, 58, 237, 0.35);
  --glow-violet: 0 14px 44px rgba(138, 92, 255, 0.32);
}

:root,
[data-theme='dark'] {
  --bg: #07050f;
  --bg-soft: #0e0920;
  --surface: rgba(28, 18, 56, 0.66);
  --surface-solid: #171036;
  --surface-raised: #1e1448;
  --surface-glass: rgba(22, 14, 48, 0.55);
  --border: rgba(167, 139, 250, 0.16);
  --border-strong: rgba(167, 139, 250, 0.34);
  --text: #eef1ff;
  --text-soft: #b4bdec;
  --text-muted: #7c86b8;
  --accent: #8b5cf6;
  --accent-strong: #a78bfa;
  --accent-contrast: #04060f;
  --accent-soft: rgba(139, 92, 246, 0.18);
  --secondary: #c026d3;
  --secondary-soft: rgba(192, 38, 211, 0.18);
  --neon: #ffd166;
  --neon-soft: rgba(255, 209, 102, 0.16);
  --danger: #ff6b8a;
  --warning: #ffb454;
  --success: #46e0a0;
  --gold: #ffd166;
  --color-scheme: dark;
}

[data-theme='light'] {
  --bg: #f7f3ff;
  --bg-soft: #f0eaff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.6);
  --border: rgba(124, 58, 237, 0.14);
  --border-strong: rgba(124, 58, 237, 0.3);
  --text: #0d1230;
  --text-soft: #443b7a;
  --text-muted: #6f679c;
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --secondary: #c026d3;
  --secondary-soft: rgba(192, 38, 211, 0.12);
  --neon: #b45309;
  --neon-soft: rgba(180, 83, 9, 0.12);
  --danger: #e11d48;
  --warning: #b45309;
  --success: #059669;
  --gold: #b45309;
  --color-scheme: light;
  --shadow-sm: 0 4px 14px rgba(20, 35, 90, 0.08);
  --shadow-md: 0 18px 44px rgba(20, 35, 90, 0.12);
  --shadow-lg: 0 40px 90px rgba(20, 35, 90, 0.18);
}

[data-reader-theme='sepia'] {
  --bg: #f4e7d0;
  --bg-soft: #efe0c6;
  --surface: #f8f0e0;
  --surface-raised: #fbf5e9;
  --border: #ddc9a8;
  --text: #3b2f22;
  --text-soft: #6b5a45;
  --text-muted: #857058;
  --color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

h1 {
  font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.4rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.3rem);
}

h3 {
  font-size: 1.16rem;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--neon);
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

:focus-visible {
  outline: 3px solid var(--neon);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(138, 92, 255, 0.45);
  color: #fff;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: #060812;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #5b21b6, #5b3fa8);
  border-radius: 999px;
  border: 2px solid #060812;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7c3aed, #7b4dff);
}

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

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

.muted {
  color: var(--text-muted);
}

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.prose {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prose--reader {
  font-size: 1.16rem;
  line-height: 1.95;
}

.mono {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.9em;
}
