/* Base styles */
html {
  font-size: 16px;
}

body {
  background: linear-gradient(145deg, #f0f0f0 0%, #e0e0e0 100%);
  min-height: 100vh;
  padding: 20px 0;
  margin: 0;
  font-family: Arial, sans-serif;
  color: #333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  width: 90%;
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  text-align: center;
}

h1 {
  color: #2c3e50;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  margin: 0 0 clamp(15px, 3vh, 30px) 0;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
  color: #34495e;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  margin: 0 0 clamp(20px, 4vh, 35px) 0;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 0 10px;
}

.instructions {
  margin: 0 auto clamp(25px, 5vh, 45px) auto;
  padding: clamp(15px, 3vw, 30px);
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 700px;
}

.instructions p {
  color: #2c3e50;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  line-height: 1.6;
  margin-bottom: 10px;
  text-align: left;
}

.instructions p:last-child {
  margin-bottom: 0;
}

.game-controls {
  margin: 0 0 clamp(20px, 4vh, 35px) 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 2vw, 15px);
  padding: 0 10px;
}

button,
select {
  padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 24px);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 600;
  min-width: clamp(90px, 20vw, 120px);
}

#newGameBtn {
  background-color: #3498db;
}

#newGameBtn:hover {
  background-color: #2980b9;
}

select {
  background-color: #2ecc71;
}

select:hover {
  background-color: #27ae60;
}

#helpBtn {
  background-color: #9b59b6;
  min-width: 100px;
}

#helpBtn:hover {
  background-color: #8e44ad;
}

#hintBtn {
  background-color: #e74c3c;
}

#hintBtn:hover {
  background-color: #c0392b;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(20px, 4vw, 50px);
  margin: 0 0 clamp(25px, 5vh, 40px) 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: #2c3e50;
  font-weight: 600;
  padding: 0 10px;
}

#building {
  position: relative;
  height: clamp(200px, 40vh, 300px);
  width: clamp(200px, 40vh, 300px);
  margin: 0 auto clamp(20px, 4vh, 30px);
}

.building-piece {
  position: absolute;
  background-color: #e74c3c;
  border: 2px solid #c0392b;
  transition: all 0.3s ease;
}

/* House parts */
.house-body {
  width: 200px;
  height: 150px;
  bottom: 0;
  left: 50px;
}

.roof {
  width: 0;
  height: 0;
  border-left: 120px solid transparent;
  border-right: 120px solid transparent;
  border-bottom: 80px solid #e74c3c;
  bottom: 150px;
  left: 30px;
}

.chimney {
  width: 30px;
  height: 60px;
  bottom: 200px;
  right: 70px;
}

.window {
  width: 40px;
  height: 40px;
  background-color: #3498db;
  border-color: #2980b9;
}

.window-left {
  bottom: 80px;
  left: 80px;
}

.window-right {
  bottom: 80px;
  right: 80px;
}

.door {
  width: 50px;
  height: 80px;
  bottom: 0;
  left: 125px;
  background-color: #8b4513;
  border-color: #6b3410;
}

#word {
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: clamp(4px, 1vw, 8px);
  margin-bottom: clamp(15px, 3vh, 25px);
  min-height: 40px;
  padding: 0 10px;
  word-wrap: break-word;
}

#keyboard {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vw, 6px);
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  width: 100%;
  max-width: 500px;
  padding: 0 10px;
}

.keyboard-row {
  display: flex;
  gap: clamp(2px, 0.5vw, 4px);
  justify-content: center;
  width: 100%;
}

.keyboard-row:last-child {
  justify-content: center;
}

.key {
  width: clamp(30px, 7vw, 40px);
  height: clamp(35px, 8vw, 40px);
  background-color: #95a5a6;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: 1;
  max-width: 60px;
}

.key:hover {
  background-color: #7f8c8d;
  transform: translateY(-2px);
}

.key.used {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
  box-shadow: none;
  transition: all 0.2s ease;
}

.key.used:hover {
  background-color: #bdc3c7;
  transform: none;
  cursor: not-allowed;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  margin: 100px auto;
  position: relative;
}

.modal-content h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

.modal-content p,
.modal-content ul {
  margin-bottom: 10px;
  text-align: left;
}

.modal-content ul {
  padding-left: 20px;
}

#closeHelp {
  background-color: #9b59b6;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  margin-top: 15px;
  font-weight: 600;
}

#closeHelp:hover {
  background-color: #8e44ad;
  transform: translateY(-2px);
}

#closeHelp {
  background-color: #9b59b6;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  margin-top: 15px;
  font-weight: 600;
}

#closeHelp:hover {
  background-color: #8e44ad;
  transform: translateY(-2px);
}

/* Media Queries */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  .game-controls {
    flex-direction: column;
    align-items: center;
  }

  .key {
    width: 35px;
    height: 35px;
    font-size: 1em;
  }

  #building {
    transform: scale(0.8);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
    width: 95%;
  }

  .game-controls {
    flex-direction: column;
    align-items: stretch;
  }

  button,
  select {
    width: 100%;
    max-width: none;
  }

  .game-stats {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .instructions {
    width: 95%;
  }
}
