* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background: #f5f5dc;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.container {
  width: 100%;
  max-width: 500px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 0 10px;
}

.logo {
  height: 60px;
  width: auto;
}

.settings-btn {
  background: white;
  border: 2px solid #4169e1;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.settings-btn:active {
  transform: scale(0.95);
}

.game-area {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 3px solid #4169e1;
}

.mistakes-counter {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  color: #4169e1;
  margin-bottom: 10px;
}

#canvas {
  display: block;
  margin: 0 auto 20px;
  border: 3px solid #ffd700;
  border-radius: 10px;
  background: #fffef7;
  max-width: 100%;
  height: auto;
}

.word-display {
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  margin: 20px 0;
  letter-spacing: 8px;
  color: #4169e1;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}

.letter {
  display: inline-block;
  min-width: 30px;
  border-bottom: 3px solid #4169e1;
  margin: 0 3px;
}

.space {
  display: inline-block;
  min-width: 30px;
  border-bottom: none;
  margin: 0 10px;
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 20px 0;
}

.key {
  background: #ffd700;
  border: 2px solid #daa520;
  border-radius: 8px;
  padding: 12px 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  color: #333;
}

.key:active {
  transform: scale(0.95);
}

.key:disabled {
  background: #ddd;
  color: #999;
  cursor: not-allowed;
}

.key.correct {
  background: #4CAF50;
  color: white;
}

.key.wrong {
  background: #f44336;
  color: white;
}

.message {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin: 20px 0;
  min-height: 35px;
  color: #4169e1;
}

.play-again {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 20px;
  font-weight: bold;
  background: #4169e1;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(65,105,225,0.3);
}

.play-again:active {
  transform: scale(0.98);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.modal-content h2 {
  color: #4169e1;
  margin-bottom: 15px;
  text-align: center;
}

.modal-content p {
  margin-bottom: 10px;
  color: #333;
}

#customWords {
  width: 100%;
  padding: 10px;
  border: 2px solid #4169e1;
  border-radius: 8px;
  font-family: 'Noto Sans', sans-serif;
  font-size: 16px;
  resize: vertical;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn.save {
  background: #4169e1;
  color: white;
}

.modal-btn.cancel {
  background: #ddd;
  color: #333;
}

.modal-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .logo {
    height: 50px;
  }
  
  .settings-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .word-display {
    font-size: 24px;
    letter-spacing: 4px;
  }
  
  .keyboard {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
  }
  
  .key {
    padding: 10px 4px;
    font-size: 16px;
  }
  
  #canvas {
    width: 100%;
  }
  
  .modal-content {
    padding: 20px;
  }
}