* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(135deg, #fce4ec 0%, #e1f5fe 50%, #fff9c4 100%);
  background-attachment: fixed;
  font-family: 'Proxima Nova', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  touch-action: none;
  overflow: hidden;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px;
  padding: 10px;
}

/* Экран приветствия */
#welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  padding: 30px;
  width: 100%;
}

#welcome-screen h2 {
  font-size: 2.5em;
  color: #555;
  margin: 0;
}

.avatar-picker p {
  margin-bottom: 10px;
  font-size: 1.2em;
  color: #444;
  text-align: center;
}

#avatar-list {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 3px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.2s;
  background: rgba(255,255,255,0.7);
}

.avatar-card.selected {
  border-color: #6fcf97;
  background: rgba(255,255,255,0.95);
}

.avatar-icon {
  font-size: 3em;
}

.avatar-name {
  font-size: 0.9em;
  font-weight: bold;
  color: #333;
}

#playBtn {
  padding: 14px 50px;
  font-size: 1.4em;
  background: #6fcf97;
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
  transition: 0.2s;
}

#playBtn:active {
  background: #5ab580;
  transform: scale(0.96);
}

/* Игровой экран */
#game-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 15px;
  background: rgba(255,255,255,0.85);
  border-radius: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 12px;
}

#userAvatarDisplay {
  font-size: 2em;
}

#progress-container {
  width: 110px;
  height: 18px;
  background: #eee;
  border-radius: 9px;
  overflow: hidden;
  position: relative;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: #6fcf97;
  transition: width 0.3s;
}

#progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7em;
  font-weight: bold;
  color: #333;
}

#group-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

#group-selector button {
  padding: 10px 18px;
  font-size: 1em;
  border: none;
  border-radius: 25px;
  background: #fff;
  color: #333;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: 0.2s;
}

#group-selector button:active {
  background: #f0e0d6;
  transform: scale(0.96);
}

#canvas-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

canvas {
  border: 3px solid #ddd;
  border-radius: 20px;
  background: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

#status {
  margin-top: 10px;
  font-size: 1.3em;
  font-weight: bold;
  color: #4a7c59;
  text-align: center;
  min-height: 2em;
}

.buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.buttons button {
  padding: 10px 20px;
  font-size: 1em;
  border: none;
  border-radius: 25px;
  background: #ffe5d9;
  color: #333;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: 0.2s;
}

.buttons button:active {
  background: #ffc9b3;
  transform: scale(0.96);
}

#result-container {
  text-align: center;
  margin-top: 10px;
}

#wordDisplay {
  font-size: 2.2em;
  font-weight: bold;
  margin-bottom: 8px;
}

.highlight-vowel {
  color: #e53935;
  font-size: 1.2em;
}

.highlight-consonant {
  color: #1e88e5;
  font-size: 1.2em;
}

#association-wrapper {
  display: flex;
  justify-content: center;
}

#association {
  max-width: 250px;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 400px) {
  #welcome-screen h2 {
    font-size: 2em;
  }
  #group-selector button {
    padding: 8px 14px;
    font-size: 0.9em;
  }
  #wordDisplay {
    font-size: 1.8em;
  }
}
.highlight-sign {
  color: #4CAF50;
  font-size: 1.2em;
}