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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: #f0f9ff;
  color: #2c3e50;
  text-align: center;
  padding: 15px;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

h1 {
  color: #e74c3c;
  margin-bottom: 15px;
  font-size: 28px;
}

.help-link {
  display: inline-block;
  margin-bottom: 15px;
  color: #3498db;
  text-decoration: none;
  font-weight: bold;
  font-size: 18px;
}

.help-link:hover {
  text-decoration: underline;
}

.score {
  font-size: 20px;
  font-weight: bold;
  color: #e67e22;
  margin-bottom: 15px;
}

.setup {
  margin-bottom: 25px;
}

label {
  display: block;
  margin: 12px 0 8px;
  font-weight: bold;
}

select, button, input {
  padding: 10px 16px;
  font-size: 18px;
  border: 2px solid #3498db;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  margin-top: 5px;
}

#startBtn {
  background: #2ecc71;
  color: white;
  font-weight: bold;
  margin-top: 15px;
}

#startBtn:hover {
  background: #27ae60;
}

.subject-buttons {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  justify-content: center;
}

.subject-btn {
  padding: 10px 16px;
  font-size: 18px;
  border: 2px solid #3498db;
  border-radius: 12px;
  background: #ecf0f1;
  cursor: pointer;
}

.subject-btn.active {
  background: #3498db;
  color: white;
}

.subject-settings {
  margin-top: 20px;
}

.mode-buttons {
  display: flex;
  gap: 8px;
  margin: 15px 0;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn {
  padding: 8px 14px;
  font-size: 16px;
  border: 2px solid #95a5a6;
  border-radius: 10px;
  background: #ecf0f1;
  cursor: pointer;
}

.mode-btn.active {
  background: #3498db;
  color: white;
  border-color: #2980b9;
}

.game {
  margin-top: 20px;
}

.question {
  margin-bottom: 25px;
}

.icon-container {
  font-size: 80px;
  margin-bottom: 15px;
  cursor: pointer;
  user-select: none;
  display: inline-block;
}

.icon-container:focus {
  outline: 3px dashed #3498db;
}

.word {
  font-size: 32px;
  font-weight: bold;
  color: #2c3e50;
  margin: 12px 0;
}

#question-text {
  font-size: 20px;
  color: #2980b9;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.option-btn {
  padding: 14px;
  font-size: 20px;
  border: 2px solid #95a5a6;
  border-radius: 12px;
  background: #ecf0f1;
  cursor: pointer;
  transition: all 0.2s;
}

.option-btn:hover {
  background: #d5dbdb;
  transform: scale(1.02);
}

.option-btn.correct {
  background: #2ecc71;
  color: white;
  border-color: #27ae60;
}

.option-btn.wrong {
  background: #e74c3c;
  color: white;
  border-color: #c0392b;
}

#dictation-area {
  margin: 20px 0;
}

#user-input {
  padding: 12px;
  font-size: 20px;
  width: 200px;
  text-align: center;
  border: 2px solid #3498db;
  border-radius: 10px;
  margin-right: 10px;
}

#check-btn {
  padding: 12px 20px;
  font-size: 18px;
  background: #e67e22;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

#check-btn:hover {
  background: #d35400;
}

.feedback {
  font-size: 22px;
  font-weight: bold;
  min-height: 30px;
  margin: 15px 0;
  color: #2c3e50;
}

#nextBtn, #restartBtn {
  background: #3498db;
  color: white;
  margin-top: 15px;
}

#restartBtn {
  background: #9b59b6;
}

.hidden {
  display: none;
}

/* Анимации */
@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.correct-animation {
  animation: correctPulse 0.6s ease-in-out;
}

.wrong-animation {
  animation: wrongShake 0.5s ease-in-out;
}

/* Математика: визуал */
.math-visual {
  font-size: 24px;
  margin: 10px 0;
  min-height: 30px;
  color: #2980b9;
}

.math-visual span {
  display: inline-block;
  margin: 0 2px;
}

/* Пояснение при ошибке */
.explanation-box {
  background: #fff8e1;
  border: 2px solid #ffc107;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  font-size: 18px;
  color: #5d4037;
  text-align: left;
}

.explanation-box strong {
  color: #e65100;
}

/* Адаптивность */
@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  h1 {
    font-size: 24px;
  }

  .word {
    font-size: 28px;
  }

  #user-input {
    width: 160px;
    font-size: 18px;
  }

  .subject-buttons, .mode-buttons {
    flex-direction: column;
    align-items: center;
  }

  .subject-btn, .mode-btn {
    width: 100%;
  }
}