:root {
  --theme-bg-dark: #0a0a0a;
  --theme-ink-dark: #f0f0f0;
  --theme-bg-light: #f0f0f0;
  --theme-ink-light: #0a0a0a;
  --theme-cursor: #fff;
  color-scheme: dark;
}

html[data-theme="dark"] {
  --bg: var(--theme-bg-dark);
  --ink: var(--theme-ink-dark);
  --gray: #2a2a2a;
  --gray2: #8a8a8a;
  --gray3: #2a2a2a;
  --theme-cursor: #fff;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: var(--theme-bg-light);
  --ink: var(--theme-ink-light);
  --gray: #d8d8d8;
  --gray2: #666;
  --gray3: #cfcfcf;
  --theme-cursor: #0a0a0a;
  color-scheme: light;
}

html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] [data-composition-id="zaydan-intro"] {
  background: var(--bg) !important;
  color: var(--ink);
}

html,
body,
body *,
body *::before,
body *::after {
  cursor: none !important;
}

#theme-toggle {
  position: fixed;
  top: auto !important;
  right: auto !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  left: 12px !important;
  z-index: 10000 !important;
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--ink) 38%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  color: var(--ink);
  padding: 3px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#theme-toggle button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 12px/1.1 'VT323', 'Lora', Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 5px 7px 6px;
}

#theme-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}

#theme-toggle:hover {
  border-color: var(--ink);
}

#cursor {
  z-index: 10003 !important;
}

#cursor-bubble {
  z-index: 10002 !important;
}

#trail-canvas {
  z-index: 10001 !important;
}

html[data-theme="light"] #cursor {
  background: var(--theme-cursor);
}

html[data-theme="light"] #cursor-bubble {
  background: #0a0a0a;
}

html[data-theme="light"] #cursor-label {
  color: #f0f0f0;
}

html[data-theme="light"] #trail-canvas {
  filter: invert(1);
}

html[data-theme="light"] #arrow-path,
html[data-theme="light"] #arrow-head {
  stroke: #0a0a0a !important;
}

html[data-theme="dark"] #trail-canvas {
  filter: none !important;
}

html[data-theme="light"] #page-out {
  background: var(--ink) !important;
}

html[data-theme="light"] #header,
html[data-theme="light"] #safe-area-top {
  background: var(--bg) !important;
}

html[data-theme="light"] #upcoming-ticker {
  background: var(--bg) !important;
  border-bottom-color: rgba(10,10,10,.14) !important;
}

html[data-theme="light"] .upcoming-group span {
  color: rgba(10,10,10,.82) !important;
  text-shadow: none !important;
}

html[data-theme="light"] .pixel-btn {
  color: rgba(10,10,10,.58) !important;
}

html[data-theme="light"] .pixel-btn:hover {
  color: #0a0a0a !important;
  text-shadow: none !important;
}

html[data-theme="light"] body::after,
html[data-theme="light"] #intro-grain {
  mix-blend-mode: multiply;
}

html[data-theme="light"] #intro-screen {
  background: var(--bg);
}

html[data-theme="light"] #intro-title,
html[data-theme="light"] #intro-name,
html[data-theme="light"] #masthead-text,
html[data-theme="light"] #z-masthead-text {
  color: var(--ink);
  text-shadow: none;
}

html[data-theme="dark"] #intro-title,
html[data-theme="dark"] #intro-name,
html[data-theme="dark"] #masthead-text,
html[data-theme="dark"] #z-masthead-text {
  color: #f0f0f0 !important;
}

html[data-theme="light"] #intro-wordmark,
html[data-theme="light"] #masthead-reference {
  filter: invert(1) drop-shadow(0 0 22px rgba(0,0,0,0.08));
}

html[data-theme="dark"] #intro-wordmark,
html[data-theme="dark"] #masthead-reference {
  filter: none !important;
}

html[data-theme="light"] #z-masthead-guide {
  color: rgba(10,10,10,.38);
}

html[data-theme="light"] #masthead-guide,
html[data-theme="light"] #masthead-replay {
  color: rgba(10,10,10,.42) !important;
}

html[data-theme="dark"] #masthead-guide,
html[data-theme="dark"] #masthead-replay {
  color: rgba(255,255,255,.24) !important;
}

html[data-theme="light"] #z-divider,
html[data-theme="light"] #z-progress {
  background: rgba(10,10,10,.14);
}

html[data-theme="light"] #box-0 {
  background: var(--bg);
}

html[data-theme="light"] .p-popup-overlay {
  background: rgba(240,240,240,.52);
}

html[data-theme="light"] .p-popup-box {
  background: #0a0a0a;
  color: #f0f0f0;
}

html[data-theme="light"] .p-popup-content,
html[data-theme="light"] .p-popup-close {
  color: #f0f0f0;
}

html[data-theme="light"] .p-popup-content a {
  color: #f0f0f0;
  border-bottom-color: rgba(240,240,240,.35);
}

html[data-theme="light"] .z-popup-overlay {
  background: rgba(240,240,240,.52);
}

html[data-theme="light"] .z-popup-box {
  background: #fff;
  color: #0a0a0a;
}

html[data-theme="light"] .z-popup-content,
html[data-theme="light"] .z-popup-close,
html[data-theme="light"] .z-popup-content a {
  color: #0a0a0a;
}

html[data-theme="light"] .project-media::after {
  color: rgba(10,10,10,.66);
}

html[data-theme="light"] .project-card:hover .project-name,
html[data-theme="light"] .project-card:focus-visible .project-name {
  color: #0a0a0a;
}

html[data-theme="light"] .archive-shell,
html[data-theme="light"] .work-intro,
html[data-theme="light"] .project-card {
  border-color: var(--gray3);
}

html[data-theme="light"] .canvas-hint,
html[data-theme="light"] .project-tags {
  color: rgba(10,10,10,.52);
}

html[data-theme="light"] .reset-canvas {
  border-color: rgba(10,10,10,.2);
  background: rgba(240,240,240,.72);
  color: var(--ink);
}

html[data-theme="light"] .freeform-canvas {
  background:
    linear-gradient(rgba(10,10,10,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10,10,10,0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: -1px -1px;
}

html[data-theme="light"] .freeform-canvas::after {
  background: linear-gradient(180deg, rgba(240,240,240,0.08), rgba(240,240,240,0.68));
}

html[data-theme="light"] .archive-item {
  border-color: rgba(10,10,10,.2);
  background: rgba(242,242,242,.9);
  box-shadow: 0 18px 44px rgba(0,0,0,.14);
}

#panel-2-writing {
  display: none !important;
}
