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

html, body {
  height: 100%;
  min-height: 100vh;
}

body {
  background: #ffffff;
  color: #000000;
  width: 100%;
  font-family: "Courier New", Courier, monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: background-color, color;
  contain: layout style;
}

/* Faster transitions for high refresh displays */
@media (min-resolution: 120dpi) {
  body {
    transition-duration: 0.15s;
  }
}

/* Dark mode styles */
.dark body {
  background: #000000;
  color: #ffffff;
}

.dark ::selection {
  background: rgba(255, 255, 255, 0.99);
  color: #000;
}

::selection {
  background: rgba(0, 0, 0, 0.99);
  color: #fff;
}

.dark .text a:hover {
  border-bottom-color: transparent;
}

.dark .link:hover {
  border-bottom-color: transparent;
}

.text {
  display: block;
  opacity: 1;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: bold;
  font-variant-ligatures: normal;
  visibility: visible;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.text p,
.text h1,
.animated-section {
  opacity: 1;
  display: block;
  visibility: visible;
  margin-bottom: 1.5rem;
}

.animated-section {
  margin-bottom: 0;
}

.text a {
  text-decoration: none;
  border-bottom: 3px solid currentColor;
  color: inherit;
  padding-bottom: 2px;
  margin: 0 0.5rem;
  font-weight: bold;
}

.text a:hover {
  border-bottom-color: transparent;
}

.currentSection {
  margin-top: 4rem;
}

.currentSection h2,
.text h1,
.animated-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.currentList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.currentList li {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
}

.currentList li:before {
  content: "–";
  margin-right: 1rem;
}

.link {
  border-bottom: 3px solid currentColor;
  display: inline-block;
  line-height: 1;
  text-decoration: none;
  color: inherit;
}

.link:hover {
  border-bottom-color: transparent;
}

/* Dark mode support for animations and text */
.dark .text {
  color: #ffffff;
}

.dark .text a {
  color: #ffffff;
}

.dark .link {
  color: #ffffff;
}

.dark .currentSection h2 {
  color: #ffffff;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 50;
  padding: 0.75rem;
  background: none;
  border: none;
  color: #666666;
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 1.25rem;
  font-family: "Courier New", Courier, monospace;
  line-height: 1;
}

.theme-toggle:hover {
  color: #808080;
}

.dark .theme-toggle {
  color: #999999;
}

.dark .theme-toggle:hover {
  color: #cccccc;
}

@keyframes fadein {
  0% {
    opacity: 0;
    transform: translateY(10px) translateZ(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

/* Optimize animations for high refresh rate displays */
@media (min-resolution: 120dpi) and (prefers-reduced-motion: no-preference) {
  .text p,
  .text h1 {
    animation-duration: 0.15s;
  }
}

@media (min-resolution: 192dpi) {
  .text p,
  .text h1 {
    animation-duration: 0.1s;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
}