* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  color: white;
  font-size: 1.75rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

main {
  flex: 1;
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.loading, .error {
  text-align: center;
  padding: 2rem;
  font-size: 1.1rem;
}

.error {
  color: #e74c3c;
  background: #fdf2f2;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.practice-area {
  text-align: center;
}

.word-section {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.label {
  color: #666;
  font-weight: 500;
}

.word {
  font-weight: 700;
  color: #667eea;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(0,0,0,0.15);
  border-top-color: #555;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.sentences-loading {
  position: relative;
  pointer-events: none;
}

.sentences-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  animation: shimmer-pulse 1s ease-in-out infinite alternate;
}

@keyframes shimmer-pulse {
  from { opacity: 0.4; }
  to   { opacity: 0.8; }
}

.fade-in {
  animation: fadeInUp 0.35s ease-out both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
}

.btn-disabled:hover {
  transform: none;
  box-shadow: none;
}

.sentences-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.sentence-block {
  text-align: left;
}

.sentence-lang {
  display: block;
  font-size: 0.8rem;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.sentence-lang-chinese {
  text-transform: none;
}

.sentence {
  font-size: 1.2rem;
  line-height: 1.6;
  color: #333;
  padding: 1rem 1.25rem;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.sentence-chinese {
  color: #888;
  font-style: italic;
  border-left-color: #aaa;
}

.sentence-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sentence-row .sentence {
  flex: 1;
}

.play-sentence-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #667eea;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.play-sentence-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.play-sentence-btn:active {
  transform: scale(0.95);
}

.input-area {
  text-align: center;
}

.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

#input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

#input-row input {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  flex: 1;
  min-width: 200px;
}

#input-row input:focus {
  outline: none;
  border-color: #667eea;
}

footer {
  text-align: center;
  margin-top: 2rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  main {
    padding: 1.5rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .sentence {
    font-size: 1.15rem;
  }

  .translation {
    font-size: 1rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  #input-row {
    flex-direction: column;
  }

  #input-row input {
    width: 100%;
  }
}

#input-row.hidden {
  display: none !important;
}