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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* Header */
.header {
  text-align: center;
  padding: 32px 0 24px;
}
.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: #888;
  font-size: 14px;
  margin-top: 4px;
}

/* Input Area */
.input-area {
  background: #1a1a2e;
  border: 1px solid #2a2a40;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}
.input-area textarea {
  width: 100%;
  min-height: 80px;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
}
.input-area textarea::placeholder {
  color: #555;
}
.input-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #60a5fa, #7c3aed);
  color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(96, 165, 250, 0.3);
}

.btn-secondary {
  background: #2a2a40;
  color: #ccc;
}
.btn-secondary:hover {
  background: #333350;
}

.btn-success {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff;
}
.btn-success:hover {
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Result Card */
.result-card {
  background: #1a1a2e;
  border: 1px solid #2a2a40;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  display: none;
}
.result-card.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-section {
  margin-bottom: 16px;
}
.result-section:last-child {
  margin-bottom: 0;
}

.result-label {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.result-text {
  font-size: 18px;
  line-height: 1.6;
  color: #f0f0f0;
}
.result-text.zh {
  color: #fbbf24;
}
.result-text.en {
  color: #60a5fa;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Word Cards */
.words-section {
  margin-top: 12px;
}
.words-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.word-card {
  background: #252540;
  border: 1px solid #333360;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.word-card:hover {
  background: #2f2f50;
  border-color: #60a5fa;
  transform: translateY(-2px);
}
.word-card .word-en {
  font-size: 15px;
  font-weight: 600;
  color: #60a5fa;
}
.word-card .word-zh {
  font-size: 12px;
  color: #fbbf24;
  margin-top: 2px;
}
.word-card .word-phonetic {
  font-size: 13px;
  color: #a78bfa;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  margin-top: 2px;
  min-height: 18px;
  letter-spacing: 0;
}
.word-card .word-example {
  font-size: 12px;
  color: #888;
  font-style: italic;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #333360;
  line-height: 1.4;
}
.word-card[data-word]:hover {
  border-color: #a78bfa;
}

/* Speaking Practice */
.speak-section {
  background: #1a1a2e;
  border: 1px solid #2a2a40;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  display: none;
}
.speak-section.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

.speak-section .target-text {
  font-size: 22px;
  font-weight: 600;
  color: #60a5fa;
  text-align: center;
  padding: 16px 0;
}

.speak-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.record-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #10b981;
  background: transparent;
  color: #10b981;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.record-btn:hover {
  background: rgba(16, 185, 129, 0.1);
}
.record-btn.recording {
  border-color: #f43f5e;
  color: #f43f5e;
  animation: pulse 1s infinite;
}

/* Manual compare input */
.manual-compare {
  margin-top: 16px;
}
.manual-divider {
  text-align: center;
  margin-bottom: 10px;
  position: relative;
}
.manual-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #333360;
}
.manual-divider span {
  background: #1a1a2e;
  padding: 0 12px;
  position: relative;
  z-index: 1;
  color: #666;
  font-size: 12px;
}
.manual-input-row {
  display: flex;
  gap: 8px;
}
.manual-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #333360;
  border-radius: 10px;
  background: #252540;
  color: #e0e0e0;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.manual-input:focus {
  border-color: #60a5fa;
}
.manual-input::placeholder {
  color: #555;
}



@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(244, 63, 94, 0); }
}

.comparison-result {
  margin-top: 16px;
  padding: 16px;
  background: #252540;
  border-radius: 12px;
  display: none;
}
.comparison-result.visible {
  display: block;
}

.comparison-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 16px;
}
.comparison-line .label {
  color: #888;
  font-size: 12px;
  min-width: 40px;
}

.word-correct {
  color: #34d399;
}
.word-wrong {
  color: #fb7185;
  text-decoration: underline wavy #fb7185;
}
.word-expected {
  color: #fbbf24;
}

.score-bar {
  margin-top: 12px;
  height: 6px;
  background: #333360;
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, #f43f5e, #fbbf24, #34d399);
}
.score-text {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: #888;
}

/* History */
.history-section {
  margin-top: 24px;
}
.history-section h3 {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  font-weight: 600;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #1a1a2e;
  border: 1px solid #2a2a40;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.history-item:hover {
  border-color: #60a5fa;
  background: #1e1e36;
}
.history-item .h-en {
  color: #60a5fa;
  font-size: 14px;
}
.history-item .h-zh {
  color: #888;
  font-size: 12px;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  color: #555;
  padding: 40px 20px;
  font-size: 14px;
  line-height: 1.8;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

/* Examples */
.examples-list {
  margin-top: 8px;
}
.example-item {
  padding: 8px 12px;
  background: #252540;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.example-item .play-small {
  cursor: pointer;
  color: #60a5fa;
  font-size: 16px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

/* Toast / Status */
.status-msg {
  text-align: center;
  padding: 8px;
  font-size: 13px;
  color: #888;
  min-height: 20px;
}

/* Responsive */
@media (max-width: 480px) {
  .app { padding: 16px 12px 80px; }
  .header h1 { font-size: 22px; }
  .result-text { font-size: 16px; }
}
