:root {
  --gray: rgb(100, 100, 100);
  --white: rgb(255, 255, 255);
  --black: rgb(0, 0, 0);
  --dark: rgb(64, 63, 61);
  --brown: rgb(207, 158, 118);
  --green: rgba(153, 202, 59);

  --page-background: rgb(225, 212, 201, 1);
  --ff-shantell: 'Shantell Sans', cursive;

  --page-max-width: 1440px;
  --page-tablet-width: 768px;
  --page-min-width: 360px;

}

@media (prefers-reduced-motion: no-preference) {
  :root {
    scroll-behavior: smooth;
  }
}

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

html {
  box-sizing: border-box;
  height: 100%;
}

.page {
  min-height: 100%;
  min-width: var(--page-min-width);
  background-color: var(--page-background);
  color: var(--dark);
  font-family: var(--ff-shantell);
  font-size: clamp(1.5rem, 1.3571rem + 0.7143vw, 2rem);
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  overflow-x: hidden;
  /* Prevent adjustments of font size after orientation changes in iOS: */
  -webkit-text-size-adjust: 100%;
  /* Change the default tap highlight to be completely transparent in iOS: */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  display: flex;
  flex-direction: column;
}

.h1 {
  font-family: var(--ff-shantell);
  font-weight: 400;
  line-height: 1.1;
  font-size: 2.5rem;
  margin: 0;
  text-align: center;
}

.btn {
  display: inline-block;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  text-align: center;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  vertical-align: middle;
}

.btn:disabled {
  cursor: default;
}

.keyboard-btn {
  height: 4rem;
  width: 4rem;
  font-size: 3rem;
  position: relative;
  text-transform: uppercase;
  padding-bottom: 3px;
  border-radius: 5px;
  box-shadow: 0 2px 0 var(--black);
  transition: 0.2s all ease;
  background-image: url('data:image/gif;base64,R0lGODlhBAAEAIABAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxucz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qWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAAQABAAAAgYEEpdoeQUAOw==');
}

.keyboard-btn:hover:not(:disabled),
.keyboard-btn:focus:not(:disabled) {
  outline: none;
  box-shadow: 0 2px 0 var(--black), 0 0 0 5px rgba(0, 0, 0, 0.3);
}

.keyboard-btn:active {
  top: 4px;
  padding-bottom: 0px;
}

.keyboard-btn__inner {
  height: 100%;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  background-color: var(--white);
  border-radius: 5px;
  border: 2px solid var(--black);
}

.keyboard-btn_disabled {
  top: 4px;
  padding-bottom: 0px;
  color: var(--white)
}

.keyboard-btn_disabled .keyboard-btn__inner {
  background-color: var(--dark)
}

.keyboard-btn_arbitrary {
  width: auto;
  height: auto;
  font-size: 1.5rem;
}

.keyboard-btn_arbitrary .keyboard-btn__inner {
  padding: 0.2rem 0.5rem;
}

.game-btn-wrap {
  min-height: 3rem;
}

.header {
  margin: 0 auto;
  max-width: var(--page-max-width);
  display: flex;
  padding: 1rem;
  line-height: 1;
  width: 100%;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  background-color: var(--brown);
  justify-content: center;
}

.header__counter {
  margin: 0 auto 0 0;
}

.counter__current {
  white-space: nowrap;
}

.main {
  margin: 0 auto;
  max-width: var(--page-max-width);
  display: grid;
  grid-template-columns: 3fr 4fr;
  padding: 1rem;
  gap: 2rem;
  border: 2px solid var(--brown);
  flex-grow: 1;
}

.main__word,
.main__hint,
.main__guesses {
  margin: 0 0 1.5rem;
}

.main__title {
  margin: 0 0 2rem;
}

.canvas {
  position: relative;
  aspect-ratio: 3296 / 3848;
}

.canvas__img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.canvas__body-part {
  opacity: 0;
  transition: 0.5s ease all;
}

.canvas__body-part_shown {
  opacity: 1;
}

.word {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.word__letter {
  display: block;
  position: relative;
  text-transform: uppercase;
  width: 4rem;
  height: 4rem;
  font-size: 4rem;
  line-height: 1;
  text-align: center;
  display: block;
}

.word__letter:after {
  content: "";
  position: absolute;
  height: 10px;
  width: 100%;
  left: 0;
  bottom: 0;
  border-radius: 5px;
  background-color: var(--dark);
}

.word__letter_guessed:after {
  content: none;
}

.hint {
  line-height: 2rem;
  text-align: center;
}

.hint:first-letter {
  text-transform: capitalize;

}

.guesses {
  text-align: center;
}

.guesses__counter {
  white-space: nowrap;
}

.keyboard {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  text-align: center;
}

.dialog__title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 2rem;
}

.dialog__secret-word {
  text-transform: uppercase;
  margin: 0;
  margin: 0 0 2rem;
}

.backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99;
  pointer-events: none;
  visibility: hidden;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.5s ease,
    visibility 0.5s ease;
}

.backdrop_active {
  pointer-events: auto;
  visibility: visible;
  opacity: 0.6;
}

.modal-block {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem;
  pointer-events: none;
}

.modal-block_active {
  pointer-events: auto;
}

.modal-block__window {
  flex: none;
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 5rem);
  position: relative;
  margin: auto 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.5s ease,
    opacity 0.5s ease,
    visibility 0.5s ease;
  transform: scale(0.9);
  opacity: 0;
  visibility: hidden;
  border-radius: 1rem;
  background: var(--page-background)
}

.modal-block_active .modal-block__window {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
}

@media (max-width: 767px) {
  .main {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .main__canvas-column {
    order: 1;
  }

  .canvas {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .keyboard-btn:not(.keyboard-btn_arbitrary) {
    height: 3rem;
    width: 3rem;
    font-size: 2rem;
  }

  .word {
    gap: 1rem;
  }

  .word__letter {
    width: 2rem;
    height: 2rem;
    font-size: 2rem;
  }

  .word__letter:after {
    height: 5px;
  }
}