/* =============================================
   VocabMaster - Premium Mobile Vocabulary App
   ============================================= */

:root {
  --bg: #F0F4F7;
  /* Seamless Light Blue-Gray */
  --surface: #FFFFFF;
  --surface-hover: #F8FAFC;
  --border: #E2E8F0;
  --border-active: #3B82F6;
  --accent: #3B82F6;
  --accent-2: #60A5FA;
  --accent-3: #2563EB;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --success: #10B981;
  --danger: #EF4444;
  --card-radius: 16px;
  --input-radius: 12px;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  /* overflow-x: hidden removed to fix sticky header */
  user-select: text;
  /* Allow text selection globally for easy copying */
}

/* Background lock when modal is open */
body.modal-open {
  overflow: hidden !important;
  height: 100vh;
}

/* ---- Background ---- */
.bg-orbs {
  display: none;
  /* Removed for clean light mode */
}

@keyframes floatOrb {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(30px, 40px) scale(1.1);
  }
}

/* ---- App Shell ---- */
.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 calc(160px + env(safe-area-inset-bottom));
}

/* ---- Glass Card ---- */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* ---- Header ---- */
.app-header {
  display: flex;
  align-items: center;
  padding: 12px 12px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  /* Integrated with background */
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  /* Extremely subtle boundary */
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-icon {
  display: none;
  /* Removed as per screenshot */
}

.header-text {
  display: flex;
  align-items: center;
}

.app-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.word-count-badge {
  background: #E0F2FE;
  color: #0369A1;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.header-btn {
  background: transparent;
  border: none;
  color: #64748B;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
}

.header-btn.add-btn {
  color: #60A5FA;
  /* Soft Light Blue */
  background: #fff;
  border: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  font-weight: 800;
}

.header-btn:hover {
  background: #F1F5F9;
  color: var(--accent);
}

.header-btn.add-btn:hover {
  background: #F0F9FF;
  color: #3B82F6;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(96, 165, 250, 0.25);
}

.header-btn.add-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(96, 165, 250, 0.2);
}

.header-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.header-btn.add-btn svg {
  stroke: currentColor;
  stroke-width: 1.5;
  /* Makes the plus sign bold */
}

/* ---- Inputs ---- */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.input-label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.textarea-wrapper {
  align-items: flex-start;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
}

.input-icon.top {
  top: 14px;
  transform: none;
}

.fancy-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  padding: 13px 14px 13px 42px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.fancy-textarea {
  padding-top: 13px;
  resize: none;
  line-height: 1.5;
}

.fancy-input::placeholder {
  color: var(--text-muted);
}

.fancy-input:focus {
  border-color: var(--accent);
  background: rgba(110, 86, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(110, 86, 255, 0.15);
}

/* ---- Save Button ---- */
.save-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  background: linear-gradient(135deg, #6e56ff 0%, #9b4dff 60%, #ff56c1 100%);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--input-radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.03em;
  margin-top: 6px;
  box-shadow: 0 8px 24px rgba(110, 86, 255, 0.4);
}

.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(110, 86, 255, 0.55);
}

.fancy-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fancy-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-icon {
  font-size: 1.1rem;
}

.btn-ripple {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  border-radius: inherit;
  transition: opacity 0.3s;
}

.save-btn:active .btn-ripple {
  opacity: 1;
}

/* ---- Settings Items ---- */
.setting-item {
  margin-top: 20px;
  text-align: left;
}

.setting-item .input-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.fancy-select {
  width: 100%;
  padding: 12px 40px 12px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.fancy-select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.range-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.fancy-range {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
  outline: none;
}

.fancy-range::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.fancy-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: var(--accent-3);
}

.range-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 40px;
}
/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Words Grid ---- */
.words-section {
  padding: 0 16px;
  margin-top: 24px;
  /* Added breathing room */
}

/* ---- Responsive Grid ---- */
.words-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Tighter vertical gap between cards */
}

/* ---- Word Card ---- */
.word-card {
  background: #fff;
  border: 1px solid #60A5FA;
  /* Extra Thin Light Blue */
  border-radius: 16px;
  padding: 8px 16px;
  /* Extreme compact padding */
  position: relative;
  transition: var(--transition);
  animation: slideIn 0.3s ease both;
  box-shadow: 0 4px 10px rgba(96, 165, 250, 0.08);
}

.word-card-accent {
  display: none;
  /* Simplified card */
}

.word-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.word-card.pressing {
  transform: scale(0.98);
  background: var(--surface-hover);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-content-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-word-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.card-word {
  font-size: 1.19rem;
  font-weight: 700;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card-conjugation-row {
  display: flex;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
  padding: 2px 0;
  flex-wrap: wrap;
  opacity: 0.9;
}

.v1 {
  color: var(--accent-3); /* Strong Blue */
}

.v-sep {
  color: var(--text-muted);
  font-weight: 400;
}

.v2 {
  color: #8B5CF6; /* Purple */
}

.v3 {
  color: #0EA5E9; /* Sky Blue */
}

.action-btn.speak-btn {
  color: #60A5FA !important;
  /* Soft Light Blue */
  background: transparent !important;
  border: none !important;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  opacity: 1 !important;
  -webkit-tap-highlight-color: transparent;
}

.action-btn.speak-btn svg {
  width: 24px;
  height: 24px;
  fill: #60A5FA !important;
}

.action-btn.speak-btn:hover {
  color: #0369A1 !important;
  /* Deeper blue on hover */
  transform: scale(1.15);
}

.action-btn.speak-btn:hover svg {
  fill: #0369A1 !important;
}

.card-divider {
  height: 1px;
  background: #F1F5F9;
  margin: 4px 0;
  /* Minimal vertical spacing */
}

.card-meaning-reveal {
  padding-top: 8px;
}

.meaning-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.meaning-bullet {
  color: var(--accent);
  font-weight: bold;
  margin-top: 1px;
}

.meaning-text {
  flex: 1;
  word-wrap: break-word;
}

/* Removed redundant card styles */

.card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

/* Speak button states */
.action-btn.speak-btn {
  color: var(--accent-3);
  position: relative;
}

.action-btn.speak-btn:hover,
.action-btn.speak-btn.playing {
  background: rgba(86, 193, 255, 0.15);
  border-color: var(--accent-3);
  box-shadow: 0 0 14px rgba(86, 193, 255, 0.35);
  transform: scale(1.1);
}

.action-btn.speak-btn.playing {
  animation: speakPulse 0.8s ease-in-out infinite alternate;
}

/* Loading Audio State */
.action-btn.speak-btn.loading-audio svg {
  opacity: 0;
}

.action-btn.speak-btn.loading-audio::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(96, 165, 250, 0.3);
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes speakPulse {
  from {
    box-shadow: 0 0 10px rgba(86, 193, 255, 0.3);
  }

  to {
    box-shadow: 0 0 22px rgba(86, 193, 255, 0.7);
  }
}

/* Delete button */
.action-btn.del-btn {
  color: var(--danger);
}

.action-btn.del-btn:hover {
  background: rgba(255, 77, 109, 0.15);
  border-color: var(--danger);
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.3);
  transform: scale(1.1);
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.card-meaning-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.card-meaning {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  word-break: break-word;
}

.card-example {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(110, 86, 255, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 0.82rem;
  font-style: italic;
  color: rgba(240, 240, 255, 0.6);
  line-height: 1.5;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(30, 30, 50, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 13px 22px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 999;
  white-space: nowrap;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- Delete Modal ---- */
.modal-overlay,
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.sheet-overlay {
  z-index: 400;
  display: none;
}

.sheet-overlay.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal {
  padding: 20px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.modal-btns {
  display: flex;
  gap: 12px;
}

.modal-cancel,
.modal-confirm {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.modal-cancel {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.modal-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-confirm {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-confirm:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

/* ---- Settings Actions ---- */
.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.settings-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: #F8FAFC;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.settings-action-btn:hover {
  background: #F1F5F9;
  border-color: var(--accent);
}

.export-btn {
  background: #EFF6FF;
  color: #1E40AF;
  border-color: #BFDBFE;
}

.import-btn {
  background: #F0FDF4;
  color: #166534;
  border-color: #BBF7D0;
}

.edit-btn {
  background: #EFF6FF;
  color: #1E40AF;
  border-color: var(--accent);
}

.copy-btn {
  background: #F8FAFC;
  color: #64748B;
  border-color: var(--border);
}

.settings-actions .del-btn {
  background: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}

.modal-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 16px 0;
}

/* ---- Speed Control ---- */
.setting-item {
  margin-bottom: 20px;
  text-align: left;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

#speedRange {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 6px;
  border-radius: 5px;
  background: #E2E8F0;
  appearance: none;
  -webkit-appearance: none;
}

#speedRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(110, 86, 255, 0.5);
  cursor: pointer;
}

#speedValue {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-3);
  min-width: 40px;
  text-align: right;
}



/* ---- Centered Centered Modal (v10) ---- */
.bottom-sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  /* Prevent it from leaking off-screen */
  background: #fff;
  border: 1.5px solid #60A5FA;
  border-radius: 24px;
  z-index: 401;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  box-shadow: 0 0 35px rgba(96, 165, 250, 0.35);
  opacity: 0;
  overflow: hidden;
  display: flex !important;
  flex-direction: column !important;
}

.bottom-sheet:not(.open) {
  display: none !important;
  /* Completely hide when not open to avoid interactions */
}

.bottom-sheet.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 8px;
  flex-shrink: 0;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 10px;
  /* Smooth scrolling for iOS */
  -webkit-overflow-scrolling: touch;
}

.sheet-footer {
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-close {
  background: #F1F5F9;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.sheet-close:hover {
  background: var(--danger);
  color: white;
}

/* ---- Expandable Search Overlay ---- */
.search-overlay-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #F0F4F7;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay-bar.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-back-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    margin-right: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.search-back-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.search-back-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.search-wrapper-expand {
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    height: 44px;
    padding: 0 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.search-wrapper-expand .search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
}

.search-wrapper-expand .search-clear {
    display: none;
    background: #F1F5F9;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
}

/* ---- Card Interactions & Options Button ---- */
.word-card {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.card-word, .card-meaning-reveal, .ex-text {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.options-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94A3B8;
    border-radius: 50%;
    transition: all 0.2s;
    margin-right: 0px;
    margin-left: -12px;
}

.options-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent);
}

.options-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.app-tabs {
  display: flex;
  margin: 16px;
  background: #E2E8F0;
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #FFFFFF;
  color: var(--accent-3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-icon {
  font-size: 1.1rem;
}

/* ---- Toggle Switch ---- */
.toggle-group {
  margin-top: 8px;
  margin-bottom: 20px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  transition: var(--transition);
}

.toggle-label:hover {
  border-color: var(--accent-2);
}

.toggle-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #CBD5E1;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
  background: var(--accent);
}

input:focus+.toggle-slider {
  box-shadow: 0 0 1px var(--accent);
}

input:checked+.toggle-slider:before {
  transform: translateX(20px);
}

/* ---- Examples Section (Modal) ---- */
.examples-section {
  margin-bottom: 16px;
}

.examples-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.examples-header .input-label {
  margin-bottom: 0;
}

.add-example-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
  color: #1E40AF;
  border: 1.5px solid #BFDBFE;
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.add-example-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.add-example-btn:hover {
  background: linear-gradient(135deg, #DBEAFE, #BFDBFE);
  border-color: #93C5FD;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.add-example-btn:active {
  transform: scale(0.97);
}

.examples-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ex-field-wrapper {
  position: relative;
}

.ex-field-wrapper .input-wrapper {
  position: relative;
  align-items: center;
}

.ex-field-wrapper .fancy-input {
  padding-right: 42px;
  /* room for remove btn */
}

.remove-example-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #EF4444;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  z-index: 2;
}

.remove-example-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.remove-example-btn:hover {
  background: #EF4444;
  color: #fff;
  border-color: #EF4444;
  transform: translateY(-50%) scale(1.1);
}

.ex-field-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #E2E8F0, transparent);
  margin: 8px 0;
}

/* ---- Card Reveal Panel (tap-to-reveal: meaning + examples) ---- */
.card-reveal-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-top-divider {
  height: 1px;
  background: #F1F5F9;
  margin: 4px 0 10px;
}

.card-reveal-inner {
  padding: 0 0 6px;
}

.card-meaning-reveal {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  word-break: break-word;
  margin-bottom: 4px;
}

.reveal-section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #E2E8F0, transparent);
  margin: 10px 0;
}

.card-examples-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ex-card-item {
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 10px 14px;
  border-left: 4px solid;
  border-radius: 0 8px 8px 0;
  word-break: break-word;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  /* Fallback */
  border-color: #cbd5e1;
}

/* 0: Green */
.ex-color-0 {
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  border-color: #22C55E;
}

.ex-color-0:hover {
  background: linear-gradient(135deg, #DCFCE7, #BBF7D0);
}

/* 1: Red */
.ex-color-1 {
  background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
  border-color: #EF4444;
}

.ex-color-1:hover {
  background: linear-gradient(135deg, #FEE2E2, #FECACA);
}

/* 2: Blue */
.ex-color-2 {
  background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
  border-color: #3B82F6;
}

.ex-color-2:hover {
  background: linear-gradient(135deg, #DBEAFE, #BFDBFE);
}

/* 3: Amber/Yellow */
.ex-color-3 {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-color: #F59E0B;
}

.ex-color-3:hover {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
}

/* 4: Purple */
.ex-color-4 {
  background: linear-gradient(135deg, #FAF5FF, #F3E8FF);
  border-color: #A855F7;
}

.ex-color-4:hover {
  background: linear-gradient(135deg, #F3E8FF, #E9D5FF);
}

.ex-text {
  font-style: italic;
  font-weight: 500;
  color: #1E293B;
  /* Navy slate for better readability */
}

.ex-trans {
  font-size: 0.72rem;
  font-style: normal;
  padding-left: 22px;
  line-height: 1.4;
  color: #64748B;
  /* Professional gray for translation */
}

.ex-card-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ex-card-item:active {
  transform: translateX(2px) scale(0.98);
}

/* Modal Dual Input styles */
.ex-field-wrapper.dual-input {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  margin-bottom: 4px;
}

.dual-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.translation-wrapper .input-icon {
  font-size: 0.9rem;
  opacity: 0.7;
}

.ex-trans-input {
  font-size: 0.88rem !important;
  background: rgba(0, 0, 0, 0.01) !important;
}

.ex-field-wrapper.dual-input .remove-example-btn {
  margin-top: 6px;
  position: static;
  transform: none;
}

.ex-card-divider {
  height: 1px;
  background: linear-gradient(90deg, #60A5FA33, #DBEAFE, #60A5FA33);
  margin: 6px 0;
}

/* Hint icon */
.reveal-hint {
  font-size: 1rem;
  cursor: pointer;
  /* user-select: none removed */
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  line-height: 1;
}

.word-card.has-reveal .card-top {
  cursor: pointer;
}

.word-card.has-reveal:hover .reveal-hint {
  opacity: 1;
}

.word-card.reveal-open {
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.15);
  border-color: #3B82F6;
}

/* Modal Delete Button */
.modal-delete-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: #FEF2F2;
  color: #991B1B;
  border: 1.5px solid #FECACA;
  border-radius: var(--input-radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.modal-delete-btn:hover {
  background: var(--bg-secondary);
  border-color: #FECACA;
}

/* ---- List Footer ---- */
.list-footer {
    padding: 30px;
    text-align: center;
    color: #94A3B8;
    font-size: 0.85rem;
    font-weight: 500;
    width: 100%;
}

.list-footer span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.list-footer::before, .list-footer::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 1px;
    background: #E2E8F0;
    vertical-align: middle;
    margin: 0 10px;
}

/* ---- Toast Notifications ---- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.modal-delete-btn:active {
  transform: scale(0.98);
}

.delete-all-btn:hover {
  background: #FEE2E2 !important;
  border-color: #EF4444 !important;
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.1) !important;
  transform: translateY(-1px);
}

/* ---- Clear All (Danger) Modal ---- */
.clear-all-modal {
  border: 2px solid #EF4444;
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.25);
  transform: scale(1.05); /* Slightly larger for emphasis */
}

.danger-icon {
  background: #FEF2F2 !important;
  font-size: 2.5rem !important;
  animation: pulse 2s infinite;
}

.danger-text {
  color: #DC2626 !important;
  font-size: 1.4rem !important;
}

.danger-btn {
  background: #EF4444 !important;
  color: white !important;
  border: none !important;
  font-weight: 700 !important;
}

.danger-btn:hover {
  background: #DC2626 !important;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3) !important;
}

/* ---- Categories System ---- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 4px;
}
.filter-grid {
  margin-top: 10px;
}
.cat-btn {
  padding: 10px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* Travel Color Theme */
  background: #e6fffa;
  color: #234e52;
  border: 1px solid #b2f5ea;
  line-height: 1.2;
  min-height: 60px;
}
.cat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  background: #d4f7f0;
}
.cat-btn.active {
  /* Glowing thin border & raised shadow */
  border: 1px solid #14b8a6; /* Bright teal */
  box-shadow: 0 0 8px rgba(20, 184, 166, 0.6), 0 6px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
  background: #e6fffa;
}

.cat-count {
  display: inline-block;
  background: rgba(20, 184, 166, 0.2);
  color: #115e59;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-top: 2px;
}

.remove-cat-btn {
  margin-top: 10px;
  width: 100%;
  color: #EF4444;
  background: #FEF2F2;
  border-color: #FECACA;
}
.remove-cat-btn:hover {
  background: #FEE2E2;
}
.clear-filter-btn {
  width: 100%;
  background: #EF4444;
  color: white;
  padding: 10px;
  border-radius: 12px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.clear-filter-btn:hover {
  background: #DC2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
.filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.filter-modal-content {
  max-width: 400px;
  width: 92%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding-top: 5px !important;
}
.filter-modal-content .modal-title {
  margin-top: 0 !important;
}
.filter-modal-content .modal-text {
  margin-bottom: 10px !important;
}

/* Category Badge in Card */
.cat-badge {
  font-size: 0.65rem;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  width: fit-content;
  border: 1px solid transparent;
}

/* Filter Icon */
.filter-btn {
  color: #8B5CF6;
  background: #fff;
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}
.filter-btn:hover {
  background: #F5F3FF;
  color: #7C3AED;
}
.filter-btn.active-filter {
  background: #8B5CF6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.filter-btn.active-filter svg {
  fill: #fff;
}

/* Header Clear Filter Button */
.active-filter-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #DC2626;
  background: #FEF2F2;
  padding: 2px 6px;
  border-radius: 12px;
  margin-right: 4px;
  border: 1px solid #FECACA;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clear-filter-header-btn {
  color: #fff !important;
  background: #EF4444 !important;
  border: 1px solid #DC2626 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: gentlePulseRed 2s infinite alternate;
  margin-right: 6px;
}
.clear-filter-header-btn:hover {
  background: #DC2626 !important;
  box-shadow: 0 0 18px rgba(220, 38, 38, 0.8);
  transform: translateY(-2px);
}
.clear-filter-header-btn svg {
  fill: currentColor !important;
  width: 22px;
  height: 22px;
}

@keyframes gentlePulseRed {
  from { box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
  to { box-shadow: 0 0 16px rgba(239, 68, 68, 0.8); }
}