@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
:root {
  --tile-width: 15rem;
  --bg-color: #262626;
  --green: #f51010ff;
  --light-gray: #fbfbfb;
  --font-color: white;
}

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

html {
  font-size: 62.5%;
  font-family: 'Montserrat', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--font-color);
  box-sizing: border-box;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: center;
  text-align: center;
}

.container {
  animation: fadeIn 500ms ease;
  display: flex;
  flex-direction: column;

  user-select: none; /* supported by Chrome and Opera */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
}

h1 {
  /* display: flex; */
  font-size: 5rem;
  text-transform: capitalize;
  letter-spacing: 1px;
  position: relative;
  padding-bottom: 1rem;
  margin-bottom: 5rem;
}

h1::before {
  background-color: var(--light-gray);
  content: '';
  position: absolute;
  width: 10rem;
  height: 3px;
  animation: growing 10s infinite ease-in-out;
  transform-origin: center;
  transform: translate(-50%, -50%);
  top: 100%;
  left: 50%;
}

.t-word {
  display: inline-block;
}
.t-word::first-letter {
  display: inline-block;
  color: #ed4334;
}

.settings {
  /* display: none; */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 15rem;
  margin-top: 2rem;
}

.options {
  justify-content: center;
}

.players {
  display: none;
}

.game {
  margin-top: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  display: none;
  position: relative;
  animation: fadeInUp 0.5s ease;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, var(--tile-width));
  width: calc(3 * var(--tile-width));
  height: calc(3 * var(--tile-width));
}

.field {
  width: var(--tile-width);
  height: var(--tile-width);
  font-size: 6rem;
  font-weight: 700;
  border: 1.5px solid var(--light-gray);
  display: flex;
  justify-content: center;
  align-items: center;
}

.field:hover {
  cursor: pointer;
  background-color: #303030;
}

.field:nth-of-type(1),
.field:nth-of-type(2),
.field:nth-of-type(3) {
  border-top: none;
}

.field:nth-of-type(7),
.field:nth-of-type(8),
.field:nth-of-type(9) {
  border-bottom: none;
}

.field:nth-of-type(1),
.field:nth-of-type(4),
.field:nth-of-type(7) {
  border-left: none;
}
.field:nth-of-type(3),
.field:nth-of-type(6),
.field:nth-of-type(9) {
  border-right: none;
}

.btn {
  background-color: var(--green);
  border: none;
  box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.7);
  outline: none;
  color: black;
  display: inline-block;
  font-size: 1.6rem;
  font-weight: bold;
  width: 22rem;
  text-transform: uppercase;
  margin: 1rem 2rem;
  padding: 1rem 1.5rem;
  transition: background-color 0.3s ease, color 0.2s ease, transform 0.3s ease;
}

.btn:hover {
  cursor: pointer;
  background-color: #19be82;
  color: var(--light-gray);
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 7px 0 rgba(0, 0, 0, 0.7);
}
.btn.active {
  background-color: var(--light-gray);
  color: var(--green);
}

.btn.player {
  width: 10rem;
}

.message-box {
  position: absolute;
  transform: scale(0);
  transition: 0.3s ease-in;
  z-index: -1;
  width: 100%;
  top: 50%;
  left: 0;
}

.hide {
  visibility: hidden;
  opacity: 0;
}

.show {
  visibility: visible;
  opacity: 1;
  z-index: 10;
  filter: blur(0);
}

@media only screen and (min-width: 320px) and (max-width: 450px) {
  :root {
    --tile-width: 10rem;
  }
  body {
    max-width: 100vw;
  }

  .settings {
    height: 20rem;
  }
  h1 {
    font-size: 4rem;
  }
  .game {
    margin-top: 2rem;
  }

  .options {
    height: 15rem;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
  }
}

@media only screen and (max-width: 650px) {
  .game {
    margin-top: 7rem;
  }
}

@keyframes fadeIn {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes growing {
  0% {
    width: 10rem;
  }
  25% {
    width: 8rem;
  }
  50% {
    width: 6rem;
  }
  75% {
    width: 8rem;
  }
  100% {
    width: 10rem;
  }
}

.logo {
  display: block;
  margin: 0 auto 20px;   /* center the logo */
  max-width: 100%;       /* responsive */
  height: auto;          /* keeps aspect ratio */
  width: 150px;          /* base size */
  transition: transform 0.3s ease, opacity 0.3s ease; /* smooth effect */
}

.logo:hover {
  transform: scale(1.1);  /* slightly enlarge */
  opacity: 0.85;          /* subtle fade */
}
@media (max-width: 600px) {
  .logo {
    width: 100px;  /* smaller logo on small screens */
  }
}
