html, body {
  height: 100%;
} 
body {
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: 'Playwrite';
  src: url('assets/fonts/playwrite-degrund.woff') format('woff'),
       url('assets/fonts/playwrite-degrund.ttf') format('ttf');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-image: url('assets/images/light.jpg');
  --theme-icon: url('assets/images/moon.svg');

  --main-color: #fff;
  --second-color: #000;
  --accent-color: #edc0c0;

  --main-popup: #fff2f2;
  
  --cell-size: min(6vw, 24px);
  
}
.dark-theme {
  --bg-image: url('assets/images/dark.jpg');
  --theme-icon: url('assets/images/sun.svg');
  
  --main-color: #000;
  --second-color: #fff;
  --accent-color: #161616;
  
  --main-popup: #1a383f;
}

body {
  font-family: 'Playwrite', serif;
  background-image: var(--bg-image);
  background-position: center center;
  background-size: cover;
  background-repeat: repeat;
  height: 100%;

  color: var(--main-color);
  overflow: hidden;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;

  width: var(--cell-size);
  height: var(--cell-size);
  font-size: clamp(8px, 2vw, 16px);

  background-color: #fff;
  border: 1px solid #d9dadb;
  opacity: 0.9;
}
.cell-active {
  background-color: #000;
}
.cell-cross {
  position: relative;
}
.cell-cross::before,
.cell-cross::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 3px;
  background-color: #000;
  transform-origin: center;
}

.cell-cross::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cell-cross::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}


.top__container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0;
  gap: 15px;
}
.show-results__button {
  display: flex;
  justify-content: center;
  align-items: center;

  background-color: var(--main-color);
  color: var(--second-color);
  border: 1px solid var(--second-color);

  padding: 10px 15px;
  cursor: pointer;
}
.toggle-sound__button {
  width: 100px;
  display: flex;
  justify-content: center;
  align-items: center;

  background-color: var(--accent-color);
  color: #fff;
  border: 1px solid #fff;

  padding: 10px 15px;

  cursor: pointer;
}
.toggle-sound__button--active {
  color: #fff
}
.toggle-theme__button {
  background-image: var(--theme-icon);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--accent-color);
  background-color: var(--second-color);


  opacity: 0.9;
  cursor: pointer;
}


.main__container {
  display: flex;
  justify-content: space-between;
  padding: 50px 50px 10px 50px;
}

.game__container {
  display: grid;
  grid-template-areas: "empty top-panel""left-panel matrix";
}
.matrix__container {
  grid-area: matrix;
  width: fit-content;
}
.matrix__row {
  display: flex;
}
.count-cells__left-container {
  grid-area: left-panel;

  display: flex;
  flex-direction: column;
  align-items: end;
}
.count-cells__top-container {
  grid-area: top-panel;

  display: flex;
  align-items: end;
}
.count-cells__left-row {
  display: flex;
}
.count__cell {
  display: flex;
  align-items: center;
  justify-content: center;

  width: var(--cell-size);
  height: var(--cell-size);
  font-size: clamp(8px, 2vw, 16px);

  background-color: var(--accent-color);
  color: var(--second-color);
  border: 1px solid var(--main-color);
}
.bold-line {
  border-top: 3px solid #000;
}
.bold-line__left{
  border-left: 3px solid #000;
}
.bold-line__left--top {
  border-left: 2px solid #000;
}


.left__container {
  margin-top: 20px;
  max-width: 350px;
}

.difficult__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 50px 30px;
  gap: 5px;

  opacity: 0.9;
  background-color: var(--accent-color); 
  border: 1px solid var(--second-color);
}
.difficult__button {
  padding: 5px 18px;
  background-color: #ccc;
  cursor: pointer;
  border: 1px solid var(--second-color);
}
.difficult__button--active {
  background-color: var(--second-color); 
}
.template__container-headline {
  padding: 5px 15px;
  color: var(--main-color);
  background-color: var(--second-color);
  border-bottom: 2px solid var(--main-color);
}
.template__item {
  padding: 10px 12px;
  background-color: var(--main-color);
  color: var(--second-color);
  border-bottom: 1px solid #ccc;
  text-transform: capitalize;
  cursor: pointer;
  opacity: 0.9;
}
.template__item--active {
  background-color: var(--second-color);
  color: var(--main-color);
  font-weight: bold;
}



.right__container {
  margin-top: 20px;
  min-width: 200px;
  gap: 15px;
  display: flex;
  flex-direction: column;
}

.timer {
  display: flex;
  justify-content: center;
  align-items: center;

  color: #fff;
  border: 1px solid var(--second-color);
  background-color: var(--accent-color);
  padding: 10px 15px;
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 15px;

  cursor: pointer;
}

.button__solution, .button__reset, .button__random, .button__save, .button__load {
  background-color: var(--main-color);
  color: var(--second-color);
  border: 1px solid var(--second-color);
}
.button__solution, .button__reset, .button__save, .button__load {
  opacity: 0.6;
  cursor: auto;
}
.button__solution--active, .button__reset-active, .button__save--active, .button__load--active {
  opacity: 1;
  cursor: pointer;
}



.popup__container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1005;
}

.popup__content {
  display: flex;
  flex-direction: column;
  background-color: var(--main-popup);

  color: var(--second-color);
  border: 1px solid var(--second-color);
  padding: 20px;
  border-radius: 10px;
  width: 500px;
  text-align: center;
  position: relative;
}

.popup__close-button {
  position: absolute;
  top: 10px;
  right: 18px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--second-color);
}

.popup__title {
  text-align: left;
  margin: 5px 0px 0px 5px;
  font-size: 20px;
  font-weight: bold;
  color: var(--second-color);
}
.popup__message {
  font-size: 18px;
  margin-bottom: 10px;
  text-align: justify;
  color: var(--second-color);
}

.popup__time {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--second-color);
}

.popup__ok-button {
  align-self: flex-end;
  max-width: 100px;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  
  background-color: #000;
  color: #fff;
  border: 1px solid #fff;

  transition: all 0.3s ease;
}

.popup__ok-button:hover {
  background-color: #fff;
  color: #000;
  border: 1px solid #000;
}



.popup__buttons {
  display: flex;
  gap: 10px;
  justify-content: end;
}
.popup__cancel-button {
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 16px;
  
  background-color: #d16c6c;
  color: #fff;
  border: 1px solid #fff;
  
  cursor: pointer;
  transition: all 0.3s ease;
}
.popup__cancel-button:hover {
  background-color: #c32222;
  border: 1px solid #000;
  color: #000;
}

.popup__results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.popup__results-table th, .popup__results-table td {
  border: 1px solid var(--second-color);
  padding: 8px;
  text-align: center;
}

.popup__results-table th {
  background-color: var(--main-color);
  font-weight: bold;
}


.burger-menu {
  display: none;

  position: fixed;
  top: 26px;
  right: 20px;

  width: 40px;
  height: 40px;

  font-size: 28px;
  line-height: 35px;
  text-align: center;

  color: #fff;
  background-color: #000;
  border: 1px solid #ccc;

  cursor: pointer;
  z-index: 1003;
}

@media (max-width: 1300px) {
  .burger-menu {
    display: block;
  }
  .difficult__container {
    padding: 0;
    margin: 65px 0 15px 0;
    background-color: inherit;
    border: none;
  }
  .inner__container {
    display: flex;
    align-items: flex-start;
    justify-content: center;

    height: 70%;
  }
  .main__container {
    padding: 0 0 0 150px;
  }
  .game__container {
    transform: scale(0.9);
  }
  .right__container {
    position: fixed;
    top: 50px;
    left: 50px;

    margin-top: 80px;
    order: -1;
  }
  .left__container {
    position: fixed;
    top: -20px;
    right: -550px;
    
    padding: 20px;
    height: 100vh;

    background-color: var(--accent-color);
    opacity: 0.9;
    transition: all 0.3s ease;

    z-index: 1002;
  }
  .left__container.left__container--active {
    right: 0;
    border-left: 1px solid #434343
  }
  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;

    z-index: 1001;
  }
  .overlay.overlay--active {
    opacity: 1;
    pointer-events: all; 
  }
}
@media (max-width: 1120px) {
  .game__container {
    transform: scale(0.8);
  }
}
@media (max-width: 950px) {
  .burger-menu {
    top: 12px;
  }
  .top__container {
    margin: 5px 0 0 0;
  }
  .main__container {
    padding: 0;
    height: 100%;

    flex-direction: column;
    align-items: center;
    justify-content: flex-start;  
  }
  .right__container {
    flex-wrap: wrap;
    justify-content: center;
    flex-direction: row;
    margin-top: 0;
    position: static;
    order: 0;
    padding: 0 10px;
    min-width: inherit;
  }
  .game__container {
    min-height: 450px;
    transform: scale(0.7);
  }
  .show-results__button {
    padding: 5px 10px;
  }
  .toggle-sound__button {
    padding: 5px 10px;
  }
  .toggle-theme__button {
    width: 50px;
    height: 50px;
  }
  .timer {
    max-width: 60px;
    min-width: 60px;
  }
}

@media (max-width: 660px) {
  .inner__container {
    display: block;
  }
  .game__container {
    min-width: none;
  }
  .right__container {
    gap: 5px;
  }
  .button {
    font-size: 14px;
    padding: 0px 10px;
  }
  .timer {
    padding: 0px 10px;
  }
  .show-results__button {
    padding: 0px 10px;
  }
  .toggle-sound__button {
    padding: 0px 10px;
  }
}
@media (max-width: 500px) {
  .top__container {
    max-width: 200px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 5px 0 0 10px;
  }
  .toggle-theme__button {
    order: -1;
  }
  .popup__content {
    width: calc(100% - 6px);
    padding: 15px;
    border-radius: 8px;
    margin: 3px;
  }
  .popup__title {
    font-size: 18px;
  }
  .popup__message {
    font-size: 16px;
  }
  .popup__time {
    font-size: 14px;
  }
  .popup__close-button {
    top: 8px;
    right: 12px;
    font-size: 16px;
  }
  .popup__buttons {
    justify-content: space-between;
  }
  .popup__ok-button,
  .popup__cancel-button {
    font-size: 14px;
    padding: 8px 14px;
    flex: 1;
  }
  .popup__results-table th,
  .popup__results-table td {
    padding: 6px;
    font-size: 12px;
  }
}
