* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f4ff;
  color: #2d3748;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
}

.page-header {
  text-align: center;
  padding: 1.5rem 0;
}
.page-header h1 {
  font-size: 2rem;
  color: #667eea;
  margin: 0 0 0.5rem;
}
.page-header p {
  color: #718096;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  min-height: 48px;
  min-width: 48px;
}
.btn:active {
  transform: scale(0.96);
}
.btn--primary {
  background: #667eea;
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.btn--secondary {
  background: #48bb78;
  color: white;
}
.btn--large {
  padding: 1rem 2rem;
  font-size: 1.3rem;
  border-radius: 0.75rem;
}
.btn--block {
  width: 100%;
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: #718096;
}
.form-group input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1.1rem;
  min-height: 48px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus {
  border-color: #667eea;
}

.card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.picture-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .picture-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.letter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 1rem;
}

.number-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1.5rem;
}

.exercise-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem;
  min-height: 80vh;
}

.exercise-prompt {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #2d3748;
  padding: 1rem;
}

.exercise-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
  max-width: 600px;
}

.speaker-button {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  background: #ed8936;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);
  transition: transform 0.1s;
}
.speaker-button:active {
  transform: scale(0.92);
}
.speaker-button--playing {
  animation: pulse 1s ease-in-out infinite;
}
.speaker-button svg {
  width: 36px;
  height: 36px;
  fill: white;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}
.picture-card {
  width: 120px;
  height: 120px;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 3px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picture-card:active {
  transform: scale(0.95);
}
.picture-card--selected {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}
.picture-card--correct {
  border-color: #68d391;
  box-shadow: 0 0 0 3px rgba(104, 211, 145, 0.3);
}
.picture-card--incorrect {
  border-color: #fc8181;
  box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.3);
}
.picture-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.picture-card .picture-card__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #718096;
  text-align: center;
  padding: 0.25rem;
}

.letter-tile {
  min-width: 48px;
  min-height: 48px;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: white;
  border: 2px solid #e2e8f0;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.letter-tile:active {
  transform: scale(0.92);
}
.letter-tile--selected {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
.letter-tile--placed {
  background: #a3b1f7;
  color: white;
  border-color: #667eea;
}
.letter-tile--correct {
  background: #68d391;
  color: white;
  border-color: #68d391;
}
.letter-tile--incorrect {
  background: #fc8181;
  color: white;
  border-color: #fc8181;
}

.number-button {
  width: 72px;
  height: 72px;
  border-radius: 9999px;
  background: white;
  border: 3px solid #e2e8f0;
  font-size: 2rem;
  font-weight: 700;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.number-button:active {
  transform: scale(0.92);
}
.number-button--selected {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
.number-button--correct {
  background: #68d391;
  color: white;
  border-color: #68d391;
}
.number-button--incorrect {
  background: #fc8181;
  color: white;
  border-color: #fc8181;
}

.sound-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 0.75rem;
  border: 2px solid #e2e8f0;
}
.sound-box__slot {
  width: 56px;
  height: 56px;
  border: 2px dashed #a0aec0;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #2d3748;
}
.sound-box__slot--filled {
  border-style: solid;
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}
.sound-box__slot--highlight {
  border-color: #ed8936;
  background: rgba(237, 137, 54, 0.1);
}
.sound-box__arrow {
  font-size: 1.5rem;
  color: #a0aec0;
}

.feedback-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}
.feedback-overlay__icon {
  width: 120px;
  height: 120px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: feedback-pop 0.5s ease-out;
}
.feedback-overlay__icon--correct {
  background: rgba(104, 211, 145, 0.9);
}
.feedback-overlay__icon--correct svg {
  fill: white;
  width: 60px;
  height: 60px;
}
.feedback-overlay__icon--incorrect {
  background: rgba(252, 129, 129, 0.7);
}
.feedback-overlay__icon--incorrect svg {
  fill: white;
  width: 60px;
  height: 60px;
}

@keyframes feedback-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #48bb78);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.word-display {
  font-size: 2.5rem;
  font-weight: 800;
  color: #2d3748;
  text-align: center;
  padding: 1.5rem;
  letter-spacing: 0.05em;
}

.letter-slots {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  justify-content: center;
}
.letter-slots .slot {
  width: 56px;
  height: 56px;
  border: 2px dashed #a0aec0;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.letter-slots .slot--filled {
  border-style: solid;
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  color: #2d3748;
}

.passage-display {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
  background: white;
  border-radius: 0.75rem;
  font-size: 1.4rem;
  line-height: 2;
}
.passage-display .word {
  display: inline;
  padding: 2px 4px;
  border-radius: 0.375rem;
  transition: background 0.2s;
}
.passage-display .word--matched {
  background: rgba(104, 211, 145, 0.3);
  color: #30a55d;
}
.passage-display .word--missed {
  background: rgba(252, 129, 129, 0.2);
  color: #fc8181;
}
.passage-display .word--current {
  background: rgba(102, 126, 234, 0.2);
  font-weight: 700;
}

.timer-display {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #2d3748;
  text-align: center;
}

.mic-button {
  width: 72px;
  height: 72px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mic-button--idle {
  background: #667eea;
}
.mic-button--idle svg {
  fill: white;
}
.mic-button--recording {
  background: #fc8181;
  animation: pulse 1s ease-in-out infinite;
}
.mic-button--recording svg {
  fill: white;
}
.mic-button svg {
  width: 32px;
  height: 32px;
}
