:root {
  --green: #d5eeb0;
  --green-dark: #6da813;
  --green-dark-70: rgba(108, 168, 19, 0.7);
  --green-light: rgb(244, 255, 229);
  --gray: rgb(156, 156, 156);
  --blue-lava: #32516a;
  --blue-lava-70: rgba(50, 81, 106, 0.70);
  --planetarium: #226eab;

  --red: rgb(207, 55, 39);

  --white: #ffffff;
  --white-70: rgba(255, 255, 255, 0.7);
  --black: #000000;
  --ff-nunito: "Nunito", sans-serif;

  --page-max-width: 1440px;
  --page-tablet-width: 768px;
  --page-min-width: 500px;
}

.light-theme {
  --page-bg-color: var(--white);
  --text-color: var(--blue-lava);
  --sidebar-color: var(--green);
  --btn-bg: var(--text-color);
  --btn-text: var(--page-bg-color);
  --btn-text-hover: var(--page-bg-color);
  --btn-outline-focus: var(--blue-lava-70);
  --btn-bg-hover: var(--planetarium);
  --btn-disabled: var(--gray);
  --list-link-bg-color: var(--green-light);
}

.dark-theme {
  --page-bg-color: #171615;
  --text-color: var(--white);
  --sidebar-color: var(--blue-lava);
  --btn-bg: var(--text-color);
  --btn-text: var(--page-bg-color);
  --btn-text-hover: var(--text-color);
  --btn-outline-focus: var(--white-70);
  --btn-bg-hover: var(--planetarium);
  --btn-disabled: var(--gray);
  --list-link-bg-color: var(--green-light);
  --list-link-bg-color: var(--blue-lava);
}

.dark-theme .list__img,
.dark-theme .results__img {
  filter: invert();
}

.dark-theme .sound-btn {
  background-image: url("./../assets/svg/sound-enable_light.svg");
}

.dark-theme .sound-btn_sound-off {
  background-image: url("./../assets/svg/sound-disable_light.svg");
}

.dark-theme .game__main {
  background: url("./../assets/img/bg-dark.jpg") no-repeat bottom / cover;
}

@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-bg-color);
  color: var(--text-color);
  font-family: var(--ff-nunito);
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  line-height: 160%;
  overflow-x: hidden;
}

.h1 {
  font-size: 2.488rem;
  line-height: 1.2;
  margin: 0;
}

.h2 {
  font-size: 2.074rem;
  line-height: 1.2;
  margin: 0;
}

.h3 {
  font-size: 1.728rem;
  line-height: 1.2;
  margin: 0;
}

.h4 {
  font-size: 1.44rem;
  line-height: 1.2;
  margin: 0;
}

.h5 {
  font-size: 1.2rem;
  line-height: 1.2;
  margin: 0;
}

.theme-switcher__switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.theme-switcher__slider {
  display: block;
  height: 1.6rem;
  position: relative;
  width: 3.6rem;
  background-color: var(--text-color);
  transition: 0.3s;
}

.theme-switcher__checkbox {
  display: none;
}

.theme-switcher__text {
  font-size: 1.2rem;
  font-weight: bold;
}

.theme-switcher__slider:before {
  background-color: var(--page-bg-color);
  content: "";
  top: 50%;
  transform: translate(0.2rem, -50%);
  height: 1.2rem;
  width: 1.2rem;
  left: 0;
  position: absolute;
  transition: 0.3s;
}

.theme-switcher__checkbox:checked+.theme-switcher__slider:before {
  transform: translate(2.2rem, -50%);
}

.theme-switcher__slider {
  border-radius: 1.6rem;
}

.theme-switcher__slider::before {
  border-radius: 50%;
}

.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;
}

.game-btn {
  border-radius: 5px;
  color: var(--btn-text);
  position: relative;
  padding: 0.5rem 1rem;
  transition: 0.3s;
  font-weight: bold;
  background-color: var(--btn-bg);
}

.game-btn:focus {
  box-shadow: 0 0 0 3px var(--btn-outline-focus);
  outline: none;
}

.game-btn:not(:disabled):hover {
  background-color: var(--btn-bg-hover);
  color: var(--btn-text-hover);
}

.game-btn:disabled {
  color: var(--btn-disabled);
}

.sound-btn {
  background: no-repeat center / 80%;
  background-image: url("./../assets/svg/sound-enable_dark.svg");
  width: 2.5rem;
  height: 2.5rem;
}

.sound-btn_sound-off {
  background: no-repeat center / 80%;
  background-image: url("./../assets/svg/sound-disable_dark.svg");
}

.hamburger {
  padding: 10px 10px;
  display: inline-block;
  cursor: pointer;
  transition-property: opacity, filter;
  transition-duration: 0.15s;
  transition-timing-function: linear;
  font: inherit;
  color: inherit;
  text-transform: none;
  background-color: transparent;
  border: 0;
  margin: 0;
  overflow: visible;
}

.hamburger_active .hamburger__inner,
.hamburger_active .hamburger__inner::before,
.hamburger_active .hamburger__inner::after {
  background-color: currentColor
}

.hamburger__box {
  width: 45px;
  height: 20px;
  display: block;
  position: relative;
}

.hamburger__inner {
  display: block;
  top: 50%;
  margin-top: -1px;
}

.hamburger__inner,
.hamburger__inner::before,
.hamburger__inner::after {
  width: 45px;
  height: 2px;
  background-color: currentColor;
  border-radius: 0px;
  position: absolute;
  transition-property: transform;
  transition-duration: 0.15s;
  transition-timing-function: ease;
}

.hamburger__inner::before,
.hamburger__inner::after {
  content: "";
  display: block;
}

.hamburger__inner::before {
  top: -9px;
}

.hamburger__inner::after {
  bottom: -9px;
}

.hamburger_type_slider .hamburger__inner {
  top: 1px;
}

.hamburger_type_slider .hamburger__inner::before {
  top: 9px;
  transition-property: transform, opacity;
  transition-timing-function: ease;
  transition-duration: 0.15s;
}

.hamburger_type_slider .hamburger__inner::after {
  top: 18px;
}

.hamburger_type_slider.hamburger_active .hamburger__inner {
  transform: translate3d(0, 9px, 0) rotate(45deg);
}

.hamburger_type_slider.hamburger_active .hamburger__inner::before {
  transform: rotate(-45deg) translate3d(-6.4285714286px, -7px, 0);
  opacity: 0;
}

.hamburger_type_slider.hamburger_active .hamburger__inner::after {
  transform: translate3d(0, -18px, 0) rotate(-90deg);
}

.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;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.5s ease;
}

.modal-block_active {
  background-color: rgba(0, 0, 0, 0.5);
  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;
}

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

.dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  text-align: center;
  border: 2px solid var(--text-color);
  background: var(--page-bg-color);
  border-radius: 1rem;
}

.dialog__title {
  margin-bottom: 1.5rem;
}

.game {
  display: grid;
  grid-template-areas: "selector header"
    "selector main";
  max-width: var(--page-max-width);
  margin: 0 auto;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr;
  position: relative;
  min-height: 100vh;
  transition: 0.3s grid-template-columns ease;
  overflow: hidden;
}

.game_selector-open .selector {
  transform: translateX(0);
}

.game__main {
  grid-area: main;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid var(--sidebar-color);
  border-top: none;
  background: url("./../assets/img/bg.jpg") no-repeat bottom / cover;
}

.game__title {
  margin-bottom: 1.5rem;
  text-transform: capitalize;
}

.game__timer {
  margin: 0 auto 3rem;
  margin-bottom: auto;
}

.game__table {
  margin: 1.5rem auto 3rem;
}

.game__controls {
  margin-top: auto;
  display: flex;
  gap: 1rem 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.header {
  display: flex;
  gap: 1.25rem;
  padding: 0 1.25rem;
  align-items: center;
  justify-content: flex-end;
  height: 4rem;
  background-color: var(--sidebar-color);
  grid-area: header;
}

.selector {
  background-color: var(--sidebar-color);
  position: absolute;
  padding: 0 1.25rem;
  height: 100%;
  top: 0;
  left: 0;
  transform: translateX(0);
  width: 300px;
  transition: 0.3s transform ease;
  z-index: 10;
}

.selector__hamburger-box {
  position: absolute;
  height: 4rem;
  width: 4rem;
  top: 0;
  left: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--sidebar-color);
  border: 1px solid var(--text-color);
}

.selector__title {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selector__inner {
  overflow-y: scroll;
  -ms-overflow-style: none;
  scrollbar-width: none;
  max-height: calc(100% - 5.25rem);
  border: 2px solid var(--text-color);
  border-radius: 5px;
  background-color: var(--page-bg-color);
}

.selector__inner::-webkit-scrollbar {
  display: none;
}

.selector__title {
  text-align: center;
}

.selector__subtitle {
  text-decoration: underline;
  text-transform: capitalize;
  text-align: center;
  font-weight: bold;
  padding: 0.5rem 0;
}

.list {
  padding: 0;
  margin: 0;
}

.list__item {
  list-style: none;
  border-bottom: 2px solid var(--text-color);
}

.list__item:first-child {
  border-top: 2px solid var(--text-color);
}

.list__link {
  display: grid;
  grid-template-columns: auto 1fr;
  padding: 0.625rem;
  gap: 1rem;
  align-items: start;
  align-content: start;
  text-decoration: none;
  color: currentColor;
  background-color: var(--list-link-bg-color);
}

.list__link:hover,
.list__link:focus {
  background-color: var(--page-bg-color);
}

.list__img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.list__title {
  margin: 0;
  text-transform: capitalize;
  font-weight: bold;
}

.list__field-size {
  margin: 0;
}

.table {
  background-color: var(--white);
  box-shadow: 0 0 0 15px white;
  color: var(--black);
  display: grid;
  grid-template-areas:
    "free-space vertical-hints"
    "horizontal-hints field";
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  border: 2px solid var(--black);
}

.table__row {
  display: flex;
}

.table__cell {
  width: 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1 / 1;
  line-height: 0;
  box-sizing: content-box;
  user-select: none;
  transition: 0.3s;
}

.free-space {
  grid-area: free-space;
  border-bottom: 2px solid var(--black);
  border-right: 2px solid var(--black);
}

.h-hints {
  grid-area: horizontal-hints;
  border-right: 2px solid var(--black);
}

.v-hints {
  grid-area: vertical-hints;
  display: flex;
  border-bottom: 2px solid var(--black);
}

.v-hints__column {
  display: flex;
  flex-direction: column;
}

.field__cell {
  cursor: pointer;
  background: no-repeat center;
  background-size: 12px;
}

.field__cell_checked {
  background-color: var(--black);
}

.field__cell_crossed {
  background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tDQogLy8gMTZweGxzIChjKSBieSBQYXVsIG1hY2tlbnppZSA8cGF1bEB3aGF0c3BhdWxkb2luZy5jb20+DQogLy8NCiAvLyAxNnB4bHMgaXMgbGljZW5zZWQgdW5kZXIgYQ0KIC8vIENyZWF0aXZlIENvbW1vbnMgQXR0cmlidXRpb24tU2hhcmVBbGlrZSA0LjAgSW50ZXJuYXRpb25hbCBMaWNlbnNlLg0KIC8vDQogLy8gWW91IHNob3VsZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgbGljZW5zZSBhbG9uZyB3aXRoIHRoaXMNCiAvLyB3b3JrLiBJZiBub3QsIHNlZSA8aHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbGljZW5zZXMvYnktc2EvNC4wLz4uDQotLT4NCg0KPHN2ZyBmaWxsPSIjMDAwMDAwIiB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgICA8cGF0aCBkPSJNMCAxNC41NDVMMS40NTUgMTYgOCA5LjQ1NSAxNC41NDUgMTYgMTYgMTQuNTQ1IDkuNDU1IDggMTYgMS40NTUgMTQuNTQ1IDAgOCA2LjU0NSAxLjQ1NSAwIDAgMS40NTUgNi41NDUgOHoiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+");
}

.h-hints__cell:not(:last-child),
.field__cell:not(:last-child) {
  border-right: 1px solid var(--black);
}

.field__cell:nth-child(5n):not(:last-child) {
  border-right: 2px solid var(--black);
}

.v-hints__column:not(:last-child) {
  border-right: 1px solid var(--black);
}

.v-hints__column .v-hints__cell:not(:last-child) {
  border-bottom: 1px solid var(--black);
}

.v-hints__column:nth-child(5n):not(:last-child) {
  border-right: 2px solid var(--black);
}

.h-hints__row:not(:last-child),
.field__row:not(:last-child) {
  border-bottom: 1px solid var(--black);
}

.h-hints__row:nth-child(5n):not(:last-child),
.field__row:nth-child(5n):not(:last-child) {
  border-bottom: 2px solid var(--black);
}

.results {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  height: auto;
  text-align: center;
}

.results__cell {
  border: 1px solid var(--text-color);
  padding: 0.5rem;
}

.results__cell::first-letter {
  text-transform: capitalize;
}

.results__header {
  background: var(--sidebar-color);
  color: var(--text-color);
}

.results__img-cell {
  width: 80px;
  text-align: center;
}

.results__img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

@media (max-width: 950px) {
  .game {
    grid-template-columns: 0 1fr;
  }

  .selector {
    transform: translateX(-100%);
  }

  .selector__hamburger-box {
    display: flex;
  }
}

@media (max-width: 650px) {
  .table__cell {
    width: 18px;
  }
}