/* Global layout */
html {
  min-height: 100%;
  background: #05070a;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  color: var(--text-color);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: transparent;
}

/* Full-screen gradient + noise background, independent of scroll/zoom */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-size: 400% 400%, 180px 180px;
  background-repeat: no-repeat, repeat;
  background-position: center center, top left;
  transition: opacity 0.35s ease;
}

/* Dark theme gradient (default) */
body::before {
  background-image:
    linear-gradient(135deg, #0a0c20 0%, #0f1b37 50%, #1b2d4e 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3' stitchTiles='noStitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.40'/></svg>");
  opacity: 1;
}

/* Light theme gradient */
body::after {
  background-image:
    linear-gradient(135deg, #e8f0ff 0%, #d0e2ff 50%, #bcd4ff 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3' stitchTiles='noStitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.40'/></svg>");
  opacity: 0;
}

/* When light mode is active, fade from dark layer to light layer */
body:not(.dark-theme)::before {
  opacity: 0;
}

body:not(.dark-theme)::after {
  opacity: 1;
}

/* Page container */
.page {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

/* Box containers */
.container {
  width: min(70vmin, 480px);
  position: relative;
  margin: 0 auto;
}

/* Result container visibility */
.result-container {
  display: none;
}

.page.show-results {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.page.show-results .result-container {
  display: block;
  margin: 0;
}
