* {
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

body {
  background-color: #0c1827;
  color: #ff9465;
  font-family: "Sono", monospace;
  font-optical-sizing: auto;
  font-variation-settings: "MONO" 1;
  display: flex;
  flex-direction: column;
}

a {
  transition: opacity 0.2s ease-in-out;
}

a:link,
a:visited {
  color: inherit;
  opacity: 0.7;
}

a:hover {
  opacity: 1;
}

/* Loading state - hide content until ready */
.page-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.page-content.loaded {
  opacity: 1;
}

.main-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 32px 16px;
  gap: 32px;
}

.bio {
  width: min(410px, 40%);
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-size: 16px;
}

.bio a:link,
.bio a:visited {
  opacity: 0.9;
}

.canvas-container {
  width: min(800px, 50%);
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

#canvas {
  width: 100%;
  height: 100%;
  outline: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  flex-shrink: 0;
}

.separator {
  opacity: 0.5;
}

#loader {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: animloader 2s linear infinite alternate;
  transition: opacity 0.3s ease-in-out;
  opacity: 1;
}

#loader.loaded {
  opacity: 0;
}

@keyframes animloader {
  0% {
    box-shadow:
      -38px -6px,
      -14px 6px,
      14px -6px;
  }
  33% {
    box-shadow:
      -38px 6px,
      -14px -6px,
      14px 6px;
  }
  66% {
    box-shadow:
      -38px -6px,
      -14px 6px,
      14px -6px;
  }
  100% {
    box-shadow:
      -38px 6px,
      -14px -6px,
      14px 6px;
  }
}

#debug-overlay-tr {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  pointer-events: none;
  font-size: 12px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

#debug-overlay-tr.loaded {
  opacity: 0.5;
}

#debug-overlay-bl {
  font-size: 12px;
  opacity: 0.5;
}

/* Medium screens: tighter side-by-side */
@media (max-width: 1024px) {
  .bio {
    width: min(320px, 35%);
    font-size: 15px;
  }

  .canvas-container {
    width: min(500px, 55%);
  }
}

/* Small screens: stack vertically, canvas first */
@media (max-width: 876px) {
  #debug-overlay-bl {
    display: none;
  }

  #wind-dir,
  #spring-force {
    display: none;
  }

  .footer {
    justify-content: center;
  }

  .main-content {
    flex-direction: column-reverse;
    flex-wrap: nowrap;
    padding: 24px 16px;
    gap: 8px;
    justify-content: center;
  }

  .bio {
    width: 100%;
    font-size: 15px;
    gap: 20px;
    flex-shrink: 0;
  }

  .canvas-container {
    width: min(400px, 90%);
    max-height: 33vh;
    flex-shrink: 1;
  }
}
