/* ============================================
   ÉCLAT — French/English Vocabulary App
   Style Sheet
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --cream: #F8F5F0;
  --cream-dark: #EDE8E0;
  --navy: #1B2A4A;
  --navy-light: #2C3E6B;
  --slate: #4A5568;
  --gold: #C9A84C;
  --gold-light: #E2C97E;
  --gold-pale: #F5EDD4;
  --white: #FFFFFF;
  --red-soft: #C0392B;
  --green-soft: #27AE60;
  --shadow-sm: 0 2px 8px rgba(27, 42, 74, 0.08);
  --shadow-md: 0 4px 20px rgba(27, 42, 74, 0.12);
  --shadow-lg: 0 8px 40px rgba(27, 42, 74, 0.18);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --nav-height: 68px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Noto Emoji', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--navy);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- App Shell ---------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Header ---------- */
.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.app-header h1 {
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.app-header .subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1px;
}

.header-word-count {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---------- Main Content Area ---------- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-height) + 16px);
}

/* ---------- Views ---------- */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--white);
  border-top: 1px solid var(--cream-dark);
  display: flex;
  align-items: center;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(27, 42, 74, 0.1);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--slate);
  transition: color var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform var(--transition);
}

.nav-btn .nav-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-btn.active {
  color: var(--navy);
}

.nav-btn.active .nav-icon {
  transform: scale(1.1);
}

.nav-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 3px;
  background: var(--gold);
  border-radius: 0 0 3px 3px;
  transition: transform var(--transition);
}

.nav-btn.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* ---------- Section Headers ---------- */
.section-header {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h2 {
  font-size: 1.3rem;
  color: var(--navy);
}

/* ---------- Filter Bar ---------- */
.filter-bar {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.filter-label {
  font-size: 0.72rem;
  color: var(--slate);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
  width: 100%;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  color: var(--slate);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
  border-color: var(--gold);
  color: var(--navy);
}

.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ---------- Search Bar ---------- */
.search-bar {
  padding: 0 20px 16px;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--navy);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

/* ---------- Word List ---------- */
.word-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid transparent;
}

.word-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.word-card.remembered {
  border-color: var(--green-soft);
  opacity: 0.7;
}

.word-card-body {
  flex: 1;
  min-width: 0;
}

.word-card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.word-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  font-family: 'Inter', sans-serif;
}

.word-meaning {
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 4px;
}

.word-example {
  font-size: 0.78rem;
  color: var(--slate);
  opacity: 0.75;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-tags {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 10px;
}

.tag-lang {
  background: var(--navy);
  color: var(--gold-light);
}

.tag-lang.EN {
  background: var(--slate);
}

.tag-level {
  background: var(--gold-pale);
  color: var(--navy);
}

.word-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--cream);
  color: var(--slate);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--navy);
  color: var(--white);
}

.icon-btn.danger:hover {
  background: var(--red-soft);
  color: var(--white);
}

.icon-btn.tts-btn:hover {
  background: var(--gold);
  color: var(--white);
}

/* ---------- Empty State ---------- */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--slate);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------- Add/Edit Form View ---------- */
.form-view {
  padding: 20px;
}

.form-view h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--navy);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--navy);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.form-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234A5568' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--navy-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  margin-top: 8px;
}

.btn-secondary:hover {
  border-color: var(--navy);
  background: var(--cream);
}

.btn-gold {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  margin-top: 8px;
}

.btn-gold:hover {
  background: var(--gold-light);
  box-shadow: var(--shadow-md);
}

/* ---------- CSV Import Section ---------- */
.csv-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--cream-dark);
}

.csv-section h3 {
  font-size: 1rem;
  color: var(--navy);
  margin-bottom: 8px;
  font-family: 'Inter', sans-serif;
}

.csv-section p {
  font-size: 0.8rem;
  color: var(--slate);
  margin-bottom: 14px;
  line-height: 1.5;
}

.csv-format {
  background: var(--navy);
  color: var(--gold-light);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.file-drop-zone {
  border: 2px dashed var(--cream-dark);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--gold);
  background: var(--gold-pale);
}

.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-drop-zone .drop-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

.file-drop-zone p {
  font-size: 0.85rem;
  color: var(--slate);
  margin: 0;
}

/* ---------- CSV Preview ---------- */
.csv-preview {
  margin-top: 14px;
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--cream-dark);
  overflow: hidden;
}

.csv-preview-header {
  padding: 12px 16px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  overflow-x: auto;
  display: block;
}

.csv-preview-table th {
  background: var(--cream);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--slate);
  white-space: nowrap;
}

.csv-preview-table td {
  padding: 7px 10px;
  border-top: 1px solid var(--cream-dark);
  color: var(--navy);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csv-preview-table tr:nth-child(even) td {
  background: var(--cream);
}

/* ---------- Practice View ---------- */
.practice-setup {
  padding: 20px;
}

.practice-setup h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--navy);
}

.practice-info {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
  color: var(--slate);
}

.practice-info .count {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  font-family: 'Inter', sans-serif;
}

/* ---------- Flashcard Area ---------- */
.flashcard-area {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px;
  min-height: calc(100vh - var(--nav-height) - 60px);
}

.flashcard-area.visible {
  display: flex;
}

.progress-bar-wrap {
  width: 100%;
  margin-bottom: 16px;
}

.progress-bar-track {
  width: 100%;
  height: 4px;
  background: var(--cream-dark);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--slate);
  margin-top: 6px;
  text-align: right;
}

/* ---------- Flashcard ---------- */
.flashcard-scene {
  width: 100%;
  max-width: 380px;
  height: 260px;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 24px;
  -webkit-tap-highlight-color: transparent;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-scene.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.flashcard-front {
  background: var(--navy);
  color: var(--white);
}

.flashcard-back {
  background: var(--white);
  color: var(--navy);
  transform: rotateY(180deg);
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.card-lang-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.12);
  color: var(--gold-light);
}

.flashcard-back .card-lang-tag {
  background: var(--gold-pale);
  color: var(--navy);
}

.card-word {
  font-family: 'Inter', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--white);
  margin-bottom: 8px;
}

.card-hint {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  margin-top: 12px;
}

.card-meaning {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--navy);
  margin-bottom: 10px;
  line-height: 1.3;
}

.card-example {
  font-size: 0.82rem;
  color: var(--slate);
  font-style: italic;
  line-height: 1.6;
  margin-top: 6px;
}

.card-tts-btn {
  margin-top: auto;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  align-self: flex-end;
  -webkit-tap-highlight-color: transparent;
}

.card-tts-btn:hover {
  background: var(--navy-light);
}

.flashcard-front .card-tts-btn {
  background: rgba(255,255,255,0.15);
  margin-top: 16px;
}

.flashcard-front .card-tts-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ---------- Flashcard Action Buttons ---------- */
.flashcard-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.flashcard-actions.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-remembered {
  flex: 1;
  padding: 14px;
  background: var(--green-soft);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-remembered:hover {
  background: #229954;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.35);
  transform: translateY(-1px);
}

.btn-again {
  flex: 1;
  padding: 14px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-again:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ---------- Session Result ---------- */
.session-result {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
}

.session-result.visible {
  display: flex;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.result-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.result-subtitle {
  font-size: 0.9rem;
  color: var(--slate);
  margin-bottom: 32px;
  line-height: 1.5;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin-bottom: 32px;
}

.result-stat {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.result-stat .stat-num {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--navy);
  line-height: 1;
}

.result-stat .stat-label {
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 4px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 42, 74, 0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 480px;
  transform: translateY(40px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--cream-dark);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  margin-top: 0;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 400;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  pointer-events: none;
  max-width: calc(100% - 40px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--green-soft);
}

.toast.error {
  background: var(--red-soft);
}

/* ---------- Word Count Badge ---------- */
.word-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  min-width: 28px;
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--cream-dark);
  margin: 8px 20px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--cream-dark);
  border-radius: 2px;
}

/* ---------- Writing Practice View ---------- */
.write-prompt-card {
  background: var(--white);
  border: 2px solid var(--gold-pale);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.write-prompt-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 8px;
}

.write-prompt-word {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.write-prompt-meaning {
  font-size: 0.95rem;
  color: var(--slate);
  margin-bottom: 6px;
}

.write-prompt-example {
  font-size: 0.82rem;
  color: var(--slate);
  font-style: italic;
  opacity: 0.7;
}

.write-feedback {
  background: linear-gradient(135deg, #f0f4ff, #faf8f0);
  border: 1px solid var(--gold-pale);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 8px;
}

.write-feedback-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.write-feedback-text {
  font-size: 0.92rem;
  color: var(--navy);
  line-height: 1.7;
  white-space: pre-wrap;
}

.write-no-api {
  background: var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.88rem;
  color: var(--slate);
  text-align: center;
  line-height: 1.6;
  margin-top: 16px;
}

/* ---------- Emoji Color ---------- */
.nav-icon,
.empty-state .empty-icon,
.result-icon,
.drop-icon,
.icon-btn,
.card-tts-btn,
.convo-cat-icon {
  font-family: 'Noto Emoji', sans-serif;
  color: var(--navy);
}

/* ---------- Dark Mode Toggle Button ---------- */
.dark-mode-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

/* ---------- Gender Tags ---------- */
.tag-gender-M {
  background: #dbeafe;
  color: #1e40af;
}

.tag-gender-F {
  background: #fce7f3;
  color: #9d174d;
}

/* ---------- AI Suggest Button ---------- */
.btn-ai-suggest {
  float: right;
  font-size: 0.72rem;
  padding: 3px 9px;
  background: var(--gold-pale);
  color: var(--gold);
  border: 1px solid var(--gold-light);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-ai-suggest:hover {
  background: var(--gold);
  color: var(--white);
}

.btn-ai-suggest:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --cream: #111827;
  --cream-dark: #1f2937;
  --white: #1e2535;
  --navy: #e2e8f0;
  --navy-light: #cbd5e1;
  --slate: #94a3b8;
  --gold-pale: #2a2010;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.7);
}

[data-theme="dark"] .app-header {
  background: #0d1117;
}

[data-theme="dark"] .bottom-nav {
  background: #1a2030;
  border-top-color: #2d3748;
}

[data-theme="dark"] .btn-primary {
  background: #2c4a7c;
}

[data-theme="dark"] .btn-primary:hover {
  background: #3a5f99;
}

[data-theme="dark"] .btn-secondary {
  border-color: #374151;
  color: var(--navy);
}

[data-theme="dark"] .filter-chip {
  background: #1e2535;
  border-color: #374151;
  color: var(--slate);
}

[data-theme="dark"] .filter-chip.active {
  background: #2c4a7c;
  border-color: #2c4a7c;
  color: #e2e8f0;
}

[data-theme="dark"] .flashcard-front {
  background: #1e3558;
}

[data-theme="dark"] .flashcard-back {
  background: #1e2535;
}

[data-theme="dark"] .chat-bubble-user {
  background: #2c4a7c;
}

[data-theme="dark"] .tag-lang {
  background: #2c4a7c;
}

[data-theme="dark"] .tag-gender-M {
  background: #1e3a5f;
  color: #93c5fd;
}

[data-theme="dark"] .tag-gender-F {
  background: #4a1942;
  color: #f9a8d4;
}

[data-theme="dark"] .modal {
  background: #1e2535;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0,0,0,0.7);
}

[data-theme="dark"] .write-feedback {
  background: #1a2035;
  border-color: #2a2010;
}

[data-theme="dark"] .hint-panel {
  background: #1a2030;
}

[data-theme="dark"] .hint-chip {
  background: #1e2535;
  border-color: #374151;
}

[data-theme="dark"] .convo-cat-btn {
  background: #1e2535;
  border-color: #374151;
  color: var(--slate);
}

[data-theme="dark"] .convo-cat-btn.active {
  background: #2c4a7c;
  border-color: #2c4a7c;
  color: #e2e8f0;
}

[data-theme="dark"] .convo-scenario-card {
  background: #2a2010;
}

[data-theme="dark"] .csv-format {
  background: #0d1117;
}

[data-theme="dark"] .csv-preview-header {
  background: #0d1117;
}

[data-theme="dark"] .write-no-api,
[data-theme="dark"] .icon-btn {
  background: #2d3748;
}

[data-theme="dark"] .btn-ai-suggest {
  background: #2a2010;
  border-color: #5a4a20;
}

/* ---------- Chat Bubble Actions ---------- */
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wrap-user { align-items: flex-end; }
.wrap-ai  { align-items: flex-start; }

.bubble-actions {
  display: flex;
  gap: 4px;
}

.bubble-btn {
  font-size: 0.7rem;
  padding: 3px 8px;
  background: var(--cream-dark);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: var(--slate);
  font-family: inherit;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.bubble-btn:hover {
  background: var(--gold-pale);
  color: var(--navy);
}

.bubble-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bubble-translation {
  font-size: 0.8rem;
  color: var(--slate);
  background: var(--cream-dark);
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 85%;
  font-style: italic;
  line-height: 1.5;
}

/* ---------- Phrase Add Button ---------- */
.btn-add-phrase {
  margin-top: 10px;
  font-size: 0.78rem;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 12px;
  color: var(--gold);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-add-phrase:hover {
  background: var(--gold-pale);
}

/* ---------- Conversation Practice View ---------- */
.convo-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.convo-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--slate);
  -webkit-tap-highlight-color: transparent;
}

.convo-cat-btn:hover {
  border-color: var(--gold);
  color: var(--navy);
}

.convo-cat-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.convo-cat-btn.active .convo-cat-icon {
  color: var(--white);
}

.convo-cat-icon {
  font-size: 1.5rem;
}

.convo-scenario-card {
  background: var(--gold-pale);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.convo-scenario-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.convo-scenario-text {
  font-size: 0.88rem;
  color: var(--navy);
  line-height: 1.5;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  max-height: 38vh;
  overflow-y: auto;
  padding: 4px 0 12px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 85%;
  word-break: break-word;
}

.chat-bubble-ai {
  background: var(--white);
  color: var(--navy);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
}

.chat-bubble-user {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.hint-panel {
  background: var(--cream-dark);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.hint-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 8px;
}

.hint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-chip {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hint-chip:hover {
  border-color: var(--gold);
  background: var(--gold-pale);
}

.hint-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

.hint-meaning {
  font-size: 0.75rem;
  color: var(--slate);
}

.chat-input-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.chat-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--navy);
  outline: none;
  resize: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.chat-input-actions {
  display: flex;
  gap: 8px;
}

.btn-hint {
  flex: 1;
  padding: 11px;
  background: var(--cream-dark);
  color: var(--navy);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-hint:hover {
  background: var(--gold-pale);
}

.btn-send {
  flex: 2;
  padding: 11px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-send:hover {
  background: var(--navy-light);
}

.btn-send:disabled,
.btn-hint:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 360px) {
  .card-word {
    font-size: 1.8rem;
  }

  .card-meaning {
    font-size: 1.3rem;
  }

  .flashcard-scene {
    height: 220px;
  }
}
