:root {
  --primary: #2d6cdf;
  --accent: #f7b801;
  --bg: #f4f6fa;
  --text: #222;
  --success: #4caf50;
  --error: #e53935;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 2rem 1.5rem;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  margin-bottom: 1rem;
  color: var(--primary);
}

.game-controls {
  margin-bottom: 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.game-controls label {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.5rem;
}

.game-controls select {
  background: white;
  border: 2px solid rgba(45, 108, 223, 0.2);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
  min-width: 120px;
  margin-bottom: 0.2rem;
}

.game-controls select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.2);
}

.game-controls label[for="difficulty-select"] {
  margin-top: 0.2rem;
}

#hangman-drawing {
  width: 180px;
  height: 220px;
  margin: 0.5rem 0 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#word-display {
  font-size: 2rem;
  letter-spacing: 0.5rem;
  margin-bottom: 1.2rem;
  word-break: break-all;
  text-align: center;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remaining-guesses {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}

#keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.2rem;
  max-width: 100%;
}

.key {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-width: 40px;
  font-weight: 600;
}

.key:disabled {
  background: #b0c4e7;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.7;
}

.key:not(:disabled):hover, 
.key:not(:disabled):focus {
  background: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
  outline: none;
}

.key:not(:disabled):focus {
  box-shadow: 0 0 0 2px rgba(247, 184, 1, 0.4);
}

#message {
  min-height: 2.2em;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
  padding: 0.5rem;
  border-radius: 6px;
}

#message.win {
  color: var(--success);
  background: rgba(76, 175, 80, 0.1);
}

#message.lose {
  color: var(--error);
  background: rgba(229, 57, 53, 0.1);
}

#restart-btn {
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#restart-btn:hover, 
#restart-btn:focus {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  outline: none;
}

#restart-btn:focus {
  box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.4);
}

.settings-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(45,108,223,0.07);
  padding: 1.2rem 1.5rem 1.1rem 1.5rem;
  margin-bottom: 1.2rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.settings-icon {
  font-size: 1.3rem;
  vertical-align: middle;
}

.settings-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.2rem;
}

.settings-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0.1rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.settings-group select {
  background: white;
  border: 2px solid rgba(45, 108, 223, 0.18);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 120px;
}

.settings-group select:focus, .settings-group select:hover {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.13);
}

.info-icon {
  font-size: 1.05em;
  color: var(--primary);
  cursor: help;
  margin-left: 0.1em;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.info-icon:hover {
  opacity: 1;
}

.settings-divider {
  border: none;
  border-top: 1.5px solid #e6eaf0;
  margin: 0 0 1.2rem 0;
  width: 100%;
  max-width: 340px;
}

@media (max-width: 500px) {
  .container {
    padding: 1rem 0.3rem;
    max-width: 98vw;
    margin: 0.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  #hangman-drawing {
    width: 120px;
    height: 150px;
  }
  
  #word-display {
    font-size: 1.3rem;
    letter-spacing: 0.3rem;
  }
  
  #keyboard {
    gap: 0.2rem;
  }
  
  .key {
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    min-width: 35px;
  }
  
  .game-controls {
    gap: 0.4rem;
  }
  
  .game-controls label[for="difficulty-select"] {
    margin-left: 0;
    margin-top: 0.2rem;
  }
  
  .game-controls select {
    min-width: 100px;
  }
  .settings-card {
    padding: 0.8rem 0.5rem 0.7rem 0.5rem;
    max-width: 98vw;
  }
  .settings-group select {
    min-width: 0;
    width: 100%;
    font-size: 0.98rem;
  }
  .settings-divider {
    max-width: 98vw;
  }
}

@media (max-width: 350px) {
  .container {
    padding: 0.8rem 0.2rem;
  }
  
  #word-display {
    font-size: 1.1rem;
    letter-spacing: 0.2rem;
  }
  
  .key {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-width: 30px;
  }
}
