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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a1a;
  color: #ffffff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3a 100%);
}

/* Header */
.header {
  text-align: center;
  padding: 20px 16px 10px;
}

.logo {
  font-size: 28px;
  font-weight: 700;
}

.logo .ai {
  color: #7c6ff7;
}

.tagline {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* Tab Bar */
.tab-bar {
  display: flex;
  padding: 0 16px;
  gap: 4px;
}

.tab {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: #aaa;
}

.tab.active {
  color: #7c6ff7;
  border-bottom-color: #7c6ff7;
}

/* Tab Content */
.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* Settings Bar */
/* Subject Selector */
.subject-bar {
  padding: 8px 16px 0;
}

.subject-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-selector label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.subject-selector select {
  flex: 1;
  background: #1a1a3a;
  color: #7c6ff7;
  border: 2px solid #7c6ff7;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.settings-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
}

.setting {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.setting select {
  background: #1e1e3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

.setting select:focus {
  outline: none;
  border-color: #7c6ff7;
}

/* Tutor Display */
.tutor-display {
  text-align: center;
  padding: 20px 16px;
}

.tutor-avatar {
  font-size: 64px;
  margin-bottom: 8px;
  transition: transform 0.3s;
}

.tutor-avatar.speaking {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.tutor-name {
  font-size: 20px;
  font-weight: 600;
}

.tutor-status {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.tutor-status.listening {
  color: #ff4444;
}

.tutor-status.thinking {
  color: #ffaa00;
}

.tutor-status.speaking {
  color: #44cc44;
}

/* Chat Area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chat Display Toggle */
.chat-display-toggle {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 4px 12px;
}

.voice-speed-select {
  font-size: 12px;
  color: #555;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 1px 4px;
  cursor: pointer;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #888;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  accent-color: #7c6ff7;
  cursor: pointer;
}

.toggle-text {
  opacity: 0.7;
}

/* Hidden messages (1+1 mode) */
.message.msg-hidden {
  display: none;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.user .message-bubble {
  background: #7c6ff7;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: #1e1e3a;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
  border: 1px solid #2a2a4a;
}

/* Correction Highlighting */
.correction-wrong {
  background: rgba(255, 80, 80, 0.2);
  color: #ff6b6b;
  text-decoration: line-through;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.correction-correct {
  background: rgba(80, 220, 100, 0.2);
  color: #50dc64;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Translator Mode Display */
.translate-original {
  color: #aaa;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.translate-result {
  color: #50dc64;
  font-size: 1.05em;
  font-weight: 600;
}

/* Translator delay sliders */
.translator-delay-setting input[type="range"] {
  width: 100%;
  accent-color: #f0a030;
  cursor: pointer;
}

/* Bilingual Display */
.bilingual-block {
  background: #0a0a1a;
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
}

.bi-en {
  padding: 8px 12px;
  font-size: 15px;
  color: #fff;
  line-height: 1.5;
}

.bi-mt {
  padding: 8px 12px;
  font-size: 14px;
  color: #ccc;
  background: #12122a;
  border-top: 1px solid #1a1a3a;
  line-height: 1.5;
}

.bi-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.bi-en .bi-label {
  background: #7c6ff7;
  color: #fff;
}

.bi-mt .bi-label {
  background: #2a4a2a;
  color: #44cc44;
}

/* Input Area */
.input-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #0d0d20;
  border-top: 1px solid #1a1a3a;
}

/* Mic Button */
.mic-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.mic-btn:hover {
  border-color: #7c6ff7;
  background: #2a2a4a;
}

.mic-btn.recording {
  border-color: #ff4444;
  background: #3a1a1a;
  animation: glow 1.5s infinite;
}

.mic-btn.interpreter-active {
  border-color: #f0a030;
  background: #3a2a10;
}

.mic-btn.interpreter-active.recording {
  border-color: #50dc64;
  background: #1a3a1a;
  animation: glow 1.5s infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 68, 68, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 68, 68, 0.6); }
}

.mic-icon {
  font-size: 28px;
}

.mic-label {
  font-size: 10px;
  color: #888;
}

.mic-btn.recording .mic-label {
  color: #ff4444;
}

/* Mic wrapper + mode toggle */
.mic-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mic-mode-toggle {
  background: #1e1e3a;
  color: #888;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 3px 12px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.mic-mode-toggle:hover {
  color: #7c6ff7;
  border-color: #7c6ff7;
}

/* Text Input Row */
.text-input-row {
  display: flex;
  width: 100%;
  gap: 8px;
}

#text-input {
  flex: 1;
  background: #1e1e3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 15px;
}

#text-input:focus {
  outline: none;
  border-color: #7c6ff7;
}

#text-input::placeholder {
  color: #555;
}

.send-btn {
  background: #7c6ff7;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}

.send-btn:hover {
  background: #6b5ce7;
}

.send-btn:disabled {
  background: #333;
  cursor: not-allowed;
}

/* Subtitle */
.subtitle {
  font-size: 13px;
  color: #666;
  text-align: center;
  min-height: 20px;
  font-style: italic;
}

/* Scrollbar */
.chat-area::-webkit-scrollbar {
  width: 4px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

/* Mode Buttons */
.mode-buttons {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Pronunciation Practice Button */
.pronun-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.pronun-btn:hover {
  border-color: #44cc44;
  background: #1a3a1a;
}

.pronun-icon {
  font-size: 20px;
}

.pronun-label {
  font-size: 9px;
  color: #888;
}

/* Pronunciation Panel */
.pronun-panel {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  margin: 0 16px 8px;
  padding: 16px;
  text-align: center;
}

.pronun-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pronun-title {
  font-size: 14px;
  font-weight: 600;
  color: #44cc44;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pronun-close {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.pronun-close:hover {
  color: #fff;
}

.pronun-sentence {
  font-size: 18px;
  line-height: 1.6;
  color: #fff;
  padding: 16px;
  background: #1e1e3a;
  border-radius: 12px;
  border: 1px solid #2a2a4a;
  margin-bottom: 8px;
}

.pronun-instruction {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}

.pronun-record-btn {
  background: #1e3a1e;
  border: 2px solid #44cc44;
  border-radius: 12px;
  color: #44cc44;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.pronun-record-btn:hover {
  background: #2a4a2a;
}

.pronun-record-btn.recording {
  border-color: #ff4444;
  color: #ff4444;
  background: #3a1a1a;
  animation: glow 1.5s infinite;
}

.pronun-record-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pronun-status {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
  min-height: 20px;
}

/* Score Card */
.pronun-scores {
  margin-top: 16px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.score-item {
  background: #1e1e3a;
  border-radius: 12px;
  padding: 12px 4px;
  text-align: center;
}

.score-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.score-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-good { color: #44cc44; }
.score-ok { color: #ffaa00; }
.score-bad { color: #ff4444; }

/* Word-by-word scores */
.word-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 12px;
  background: #1e1e3a;
  border-radius: 12px;
  margin-bottom: 12px;
}

.word-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #0a0a1a;
  transition: background 0.2s;
}

.word-score.expanded {
  background: #12122a;
}

.word-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.word-top.clickable {
  cursor: pointer;
}

.word-text {
  font-size: 14px;
  font-weight: 600;
}

.word-num {
  font-size: 10px;
}

.word-expand-icon {
  font-size: 8px;
  color: #555;
  transition: color 0.2s;
}

.word-top.clickable:hover .word-expand-icon {
  color: #aaa;
}

/* Phoneme detail row */
.phoneme-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding-top: 4px;
  border-top: 1px solid #1a1a3a;
  margin-top: 4px;
}

.phoneme {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: #1a1a3a;
}

.phoneme small {
  font-size: 10px;
  opacity: 0.7;
}

.ph-good { color: #44cc44; }
.ph-ok { color: #ffaa00; }
.ph-bad { color: #ff4444; background: #2a1515; }

.word-good .word-text { color: #44cc44; }
.word-good .word-num { color: #44cc44; }
.word-ok .word-text { color: #ffaa00; }
.word-ok .word-num { color: #ffaa00; }
.word-bad .word-text { color: #ff4444; }
.word-bad .word-num { color: #ff4444; }
.word-missed .word-text { color: #666; text-decoration: line-through; }
.word-missed .word-num { color: #666; }

/* Pronunciation Feedback */
.pronun-feedback {
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #e0e0e0;
  text-align: left;
}

.pronun-feedback.loading {
  color: #888;
  text-align: center;
  font-style: italic;
}

.pronun-next-btn {
  background: #7c6ff7;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}

.pronun-next-btn:hover {
  background: #6b5ce7;
}

/* Assessment Button */
.assess-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.assess-btn:hover {
  border-color: #7c6ff7;
  background: #1a1a3a;
}

.assess-icon {
  font-size: 20px;
}

.assess-label {
  font-size: 9px;
  color: #888;
}

/* Revision Mode Button */
.revision-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.revision-btn:hover {
  border-color: #f0a030;
  background: #3a2a1a;
}

.revision-icon {
  font-size: 20px;
}

.revision-label {
  font-size: 9px;
  color: #888;
}

/* Screen Capture Button */
.capture-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.capture-btn:hover {
  border-color: #3cb8f0;
  background: #1a2a3a;
}

.capture-icon {
  font-size: 20px;
}

.capture-label {
  font-size: 9px;
  color: #888;
}

/* Screen Capture Preview */
.capture-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  padding: 6px 10px;
  background: #1a2a3a;
  border: 1px solid #3cb8f0;
  border-radius: 10px;
}

.capture-preview-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.capture-preview-title {
  font-size: 0.75rem;
  color: #3cb8f0;
  white-space: nowrap;
}

.capture-preview-remove {
  background: none;
  border: none;
  color: #f87171;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.capture-preview-img {
  max-height: 50px;
  max-width: 90px;
  border-radius: 6px;
  border: 1px solid #333;
  object-fit: cover;
}

/* Screenshot thumbnail in chat messages */
.msg-screenshot-thumb {
  margin-bottom: 6px;
}

.msg-screenshot-thumb img {
  max-width: 180px;
  max-height: 100px;
  border-radius: 8px;
  border: 1px solid #333;
  object-fit: cover;
}

/* Revision Mode Panel */
.revision-panel {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  margin: 0 16px 8px;
  padding: 16px;
  text-align: center;
}

.revision-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.revision-title {
  font-size: 14px;
  font-weight: 600;
  color: #f0a030;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.revision-close {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.revision-close:hover {
  color: #fff;
}

.revision-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.revision-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #333;
  background: #1e1e3a;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.revision-tab.active {
  border-color: #f0a030;
  color: #f0a030;
  background: #2a2010;
}

.revision-prompt {
  font-size: 18px;
  line-height: 1.6;
  color: #ff6b6b;
  padding: 16px;
  background: #1e1e3a;
  border-radius: 12px;
  border: 1px solid #2a2a4a;
  margin-bottom: 8px;
  text-decoration: line-through;
  font-style: italic;
}

.revision-instruction {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}

.revision-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.revision-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #1e1e3a;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.revision-input-row input:focus {
  border-color: #f0a030;
}

.revision-speak-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #333;
  background: #1e1e3a;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.revision-speak-btn:hover {
  border-color: #f0a030;
}

.revision-speak-btn.recording {
  border-color: #ff4444;
  background: #3a1a1a;
  animation: glow 1.5s infinite;
}

.revision-submit-btn {
  background: #2a2010;
  border: 2px solid #f0a030;
  border-radius: 12px;
  color: #f0a030;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.revision-submit-btn:hover {
  background: #3a3020;
}

.revision-result {
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.5;
}

.revision-result.correct {
  background: rgba(80, 220, 100, 0.15);
  border: 1px solid #50dc64;
  color: #50dc64;
}

.revision-result.wrong {
  background: rgba(255, 80, 80, 0.15);
  border: 1px solid #ff6b6b;
  color: #ff6b6b;
}

.revision-next-btn {
  background: #1e1e3a;
  border: 1px solid #444;
  border-radius: 10px;
  color: #ccc;
  padding: 8px 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.revision-next-btn:hover {
  border-color: #f0a030;
  color: #f0a030;
}

.revision-spelling-word {
  font-size: 16px;
  color: #aaa;
  padding: 16px;
  background: #1e1e3a;
  border-radius: 12px;
  border: 1px solid #2a2a4a;
  margin-bottom: 12px;
}

.revision-play-btn {
  background: #1a2a3a;
  border: 2px solid #4488ff;
  border-radius: 12px;
  color: #4488ff;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.revision-play-btn:hover {
  background: #2a3a4a;
}

.revision-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #2a2a4a;
}

.revision-stat {
  font-size: 12px;
  color: #888;
}

.revision-stat strong {
  color: #f0a030;
}

/* ═══ VOICE VIEW SWITCHING ═══ */
.voice-view {
  display: none;
}

.voice-view.active {
  display: block;
}

/* Panels always visible when their view is active (no more inline display:none toggling) */
.voice-view.active .assess-panel,
.voice-view.active .pronun-panel,
.voice-view.active .revision-panel {
  display: block;
}

.view-back-btn {
  background: none;
  border: 1px solid #3a3a5a;
  color: #a78bfa;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.view-back-btn:hover {
  background: #1e1e3a;
}

/* Assessment Panel */
.assess-panel {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  margin: 0 16px 8px;
  padding: 16px;
  text-align: center;
}

.assess-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.assess-title {
  font-size: 14px;
  font-weight: 600;
  color: #7c6ff7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.assess-close {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.assess-close:hover {
  color: #fff;
}

.assess-desc {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}

.radar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

/* CEFR / IELTS Level Cards */
.level-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.level-card {
  flex: 1;
  background: #1e1e3a;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.level-badge {
  font-size: 28px;
  font-weight: 800;
  border: 3px solid #7c6ff7;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  color: #7c6ff7;
}

.level-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.level-note {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
}

/* Accent Analysis */
.accent-analysis {
  background: #1e1e3a;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  text-align: left;
}

.accent-origin {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 10px;
  text-align: center;
}

.accent-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.accent-meter-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  width: 75px;
}

.accent-meter-track {
  flex: 1;
  height: 10px;
  background: #0a0a1a;
  border-radius: 5px;
  overflow: hidden;
}

.accent-meter-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease-out;
}

.accent-meter-num {
  font-size: 14px;
  font-weight: 700;
  width: 40px;
  text-align: right;
}

/* Accent Breakdown */
.accent-breakdown {
  margin-bottom: 12px;
}

.accent-breakdown-title {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.accent-breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

.accent-bar-seg {
  transition: width 0.8s ease-out;
  min-width: 2px;
}

.accent-breakdown-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.accent-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accent-flag {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

.accent-breakdown-label {
  font-size: 12px;
  color: #ccc;
  width: 100px;
}

.accent-breakdown-mini-bar {
  flex: 1;
  height: 6px;
  background: #0a0a1a;
  border-radius: 3px;
  overflow: hidden;
}

.accent-breakdown-mini-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease-out;
}

.accent-breakdown-pct {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e0;
  width: 36px;
  text-align: right;
}

.accent-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.accent-trait {
  font-size: 11px;
  background: #0a0a1a;
  color: #ffaa00;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #333;
}

.accent-tip {
  font-size: 12px;
  color: #44cc44;
  background: #0a1a0a;
  border-left: 3px solid #44cc44;
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  line-height: 1.4;
}

/* Score rows */
.assess-scores {
  margin-bottom: 12px;
}

.assess-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.assess-score-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

.assess-score-label {
  font-size: 12px;
  color: #aaa;
  width: 90px;
  text-align: left;
}

.assess-bar-track {
  flex: 1;
  height: 8px;
  background: #1e1e3a;
  border-radius: 4px;
  overflow: hidden;
}

.assess-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
}

.assess-bar-fill.score-good { background: #44cc44; }
.assess-bar-fill.score-ok { background: #ffaa00; }
.assess-bar-fill.score-bad { background: #ff4444; }

.assess-score-num {
  font-size: 14px;
  font-weight: 700;
  width: 30px;
  text-align: right;
}

.assess-avg {
  text-align: center;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid #2a2a4a;
  font-size: 16px;
  font-weight: 600;
  color: #ccc;
}

.assess-avg span {
  font-size: 20px;
}

.assess-summary {
  background: #1a1a3a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #e0e0e0;
  text-align: left;
}

.assess-run-btn {
  background: #7c6ff7;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.assess-run-btn:hover {
  background: #6b5ce7;
}

.assess-run-btn:disabled {
  background: #333;
  cursor: not-allowed;
}

.assess-status {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
  min-height: 20px;
}

/* ═══════ ESSAY COACH ═══════ */

/* Writing Mode Bar */
.essay-mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #0d0d20;
  border-bottom: 1px solid #1a1a3a;
}

.essay-mode-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.essay-mode-bar select {
  flex: 1;
  background: #1e1e3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.essay-mode-bar select:focus {
  outline: none;
  border-color: #7c6ff7;
}

/* Essay Input Section */
.essay-input-section {
  padding: 16px;
}

.essay-input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.essay-input-title {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
}

.essay-upload-btns {
  display: flex;
  gap: 8px;
}

.essay-upload-btn {
  background: #1e1e3a;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.essay-upload-btn:hover {
  border-color: #7c6ff7;
  color: #fff;
}

.essay-textarea {
  width: 100%;
  background: #1e1e3a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 180px;
  font-family: inherit;
}

.essay-textarea:focus {
  outline: none;
  border-color: #7c6ff7;
}

.essay-textarea::placeholder {
  color: #555;
}

.essay-meta-row {
  margin-top: 10px;
}

.essay-prompt-input {
  width: 100%;
  background: #1e1e3a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
}

.essay-prompt-input:focus {
  outline: none;
  border-color: #7c6ff7;
}

.essay-prompt-input::placeholder {
  color: #555;
}

.essay-analyze-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: #7c6ff7;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.essay-analyze-btn:hover {
  background: #6b5ce7;
}

.essay-analyze-btn:disabled {
  background: #333;
  cursor: not-allowed;
}

.essay-status {
  font-size: 13px;
  color: #888;
  text-align: center;
  margin-top: 8px;
  min-height: 20px;
}

/* Essay Results */
.essay-results {
  padding: 0 16px 16px;
}

/* Score Dashboard */
.essay-score-dashboard {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.essay-score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.essay-score-title {
  font-size: 14px;
  font-weight: 600;
  color: #7c6ff7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.essay-level-badges {
  display: flex;
  gap: 8px;
}

.essay-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid;
}

.essay-dim-scores {
  margin-top: 12px;
}

.essay-dim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.essay-dim-label {
  font-size: 12px;
  color: #aaa;
  width: 120px;
  text-align: left;
}

.essay-dim-bar-track {
  flex: 1;
  height: 8px;
  background: #1e1e3a;
  border-radius: 4px;
  overflow: hidden;
}

.essay-dim-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
}

.essay-dim-num {
  font-size: 14px;
  font-weight: 700;
  width: 30px;
  text-align: right;
}

/* Register Section */
.register-section {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.register-header {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.register-meter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.register-label-left,
.register-label-right {
  font-size: 10px;
  color: #666;
  white-space: nowrap;
}

.register-track {
  flex: 1;
  height: 8px;
  background: linear-gradient(90deg, #44cccc, #7c6ff7, #ff6644);
  border-radius: 4px;
  position: relative;
}

.register-marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  border: 3px solid #7c6ff7;
  transform: translateX(-50%);
  transition: left 0.5s ease-out;
}

.register-detected {
  text-align: center;
  font-size: 13px;
  color: #ccc;
  margin-bottom: 8px;
}

.register-issues {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.register-issue {
  font-size: 12px;
  background: #1e1e3a;
  border-radius: 8px;
  padding: 8px 12px;
  line-height: 1.4;
}

.register-issue-word {
  color: #ff4444;
  font-weight: 600;
}

.register-issue-fix {
  color: #44cc44;
  font-weight: 600;
}

/* Essay Chat Section */
.essay-chat-section {
  background: #141430;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.essay-chat-header {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.essay-chat-area {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.essay-chat-area .message {
  max-width: 90%;
}

/* Essay Voice Row */
.essay-chat-voice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.essay-mic-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.essay-mic-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.essay-mic-btn:hover {
  border-color: #7c6ff7;
}

.essay-mic-btn.recording {
  border-color: #ff4444;
  background: #3a1a1a;
  animation: glow 1.5s infinite;
}

.essay-subtitle {
  flex: 1;
  font-size: 13px;
  color: #666;
  font-style: italic;
  min-height: 20px;
}

/* Mother tongue toggle button */
.mt-toggle-btn {
  display: inline-block;
  background: #1e1e3a;
  color: #888;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s;
}

.mt-toggle-btn:hover {
  color: #44cc44;
  border-color: #44cc44;
}

.mt-content {
  margin-top: 6px;
  padding: 8px 12px;
  background: #12122a;
  border-radius: 8px;
  border-left: 3px solid #44cc44;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
}

.essay-chat-input-row {
  display: flex;
  gap: 8px;
}

.essay-chat-input-row input {
  flex: 1;
  background: #1e1e3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}

.essay-chat-input-row input:focus {
  outline: none;
  border-color: #7c6ff7;
}

.essay-chat-input-row input::placeholder {
  color: #555;
}

/* ═══ AUTH ═══ */

.auth-bar {
  text-align: right;
  margin-top: 5px;
}

.auth-user-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 5px;
}

.auth-user-name {
  color: #a78bfa;
  font-size: 0.85rem;
}

.auth-btn {
  background: transparent;
  border: 1px solid #7c6ff7;
  color: #7c6ff7;
  padding: 5px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.auth-btn:hover {
  background: #7c6ff7;
  color: white;
}

.auth-btn-small {
  font-size: 0.7rem;
  padding: 3px 10px;
  opacity: 0.7;
}

/* Auth Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 360px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #888;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-title {
  color: white;
  text-align: center;
  margin: 0 0 20px 0;
  font-size: 1.3rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input {
  background: #0d0d1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 14px;
  color: white;
  font-size: 0.95rem;
  outline: none;
}

.auth-input:focus {
  border-color: #7c6ff7;
}

.auth-submit-btn {
  background: linear-gradient(135deg, #7c6ff7, #a78bfa);
  border: none;
  color: white;
  padding: 11px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.auth-submit-btn:hover {
  opacity: 0.9;
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-forgot {
  text-align: center;
  font-size: 0.78rem;
  margin: 0 0 4px 0;
}

.auth-forgot a {
  color: #888;
  text-decoration: none;
}

.auth-forgot a:hover {
  color: #a78bfa;
  text-decoration: underline;
}

.auth-toggle {
  text-align: center;
  color: #888;
  font-size: 0.8rem;
  margin: 0;
}

.auth-toggle a {
  color: #a78bfa;
  text-decoration: none;
}

.auth-error {
  color: #f87171;
  text-align: center;
  font-size: 0.8rem;
  margin: 0;
  min-height: 1em;
}

/* ═══ PROGRESS TAB ═══ */

.progress-login-prompt {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.progress-login-prompt p {
  margin-bottom: 20px;
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #a78bfa;
}

.stat-label {
  font-size: 0.65rem;
  color: #888;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-section {
  margin-bottom: 16px;
}

.progress-section-title {
  color: #ccc;
  font-size: 0.9rem;
  margin: 0 0 8px 0;
}

.weakness-card {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  padding: 14px;
  color: #ccc;
  font-size: 0.85rem;
  line-height: 1.5;
}

.progress-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 3px;
}

.progress-subtab {
  flex: 1;
  background: transparent;
  border: none;
  color: #888;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.progress-subtab.active {
  background: #7c6ff7;
  color: white;
}

.progress-panel {
  display: none;
}

.progress-panel.active {
  display: block;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-date {
  color: #666;
  font-size: 0.7rem;
}

.history-scores {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-badge {
  background: #2a2a3e;
  color: #a78bfa;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-summary {
  color: #aaa;
  font-size: 0.8rem;
  margin-top: 4px;
  line-height: 1.4;
}

.history-empty {
  text-align: center;
  color: #666;
  padding: 30px;
  font-size: 0.85rem;
}

/* Vocabulary */
.vocab-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.vocab-filter {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  color: #888;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.vocab-filter.active {
  background: #7c6ff7;
  border-color: #7c6ff7;
  color: white;
}

.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vocab-card {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  padding: 12px 14px;
}

.vocab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.vocab-word-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vocab-word {
  font-weight: 700;
  color: #e0e0e0;
  font-size: 0.95rem;
}

.vocab-difficulty {
  font-size: 0.55rem;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.vocab-diff-basic { background: #1e3a2f; color: #34d399; }
.vocab-diff-intermediate { background: #2a2a1e; color: #fbbf24; }
.vocab-diff-advanced { background: #2a1e2e; color: #c084fc; }

.vocab-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vocab-speak-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.2s;
}

.vocab-speak-btn:hover {
  background: #2a2a3e;
}

.vocab-definition {
  color: #bbb;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 4px;
}

.vocab-translation {
  color: #a78bfa;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.vocab-example {
  color: #888;
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 6px;
  padding-left: 8px;
  border-left: 2px solid #333;
}

.vocab-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vocab-times {
  color: #555;
  font-size: 0.65rem;
}

.vocab-source {
  color: #555;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vocab-status-btn {
  background: #2a2a3e;
  border: none;
  color: #888;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.vocab-status-btn:hover {
  background: #7c6ff7;
  color: white;
}

.vocab-status-btn.status-new { color: #60a5fa; }
.vocab-status-btn.status-learning { color: #fbbf24; }
.vocab-status-btn.status-mastered { color: #34d399; }

/* Responsive */
@media (max-width: 480px) {
  #app {
    max-width: 100%;
  }

  .mic-btn {
    width: 70px;
    height: 70px;
  }

  .mode-buttons {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .pronun-btn,
  .assess-btn,
  .revision-btn,
  .capture-btn {
    width: 50px;
    height: 50px;
  }

  .pronun-icon,
  .assess-icon,
  .revision-icon,
  .capture-icon {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══════════════════════════════════════════════
   RAG Knowledge Base Styles
   ═══════════════════════════════════════════════ */

.knowledge-bar {
  display: flex;
  justify-content: center;
  padding: 4px 16px 0;
}

.knowledge-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(124, 111, 247, 0.15);
  border: 1px solid rgba(124, 111, 247, 0.3);
  color: #b8b0ff;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.knowledge-btn:hover {
  background: rgba(124, 111, 247, 0.25);
  border-color: rgba(124, 111, 247, 0.5);
}

.knowledge-icon {
  font-size: 15px;
}

.knowledge-count {
  background: #7c6ff7;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.knowledge-modal-content {
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
}

.knowledge-desc {
  color: #888;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.knowledge-upload-area {
  border: 2px dashed rgba(124, 111, 247, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.knowledge-upload-area:hover {
  border-color: rgba(124, 111, 247, 0.6);
}

.knowledge-upload-area.drag-over {
  border-color: #7c6ff7;
  background: rgba(124, 111, 247, 0.1);
}

.knowledge-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #b8b0ff;
  font-size: 14px;
}

.knowledge-upload-icon {
  font-size: 28px;
  color: #7c6ff7;
}

.knowledge-upload-hint {
  font-size: 11px;
  color: #666;
}

.knowledge-upload-subject {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #888;
}

.knowledge-upload-subject select {
  background: #1a1a3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.knowledge-upload-progress {
  margin-bottom: 16px;
}

.knowledge-progress-bar {
  height: 6px;
  background: #1a1a3a;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.knowledge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c6ff7, #a78bfa);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

.knowledge-progress-text {
  font-size: 12px;
  color: #888;
  text-align: center;
}

.knowledge-filter {
  margin-bottom: 12px;
}

.knowledge-filter select {
  width: 100%;
  background: #1a1a3a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.knowledge-doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.knowledge-empty {
  color: #555;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

.knowledge-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
}

.knowledge-doc-info {
  flex: 1;
  min-width: 0;
}

.knowledge-doc-title {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.knowledge-doc-meta {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

.knowledge-doc-badge {
  font-size: 10px;
  background: rgba(124, 111, 247, 0.2);
  color: #b8b0ff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

.knowledge-doc-delete {
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.knowledge-doc-delete:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff5050;
}

.knowledge-doc-lock {
  color: #555;
  font-size: 14px;
  padding: 4px 8px;
}

/* Citation badges in chat */
.citation-badge {
  display: inline;
  background: rgba(124, 111, 247, 0.2);
  color: #9d93f7;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: help;
  vertical-align: super;
  font-weight: 600;
  text-decoration: none;
}

.citation-badge:hover {
  background: rgba(124, 111, 247, 0.35);
}

.citation-legend {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: #666;
}

.citation-item {
  margin: 2px 0;
}

.citation-num {
  color: #9d93f7;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   Deep Solve Styles
   ═══════════════════════════════════════════════ */

.deepsolve-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1e1e3a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
}

.deepsolve-btn:hover {
  border-color: #ff8c00;
  background: #2a1e0a;
}

.deepsolve-btn.active {
  border-color: #ff8c00;
  background: #3a2a0a;
  box-shadow: 0 0 12px rgba(255, 140, 0, 0.3);
}

.deepsolve-icon { font-size: 20px; }
.deepsolve-label { font-size: 9px; color: #888; }

.deep-solve-bubble {
  border-left: 3px solid #ff8c00 !important;
  background: #1a1a2e !important;
}

.deep-solve-header {
  font-weight: 700;
  color: #ff8c00;
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.deep-solve-stages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.ds-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #888;
}

.ds-stage-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.ds-stage-icon.ds-pending { color: #555; }
.ds-stage-icon.ds-running { color: #ff8c00; animation: ds-pulse 1s infinite; }
.ds-stage-icon.ds-complete { color: #44cc44; }
.ds-stage-icon.ds-error { color: #ff4444; }

@keyframes ds-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.deep-solve-content {
  line-height: 1.5;
}

.ds-error {
  color: #ff8c00;
  font-size: 13px;
}

.ds-suggestion {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ds-suggest-text {
  font-size: 11px;
  color: #888;
}

.ds-suggest-btn {
  background: #ff8c00;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.ds-suggest-btn:hover {
  background: #e07800;
}

/* ── Study Materials ────────────────────────────────── */

.study-modal-content {
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
}

.study-doc-info {
  color: #888;
  font-size: 12px;
  text-align: center;
  margin-bottom: 16px;
}

.study-generate-area {
  text-align: center;
  padding: 20px 0;
}

.study-generate-text {
  color: #888;
  font-size: 13px;
  margin-bottom: 16px;
}

.study-generate-btn {
  background: linear-gradient(135deg, #7c6ff7, #a78bfa);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.study-generate-btn:hover {
  opacity: 0.85;
}

.study-loading {
  text-align: center;
  padding: 30px 0;
}

.study-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: #7c6ff7;
  border-radius: 50%;
  animation: study-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes study-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.study-loading-text {
  color: #888;
  font-size: 13px;
}

.study-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 3px;
}

.study-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #888;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.study-tab.active {
  background: #7c6ff7;
  color: white;
}

.study-panel {
  display: none;
}

.study-panel.active {
  display: block;
}

.study-summary-text {
  color: #e0e0e0;
  font-size: 13px;
  line-height: 1.7;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  white-space: pre-wrap;
}

/* Flashcards */

.flashcard-container {
  perspective: 1000px;
  margin-bottom: 12px;
}

.flashcard {
  width: 100%;
  height: 200px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  color: #e0e0e0;
  overflow-y: auto;
}

.flashcard-front {
  background: linear-gradient(135deg, #1a1a3a, #252550);
  border: 1px solid rgba(124,111,247,0.3);
}

.flashcard-back {
  background: linear-gradient(135deg, #1a2a1a, #1a3a2a);
  border: 1px solid rgba(80,200,120,0.3);
  transform: rotateY(180deg);
}

.flashcard-counter {
  text-align: center;
  color: #888;
  font-size: 12px;
  margin-bottom: 8px;
}

.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.flashcard-btn {
  background: #1a1a3a;
  border: 1px solid #333;
  color: #b8b0ff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.flashcard-btn:hover {
  border-color: #7c6ff7;
}

.flashcard-shuffle-btn {
  color: #f0a030;
  border-color: rgba(240,160,48,0.3);
}

.flashcard-shuffle-btn:hover {
  border-color: #f0a030;
}

/* Quiz */

.quiz-progress {
  color: #888;
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

.quiz-question {
  color: #e0e0e0;
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  padding: 12px 16px;
  background: #1a1a3a;
  border: 1px solid #333;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.quiz-option:hover {
  border-color: #7c6ff7;
  background: #1e1e42;
}

.quiz-option.correct {
  border-color: #50c878;
  background: rgba(80,200,120,0.1);
  color: #50c878;
}

.quiz-option.wrong {
  border-color: #ff5050;
  background: rgba(255,80,80,0.1);
  color: #ff5050;
}

.quiz-option.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.quiz-explanation {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(124,111,247,0.1);
  border-radius: 8px;
  color: #b8b0ff;
  font-size: 13px;
  line-height: 1.4;
}

.quiz-next-btn {
  margin-top: 12px;
  background: #7c6ff7;
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s;
}

.quiz-next-btn:hover {
  opacity: 0.85;
}

.quiz-results {
  text-align: center;
  padding: 30px 0;
}

.quiz-score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  font-weight: 700;
}

.quiz-score-text {
  color: #e0e0e0;
  font-size: 14px;
  margin-bottom: 16px;
}

.quiz-retry-btn {
  background: #7c6ff7;
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  max-width: 200px;
  margin: 0 auto;
  display: block;
  transition: opacity 0.2s;
}

.quiz-retry-btn:hover {
  opacity: 0.85;
}

.study-regenerate-btn {
  margin-top: 16px;
  background: none;
  border: 1px solid #333;
  color: #888;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.study-regenerate-btn:hover {
  border-color: #7c6ff7;
  color: #b8b0ff;
}

.study-error {
  color: #ff5050;
  text-align: center;
  padding: 16px;
  font-size: 13px;
}

.knowledge-doc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.knowledge-doc-study {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.knowledge-doc-study:hover {
  background: rgba(124,111,247,0.15);
}

/* ── Proactive TutorBot ────────────────────────────── */

.followup-chips {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.followup-chip {
  background: rgba(124,111,247,0.15);
  color: #a99ff7;
  border: 1px solid rgba(124,111,247,0.3);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followup-chip:hover {
  background: rgba(124,111,247,0.3);
  color: #c4bcff;
  border-color: rgba(124,111,247,0.5);
}

.followup-chip:active {
  transform: scale(0.95);
}

.nudge-message {
  opacity: 0;
  animation: nudgeFadeIn 0.5s ease forwards;
}

.nudge-bubble {
  background: rgba(124,111,247,0.08) !important;
  border: 1px dashed rgba(124,111,247,0.3) !important;
  color: #999 !important;
  font-style: italic;
  font-size: 13px !important;
}

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

.study-suggestion {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.study-suggest-icon {
  font-size: 14px;
}

.study-suggest-text {
  font-size: 11px;
  color: #888;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-suggest-btn {
  background: #50c878;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.study-suggest-btn:hover {
  background: #45b06a;
}

/* ─── Mock Exam ─── */
.knowledge-doc-badge-type {
  background: #efe7ff;
  color: #7c4ddb;
}
.mockexam-setup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0;
}
.mockexam-setup-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #555;
}
.mockexam-setup-row select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.mockexam-title { margin: 4px 0; }
.mockexam-note { font-size: 13px; color: #888; margin-bottom: 14px; }
.mockexam-q {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fafafa;
}
.mockexam-q-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 8px;
}
.mockexam-q-num { font-weight: 700; color: #7c6ff7; }
.mockexam-q-marks { color: #999; }
.mockexam-src {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.mockexam-src-real { background: #e6f7ec; color: #2e9e57; }
.mockexam-src-new { background: #eef0ff; color: #5b6cf0; }
.mockexam-q-text { font-size: 15px; margin-bottom: 10px; line-height: 1.5; }
.mockexam-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}
.mockexam-answer {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.mockexam-score { text-align: center; margin-bottom: 12px; }
.mockexam-score-big { font-size: 34px; font-weight: 800; color: #7c6ff7; }
.mockexam-score-pct { font-size: 16px; color: #888; }
.mockexam-overall {
  background: #f6f4ff;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.mockexam-result-item {
  border-left: 4px solid #ccc;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.mockexam-correct { border-left-color: #34c759; }
.mockexam-wrong { border-left-color: #ff5a5f; }
.mockexam-result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
}
.mockexam-result-marks { color: #777; white-space: nowrap; }
.mockexam-result-model { font-size: 13px; color: #555; margin-top: 6px; }
.mockexam-result-fb { font-size: 13px; color: #777; margin-top: 4px; font-style: italic; }

.mockexam-topics-area { margin: 14px 0; }
.mockexam-topics-label { font-size: 14px; font-weight: 600; color: #444; margin-bottom: 8px; }
.mockexam-topics-hint { font-weight: 400; color: #999; font-size: 12px; }
.mockexam-topics-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
}
.mockexam-topics-empty { color: #999; font-size: 13px; margin: 4px; }
.mockexam-topic-doc { margin-bottom: 10px; }
.mockexam-topic-doc:last-child { margin-bottom: 0; }
.mockexam-topic-doctitle {
  font-size: 12px;
  font-weight: 700;
  color: #7c6ff7;
  margin-bottom: 4px;
}
.mockexam-topic {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 8px;
  font-size: 14px;
  cursor: pointer;
}
.mockexam-topic input { accent-color: #7c6ff7; }
.mockexam-ask { margin: 14px 0; }
.mockexam-ask label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.mockexam-ask textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
