/* ============================================
   FONTS (self-hosted)
   ============================================ */
@font-face {
  font-family: 'Lexend';
  src: url('fonts/Lexend-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Lexend';
  src: url('fonts/Lexend-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Lexend';
  src: url('fonts/Lexend-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'NotoSansSC';
  src: url('fonts/NotoSansSC-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NotoSansSC';
  src: url('fonts/NotoSansSC-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { 
  height: 100%; 
  overflow-x: hidden;
  touch-action: manipulation;
}
body {
  font-family: 'Lexend', sans-serif;
  background: #081a10;
  color: #fff;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Lexend', sans-serif;
}

/* ============================================
   ANIMATED BACKGROUND BLOBS
   ============================================ */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
.blob1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #2ecc71, #00b894);
  top: -150px; left: -150px;
  animation: blobMove1 12s ease-in-out infinite alternate;
}
.blob2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #00cec9, #00b894);
  bottom: -100px; right: -100px;
  animation: blobMove2 15s ease-in-out infinite alternate;
}
.blob3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #55efc4, #00b894);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: blobMove3 10s ease-in-out infinite alternate;
}
@keyframes blobMove1 {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(80px,60px) scale(1.15); }
}
@keyframes blobMove2 {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-60px,-80px) scale(1.2); }
}
@keyframes blobMove3 {
  0%   { transform: translate(-50%,-50%) scale(1); }
  100% { transform: translate(-45%,-55%) scale(1.1); }
}

/* ============================================
   APP WRAPPER
   ============================================ */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 100px;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
  width: 100%;
  max-width: 680px;
  padding: 28px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.app-title {
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-weight: 700;
  background: linear-gradient(135deg, #55efc4, #00b894, #81ecec);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
  text-align: center;
  filter: drop-shadow(0 2px 8px rgba(46,204,113,0.4));
}

/* Word Count Badge */
.word-count-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(46,204,113,0.15);
  border: 1.5px solid rgba(46,204,113,0.3);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #55efc4;
  animation: fadeInUp 0.6s ease both;
}
.badge-star { font-size: 0.9rem; }

/* Search */
.search-container {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 16px;
  width: 20px; height: 20px;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
}
.search-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 14px 48px;
  border-radius: 50px;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-input:focus {
  border-color: rgba(46,204,113,0.6);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 4px rgba(46,204,113,0.15), 0 8px 32px rgba(0,0,0,0.2);
}
.search-clear {
  position: absolute;
  right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  transition: background 0.2s, transform 0.2s;
  opacity: 0;
  pointer-events: none;
}
.search-clear svg { width: 14px; height: 14px; }
.search-clear.visible { opacity: 1; pointer-events: all; }
.search-clear:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }

/* Storage Bar */
.storage-bar-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.storage-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
}
.storage-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2ecc71, #00cec9);
  border-radius: 4px;
  transition: width 0.6s ease, background 0.4s;
}
.storage-bar-fill.warn  { background: linear-gradient(90deg, #fdcb6e, #e17055); }
.storage-bar-fill.danger{ background: linear-gradient(90deg, #e17055, #d63031); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  width: 100%;
  max-width: 680px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 8px;
}

/* Home Screen */
.home-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeInUp 0.6s ease both;
}
.home-illustration { font-size: 5rem; animation: float 3s ease-in-out infinite; }
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
.home-hint {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
}
.add-word-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(46,204,113,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.add-word-btn svg { width: 20px; height: 20px; }
.add-word-btn:hover  { transform: scale(1.05); }
.add-word-btn:active { transform: scale(0.97); }
.add-word-fab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(46,204,113,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.add-word-fab svg { width: 20px; height: 20px; }
.add-word-fab:hover  { transform: scale(1.05); }
.add-word-fab:active { transform: scale(0.97); }

/* No Results */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeInUp 0.4s ease both;
}
.no-results-icon { font-size: 3rem; }
.no-results p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.6);
  text-align: center;
  line-height: 1.6;
}

/* ============================================
   FAB
   ============================================ */

.fab {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(46,204,113,0.55);
  z-index: 50;
  transition: transform 0.25s, box-shadow 0.25s;
  animation: fadeInUp 0.5s ease both;
}

.fab svg { width: 28px; height: 28px; }
.fab:hover  { transform: scale(1.1) rotate(90deg); box-shadow: 0 12px 36px rgba(46,204,113,0.6); }
.fab:active { transform: scale(0.95); }

/* ============================================
   CAROUSEL
   ============================================ */
.carousel-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  animation: fadeInUp 0.5s ease both;
}
.card-counter {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}
.carousel-track-container {
  width: 100%;
  overflow: hidden;
  border-radius: 28px;
}
.carousel-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* ============================================
   DICTIONARY CARD
   ============================================ */
.dict-card {
  min-width: 100%;
  background: linear-gradient(145deg,
    rgba(46, 204, 113, 0.3) 0%,
    rgba(0, 184, 148, 0.3) 50%,
    rgba(0, 206, 201, 0.35) 100%
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.5),
    0 0 0 1px rgba(46,204,113,0.15),
    inset 0 1px 0 rgba(255,255,255,0.15);
}
.card-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}
.card-image {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.dict-card:hover .card-image { transform: scale(1.02); }
.card-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.2);
}
.card-image-placeholder svg { width: 48px; height: 48px; }
.card-image-placeholder span { font-size: 0.85rem; }

/* Card Body */
.card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.word-texts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.word-english {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.word-chinese {
  font-family: 'NotoSansSC', sans-serif;
  font-size: clamp(1.6rem, 5.5vw, 2.2rem);
  font-weight: 700;
  color: #a8f5e0;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(46,204,113,0.3);
}
.word-pinyin {
  font-family: 'Lexend', sans-serif;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 400;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.3px;
}

/* Audio Buttons */
.audio-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.audio-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: visible;
}
.btn-en {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  box-shadow: 0 6px 20px rgba(46,204,113,0.5);
}
.btn-cn {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,206,201,0.5);
}
.audio-btn svg { width: 20px; height: 20px; }
.audio-btn:active { transform: scale(0.92); }
.audio-btn:hover  { transform: scale(1.08); }

/* Pulsing ring */
.audio-btn.speaking::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(46,230,130,0.7);
  animation: pulseRing 1s ease-out infinite;
}
.audio-btn.speaking::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(46,230,130,0.35);
  animation: pulseRing 1s ease-out infinite 0.35s;
}
@keyframes pulseRing {
  0%   { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ============================================
   SENTENCE SECTION
   ============================================ */
.sentence-section {
  background: rgba(0,0,0,0.2);
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.sentence-toggle-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.sentence-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 9px 12px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.1);
  transition: all 0.25s;
}
.sentence-btn.active {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(46,204,113,0.5);
}
.sentence-btn:hover:not(.active) {
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
}
.sentence-btn:active { transform: scale(0.97); }
.sentence-hint {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.35);
  text-align: center;
  line-height: 1.5;
  padding: 6px 0;
  font-style: italic;
}
.sentence-text {
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  color: rgba(255,255,255,0.9);
  line-height: 1.65;
  font-family: 'Lexend', sans-serif;
}
.sentence-text.cn-text { font-family: 'NotoSansSC', sans-serif; }
.sentence-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.sentence-audio-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,204,113,0.5);
  transition: transform 0.2s;
  position: relative;
  overflow: visible;
}
.sentence-audio-btn svg { width: 18px; height: 18px; }
.sentence-audio-btn:active { transform: scale(0.92); }
.sentence-audio-btn:hover  { transform: scale(1.08); }
.sentence-audio-btn.speaking::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(46,230,130,0.7);
  animation: pulseRing 1s ease-out infinite;
}
.sentence-edit-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.sentence-edit-btn svg { width: 16px; height: 16px; }
.sentence-edit-btn:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.card-edit-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
}
.card-edit-btn svg { width: 16px; height: 16px; }
.card-edit-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* Sentence Edit */
.sentence-edit-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sentence-textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(46,204,113,0.4);
  border-radius: 12px;
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.25s;
}
.sentence-textarea:focus {
  border-color: rgba(46,204,113,0.8);
  box-shadow: 0 0 0 3px rgba(46,204,113,0.15);
}
.sentence-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edit-save-btn, .edit-reset-btn, .edit-cancel-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 8px 6px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s;
}
.edit-save-btn {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  box-shadow: 0 4px 12px rgba(46,204,113,0.4);
}
.edit-reset-btn {
  background: rgba(255,140,60,0.25);
  color: #ffb380;
  border: 1.5px solid rgba(255,140,60,0.3);
}
.edit-cancel-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  border: 1.5px solid rgba(255,255,255,0.1);
}
.edit-save-btn:active,
.edit-reset-btn:active,
.edit-cancel-btn:active { transform: scale(0.96); }

/* Approved Badge */
.approved-badge {
  font-family: 'Lexend', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffd700;
  background: rgba(255,215,0,0.15);
  border: 1.5px solid rgba(255,215,0,0.35);
  border-radius: 50px;
  padding: 4px 10px;
  animation: fadeIn 0.4s ease both;
  white-space: nowrap;
}

/* ============================================
   NAV ARROWS
   ============================================ */
.nav-arrow {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
  z-index: 10;
}
.nav-arrow svg { width: 22px; height: 22px; }
.arrow-left  { left: -22px; }
.arrow-right { right: -22px; }
.nav-arrow:hover {
  background: rgba(46,204,113,0.3);
  border-color: rgba(46,204,113,0.5);
  box-shadow: 0 6px 20px rgba(46,204,113,0.35);
  transform: translateY(-50%) scale(1.1);
}
.nav-arrow:active { transform: translateY(-50%) scale(0.94); }

/* Dot Indicators */
.dot-indicators {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  padding: 0 8px;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: all 0.3s ease;
  cursor: pointer;
}
.dot.active {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  width: 22px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(46,204,113,0.5);
}

/* ============================================
   WORD MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s ease both;
  overflow-y: auto;
  padding: 20px 16px;
}
.modal-overlay.hidden { display: none !important; }

.word-modal-box {
  background: linear-gradient(145deg,
    rgba(46,204,113,0.3),
    rgba(0,184,148,0.35),
    rgba(0,206,201,0.3)
  );
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 28px 28px 16px 16px;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  margin-top: auto;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.word-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.word-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}
.modal-close-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  transition: background 0.2s;
}
.modal-close-btn svg { width: 16px; height: 16px; }
.modal-close-btn:hover { background: rgba(255,255,255,0.22); }

/* Image Section */
.image-section { margin-bottom: 20px; }
.image-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.image-tab {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 10px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(255,255,255,0.1);
  transition: all 0.25s;
}
.image-tab.active {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(46,204,113,0.4);
}
.image-panel { width: 100%; }

/* Upload */
.upload-area {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 16px;
  border: 2px dashed rgba(46,204,113,0.4);
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.25s, background 0.25s;
}
.upload-area:hover {
  border-color: rgba(46,204,113,0.7);
  background: rgba(46,204,113,0.05);
}
.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255,255,255,0.4);
  font-size: 0.9rem;
}
.upload-icon { font-size: 2.5rem; }
.upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.clear-image-btn {
  appearance: none;
  -webkit-appearance: none;
  margin-top: 8px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.78rem;
  color: rgba(255,100,100,0.8);
  background: rgba(255,100,100,0.1);
  border: 1px solid rgba(255,100,100,0.2);
  border-radius: 50px;
  padding: 6px 14px;
  transition: background 0.2s;
}
.clear-image-btn:hover { background: rgba(255,100,100,0.2); }

/* Drawing Canvas */
.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.color-picker {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }
.tool-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.12);
  transition: all 0.2s;
}
.tool-btn svg { width: 18px; height: 18px; }
.tool-btn:hover  { background: rgba(255,255,255,0.22); color: #fff; }
.tool-btn:active { transform: scale(0.93); }
.tool-btn.active {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(46,204,113,0.4);
}
.draw-canvas {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 16px;
  border: 2px solid rgba(46,204,113,0.3);
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

/* Word Fields */
.word-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.3px;
}
.optional {
  font-weight: 400;
  color: rgba(255,255,255,0.35);
}
.field-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.field-input {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.field-input:focus {
  border-color: rgba(46,204,113,0.6);
  box-shadow: 0 0 0 3px rgba(46,204,113,0.12);
}
.field-input::placeholder { color: rgba(255,255,255,0.3); }
.field-textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.25s;
}
.cn-textarea { font-family: 'NotoSansSC', sans-serif; }
.field-textarea:focus {
  border-color: rgba(46,204,113,0.6);
  box-shadow: 0 0 0 3px rgba(46,204,113,0.12);
}
.field-textarea::placeholder { color: rgba(255,255,255,0.3); }

.translate-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(46,204,113,0.4);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.translate-btn svg { width: 20px; height: 20px; }
.translate-btn:active { transform: scale(0.92); }
.translate-btn:hover  { transform: scale(1.08); }
.translate-status {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  min-height: 16px;
}

/* Modal Actions */
.word-modal-actions {
  display: flex;
  gap: 12px;
}
.modal-save-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 14px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  box-shadow: 0 8px 24px rgba(46,204,113,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.modal-save-btn:hover  { transform: scale(1.03); }
.modal-save-btn:active { transform: scale(0.97); }
.modal-delete-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 14px 20px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255,80,80,0.15);
  color: #ff8080;
  border: 1.5px solid rgba(255,80,80,0.25);
  transition: all 0.2s;
}
.modal-delete-btn:hover  { background: rgba(255,80,80,0.25); }
.modal-delete-btn:active { transform: scale(0.97); }

/* ============================================
   APPROVAL MODAL
   ============================================ */
.modal-box {
  background: linear-gradient(145deg,
    rgba(46,204,113,0.4),
    rgba(0,184,148,0.4)
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 28px;
  padding: 32px 28px 24px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.modal-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  animation: spin 0.5s ease both;
  display: block;
}
.modal-title {
  font-family: 'Lexend', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.modal-subtitle {
  font-family: 'NotoSansSC', sans-serif;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
  margin-bottom: 24px;
  line-height: 1.5;
}
.modal-actions { display: flex; gap: 12px; }
.modal-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  padding: 12px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.2s;
}
.modal-confirm {
  background: linear-gradient(135deg, #2ecc71, #00b894);
  color: #fff;
  box-shadow: 0 6px 20px rgba(46,204,113,0.5);
}
.modal-cancel {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.15);
}
.modal-confirm:hover { transform: scale(1.05); }
.modal-cancel:hover  { background: rgba(255,255,255,0.18); }
.modal-confirm:active,
.modal-cancel:active  { transform: scale(0.96); }

/* ============================================
   CELEBRATION POPUP
   ============================================ */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.celebrate-overlay.hidden { display: none !important; }
.celebrate-box {
  border-radius: 28px;
  padding: 32px 36px;
  text-align: center;
  background: linear-gradient(135deg, #ffd700, #ff9500);
  box-shadow: 0 24px 60px rgba(255,180,0,0.5), 0 0 0 3px rgba(255,255,255,0.3);
  animation: celebratePop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  width: 280px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.celebrate-box.celebrate-cn {
  background: linear-gradient(135deg, #00c853, #00897b);
  box-shadow: 0 24px 60px rgba(0,200,100,0.5), 0 0 0 3px rgba(255,255,255,0.3);
}

.celebrate-box.celebrate-hide {
  animation: celebrateFadeOut 0.5s cubic-bezier(0.55, 0, 1, 0.45) both;
}

@keyframes celebrateFadeOut {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.75) translateY(30px); }
}

.celebrate-stars {
  font-size: 3.5rem;
  animation: starSpin 0.6s ease both;
  display: block;
  margin-bottom: 8px;
}
.celebrate-title {
  font-family: 'Lexend', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-bottom: 6px;
}
.celebrate-subtitle {
  font-family: 'NotoSansSC', sans-serif;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.9);
}

/* ============================================
   MILESTONE POPUP
   ============================================ */
.milestone-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.milestone-overlay.hidden { display: none !important; }
.milestone-box {
  background: linear-gradient(135deg, #a29bfe, #6c5ce7);
  border-radius: 28px;
  padding: 32px 36px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(108,92,231,0.5), 0 0 0 3px rgba(255,255,255,0.3);
  animation: celebratePop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  width: 300px;
}
.milestone-emoji { font-size: 3.5rem; margin-bottom: 10px; }
.milestone-title {
  font-family: 'Lexend', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.milestone-subtitle {
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
}

/* ============================================
   EXPORT BAR
   ============================================ */
.export-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 16px;
  background: rgba(8,26,16,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 40;
  flex-wrap: wrap;
}
.export-btn {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 50px;
  font-family: 'Lexend', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.12);
  transition: all 0.2s;
  white-space: nowrap;
}
.export-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.export-btn:hover  { background: rgba(46,204,113,0.2); border-color: rgba(46,204,113,0.4); color: #fff; }
.export-btn:active { transform: scale(0.96); }
.sound-toggle-label {
  cursor: pointer;
}
.sound-toggle-label input[type="checkbox"] { display: none; }

/* Dimmed state when sound is off */
#sound-toggle-label.sound-off {
  opacity: 0.45;
  filter: grayscale(1);
}


/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 2000;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  animation: fadeInUp 0.3s ease both;
  pointer-events: none;
}
.toast.hidden { display: none !important; }
.toast.warn { border-color: rgba(253,203,110,0.5); color: #fdcb6e; }
.toast.error { border-color: rgba(255,100,100,0.5); color: #ff8080; }
.toast.success { border-color: rgba(46,204,113,0.5); color: #55efc4; }

/* ============================================
   UTILITY & ANIMATIONS
   ============================================ */
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  from { transform: rotate(-20deg) scale(0.5); opacity: 0; }
  to   { transform: rotate(0deg) scale(1); opacity: 1; }
}
@keyframes starSpin {
  0%   { transform: rotate(-30deg) scale(0.3); opacity: 0; }
  60%  { transform: rotate(10deg) scale(1.2); opacity: 1; }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}
@keyframes celebratePop {
  0%   { opacity: 0; transform: scale(0.5) translateY(30px); }
  60%  { transform: scale(1.08) translateY(-8px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 600px) {
  .app-wrapper { padding: 0 24px 100px; }
  .arrow-left  { left: -26px; }
  .arrow-right { right: -26px; }
  .nav-arrow   { width: 50px; height: 50px; }
  .export-bar  { gap: 12px; }
}
@media (min-width: 900px) {
  .app-wrapper { padding: 0 32px 100px; }
  .app-header  { padding: 36px 0 20px; }
  .arrow-left  { left: -30px; }
  .arrow-right { right: -30px; }
  .nav-arrow   { width: 54px; height: 54px; }
  .nav-arrow svg { width: 26px; height: 26px; }
  .word-modal-box { border-radius: 28px; margin: auto; }
  .modal-overlay { align-items: center; }
}
@media (max-width: 380px) {
  .audio-btn  { width: 46px; height: 46px; }
  .card-body  { padding: 16px 16px 18px; }
  .export-btn { font-size: 0.72rem; padding: 7px 10px; }
}

.guide-modal-box {
  max-height: 75vh;
  overflow-y: auto;
  text-align: left;
}

.guide-content {
  margin: 12px 0;
}

.guide-heading {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 16px 0 6px 0;
  color: #2ecc71;
}

.guide-content ul {
  margin: 0 0 8px 0;
  padding-left: 18px;
}

.guide-content ul li {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e0e0e0;
  margin-bottom: 4px;
}

/* Translation direction toggle */
.translate-toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.translate-dir-btn {
  flex: 1;
  padding: 8px;
  border-radius: 20px;
  border: 2px solid #2ecc71;
  background: transparent;
  color: #2ecc71;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.translate-dir-btn.active {
  background: #2ecc71;
  color: #fff;
}


@media (max-width: 600px) {
  .fab {
    top: 60px;       /* ✅ positions it near the "You know X word!" banner */
    bottom: auto;    /* ✅ cancels the bottom positioning */
    right: 16px;
    z-index: 999;
    width: 44px;     /* ✅ slightly smaller on mobile so it doesn't crowd */
    height: 44px;
  }

  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .modal-box {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
  }
}
