:root {
  --background-gradient-start: #e8f1e4;
  --background-gradient-end: #c2d9bb;
  --header-background: #f8f8f8ea;
  --nav-link-color: #3d615d;
  --nav-link-color-32: #3d615d32;
  --nav-link-hover-color: #5f9c96;
  --title-color: #3d615d;
  --button-background: #5f9c96;
  --button-hover-background: #8cc2bb;
  --button-hover-background-0: #8cc2bb00;
  --button-active-background: #3d615d;
  --footer-background: #f8f8f8c8;
  --footer-text-color: #87a07f;
  --footer-text-color-0: #87a07f00;

  --score-color-0: #ff7f00;
  --score-color-1: #ff9f00;
  --score-color-2: #ff8f00;
  --score-color-3: #ffbf00;
  --score-color-4: #ffaf00;
  --footer-height: 10%;
}

@font-face {
  font-family: "Handjet";
  src: url("Handjet.ttf");
  font-weight: 100 900;
  font-stretch: 25% 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  box-sizing: border-box;
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  font-family: "Handjet", cursive;
  font-weight: 400;
  background-color: green;
  font-size: 1.6rem;
  margin: 0;
  padding: 0;
  color: var(--title-color);
  background: radial-gradient(
    circle,
    var(--background-gradient-start),
    var(--background-gradient-end)
  );
  animation:
    bgGradient 240s infinite linear,
    radialPulse 6s infinite ease-in-out;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: -42;
}

#game-canvas {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.1);
  /* Adjust the opacity as needed */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-stats {
  font-size: 4vw;
  color: var(--title-color);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* Center the text */
  pointer-events: none;
  user-select: none;
  z-index: -4;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

#score-display,
#timer-display {
  display: inline-block;
  font-size: 10vw;
}

#game-message {
  position: fixed;
  display: inline-block;
  z-index: 3;
  bottom: 100%;
  /* Adjust this value as needed */
  color: white;
  padding: 20px;
  border: 2px solid white;
  background: rgba(0, 0, 0, 0.7);
  display: none;
}

[data-theme="dark"] {
  --background-gradient-start: #232323;
  --background-gradient-end: #535353;
  --header-background: #333333ea;
  --nav-link-color: #ffffff;
  --nav-link-color-32: #ffffff32;
  --nav-link-hover-color: #cccccc;
  --title-color: #ffffff;
  --button-background: #666666;
  --button-hover-background: #999999;
  --button-hover-background-0: #99999900;
  --button-active-background: #333333;
  --footer-background: #333333c8;
  --footer-text-color: #cccccc;
  --footer-text-color-0: #cccccc00;
}

[data-theme="light"] {
  --background-gradient-start: #e8f1e4;
  --background-gradient-end: #c2d9bb;
  --header-background: #f8f8f8ea;
  --nav-link-color: #3d615d;
  --nav-link-color-32: #3d615d32;
  --nav-link-hover-color: #5f9c96;
  --title-color: #3d615d;
  --button-background: #5f9c96;
  --button-hover-background: #8cc2bb;
  --button-hover-background-0: #8cc2bb00;
  --button-active-background: #3d615d;
  --footer-background: #f8f8f8c8;
  --footer-text-color: #87a07f;
  --footer-text-color-0: #87a07f00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-gradient-start: #232323;
    --background-gradient-end: #535353;
    --header-background: #333333ea;
    --nav-link-color: #ffffff;
    --nav-link-color-32: #ffffff32;
    --nav-link-hover-color: #cccccc;
    --title-color: #ffffff;
    --button-background: #666666;
    --button-hover-background: #999999;
    --button-hover-background-0: #99999900;
    --button-active-background: #333333;
    --footer-background: #333333c8;
    --footer-text-color: #cccccc;
    --footer-text-color-0: #cccccc00;
  }
}

@media (prefers-color-scheme: light) or (prefers-color-scheme: no-preference) {
  :root {
    --background-gradient-start: #e8f1e4;
    --background-gradient-end: #c2d9bb;
    --header-background: #f8f8f8ea;
    --nav-link-color: #3d615d;
    --nav-link-color-32: #3d615d32;
    --nav-link-hover-color: #5f9c96;
    --title-color: #3d615d;
    --button-background: #5f9c96;
    --button-hover-background: #8cc2bb;
    --button-hover-background-0: #8cc2bb00;
    --button-active-background: #3d615d;
    --footer-background: #f8f8f8c8;
    --footer-text-color: #87a07f;
    --footer-text-color-0: #87a07f00;
  }
}

form#joinUsForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--background-gradient-end);
  border-radius: 5px;
  color: var(--title-color);
}

form#joinUsForm label {
  font-weight: bold;
}

form#joinUsForm input[type="text"],
textarea {
  font-family: "Handjet", cursive;
  font-size: 3.3rem;
  padding: 10px;
  border: 1px solid var(--nav-link-color);
  border-radius: 5px;
  resize: none;
}

textarea {
  height: 16rem;
}

form#joinUsForm input[type="number"] {
  font-size: large;
  border: none;
  background: none;
  color: var(--title-color);
  font-weight: bold;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
}

form#joinUsForm input[type="submit"] {
  padding: 10px;
  border: none;
  border-radius: 5px;
  background: var(--button-background);
  color: white;
  cursor: pointer;
  transition: background 0.3s ease-in-out;
}

form#joinUsForm input[type="submit"]:hover {
  background: var(--button-hover-background);
}

form#joinUsForm input[type="submit"]:active {
  background: var(--button-active-background);
}

form#joinUsForm .gdpr-consent {
  display: flex;
  align-items: center;
  gap: 5px;
}

form#joinUsForm .gdpr-consent input[type="checkbox"] {
  margin-top: 3px;
}

h1 {
  font-weight: 900;
  overflow: hidden;
  border-right: 0.15em solid orange;
  max-width: fit-content;
  white-space: nowrap;
  margin: 0 auto;
  letter-spacing: 0.15em;
  animation:
    typing 3.5s steps(40, end) forwards,
    blink-caret 0.75s step-end infinite;
}

h2 {
  font-weight: 600;
}

header {
  padding: 2.5rem;
  text-align: center;
  border-bottom: 0.15rem solid var(--nav-link-color);
  background-color: var(--header-background);
  width: 100%;
  min-height: 0;
  border-radius: 1rem;
  position: relative;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(0.2rem);
}

.nav-boss {
  background-color: var(--header-background);
  backdrop-filter: blur(0.2rem);
  color: var(--nav-link-color);
  border-bottom: 0.15rem solid var(--nav-link-color);
}

nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 120rem;
}

nav ul li a {
  color: var(--nav-link-color);
  transition: color 0.2s ease-in-out;
  text-decoration: none;
  padding: 1rem;
  border-radius: 0.5rem;
  display: block;
  transition: background 0.3s;
}

nav ul li a:hover {
  color: var(--nav-link-hover-color);
  transition: color 0.2s ease-in-out;
  background-color: rgba(95, 156, 150, 0.1);
}

h1,
h2 {
  transition: color 0.2s ease-in-out;
  filter: drop-shadow(0.256rem 0.064rem 0.05rem var(--footer-text-color));
  margin-bottom: 1rem;
  color: var(--title-color);
}

section {
  scroll-margin-top: 4rem;
  margin-left: 4rem;
  margin-right: 4rem;
}

section:last-of-type {
  margin-bottom: 20rem;
}

button {
  background-color: var(--button-background);
  border: none;
  color: #f8f8f2;
  padding: 1.5rem 3rem;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 1.8rem;
  transition: background-color 0.2s ease-in-out;
  cursor: pointer;
  border-radius: 2.5rem;
  box-shadow: 0 0.8rem 1.5rem rgba(0, 0, 0, 0.1);
  margin-top: 2rem;
  transition: transform 0.3s;
}

button:hover {
  background-color: var(--button-hover-background);
  transition: background-color 0.2s ease-in-out;
  transform: scale(1.05);
  box-shadow: 0 0 2rem var(--button-hover-background);
}

button:active {
  background-color: var(--button-active-background);
  transition: background-color 0.2s ease-in-out;
  transform: scale(0.95);
  box-shadow: 0 0 2rem var(--button-active-background);
}

footer {
  position: fixed;
  left: 0;
  bottom: 0;
  background-color: var(--footer-background);
  padding: 1rem;
  text-align: center;
  color: var(--footer-text-color);
  justify-content: center;
  align-items: center;
  border-top: 0.15rem solid var(--nav-link-color);
  width: 100%;
  height: var(--footer-height);
  z-index: 1;
  /* allow click through */
  backdrop-filter: blur(0.2rem);
  pointer-events: none;
}

footer p {
  margin: 0;
  padding: 0;
  font-size: 3rem;
}

main {
  margin-bottom: var(--footer-height);
  display: flex;
  flex-direction: column;
  gap: 3rem;
  flex: 1;
  width: 100%;
  padding: 2rem;
  max-width: 120rem;
  height: calc(100% - var(--footer-height));
  overflow: auto;
  z-index: 0;
}

.switch {
  z-index: 2;
  display: inline-block;
  margin-right: 1rem;
  height: 100%;
  width: 3.6rem;
  flex-grow: 0;
  position: relative;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  max-height: 3.2rem;
  /* Change to 2 * 1.6 (base font size) */
  /* Set a maximum height */
  transform-origin: center;
  /* Set the transform origin to center */
}

.slider:before {
  position: absolute;
  content: "";
  height: 1.625rem;
  /* Change to 26 * 1.6 (base font size) */
  width: 1.625rem;
  /* Change to 26 * 1.6 (base font size) */
  left: 0.25rem;
  /* Change to 4 * 1.6 (base font size) */
  bottom: 0.25rem;
  /* Change to 4 * 1.6 (base font size) */
  background-color: white;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #12b625;
}

input:checked + .slider:before {
  transform: translateX(100%);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hide-on-game {
  transition: height 0.15s ease-in-out;
}

.blur-on-game {
  transition: filter 0.25s ease-in-out;
}

nav {
  position: sticky;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
  top: 0;
  z-index: 1;
  width: 100%;
  max-width: 120rem;
  transition: all 0.3s ease;
  background-color: transparent;
  backdrop-filter: none;
  border-bottom: none;
}

.flash-score {
  animation: rainbowColor 0.2s infinite alternate;
}

@keyframes rainbowColor {
  0% {
    color: var(--score-color-0);
  }

  20% {
    color: var(--score-color-1);
  }

  40% {
    color: var(--score-color-2);
  }

  60% {
    color: var(--score-color-3);
  }

  80% {
    color: var(--score-color-4);
  }

  100% {
    color: var(--score-color-0);
  }
}

@keyframes radialPulse {
  0% {
    background-size:
      30% 30%,
      100% 100%,
      100% 100%;
  }

  50% {
    background-size:
      100% 100%,
      100% 100%,
      30% 30%;
  }

  100% {
    background-size:
      30% 30%,
      100% 100%,
      100% 100%;
  }
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from,
  to {
    border-color: transparent;
  }

  50% {
    border-color: orange;
  }
}

/* Styles for screens smaller than 768px */
@media (max-width: 768px) {
  html {
    font-size: 50%;
    /* reduce the base font size for small screens */
  }

  header {
    width: 100%;
    padding: 1vw;
    text-align: center;
  }

  /* 
  .switch {
    width: 3.6rem;
    height: 2rem;
    bottom: 0;
    right: .8rem;
  } */

  h1,
  h2 {
    /* Adjust heading sizes for better visibility */
    overflow: visible;
    /* Allow text to wrap */
    white-space: normal;
    /* Allow text to wrap */
  }

  h1 {
    font-size: 4rem;
  }

  h2 {
    font-size: 3.6rem;
  }

  nav ul li a {
    padding: 0.5rem;
  }

  button {
    font-size: 1.6rem;
    /* Adjust button font size */
    padding: 1.2rem 2.4rem;
    /* Adjust button padding */
  }

  main {
    padding: 1rem;
  }

  footer {
    padding: 0.8rem;
    font-size: 1.4rem;
  }

  #game-stats {
    font-size: 10vw;
    /* adjust the game stats font size for better visibility */
  }

  #score-display,
  #timer-display {
    font-size: 20vw;
    /* adjust the score display and timer display font size for better visibility */
  }
}

/* Styles for screens larger than 768px but smaller than 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  header {
    width: 90%;
  }

  h1 {
    font-size: 3.6rem;
  }

  h2 {
    font-size: 2.8rem;
  }

  button {
    font-size: 2rem;
    padding: 2rem 4rem;
  }

  /* 
  .switch {
    bottom: 0;
    right: 1vw;
    width: 3rem;
    height: 2rem;
  } */

  body {
    margin-bottom: 0;
  }

  .footer {
    position: relative;
  }
}

/* Styles for screens larger than 1024px */
@media (min-width: 1024px) {
  header {
    width: 75%;
  }

  h1 {
    font-size: 7rem;
  }

  h2 {
    font-size: 3.6rem;
  }

  button {
    font-size: 2.4rem;
    padding: 2.4rem 4.8rem;
  }
}

.section-card {
  border-radius: 1rem;
  align-items: center;
  justify-content: center;
  padding: 0 4rem 2.5rem 2.5rem;
}

.section-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.marginated {
  margin-right: 30%;
}

.img-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  margin-top: 0.3rem;
  margin-right: 0.3rem;
  margin-bottom: 0.3rem;
  border-radius: 8rem 1rem 1rem 8rem;
  /* filter: blur LEFT EDGE */
  filter: blur(0.15rem);
  overflow: hidden;
  z-index: -1;
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  position: relative;
  /* inset box-shadow with transparent color!!! */
}

.img-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

@media (prefers-color-scheme: dark) {
  .section-card {
    background-color: #33333380;
  }
}

@media (prefers-color-scheme: light) or (prefers-color-scheme: no-preference) {
  .section-card {
    background-color: #f8f8f880;
  }
}

[data-theme="dark"] .section-card {
  background-color: #33333380;
}

[data-theme="light"] .section-card {
  background-color: #f8f8f880;
}

/* svg and animations */

#fw-svg {
  fill: var(--title-color);
}

#controller-container {
  width: 100%;
  /* take up the full width of the screen */
  height: 100%;
  /* take up the full height of the screen */
  position: fixed;
  /* fix the position so it always covers the screen */
  z-index: -50;
  /* adjust as needed to layer elements properly */
  pointer-events: none;
  /* let clicks pass through to underlying elements */
}

#controller_image {
  position: relative;
  width: 100%;
  /* adjust as needed to size the SVG properly */
  height: auto;
  /* keep the aspect ratio */
  top: 50%;
  /* position it in the center of the screen */
  left: 50%;
  /* position it in the center of the screen */
  transform: translate(-25%, -54.5%);
  user-select: none;
  transition:
    opacity 0.5s ease-in-out,
    transform 0.3s ease-in-out;
  /* transition as before */
}

#controller_image.visible {
  opacity: 1;
  /* make it visible when the .visible class is added */
}

.rect {
  fill: rgba(0, 0, 0, 0);
  /* animation: change 3s infinite; */
}

.inset {
  display: none;
}

.inset.c1 {
  fill: var(--footer-text-color);
  /* animation: -change 3s infinite; */
}

.inset.c2 {
  fill: var(--button-hover-background);
  /* animation: change 3s infinite; */
}

.c1 {
  animation: move_1_forwards 0.6s ease-in-out forwards paused;
}

.c2 {
  animation: move_2_forwards 0.6s ease-in-out forwards paused;
}

/* Animation definitions */
@keyframes move_1_forwards {
  0% {
    transform: translate(-80%, 100%);
  }

  60% {
    fill: var(--button-hover-background-0);
  }

  100% {
    transform: translateY(0);
    fill: var(--button-hover-background);
  }
}

@keyframes move_2_forwards {
  0% {
    transform: translate(80%, -100%);
  }

  60% {
    fill: var(--footer-text-color-0);
  }

  100% {
    transform: translateY(0);
    fill: var(--footer-text-color);
  }
}

@keyframes move_1_backwards {
  0% {
    transform: translateY(0);
    fill: var(--button-hover-background);
  }

  60% {
    fill: var(--button-hover-background-0);
  }

  100% {
    transform: translate(-80%, 100%);
  }
}

@keyframes move_2_backwards {
  0% {
    transform: translateY(0);
    fill: var(--footer-text-color);
  }

  60% {
    fill: var(--footer-text-color-0);
  }

  100% {
    transform: translate(80%, -100%);
  }
}

/* gradually change c1 and c2 fillings */
@keyframes change {
  0% {
    fill: var(--button-hover-background);
  }

  50% {
    fill: var(--footer-text-color);
  }

  100% {
    fill: var(--button-hover-background);
  }
}

@keyframes -change {
  0% {
    fill: var(--footer-text-color);
  }

  50% {
    fill: var(--button-hover-background);
  }

  100% {
    fill: var(--footer-text-color);
  }
}
