* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Screens */
.screen {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
}

/* ========= HOME SCREEN ========= */
.home-header {
  text-align: center;
  padding: 32px 20px 12px;
}
.logo-area { margin-bottom: 8px; }
.home-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;
}
.subtitle {
  color: #64748b;
  font-size: 13px;
  margin-top: 2px;
}

/* Kids Grid */
.kids-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
}
.kids-grid h2 {
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.kid-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s;
}
.kid-card:active { transform: scale(0.97); background: #1e3a5f; }
.kid-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kid-info { flex: 1; }
.kid-name { font-weight: 600; font-size: 16px; }
.kid-grade { font-size: 12px; color: #64748b; margin-top: 1px; }
.kid-go {
  color: #475569;
  font-size: 20px;
}

/* Subject Panel */
.subject-panel {
  flex: 1;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
}
.subject-panel h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #f1f5f9;
}
.subject-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.subj-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s;
}
.subj-card:active { transform: scale(0.97); border-color: #3b82f6; }
.subj-icon { font-size: 28px; }
.subj-info { flex: 1; }
.subj-name { font-weight: 600; font-size: 15px; }
.subj-desc { font-size: 12px; color: #64748b; margin-top: 2px; }
.subj-arrow { color: #475569; font-size: 18px; }
.back-btn {
  background: none; border: none; color: #60a5fa;
  font-size: 14px; padding: 12px 0; cursor: pointer; text-align: left;
}

/* Footer */
.home-footer {
  text-align: center;
  padding: 12px;
}
.experimental-badge {
  font-size: 10px;
  color: #475569;
  background: #1e293b;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #334155;
}

/* ========= TUTOR SCREEN ========= */
.tutor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #1a1a3e, #0f172a);
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}
.top-back {
  background: none; border: none; color: #94a3b8;
  font-size: 24px; padding: 4px; cursor: pointer;
}
.tutor-header-info { flex: 1; }
.tutor-subject { font-weight: 600; font-size: 14px; display: block; }
.tutor-student { font-size: 11px; color: #64748b; }
.tutor-status-badge { font-size: 11px; color: #22c55e; }

/* Character Area */
.tutor-char-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  background: linear-gradient(180deg, #0f172a 0%, #1a1a3e 100%);
}
.char-container {
  width: 110px;
  height: 110px;
  position: relative;
}
.char-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 16px rgba(59,130,246,0.15));
  transition: filter 0.3s;
}
/* Character states */
.char-container.talking .char-svg { filter: drop-shadow(0 4px 20px rgba(59,130,246,0.35)); }
.char-container.listening .char-svg { filter: drop-shadow(0 4px 20px rgba(239,68,68,0.3)); }
.char-container.thinking .char-svg { filter: drop-shadow(0 4px 20px rgba(251,191,36,0.3)); }
.char-container.happy .char-svg { filter: drop-shadow(0 4px 20px rgba(34,197,94,0.35)); }

.char-label {
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  margin-top: 0;
}
.char-state {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
  min-height: 16px;
  text-align: center;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 85%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.tutor-msg {
  background: linear-gradient(135deg, #1e3a5f, #1e293b);
  border: 1px solid #334155;
  border-radius: 18px 18px 18px 4px;
  align-self: flex-start;
  color: #e2e8f0;
}
.kid-msg {
  background: #1e3a5f;
  border: 1px solid #3b82f6;
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
  color: #e2e8f0;
}
.kid-msg .transcribed { opacity: 0.6; font-size: 11px; display: block; margin-bottom: 4px; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
  margin: 0 16px 8px;
}
.typing-dot {
  width: 10px; height: 10px;
  background: #475569;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); background: #475569; }
  40% { transform: translateY(-10px); background: #60a5fa; }
}

/* Lesson Steps Bar */
.lesson-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  background: #1a1a3e;
  font-size: 11px;
  color: #475569;
  flex-shrink: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.lesson-steps .step { color: #475569; font-weight: 500; }
.lesson-steps .step.active { color: #60a5fa; }
.lesson-steps .step.done { color: #22c55e; }
.voice-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px 20px;
  border-top: 1px solid #1e293b;
  gap: 6px;
}

.voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  opacity: 0;
  transition: opacity 0.3s;
}
.voice-wave.active { opacity: 1; }
.vbar {
  width: 3px;
  border-radius: 2px;
  background: #60a5fa;
  animation: waveAnim 0.8s infinite ease-in-out;
}
.voice-wave.active .vbar:nth-child(1) { height: 10px; }
.voice-wave.active .vbar:nth-child(2) { height: 18px; animation-delay: 0.1s; }
.voice-wave.active .vbar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.voice-wave.active .vbar:nth-child(4) { height: 20px; animation-delay: 0.15s; }
.voice-wave.active .vbar:nth-child(5) { height: 14px; animation-delay: 0.3s; }
.voice-wave.active .vbar:nth-child(6) { height: 22px; animation-delay: 0.25s; }
.voice-wave.active .vbar:nth-child(7) { height: 12px; animation-delay: 0.35s; }
@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1); }
}

.mic-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: 3px solid #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(59,130,246,0.25);
  color: white;
}
.mic-btn:active { transform: scale(0.92); }
.mic-btn svg { width: 28px; height: 28px; }
.mic-btn.listening {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #f87171;
  box-shadow: 0 4px 24px rgba(239,68,68,0.4);
  animation: micPulse 1.5s infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(239,68,68,0.4); }
  50% { box-shadow: 0 4px 48px rgba(239,68,68,0.7); }
}
.mic-label {
  font-size: 11px;
  color: #64748b;
}
.mic-label .tap { color: #60a5fa; font-weight: 500; }

/* Action Buttons */
.action-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: 0.2s;
}
.action-btn:active { transform: scale(0.97); }
.action-btn.primary { background: #1e3a5f; border-color: #3b82f6; color: #60a5fa; }
