:root {
  --beige: #f4e2d0;
  --dark-brown: #4b2e1f;
  --light-brown: #a67c52;
  --yellow: #f7c84c;
  --sand: #e0c097;
  --margin-controls: calc(clamp(3.125rem, 12.5vh + 0.625rem, 4.375rem) * -1);
  --margin-btn-height: clamp(1rem, 5vh + 0rem, 1.5rem);
  --height-instructions: clamp(9.375rem, 41.579vh + 1.059rem, 19.25rem);
  --gap-start-screen-content: clamp(0.375rem, 6.842vh - 0.993rem, 2rem);
  --gap-main: clamp(0.5rem, 40vh - 15rem, 5rem);
  --font-size-h1: clamp(2.5rem, 8.421vh + 0.816rem, 4.5rem);
  --font-size-h2: clamp(1.5rem, 10vh - 0.5rem, 4.5rem);
  --margin-canvas: clamp(0rem, 51.429vh - 21.214rem, 4.5rem);
  --margin-canvas-small: clamp(0rem, 56.25vh - 18rem, 4.5rem);
  --margin-btn-overlay: clamp(0.5rem, 8.75vh - 1.25rem, 1.375rem);
  --heigth-btn-overlay: clamp(20rem, 68.75vw - 0.625rem, 31rem);
  --height-spacer-vh: clamp(10.375rem, 42.045vh + 1.966rem, 15rem);
  --height-spacer-vw: clamp(10.375rem, 30.833vw + 1.125rem, 15rem);
  --height-overlay-wrapper: clamp(2.5rem, 4.762vh + 1.548rem, 3rem);
}

@font-face {
  font-family: 'Stardos Stencil';
  src: url('./assets/fonts/StardosStencil-Regular.ttf') format('truetype');
  font-weight: normal;
  font-display: swap;

}

@font-face {
  font-family: 'Stardos Stencil';
  src: url('./assets/fonts/StardosStencil-Bold.ttf') format('truetype');
  font-weight: bold;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('./assets/fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('./assets/fonts/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

.d-flex {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--beige);
  color: var(--dark-brown);
  background-image: url('assets/img/ui/background.webp');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(244, 226, 208, 0.6);
  z-index: -1;
}

main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

h1 {
  font-family: 'Stardos Stencil', cursive;
  font-weight: bold;
  font-size: 72px;
  color: var(--dark-brown);
  text-shadow: 2px 2px var(--light-brown);
  margin-top: 0px;
  margin-bottom: 0px;
}

h2 {
  font-family: 'Stardos Stencil', cursive;
  font-size: var(--font-size-h2);
  color: var(--dark-brown);
  text-shadow: 2px 2px var(--light-brown);
  margin-top: 20px;
  margin-bottom: 20px;
}

.fullscreen-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Canvas styling */
canvas {
  display: block;
  position: relative;
  background-color: black;
  border: 8px solid var(--dark-brown);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  margin-top: var(--margin-canvas);
}

.btn-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: calc(var(--heigth-btn-overlay) * -1);
  height: var(--heigth-btn-overlay);
  width: 720px;
}

/* Overlay Buttons */
.game-menu-wrapper {
  margin-top: var(--margin-btn-overlay);
  height: var(--height-overlay-wrapper);
  width: min(720px, 100%);
  position: relative;
  z-index: 10;
}

.game-menu {
  position: relative;
  z-index: 10;
}

.game-menu-content {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 12px;
}

.endscreen-menu {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
}

.endscreen-menu-content {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.spacer {
  height: min(var(--height-spacer-vh), var(--height-spacer-vw));
  width: 100px;
}

.endscreen-menu-content button {
  max-width: 200px;
}

.controls-wrapper {
  position: relative;
  width: min(720px, 100%);
  height: var(--height-overlay-wrapper);
  z-index: 10;
  margin-bottom: var(--margin-btn-overlay);
}

.controls {
  position: relative;
  z-index: 10;
}

.controls-content {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
}

.controls-content button {
  background-color: rgba(75, 46, 31, 0.2);
  border-color: rgba(166, 124, 82, 0.5);
}

.controls-movement,
.controls-action {
  display: flex;
  gap: 16px;
}

.start-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(244, 226, 208, 1);
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url('assets/img/ui/background.webp');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

.start-screen-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  justify-content: space-between;
}

#info-and-controls-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px 24px 0 24px;
  max-height: var(--height-instructions);
  width: auto;
  border-radius: 24px;
  border: 4px solid var(--dark-brown);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#input-instructions {
  margin: 0;
  max-width: 100%;
  width: clamp(19rem, 84.474vh + 2.105rem, 39.063rem);
  height: 100%;
}

#info {
  box-sizing: border-box;
  margin: 0;
  max-width: 625px;
  text-align: justify;
  padding: 24px;
  color: black;
  font-family: "Stardos Stencil";
  font-size: 20px;
  background-color: var(--light-brown);
  height: var(--height-instructions);
  width: auto;
}

strong {
  font-size: 24px;
}

.legal-links {
  margin-top: 12px;
  color: var(--dark-brown);
  font-size: 14px;
}

.legal-links a {
  color: var(--dark-brown);
}

.keyboard-controls {
  max-width: 100%;
  width: 800px;
  height: auto;
  margin-top: 10px;
}

.btn-wrapper {
  display: flex;
  gap: 16px;
}

/* Button Design */
.btn {
  display: flex;
  background-color: var(--yellow);
  color: var(--dark-brown);
  border: 2px solid var(--light-brown);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background-color: var(--light-brown);
  color: white;
}

.btn-start {
  box-shadow: 2px 2px var(--light-brown);
  width: 160px;
  display: flex;
  justify-content: center;
}

.btn-start:hover {
  box-shadow: 3px 3px var(--dark-brown);
}

.btn-muted {
  background-color: #8b0000;
  color: #fff8dc;
  border: 2px solid #5c1a0b;
  box-shadow: 0 0 6px rgba(139, 0, 0, 0.5);
}

.btn-muted:hover {
  background-color: #a52a2a;
  color: white;
  box-shadow: 0 0 8px rgba(255, 69, 0, 0.6);
}

.btn-fullscreen img,
.btn-mute img,
.btn-restart img,
.btn-quit img,
.btn-control img {
  height: var(--margin-btn-height);
}

.landscape-request {
  display: none;
}

.loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url('assets/img/ui/background.webp');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
}

@media (max-height: 700px) {
  h1 {
    font-size: var(--font-size-h1);
  }

  main {
    padding: 0px;
  }

  .start-screen-content img {
    height: var(--height-instructions);
  }

  .start-screen-content {
    gap: var(--gap-start-screen-content);
  }
}

@media (max-height: 640px) {
  h2 {
    display: none;
  }

  canvas {
    margin-top: var(--margin-canvas-small);
  }
}

/* Smartphones */
@media only screen and (max-width: 736px) {

  main {
    padding: 0px;
  }

  canvas {
    width: 100%;
    border: none;
    border-radius: 0;
  }

  .start-screen-content img {
    height: var(--height-instructions);
  }

  .btn-overlay {
    width: 100%;
  }
}

@media only screen and (max-height: 496px) {

  main {
    padding: 0px;
  }

  canvas {
    height: 100vh;
    border: none;
    border-radius: 0;
  }

  h2 {
    display: none;
  }

  .start-screen-content img {
    height: var(--height-instructions);
  }

  .btn-overlay {
    margin: -100vh;
    height: 100vh;
    width: 100%;
  }
}

/* Portrait orientation */
@media screen and (orientation: portrait) {
  main {
    display: none;
  }

  .landscape-request {
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
    z-index: 20;
  }

  .landscape-request p {
    text-align: center;
    color: var(--dark-brown);
    font-weight: 700;
    font-size: 24px;
    padding: 8px;
  }
}

/* Legal Notice */
.legal-notice {
  text-align: center;
  color: var(--dark-brown);
  margin: 16px;
}

.legal-notice h1 {
  font-family: 'Inter', sans-serif;
}

/* Privacy Policy */
.privacy-policy {
  margin: 16px;
  color: var(--dark-brown);
}

.privacy-policy h1 {
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.privacy-policy h2 {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
}