:root {
  --color-background: #f8f8f8;
}

html {
  height: 100%;
  width: 100%;
  color-scheme: light dark;
}

body {
  font-family: Arial, sans-serif;
  margin: 20px;
  line-height: 1.6;
  background-color: var(--color-background);
}

@media (prefers-color-scheme: dark) {

  :root {
    --color-background: #121212;
  }
}

h1 {
  color: color-mix(in oklab, currentColor 35%, var(--color-background));
}

h2 {
  color: color-mix(in oklab, currentColor 45%, var(--color-background));
}

h3 {
  color: color-mix(in oklab, currentColor 55%, var(--color-background));
}

pre {
  background-color: color-mix(in oklab, currentColor 5%, var(--color-background));
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border-left: 4px solid color-mix(in oklab, currentColor 20%, var(--color-background));
  transition: all 0.2s ease;
}

/* Enhanced theme classes for better control */
.theme-light {
  --color-background: #f8f8f8;
  background-color: var(--color-background);
  color: #000000;
}

.theme-dark {
  --color-background: #121212;
  background-color: var(--color-background);
  color: #ffffff;
}

/* Button theming */
button {
  transition: all 0.2s ease;
  border: 1px solid color-mix(in oklab, currentColor 20%, var(--color-background));
  background-color: color-mix(in oklab, currentColor 10%, var(--color-background));
  color: currentColor;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
}

button:hover {
  background-color: color-mix(in oklab, currentColor 15%, var(--color-background));
  border-color: color-mix(in oklab, currentColor 30%, var(--color-background));
}

/* Input theming */
input {
  transition: all 0.2s ease;
  border: 1px solid color-mix(in oklab, currentColor 20%, var(--color-background));
  background-color: var(--color-background);
  color: currentColor;
  border-radius: 4px;
  padding: 8px;
}

input:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.4;
}

/* Syntax highlighting colors - Light theme */
.keyword {
  color: #0000FF;
  font-weight: 600;
}

.variable {
  color: #001080;
  font-weight: 500;
}

.function {
  color: #795E26;
  font-weight: 500;
}

.method {
  color: #795E26;
  font-weight: 500;
}

.property {
  color: #001080;
}

.string {
  color: #A31515;
}

.template {
  color: #A31515;
}

.number {
  color: #098658;
  font-weight: 500;
}

.comment {
  color: #008000;
  font-style: italic;
}

/* Theme switcher button styling */
.theme-switcher {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.theme-switcher button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-switcher button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Dark theme overrides for syntax highlighting */
body[data-theme="dark"] .keyword,
.theme-dark .keyword {
  color: #569CD6;
  font-weight: 600;
}

body[data-theme="dark"] .variable,
.theme-dark .variable {
  color: #9CDCFE;
  font-weight: 500;
}

body[data-theme="dark"] .function,
.theme-dark .function {
  color: #DCDCAA;
  font-weight: 500;
}

body[data-theme="dark"] .method,
.theme-dark .method {
  color: #DCDCAA;
  font-weight: 500;
}

body[data-theme="dark"] .property,
.theme-dark .property {
  color: #9CDCFE;
}

body[data-theme="dark"] .string,
.theme-dark .string {
  color: #CE9178;
}

body[data-theme="dark"] .template,
.theme-dark .template {
  color: #CE9178;
}

body[data-theme="dark"] .number,
.theme-dark .number {
  color: #B5CEA8;
  font-weight: 500;
}

body[data-theme="dark"] .comment,
.theme-dark .comment {
  color: #6A9955;
  font-style: italic;
}

/* System theme preference overrides when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) .keyword {
    color: #569CD6;
    font-weight: 600;
  }
  
  body:not([data-theme="light"]) .variable {
    color: #9CDCFE;
    font-weight: 500;
  }
  
  body:not([data-theme="light"]) .function {
    color: #DCDCAA;
    font-weight: 500;
  }
  
  body:not([data-theme="light"]) .method {
    color: #DCDCAA;
    font-weight: 500;
  }
  
  body:not([data-theme="light"]) .property {
    color: #9CDCFE;
  }
  
  body:not([data-theme="light"]) .string {
    color: #CE9178;
  }
  
  body:not([data-theme="light"]) .template {
    color: #CE9178;
  }
  
  body:not([data-theme="light"]) .number {
    color: #B5CEA8;
    font-weight: 500;
  }
  
  body:not([data-theme="light"]) .comment {
    color: #6A9955;
    font-style: italic;
  }

  .theme-switcher {
    background: rgba(45, 45, 45, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Dark theme styling for theme switcher */
body[data-theme="dark"] .theme-switcher {
  background: rgba(45, 45, 45, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Animations for theme notification */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}