@import url("https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700,900&f[]=general-sans@400,500,600,700&display=swap");

:root,
[data-theme="default"],
[data-theme="dark"] {
  --font-body: "Satoshi", "Inter", sans-serif;
  --font-display: "General Sans", "Satoshi", sans-serif;
  --font-code: "JetBrains Mono", "Fira Code", "Consolas", monospace;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --bg-primary: #0d0d10;
  --bg-secondary: #141418;
  --surface-primary: #19191f;
  --surface-secondary: #202029;
  --surface-tertiary: #292938;
  --border-color: #333341;
  --border-strong: #4a4a5d;
  --text-primary: #f4f2ec;
  --text-secondary: #a9a5a0;
  --text-tertiary: #706d6c;
  --accent: #ff8a1f;
  --accent-strong: #ffc46b;
  --accent-hover: #ff9f45;
  --accent-contrast: #17120d;
  --success: #61d394;
  --error: #ff6b7a;
  --warning: #ffd166;
  --info: #74b9ff;
  --accent-rgb: 255, 138, 31;
  --accent-strong-rgb: 255, 196, 107;
  --surface-code: #101014;
  --code-text: #f8d7a9;
  --glass-overlay: rgba(9, 9, 13, 0.68);
  --editor-dot-1: #ff5f57;
  --editor-dot-2: #ffbd2e;
  --editor-dot-3: #28c840;

  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(var(--accent-rgb), 0.38), 0 0 28px rgba(var(--accent-rgb), 0.2);
  --shadow-card: 0 18px 60px rgba(0, 0, 0, 0.34);
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f8f4ed;
  --bg-secondary: #fffaf2;
  --surface-primary: #ffffff;
  --surface-secondary: #f1ece4;
  --surface-tertiary: #e8dfd3;
  --border-color: #d8cec1;
  --border-strong: #bba994;
  --text-primary: #201b16;
  --text-secondary: #675d53;
  --text-tertiary: #948779;
  --accent: #c95800;
  --accent-strong: #ff8a1f;
  --accent-hover: #db6a16;
  --accent-contrast: #ffffff;
  --success: #247a45;
  --error: #ad2941;
  --warning: #8c5a00;
  --info: #1769aa;
  --accent-rgb: 201, 88, 0;
  --accent-strong-rgb: 255, 138, 31;
  --surface-code: #201b16;
  --code-text: #ffdaa8;
  --glass-overlay: rgba(248, 244, 237, 0.72);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(var(--accent-rgb), 0.32), 0 0 24px rgba(var(--accent-rgb), 0.14);
  --shadow-card: 0 18px 60px rgba(97, 63, 24, 0.16);
}

[data-theme="matrix"] {
  --bg-primary: #020703;
  --bg-secondary: #06110a;
  --surface-primary: #08150c;
  --surface-secondary: #0b2111;
  --surface-tertiary: #103018;
  --border-color: #1f5f31;
  --border-strong: #42d66b;
  --text-primary: #dcffe5;
  --text-secondary: #80d998;
  --text-tertiary: #4e8c5f;
  --accent: #21ff66;
  --accent-strong: #a7ffbe;
  --accent-hover: #55ff89;
  --accent-contrast: #021108;
  --success: #21ff66;
  --error: #ff5f7a;
  --warning: #d7ff67;
  --info: #48ffc9;
  --accent-rgb: 33, 255, 102;
  --accent-strong-rgb: 167, 255, 190;
  --surface-code: #06110a;
  --code-text: #b9ffcb;
  --glass-overlay: rgba(2, 7, 3, 0.78);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(var(--accent-rgb), 0.45), 0 0 30px rgba(var(--accent-rgb), 0.24);
  --shadow-card: 0 22px 70px rgba(0, 255, 80, 0.08);
}

[data-theme="blue"] {
  --bg-primary: #17317c;
  --bg-secondary: #1f3f9b;
  --surface-primary: #1e3a8a;
  --surface-secondary: #2146a8;
  --surface-tertiary: #2f5bc0;
  --border-color: rgba(255, 255, 255, 0.28);
  --border-strong: rgba(255, 255, 255, 0.48);
  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-tertiary: #bfd2ff;
  --accent: #93c5fd;
  --accent-strong: #ffffff;
  --accent-hover: #bfdbfe;
  --accent-contrast: #10214d;
  --success: #5eead4;
  --error: #fecdd3;
  --warning: #fde68a;
  --info: #dbeafe;
  --accent-rgb: 147, 197, 253;
  --accent-strong-rgb: 255, 255, 255;
  --surface-code: #10214d;
  --code-text: #eff6ff;
  --glass-overlay: rgba(15, 36, 92, 0.72);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 18px 60px rgba(6, 20, 64, 0.28);
  --shadow-card: 0 18px 60px rgba(0, 0, 0, 0.24);
}

[data-theme="mono"] {
  --bg-primary: #000000;
  --bg-secondary: #090909;
  --surface-primary: #111111;
  --surface-secondary: #181818;
  --surface-tertiary: #242424;
  --border-color: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.36);
  --text-primary: #f8f8f8;
  --text-secondary: rgba(255, 255, 255, 0.78);
  --text-tertiary: rgba(255, 255, 255, 0.52);
  --accent: #ffffff;
  --accent-strong: #ffffff;
  --accent-hover: #d7d7d7;
  --accent-contrast: #000000;
  --success: #ffffff;
  --error: #ffffff;
  --warning: #ffffff;
  --info: #ffffff;
  --accent-rgb: 255, 255, 255;
  --accent-strong-rgb: 255, 255, 255;
  --surface-code: #0a0a0a;
  --code-text: #f8f8f8;
  --glass-overlay: rgba(0, 0, 0, 0.76);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 34px rgba(255, 255, 255, 0.08);
  --shadow-card: 0 18px 60px rgba(0, 0, 0, 0.7);
}

[data-theme="phdark"] {
  --bg-primary: #000000;
  --bg-secondary: #121212;
  --surface-primary: #1c1c1c;
  --surface-secondary: #242424;
  --surface-tertiary: #2e2e2e;
  --border-color: rgba(255, 153, 0, 0.16);
  --border-strong: rgba(255, 153, 0, 0.36);
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-tertiary: #7d7d7d;
  --accent: #ff9900;
  --accent-strong: #ffb347;
  --accent-hover: #ffad33;
  --accent-contrast: #060606;
  --success: #ffb347;
  --error: #ff7c52;
  --warning: #ffd089;
  --info: #ffffff;
  --accent-rgb: 255, 153, 0;
  --accent-strong-rgb: 255, 179, 71;
  --surface-code: #080808;
  --code-text: #ffd08a;
  --glass-overlay: rgba(0, 0, 0, 0.78);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(var(--accent-rgb), 0.44), 0 0 36px rgba(var(--accent-rgb), 0.22);
  --shadow-card: 0 20px 72px rgba(0, 0, 0, 0.6);
}

[data-theme="kitty"] {
  --bg-primary: #fff4f8;
  --bg-secondary: #ffe8f1;
  --surface-primary: #ffffff;
  --surface-secondary: #ffe1ec;
  --surface-tertiary: #ffd0e1;
  --border-color: #f4a9c4;
  --border-strong: #ef6f9f;
  --text-primary: #4a2130;
  --text-secondary: #8b4a64;
  --text-tertiary: #b7728d;
  --accent: #ff6fa6;
  --accent-strong: #e60033;
  --accent-hover: #ff8fbd;
  --accent-contrast: #ffffff;
  --success: #56b88f;
  --error: #e60033;
  --warning: #f3b13f;
  --info: #7aa7ff;
  --accent-rgb: 255, 111, 166;
  --accent-strong-rgb: 230, 0, 51;
  --surface-code: #4a2130;
  --code-text: #ffeaf2;
  --glass-overlay: rgba(255, 244, 248, 0.78);
  --color-bg: var(--bg-primary);
  --color-bg-soft: var(--bg-secondary);
  --color-surface: var(--surface-primary);
  --color-surface-2: var(--surface-secondary);
  --color-surface-3: var(--surface-tertiary);
  --color-border: var(--border-color);
  --color-border-strong: var(--border-strong);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-faint: var(--text-tertiary);
  --color-primary: var(--accent);
  --color-primary-2: var(--accent-strong);
  --color-primary-dark: var(--accent-hover);
  --color-success: var(--success);
  --color-error: var(--error);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --glow-orange: 0 0 0 1px rgba(var(--accent-rgb), 0.34), 0 0 32px rgba(var(--accent-rgb), 0.24);
  --shadow-card: 0 18px 52px rgba(230, 0, 51, 0.12);
}

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

html {
  min-height: 100%;
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background:
    radial-gradient(circle at 22% 0%, rgba(var(--accent-rgb), 0.18), transparent 30rem),
    radial-gradient(circle at 92% 8%, rgba(var(--accent-strong-rgb), 0.08), transparent 28rem),
    var(--color-bg);
  line-height: 1.55;
}

[data-theme="matrix"] body {
  background:
    linear-gradient(rgba(33, 255, 102, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 255, 102, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, rgba(33, 255, 102, 0.18), transparent 28rem),
    #020703;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.matrix-code-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
}

[data-theme="matrix"] .matrix-code-rain,
body.theme-matrix .matrix-code-rain {
  display: grid;
  grid-template-columns: repeat(28, minmax(2.4rem, 1fr));
  gap: clamp(0.25rem, 1.1vw, 1.2rem);
  padding: 0 clamp(0.35rem, 2vw, 2rem);
  opacity: 1;
  mask-image:
    linear-gradient(180deg, transparent, #000 8%, #000 92%, transparent),
    linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.matrix-code-column {
  display: flex;
  flex-direction: column;
  gap: clamp(0.72rem, 2.2vh, 1.6rem);
  min-width: 0;
  padding-top: 0;
  font-family: var(--font-code);
  font-size: clamp(0.62rem, 0.55rem + 0.18vw, 0.82rem);
  font-weight: 800;
  line-height: 1;
  opacity: 0.62;
  transform: translateY(0);
  animation: matrixCodeFall calc(18s + (var(--column-index) * 0.72s)) linear infinite;
  animation-delay: calc(var(--column-index) * -1.15s);
}

.matrix-code-column:nth-child(2n) {
  opacity: 0.48;
  animation-duration: calc(22s + (var(--column-index) * 0.64s));
}

.matrix-code-column:nth-child(3n) {
  opacity: 0.72;
  animation-duration: calc(15s + (var(--column-index) * 0.54s));
}

.matrix-code-token {
  width: min-content;
  max-width: 8.5rem;
  padding: 0.18rem 0.28rem;
  border: 1px solid rgba(33, 255, 102, 0.12);
  border-radius: 0.22rem;
  background: rgba(2, 7, 3, 0.22);
  text-shadow: 0 0 10px currentColor, 0 0 22px currentColor;
  white-space: nowrap;
  filter: saturate(1.35);
  transform: translateX(calc(var(--column-shift) * 0.18rem));
}

.matrix-code-token:nth-child(4n) {
  opacity: 0.68;
  transform: translateX(calc((var(--column-shift) * 0.18rem) + 0.55rem));
}

.matrix-code-token:nth-child(5n) {
  opacity: 0.86;
  transform: translateX(calc((var(--column-shift) * 0.18rem) - 0.45rem));
}

.matrix-code-token.is-html {
  color: #7df9ff;
  border-color: rgba(125, 249, 255, 0.2);
}

.matrix-code-token.is-css {
  color: #d7ff67;
  border-color: rgba(215, 255, 103, 0.18);
}

.matrix-code-token.is-js {
  color: #ff7ad9;
  border-color: rgba(255, 122, 217, 0.2);
}

.matrix-code-token.is-glyph {
  min-width: 1.45rem;
  color: #21ff66;
  border-color: rgba(33, 255, 102, 0.18);
  background: rgba(33, 255, 102, 0.055);
  font-family: "PingFang SC", "Hiragino Sans GB", var(--font-code);
  font-size: 1.18em;
  letter-spacing: 0.04em;
  text-align: center;
}

.page-topbar,
.app-shell,
.auth-shell,
.floating-actions,
.editor-overlay,
.scroll-progress {
  position: relative;
}

.page-topbar,
.app-shell,
.auth-shell,
.floating-actions {
  z-index: 1;
}

@keyframes matrixCodeFall {
  from {
    transform: translateY(-125%);
  }

  to {
    transform: translateY(110vh);
  }
}

[data-theme="blue"] body {
  background:
    linear-gradient(135deg, rgba(23, 49, 124, 0.94), rgba(31, 63, 155, 0.96)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 12px);
}

[data-theme="mono"] body {
  background: #000000;
}

[data-theme="phdark"] body,
body.theme-phdark {
  background:
    radial-gradient(circle at 18% 0%, rgba(var(--accent-rgb), 0.22), transparent 22rem),
    radial-gradient(circle at 100% 8%, rgba(var(--accent-rgb), 0.1), transparent 20rem),
    linear-gradient(180deg, #000000 0%, #080808 100%);
}

body.auth-page {
  overflow-x: hidden;
}

body {
  --theme-cursor-x: 50vw;
  --theme-cursor-y: 50vh;
  --cursor-orb-size: 0.46rem;
  --cursor-ring-size: 2.8rem;
  --cursor-ring-active-size: 4.9rem;
  --cursor-ring-border: rgba(var(--accent-strong-rgb), 0.5);
  --cursor-ring-bg: radial-gradient(circle, rgba(var(--accent-rgb), 0.16), transparent 62%);
  --cursor-spotlight-bg:
    radial-gradient(circle 26rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(var(--accent-rgb), 0.16), transparent 58%),
    radial-gradient(circle 12rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(var(--accent-strong-rgb), 0.12), transparent 64%);
  --cursor-particle-bg: rgba(var(--accent-rgb), 0.8);
  --cursor-particle-shadow: 0 0 18px rgba(var(--accent-rgb), 0.48);
}

[data-theme="light"] body,
body.theme-light {
  --cursor-ring-border: rgba(201, 88, 0, 0.34);
  --cursor-ring-bg: radial-gradient(circle, rgba(255, 255, 255, 0.68), rgba(201, 88, 0, 0.1) 58%, transparent 72%);
  --cursor-spotlight-bg:
    radial-gradient(circle 30rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 255, 255, 0.78), transparent 54%),
    radial-gradient(circle 13rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(201, 88, 0, 0.14), transparent 68%);
  --cursor-particle-bg: rgba(201, 88, 0, 0.48);
  --cursor-particle-shadow: 0 0 14px rgba(201, 88, 0, 0.2);
}

[data-theme="matrix"] body,
body.theme-matrix {
  --cursor-orb-size: 0.38rem;
  --cursor-ring-size: 3.2rem;
  --cursor-ring-active-size: 5.8rem;
  --cursor-ring-border: rgba(33, 255, 102, 0.7);
  --cursor-ring-bg: radial-gradient(circle, rgba(33, 255, 102, 0.18), transparent 66%);
  --cursor-spotlight-bg:
    radial-gradient(circle 24rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(33, 255, 102, 0.16), transparent 58%),
    radial-gradient(circle 9rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(72, 255, 201, 0.12), transparent 62%);
  --cursor-particle-bg: transparent;
  --cursor-particle-shadow: 0 0 14px rgba(33, 255, 102, 0.74);
}

[data-theme="blue"] body,
body.theme-blue {
  --cursor-ring-border: rgba(219, 234, 254, 0.7);
  --cursor-ring-bg: radial-gradient(circle, rgba(147, 197, 253, 0.22), rgba(255, 255, 255, 0.08) 52%, transparent 70%);
  --cursor-spotlight-bg:
    radial-gradient(circle 28rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(219, 234, 254, 0.18), transparent 56%),
    radial-gradient(circle 12rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(147, 197, 253, 0.2), transparent 66%);
}

[data-theme="mono"] body,
body.theme-mono {
  --cursor-ring-border: rgba(255, 255, 255, 0.72);
  --cursor-ring-bg: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 62%);
  --cursor-spotlight-bg:
    radial-gradient(circle 22rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 255, 255, 0.13), transparent 58%);
  --cursor-particle-bg: rgba(255, 255, 255, 0.68);
}

[data-theme="phdark"] body,
body.theme-phdark {
  --cursor-ring-border: rgba(255, 179, 71, 0.74);
  --cursor-ring-bg: radial-gradient(circle, rgba(255, 153, 0, 0.24), rgba(255, 179, 71, 0.1) 56%, transparent 70%);
  --cursor-spotlight-bg:
    radial-gradient(circle 28rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 153, 0, 0.18), transparent 58%),
    radial-gradient(circle 10rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 179, 71, 0.22), transparent 66%);
}

[data-theme="kitty"] body,
body.theme-kitty {
  --cursor-orb-size: 0.5rem;
  --cursor-ring-size: 3.1rem;
  --cursor-ring-active-size: 5.4rem;
  --cursor-ring-border: rgba(230, 0, 51, 0.46);
  --cursor-ring-bg: radial-gradient(circle, rgba(255, 255, 255, 0.76), rgba(255, 111, 166, 0.22) 54%, transparent 72%);
  --cursor-spotlight-bg:
    radial-gradient(circle 24rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 255, 255, 0.72), transparent 54%),
    radial-gradient(circle 13rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(255, 111, 166, 0.24), transparent 68%);
  --cursor-particle-bg: #ffffff;
  --cursor-particle-shadow: 0 8px 22px rgba(230, 0, 51, 0.2), 0 0 18px rgba(255, 111, 166, 0.36);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.92) 0 0.42rem, transparent 0.46rem),
    radial-gradient(circle at 32% 28%, rgba(255, 208, 225, 0.75) 0 0.34rem, transparent 0.38rem),
    radial-gradient(circle at 74% 18%, rgba(255, 255, 255, 0.86) 0 0.38rem, transparent 0.42rem),
    linear-gradient(135deg, #fff7fb 0%, #ffe3ef 48%, #fff1f6 100%);
  background-size: 8rem 8rem, 9rem 9rem, 11rem 11rem, auto;
}

body.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--cursor-spotlight-bg);
  opacity: 0;
  transition: opacity 220ms ease;
}

body.auth-page.is-cursor-active::before,
body.has-theme-cursor.is-cursor-active:not(.auth-page)::before {
  opacity: 1;
}

body.has-theme-cursor:not(.auth-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--cursor-spotlight-bg);
  opacity: 0;
  transition: opacity 220ms ease;
}

.theme-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  will-change: transform;
}

body.is-cursor-active .theme-cursor {
  opacity: 1;
}

.theme-cursor-orb,
.theme-cursor-ring,
.theme-cursor-shine {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius-full);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.theme-cursor-orb {
  width: var(--cursor-orb-size);
  height: var(--cursor-orb-size);
  background: var(--color-primary-2);
  box-shadow:
    0 0 18px rgba(var(--accent-rgb), 0.72),
    0 0 42px rgba(var(--accent-strong-rgb), 0.38);
}

.theme-cursor-ring {
  width: var(--cursor-ring-size);
  height: var(--cursor-ring-size);
  border: 1px solid var(--cursor-ring-border);
  background: var(--cursor-ring-bg);
  box-shadow:
    inset 0 0 18px rgba(var(--accent-rgb), 0.14),
    0 0 28px rgba(var(--accent-rgb), 0.16);
  transition:
    width 180ms ease,
    height 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.theme-cursor-shine {
  width: 1.45rem;
  height: 1.45rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 62%);
  opacity: 0.62;
  transform: translate(-50%, -50%) rotate(35deg);
  filter: blur(0.5px);
}

body.is-cursor-interactive .theme-cursor-ring {
  width: var(--cursor-ring-active-size);
  height: var(--cursor-ring-active-size);
  border-color: rgba(var(--accent-strong-rgb), 0.72);
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.26), transparent 66%);
}

.theme-cursor-trail {
  position: fixed;
  inset: 0;
  z-index: 119;
  pointer-events: none;
  overflow: hidden;
}

.theme-cursor-particle {
  position: fixed;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: var(--radius-full);
  background: var(--cursor-particle-bg);
  box-shadow: var(--cursor-particle-shadow);
  opacity: 0.62;
  transform: translate(-50%, -50%);
  animation: themeCursorTrail 620ms ease-out forwards;
}

.theme-cursor-particle.is-code {
  width: auto;
  height: auto;
  border-radius: 0;
  color: #21ff66;
  background: transparent;
  font-family: var(--font-code);
  font-size: 0.72rem;
  font-weight: 900;
  text-shadow: var(--cursor-particle-shadow);
  animation-duration: 900ms;
}

.theme-cursor-particle.is-kitty {
  width: auto;
  height: auto;
  min-width: 1.45rem;
  min-height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.34rem;
  border: 1px solid rgba(230, 0, 51, 0.18);
  border-radius: var(--radius-full);
  color: #e60033;
  background: rgba(255, 255, 255, 0.92);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: var(--cursor-particle-shadow);
  opacity: 0.9;
  animation-duration: 1300ms;
}

.theme-cursor-particle.is-kitty::before {
  content: "🎀";
  margin-right: 0.18rem;
  font-size: 0.78rem;
}

body.matrix-focus-mode .theme-cursor-particle.is-code {
  color: #7df9ff;
  font-size: 0.82rem;
  opacity: 0.78;
  text-shadow:
    0 0 12px rgba(33, 255, 102, 0.95),
    0 0 28px rgba(125, 249, 255, 0.55);
  animation-duration: 1600ms;
}

@keyframes themeCursorTrail {
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--trail-drift-x)), calc(-50% + var(--trail-drift-y))) scale(0.32);
  }
}

body.editor-open {
  overflow: hidden;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

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

textarea,
input {
  border: 0;
  outline: 0;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

::selection {
  background: rgba(var(--accent-rgb), 0.28);
}

.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;
}

.app-shell,
.auth-shell {
  width: min(100%, 1800px);
  margin: 0 auto;
}

.page-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) clamp(var(--space-4), 4vw, var(--space-8));
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

[data-theme="light"] .page-topbar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="kitty"] .page-topbar,
body.theme-kitty .page-topbar {
  border-bottom-color: rgba(230, 0, 51, 0.16);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 225, 236, 0.86)),
    color-mix(in srgb, var(--color-bg) 86%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: max-content;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.5rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  text-transform: none;
}

.brand-logo-default {
  display: inline-flex;
}

.brand-logo-ph {
  display: none;
}

.brand-logo-kitty {
  display: none;
}

.brand-logo-code {
  color: var(--color-text);
}

.brand-logo-forge-wrap,
.brand-logo-hub-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 0.18rem;
  padding: 0.18rem 0.42rem 0.24rem;
  border-radius: 0.45rem;
}

.brand-logo-forge-wrap {
  background: color-mix(in srgb, var(--color-surface) 72%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-border) 75%, transparent);
}

.brand-logo-forge,
.brand-logo-porn,
.brand-logo-hub {
  color: var(--color-text);
}

.brand-logo-hub-wrap {
  background: #000000;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.16), 0 0 20px rgba(var(--accent-rgb), 0.12);
}

.brand-logo-porn {
  color: #ffffff;
}

.brand-logo-hub {
  color: var(--accent);
}

[data-theme="kitty"] .brand-logo-default,
body.theme-kitty .brand-logo-default,
[data-theme="kitty"] .brand-logo-ph,
body.theme-kitty .brand-logo-ph {
  display: none;
}

[data-theme="kitty"] .brand-logo-kitty,
body.theme-kitty .brand-logo-kitty {
  display: inline-flex;
  gap: 0.2rem;
  color: #e60033;
  letter-spacing: 0;
}

.brand-logo-kitty-face {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border: 2px solid #4a2130;
  border-radius: 999px;
  color: #e60033;
  background: #ffffff;
  box-shadow: 0 0 0 0.2rem rgba(255, 111, 166, 0.16);
}

.brand-logo-kitty-wrap {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.46rem 0.24rem;
  border-radius: 999px;
  color: #ffffff;
  background: #e60033;
  box-shadow: 0 8px 20px rgba(230, 0, 51, 0.18);
}

[data-theme="kitty"] .brand-copy,
body.theme-kitty .brand-copy {
  color: #8b4a64;
}

[data-theme="phdark"] .brand-logo-default,
body.theme-phdark .brand-logo-default {
  display: none;
}

[data-theme="phdark"] .brand-logo-ph,
body.theme-phdark .brand-logo-ph {
  display: inline-flex;
}

[data-theme="phdark"] .brand-copy,
body.theme-phdark .brand-copy {
  display: none;
}

.brand-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

.brand-copy span {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.button,
.ghost-button,
.icon-button,
.tab-button,
.task-helper-button,
.task-complete-button,
.quiz-option,
.day-chip {
  transition:
    transform var(--transition),
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--color-muted);
  font-size: var(--text-sm);
  background: transparent;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-text);
  border-color: var(--color-border);
  background: var(--color-surface-2);
}

[data-theme="kitty"] .nav-link:hover,
[data-theme="kitty"] .nav-link.is-active,
body.theme-kitty .nav-link:hover,
body.theme-kitty .nav-link.is-active {
  color: #ffffff;
  border-color: rgba(230, 0, 51, 0.14);
  background: linear-gradient(135deg, #ff8fbd, #e60033);
  box-shadow: 0 10px 24px rgba(230, 0, 51, 0.14);
}

.button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.65rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 700;
}

.button {
  padding: var(--space-2) var(--space-5);
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--color-primary-2), var(--color-primary));
  box-shadow: var(--glow-orange);
}

.button:hover,
.ghost-button:hover,
.icon-button:hover,
.task-helper-button:hover,
.task-complete-button:hover,
.quiz-option:hover {
  transform: translateY(-1px);
}

.button:active,
.ghost-button:active,
.icon-button:active,
.task-helper-button:active,
.task-complete-button:active,
.quiz-option:active {
  transform: translateY(0);
}

.ghost-button,
.icon-button {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.ghost-button {
  padding: var(--space-2) var(--space-4);
}

.icon-button {
  width: 2.65rem;
  padding: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: max-content;
  min-height: 1.85rem;
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: var(--radius-full);
  color: var(--color-primary-2);
  background: rgba(var(--accent-rgb), 0.09);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

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

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  position: relative;
  z-index: 1;
}

.auth-grid {
  width: min(100%, 1120px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-8);
  align-items: center;
}

.auth-hero {
  padding: var(--space-8);
}

.auth-hero h1 {
  margin-top: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.auth-hero p {
  margin-top: var(--space-4);
  color: var(--color-muted);
  max-width: 60ch;
}

.feature-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-8);
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-muted);
}

.feature-list li::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.55);
}

.auth-card,
.panel,
.dashboard-card,
.task-card,
.quiz-card,
.doc-card,
.editor-shell,
.notes-shell,
.helper-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  box-shadow: var(--shadow-card);
}

.auth-card {
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.mini-code-window::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle 14rem at var(--theme-cursor-x) var(--theme-cursor-y), rgba(var(--accent-rgb), 0.18), transparent 62%);
  opacity: 0;
  transition: opacity 180ms ease;
}

body.auth-page.is-cursor-active .auth-card::before,
body.auth-page.is-cursor-active .mini-code-window::before {
  opacity: 1;
}

.auth-card > *,
.mini-code-window > * {
  position: relative;
  z-index: 1;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.form-stack {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field label {
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-soft);
  padding: var(--space-3) var(--space-4);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: var(--glow-orange);
}

.auth-error {
  min-height: 1.5rem;
  color: var(--color-error);
  font-size: var(--text-sm);
}

.mini-code-window {
  position: relative;
  margin-top: var(--space-8);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--surface-code);
}

.window-dots {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.window-dots span {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}

.mini-code-window pre {
  padding: var(--space-4);
  color: var(--code-text);
  font-family: var(--font-code);
  font-size: var(--text-sm);
  overflow: auto;
}

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

@media (max-width: 980px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    padding: var(--space-3);
  }
}

@media (max-width: 720px) {
  .page-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}
