/* Modern High-Aesthetic Stylesheet for Sách Luyện Dịch HSK (HSK 1-9) */
:root {
  --bg-app: #f4f1ea;
  --bg-card: #ffffff;
  --bg-paper: #faf8f5;
  --bg-input: #ffffff;
  --primary: #0f2b48;
  --primary-hover: #173d66;
  --accent-red: #a31c1c;
  --accent-red-hover: #821515;
  --accent-green: #15803d;
  --accent-amber: #b45309;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2dcd2;
  --border-focus: #0f2b48;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(15,43,72,0.08);
  --shadow-lg: 0 12px 32px rgba(15,43,72,0.12);
  --line-color: #cbd5e1;
  --line-margin: #f87171;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif-sc: 'Noto Serif SC', 'Songti SC', 'Source Han Serif SC', serif;
  --font-sans-sc: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}

/* Global reset removed for integration */

/* Body styles scoped to .trans-container */

/* Container */
.trans-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 16px 20px 80px;
}

/* Header */
.trans-header-bar {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1ece1;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 26px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.brand-badge {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

/* User Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.trans-stat-item {
  background: var(--bg-paper);
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid #eae4d8;
  color: var(--text-muted);
}

.trans-stat-item strong {
  color: var(--primary);
  font-weight: 700;
}

.trans-stat-item.warning {
  background: #fef2f2;
  border-color: #fee2e2;
  color: var(--accent-red);
}

/* Level Tabs */
.level-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.level-btn {
  background: #f1ede4;
  border: 1px solid #e2dbce;
  color: #475569;
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.level-btn:hover {
  background: #e6e0d3;
  color: var(--primary);
}

.level-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15,43,72,0.25);
}

.level-btn .count-badge {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 400;
}

/* Mode & Utility Toolbar */
.toolbar-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.mode-switch-group {
  display: flex;
  gap: 6px;
}

.mode-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #dcd4c6;
  background: var(--bg-paper);
  color: var(--text-main);
  transition: all 0.2s;
}

.mode-btn:hover {
  background: #ede7da;
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.nav-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-nav {
  padding: 6px 12px;
  border: 1px solid #dcd4c6;
  background: #ffffff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-nav:hover {
  background: #f8f6f0;
  border-color: #b8ac97;
}

.lesson-selector {
  padding: 6px 12px;
  border: 1px solid #dcd4c6;
  background: #ffffff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  max-width: 220px;
  cursor: pointer;
}

.btn-util {
  padding: 6px 12px;
  border: 1px solid #dcd4c6;
  background: #ffffff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-util:hover {
  background: #f1ede4;
}

.btn-util.primary {
  background: #1e3a5f;
  color: #ffffff;
  border-color: #1e3a5f;
}

.btn-util.primary:hover {
  background: #152b47;
}

/* Main Card */
.lesson-card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.lesson-card-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1ece1;
}

.lesson-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.lesson-topic-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.lesson-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: #f1ede4;
  color: #555;
}

.tag-badge.level {
  background: #e0f2fe;
  color: #0369a1;
}

.tag-badge.direction {
  background: #fef3c7;
  color: #92400e;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Original Passage Box */
.passage-box {
  background: var(--bg-paper);
  border: 1px solid #e8e2d5;
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

.chinese-text {
  font-family: var(--font-serif-sc);
  font-size: 22px;
  line-height: 2.1;
  color: #1a1a1a;
  letter-spacing: 0.02em;
}

.vietnamese-prompt {
  font-size: 17px;
  line-height: 1.8;
  color: #1e293b;
}

/* Sentence segment highlighting */
.sentence-span {
  display: inline;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.sentence-span:hover {
  background-color: #fef08a;
  color: #000;
}

.sentence-span.active {
  background-color: #fde047;
  box-shadow: 0 0 0 2px #facc15;
}

/* Hanzi ruby pinyin */
ruby {
  ruby-position: over;
}

rt {
  font-family: var(--font-sans);
  font-size: 12px;
  color: #0369a1;
  font-weight: 500;
  user-select: none;
}

/* Word highlight in passage */
.hz-word {
  cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: all 0.15s;
}

.hz-word:hover {
  border-bottom-color: #2563eb;
  color: #1d4ed8;
}

/* Audio Player Bar */
.audio-controller-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.audio-main-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-audio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  transition: all 0.15s;
}

.btn-audio:hover {
  background: var(--primary-hover);
}

.btn-audio.secondary {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-audio.secondary:hover {
  background: #f1f5f9;
}

.speed-control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.speed-btn {
  padding: 4px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s;
}

.speed-btn:hover {
  background: #f1f5f9;
}

.speed-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.audio-hint {
  font-size: 12px;
  color: #64748b;
  margin-left: auto;
  font-style: italic;
}

/* Pinyin Box */
.pinyin-box {
  background: #fbfbfd;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.pinyin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.05em;
}

.pinyin-content {
  color: #334155;
  font-size: 14px;
  line-height: 1.8;
}

.pinyin-placeholder {
  color: #94a3b8;
  font-style: italic;
}

/* Translation Lined Notebook Area */
.translation-input-section {
  margin-bottom: 20px;
}

.input-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.input-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  letter-spacing: 0.05em;
}

.input-word-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Authentic Lined Paper Textarea */
.lined-paper-wrapper {
  position: relative;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.03);
  background: #ffffff;
}

.notebook-textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px 18px 12px 28px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 36px;
  color: #1e293b;
  border: none;
  outline: none;
  resize: vertical;
  background-color: #fafaf9;
  /* Lined Paper effect with blue rules & red margin */
  background-image: 
    linear-gradient(90deg, transparent 20px, #fca5a5 20px, #fca5a5 21px, transparent 21px),
    linear-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 100% 100%, 100% 36px;
  background-attachment: local;
}

.notebook-textarea:focus {
  background-color: #ffffff;
}

/* Bottom Actions */
.lesson-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
}

.action-buttons-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent-red);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(163,28,28,0.25);
  transition: all 0.2s;
}

.btn-submit:hover {
  background: var(--accent-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(163,28,28,0.3);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.shortcut-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.shortcut-hint kbd {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 600;
}

/* ==========================================================
   EVALUATION & CORRECTION RESULTS PANEL (Matches Screenshot 2)
   ========================================================== */
.results-card {
  display: none;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 26px 30px;
  box-shadow: var(--shadow-lg);
  margin-top: 24px;
  animation: slideDown 0.3s ease-out forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1ece1;
  margin-bottom: 20px;
}

.results-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-red);
  letter-spacing: -0.01em;
}

.results-engine-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
}

/* Score Overview Row */
.score-overview-container {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: #fffbf5;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  margin-bottom: 18px;
}

.score-circle-wrapper {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--accent-red);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.score-circle-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-red);
  line-height: 1;
}

.score-circle-max {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.score-text-details h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-red);
  margin-bottom: 6px;
}

.score-text-details p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

/* Error Summary Banner */
.error-summary-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 12px;
}

.error-pill {
  background: #fee2e2;
  color: var(--accent-red);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* Repeated Error Alert */
.repeated-error-alert {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 4px solid #eab308;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #713f12;
  line-height: 1.5;
}

.repeated-error-alert strong {
  color: #854d0e;
}

/* Sentence Details Breakdown */
.breakdown-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sentence-correction-card {
  background: #ffffff;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: all 0.2s;
}

.sentence-correction-card.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.sentence-correction-card.warning {
  border-color: #fed7aa;
  background: #fffaf0;
}

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

.sentence-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.sentence-score-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fee2e2;
  color: var(--accent-red);
}

.sentence-score-badge.good {
  background: #dcfce7;
  color: var(--accent-green);
}

.sentence-source-row {
  font-family: var(--font-serif-sc);
  font-size: 17px;
  color: #0f172a;
  margin-bottom: 6px;
  line-height: 1.6;
}

.sentence-user-row {
  font-size: 14px;
  color: #334155;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
  margin-bottom: 6px;
}

.sentence-target-row {
  font-size: 14px;
  color: #15803d;
  background: #f0fdf4;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-weight: 500;
}

.sentence-critique {
  font-size: 13px;
  color: #991b1b;
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.sentence-vocab-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.vocab-note-chip {
  font-size: 11px;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  color: #334155;
}

/* Full Reference Translation Accordion */
.full-ref-accordion {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 20px;
}

.full-ref-header {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.full-ref-content {
  font-size: 15px;
  line-height: 1.8;
  color: #334155;
}

/* AI Consultation Button */
.ai-consultation-box {
  margin-top: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ai-box-text h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.ai-box-text p {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-ai-grade {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
  transition: all 0.2s;
}

.btn-ai-grade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

/* ==========================================================
   MODALS (Dictionary, Editor, Importer, Settings)
   ========================================================== */
.trans-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.trans-modal-overlay.active {
  display: flex;
}

.trans-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: zoomIn 0.25s ease-out;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.trans-modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.trans-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.trans-btn-close-modal {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trans-btn-close-modal:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.trans-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.trans-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Dictionary Modal Specifics */
.dict-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.dict-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}

.dict-input:focus {
  border-color: var(--primary);
}

.dict-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.dict-pill {
  padding: 4px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
}

.dict-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.dict-results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.dict-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  transition: all 0.15s;
}

.dict-item-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
}

.dict-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dict-item-zh {
  font-family: var(--font-serif-sc);
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.dict-item-py {
  font-size: 13px;
  color: #0284c7;
  font-weight: 600;
}

.dict-item-lvl {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: #eff6ff;
  color: #1d4ed8;
}

.dict-item-vi {
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

/* Form Groups for Lesson Editor */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15,43,72,0.1);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Floating Word Popover */
.trans-word-popover {
  display: none;
  position: absolute;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 10px 14px;
  z-index: 2000;
  max-width: 280px;
  pointer-events: auto;
}

.trans-word-popover.active {
  display: block;
}

.pop-zh {
  font-family: var(--font-serif-sc);
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

.pop-py {
  font-size: 13px;
  color: #0284c7;
  font-weight: 600;
  margin-left: 6px;
}

.pop-lvl {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  margin-left: 6px;
}

.pop-vi {
  font-size: 13px;
  color: #475569;
  margin-top: 4px;
}

.btn-pop-action {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
  transition: all 0.15s;
}

.btn-pop-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-pop-action.star-btn {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}

.btn-pop-action.star-btn:hover {
  background: #fef08a;
}

.btn-pop-action.star-btn.saved {
  background: #fef08a;
  color: #a16207;
  font-weight: 700;
}

/* Notebook Styles */
.trans-modal-lg {
  max-width: 880px !important;
  width: 95% !important;
}

.notebook-quick-add-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.notebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.notebook-word-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.notebook-word-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

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

.nb-card-zh {
  font-family: var(--font-serif-sc);
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.nb-card-py {
  font-size: 13.5px;
  color: #0284c7;
  font-weight: 600;
}

.nb-card-lvl {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}

.nb-card-vi {
  font-size: 13px;
  color: #334155;
  line-height: 1.4;
  margin-top: 2px;
  word-break: break-word;
}

.nb-card-date {
  font-size: 11px;
  color: #94a3b8;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nb-card-actions {
  display: flex;
  gap: 6px;
}

.nb-btn-speak, .nb-btn-delete {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.nb-btn-speak:hover {
  background: #e0f2fe;
  color: #0369a1;
}

.nb-btn-delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.success-btn {
  background: #16a34a !important;
  color: #ffffff !important;
  border-color: #15803d !important;
  font-weight: 600 !important;
}

.success-btn:hover {
  background: #15803d !important;
}

.info-btn {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  font-weight: 600 !important;
}

.info-btn:hover {
  background: #0369a1 !important;
}

/* Toast message */
.trans-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.trans-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Dict star button */
.btn-dict-star {
  background: none;
  border: none;
  font-size: 16px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.btn-dict-star:hover {
  color: #eab308;
}
.btn-dict-star.saved {
  color: #eab308;
}

/* Focus vocab chips in lesson */
.vocab-focus-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff !important;
  border: 1px solid #fde68a !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
}
.vocab-focus-chip .chip-speak {
  cursor: pointer;
  font-size: 13px;
}
.vocab-focus-chip .chip-star {
  cursor: pointer;
  font-size: 14px;
  color: #cbd5e1;
  transition: color 0.15s;
}
.vocab-focus-chip .chip-star:hover,
.vocab-focus-chip .chip-star.saved {
  color: #eab308;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .trans-container {
    padding: 10px 12px 60px;
  }
  .trans-header-bar {
    padding: 14px 16px;
  }
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-stats {
    width: 100%;
    justify-content: space-between;
  }
  .lesson-card {
    padding: 18px 16px;
  }
  .chinese-text {
    font-size: 19px;
    line-height: 2;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .score-overview-container {
    flex-direction: column;
    text-align: center;
  }
}
