/* ── Splash Screen ──────────────────────────────────────────── */
  #splash-screen {
    position: fixed; inset: 0; z-index: 9999;
    background: #0d1018;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
  }
  #splash-screen.hide { opacity: 0; visibility: hidden; pointer-events: none; }
  .splash-icon { font-size: 64px; animation: splashBounce 1.2s ease-in-out infinite; }
  .splash-title { font-family: 'Sora', sans-serif; font-size: 28px; font-weight: 800; background: linear-gradient(135deg, #7c83fd, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-top: 12px; }
  .splash-creator { font-size: 11px; color: #3a3f5e; font-weight: 600; margin-top: 6px; letter-spacing: 0.5px; }
  .splash-loader { width: 120px; height: 3px; background: #1e2440; border-radius: 2px; margin-top: 24px; overflow: hidden; }
  .splash-loader-bar { width: 40%; height: 100%; background: linear-gradient(90deg, #7c83fd, #c084fc); border-radius: 2px; animation: splashLoad 1s ease-in-out infinite; }
  @keyframes splashBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
  @keyframes splashLoad { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif; background: #0d1018; color: #e2e4f0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  h1, h2, .home-greeting, .modal-term, .stat-number, .streak-num, .db-stat, .onboard-title, .root-name { font-family: 'Sora', sans-serif; }
  input, button, textarea { font-family: inherit; }
  input { outline: none; }
  input:focus { border-color: #7c83fd !important; box-shadow: 0 0 0 3px rgba(124,131,253,0.15); }
  button { cursor: pointer; }
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #252a42; border-radius: 4px; }
  @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
  .spin { display: inline-block; animation: spin 1s linear infinite; }

  /* ── Animations ─────────────────────────────────────────── */
  @keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  @keyframes glowPulse { 0%, 100% { box-shadow: 0 0 8px rgba(124,131,253,0.2); } 50% { box-shadow: 0 0 20px rgba(124,131,253,0.4); } }
  @keyframes confettiFall { 0% { transform: translateY(-10px) rotate(0deg); opacity: 1; } 100% { transform: translateY(60px) rotate(360deg); opacity: 0; } }
  @keyframes streakBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
  @keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
  @keyframes correctFlash { 0% { box-shadow: 0 0 0 0 rgba(39,174,96,0.5); } 100% { box-shadow: 0 0 30px 10px rgba(39,174,96,0); } }
  @keyframes wrongShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
  .anim-fade-up { animation: fadeInUp 0.35s ease-out both; }
  .anim-scale-in { animation: scaleIn 0.25s ease-out both; }
  .anim-fade { animation: fadeIn 0.3s ease-out both; }

  /* ── Header ─────────────────────────────────────────────── */
  #header { background: linear-gradient(135deg, #111520 0%, #161b30 100%); border-bottom: 1px solid rgba(124,131,253,0.15); padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-shrink: 0; position: relative; }
  #header::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(ellipse at 20% 50%, rgba(124,131,253,0.06) 0%, transparent 70%); pointer-events: none; }
  #header h1 { font-size: 16px; font-weight: 800; background: linear-gradient(135deg, #7c83fd, #c084fc, #7c83fd); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: shimmer 4s linear infinite; margin: 0; }
  .header-tool-btn { background: none; border: none; font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background 0.15s; }
  .header-tool-btn:active { background: rgba(124,131,253,0.15); }
  .header-menu-item { display: flex; align-items: center; gap: 5px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text-secondary); font-weight: 600; transition: all 0.15s; }
  .header-menu-item span { font-size: 11px; }
  .header-menu-item:active { background: var(--accent-bg); border-color: var(--accent); }
  .badge { background: rgba(124,131,253,0.15); color: #7c83fd; padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 700; backdrop-filter: blur(8px); flex-shrink: 0; }

  /* ── Tabs ────────────────────────────────────────────────── */
  #tabs { display: flex; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-shrink: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; padding: 0 4px; }
  #tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 1; padding: 8px 6px 6px; border: none; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 700; border-bottom: 2.5px solid transparent; transition: all 0.25s ease; white-space: nowrap; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
  .tab-icon { font-size: 18px; line-height: 1; display: block; }
  .tab-label { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; display: block; }
  .tab-btn.active { color: var(--accent-soft); border-bottom-color: var(--accent); }
  .tab-btn.active .tab-icon { transform: scale(1.1); }
  .tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 20%; right: 20%; height: 2.5px; background: var(--accent); border-radius: 2px; filter: blur(4px); }
  .tab-btn:hover:not(.active) { color: var(--text-secondary); }

  /* ── Content + Panel Transitions ────────────────────────── */
  #content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
  .tab-panel { display: none; flex-direction: column; height: 100%; overflow: hidden; }
  .tab-panel.active { display: flex; animation: fadeIn 0.2s ease-out; }

  /* Controls bar */
  .controls-bar { background: #111520; border-bottom: 1px solid #252a42; padding: 16px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
  .section-label { font-size: 10px; font-weight: 700; color: #7c83fd; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

  /* Pills */
  .pills { display: flex; flex-wrap: wrap; gap: 6px; }
  .pill { padding: 5px 11px; border-radius: 20px; border: 1.5px solid #252a42; background: transparent; color: #6b6f8e; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  .pill.active { color: #fff; }

  /* Count row */
  .count-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .count-btn { padding: 5px 12px; border-radius: 8px; border: 1.5px solid #252a42; background: transparent; color: #6b6f8e; font-size: 12px; font-weight: 700; }
  .count-btn.active { border-color: #7c83fd; background: #7c83fd22; color: #a78bfa; }
  .count-input { width: 56px; padding: 5px 8px; border-radius: 8px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 12px; text-align: center; }

  /* Action row */
  .action-row { display: flex; gap: 8px; }
  .filter-input { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 13px; }
  .btn-primary { padding: 9px 18px; border-radius: 10px; border: none; background: linear-gradient(135deg, #7c83fd, #a78bfa); color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; transition: all 0.25s ease; box-shadow: 0 2px 12px rgba(124,131,253,0.25); }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(124,131,253,0.4); }
  .btn-primary:active { transform: translateY(0); }
  .btn-primary:disabled { background: #1e2440; color: #3a3f5e; cursor: not-allowed; box-shadow: none; transform: none; }
  .btn-secondary { padding: 8px 14px; border-radius: 9px; border: 1.5px solid #252a42; background: transparent; color: #7c83fd; font-size: 12px; font-weight: 700; }
  .btn-secondary:disabled { color: #3a3f5e; cursor: not-allowed; }
  .btn-ghost { padding: 8px 20px; border-radius: 20px; border: 1.5px solid #252a42; background: transparent; color: #7c83fd; font-size: 12px; font-weight: 700; }

  /* Scrollable results */
  .results { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 60px; -webkit-overflow-scrolling: touch; }

  /* Alerts */
  .alert-info { background: #1a2035; border: 1px solid #7c83fd44; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; color: #a78bfa; font-size: 13px; display: flex; gap: 8px; align-items: center; }
  .alert-error { background: #2d0f0f; border: 1px solid #e74c3c44; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; color: #e74c3c; font-size: 13px; }

  /* View toggle */
  .view-toggle { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .view-btns { display: flex; gap: 5px; }
  .view-btn { padding: 5px 10px; border-radius: 7px; border: 1.5px solid #252a42; background: transparent; color: #6b6f8e; font-size: 12px; font-weight: 700; }
  .view-btn.active { border-color: #7c83fd; background: #7c83fd22; color: #a78bfa; }

  /* Cards grid */
  .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .term-card { background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated)); border-radius: 14px; border: 1.5px solid var(--border); padding: 16px; padding-left: 20px; cursor: pointer; transition: all 0.3s ease; backdrop-filter: blur(8px); position: relative; overflow: hidden; }
  .term-card::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 4px; background: var(--card-cat-color, var(--accent)); border-radius: 14px 0 0 14px; transition: width 0.2s; }
  .term-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,131,253,0.12); }
  .term-card:hover::before { width: 6px; }
  .term-card-title { font-size: 15px; font-weight: 800; color: var(--text-primary); font-family: 'Sora', sans-serif; }
  .term-card-turkish { font-size: 12px; font-weight: 600; }
  .term-card-def { font-size: 12px; color: var(--text-muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }
  .term-card-hint { margin-top: 8px; font-size: 11px; color: var(--text-dim); transition: color 0.2s; }
  .term-card:hover .term-card-hint { color: var(--accent-soft); }

  /* Table */
  .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .data-table th { padding: 9px 12px; text-align: left; color: #7c83fd; font-size: 11px; font-weight: 700; text-transform: uppercase; border-bottom: 1px solid #252a42; }
  .data-table tr:hover { background: #1a1e2e; cursor: pointer; }
  .data-table td { padding: 9px 12px; border-bottom: 1px solid #1a1e2e; }

  /* Difficulty badge */
  .badge-basic { background: #27ae60; color: #fff; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
  .badge-intermediate { background: #f39c12; color: #fff; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
  .badge-advanced { background: #e74c3c; color: #fff; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }

  /* Empty state */
  .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; gap: 10px; text-align: center; }
  .empty-icon { font-size: 44px; }
  .empty-title { font-size: 15px; font-weight: 700; color: #5a5f7e; }
  .empty-sub { font-size: 13px; color: #3a3f5e; line-height: 1.7; max-width: 300px; }

  /* Bottom sheet modal */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); z-index: 8500; display: flex; align-items: flex-end; animation: fadeIn 0.2s ease-out; }
  .modal-sheet { background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card)); border-radius: 24px 24px 0 0; width: 100%; max-height: 80vh; overflow-y: auto; padding: 0 20px 28px; border: 1px solid rgba(124,131,253,0.15); box-shadow: 0 -12px 50px rgba(0,0,0,.5); animation: slideUp 0.3s ease-out; }
  .modal-handle-wrap { position: sticky; top: 0; background: #161b2e; padding-top: 12px; padding-bottom: 8px; z-index: 1; }
  .modal-handle { width: 40px; height: 4px; background: #2a2f4e; border-radius: 2px; margin: 0 auto 14px; }
  .modal-term { font-size: 22px; font-weight: 800; color: #e2e4f0; }
  .modal-turkish { font-size: 15px; font-weight: 600; }
  .modal-def { background: #1a1f35; border-radius: 10px; padding: 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.75; color: #c5c9e8; }
  .modal-etym-label { font-size: 10px; font-weight: 700; color: #7c83fd; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
  .etym-root { background: #1e2540; border-radius: 8px; padding: 6px 10px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
  .etym-roots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .etym-full { font-size: 13px; color: #a8b0cc; font-style: italic; line-height: 1.7; }
  .modal-example { background: #1a2535; border-left: 3px solid #7c83fd; border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #c5c9e8; line-height: 1.7; }
  .tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
  .tag { background: #252a42; color: #6b6f8e; padding: 3px 10px; border-radius: 20px; font-size: 11px; }
  .related-term { background: #1e2440; color: #9398b8; padding: 3px 10px; border-radius: 20px; font-size: 12px; border: 1px solid #252a42; }
  .modal-close { width: 100%; padding: 13px; border-radius: 10px; border: 1.5px solid #252a42; background: transparent; color: #9398b8; font-size: 14px; font-weight: 700; }

  /* Modal action buttons row */
  .modal-actions { display: flex; gap: 8px; margin-bottom: 12px; }
  .modal-act-btn { flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid #252a42; background: transparent; color: #6b6f8e; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.15s; }
  .modal-act-btn:hover { border-color: #7c83fd; color: #a78bfa; }
  .modal-act-btn.fav-active { border-color: #f39c12; background: #2e1f0d; color: #f39c12; }

  /* Edit modal overlay */
  .edit-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 8500; display: flex; align-items: center; justify-content: center; padding: 20px; }
  .edit-card { background: #161b2e; border-radius: 16px; width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto; padding: 20px; border: 1px solid #2a2f4e; }
  .edit-field { margin-bottom: 14px; }
  .edit-label { font-size: 10px; font-weight: 700; color: #7c83fd; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
  .edit-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 13px; }
  .edit-textarea { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 13px; min-height: 60px; resize: vertical; font-family: inherit; }

  /* Roots tab */
  .root-card { background: #141824; border-radius: 12px; border: 1.5px solid #252a42; padding: 14px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s; }
  .root-card:hover { border-color: #7c83fd; }
  .root-name { font-size: 18px; font-weight: 800; color: #a78bfa; }
  .root-origin { font-size: 11px; color: #6b6f8e; font-weight: 600; }
  .root-meaning { font-size: 13px; color: #e2e4f0; margin-top: 4px; }
  .root-count { font-size: 11px; color: #27ae60; font-weight: 700; }
  .root-terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .root-term-chip { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: #1e2440; color: #9398b8; border: 1px solid #252a42; cursor: pointer; transition: all 0.15s; }
  .root-term-chip:hover { border-color: #7c83fd; color: #e2e4f0; }
  .root-type-pill { padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
  .root-type-prefix { background: #16a08522; color: #16a085; }
  .root-type-suffix { background: #e74c3c22; color: #e74c3c; }
  .root-type-root { background: #7c83fd22; color: #7c83fd; }
  .roots-search { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 13px; margin-bottom: 12px; }
  .roots-stats { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
  .roots-stat-card { background: #141824; border-radius: 10px; padding: 10px 14px; border: 1px solid #252a42; flex: 1; min-width: 80px; text-align: center; }
  .roots-stat-num { font-size: 22px; font-weight: 800; color: #a78bfa; }
  .roots-stat-label { font-size: 10px; color: #6b6f8e; font-weight: 700; }

  /* Fav star in db list */
  .db-fav-star { font-size: 14px; color: #3a3f5e; cursor: pointer; flex-shrink: 0; transition: color 0.15s; }
  .db-fav-star.active { color: #f39c12; }
  .db-fav-star:hover { color: #f39c12; }

  /* Modal image */
  .modal-img-wrap { margin-bottom: 16px; border-radius: 12px; overflow: hidden; background: #1a1f35; display: flex; align-items: center; justify-content: center; position: relative; width: 100%; }
  .modal-img { width: 100%; height: auto; max-height: 320px; object-fit: contain; display: block; border-radius: 12px; background: #1a1f35; }
  .modal-img-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px; color: #3a3f5e; }
  .modal-img-loading { display: flex; align-items: center; gap: 8px; color: #6b6f8e; font-size: 13px; padding: 30px; }
  .modal-img-credit { position: absolute; bottom: 6px; right: 8px; font-size: 10px; color: rgba(255,255,255,0.5); background: rgba(0,0,0,0.4); padding: 2px 6px; border-radius: 4px; }

  /* API key screen */
  #apikey-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 28px; overflow-y: auto; }
  .apikey-card { max-width: 420px; width: 100%; }
  .apikey-box { background: #141824; border-radius: 14px; padding: 20px; border: 1.5px solid #252a42; margin-bottom: 14px; }
  .apikey-input { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 14px; margin-bottom: 12px; }
  .apikey-note { background: #111520; border-radius: 10px; padding: 14px; border: 1px solid #252a42; }
  .warning-label { font-size: 11px; font-weight: 700; color: #f39c12; margin-bottom: 6px; }

  /* Search bar */
  .search-bar { background: #111520; border-bottom: 1px solid #252a42; padding: 16px; flex-shrink: 0; }
  .search-row { display: flex; gap: 8px; }
  .search-input { flex: 1; padding: 11px 14px; border-radius: 10px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 14px; }
  .search-hint { margin-top: 8px; font-size: 11px; color: #27ae60; }
  .local-result { background: #141824; border-radius: 10px; padding: 12px; cursor: pointer; border: 1.5px solid #252a42; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
  .local-result:hover { border-color: #7c83fd; }
  .groq-badge { background: #1e2440; color: #7c83fd; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
  .result-card { background: #141824; border-radius: 14px; border: 1.5px solid #7c83fd55; padding: 18px; }

  /* Database */
  .db-header { background: #111520; border-bottom: 1px solid #252a42; padding: 16px; flex-shrink: 0; }
  .db-stat { font-size: 28px; font-weight: 800; color: #a78bfa; }
  .db-row { background: var(--bg-card); border-radius: 10px; padding: 10px 14px; cursor: pointer; border: 1.5px solid var(--border); display: flex; align-items: center; gap: 10px; margin-bottom: 5px; transition: all 0.2s ease; }
  .db-row:hover { border-color: var(--border-hover); transform: translateX(3px); box-shadow: 0 2px 10px rgba(124,131,253,0.08); }
  .db-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .db-delete-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: #3a3f5e; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; cursor: pointer; }
  .db-delete-btn:hover { background: #2e0d0d; border-color: #e74c3c44; color: #e74c3c; }
  .cat-chip { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
  .cat-chip.clickable { cursor: pointer; transition: all 0.15s; }
  .cat-chip.clickable:hover { filter: brightness(1.3); }
  .cat-chip.active-filter { outline: 2px solid; outline-offset: 1px; }

  /* Quiz */
  .quiz-setup { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 80px; -webkit-overflow-scrolling: touch; }
  .quiz-types { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
  .quiz-type-btn { padding: 11px 14px; border-radius: 10px; border: 1.5px solid #252a42; background: #141824; color: #6b6f8e; text-align: left; display: flex; justify-content: space-between; align-items: center; }
  .quiz-type-btn.active { border-color: #7c83fd; background: #7c83fd18; color: #e2e4f0; }
  .quiz-bar { background: #111520; border-bottom: 1px solid #252a42; padding: 10px 16px; flex-shrink: 0; }
  .progress-track { height: 4px; background: #252a42; border-radius: 2px; overflow: hidden; }
  .progress-fill { height: 100%; background: linear-gradient(90deg, #7c83fd, #a78bfa); border-radius: 2px; transition: width 0.3s; }
  .question-card { background: #141824; border-radius: 14px; padding: 20px; margin-bottom: 20px; border: 1.5px solid #252a42; }
  .option-btn { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text-secondary); font-size: 14px; font-weight: 600; text-align: left; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; transition: all 0.25s ease; }
  .option-btn:hover:not(:disabled) { border-color: var(--accent); transform: translateX(4px); background: var(--accent-bg); }
  .option-btn.correct { background: #0d2e1a; border-color: #27ae60; color: #4ade80; animation: correctFlash 0.5s ease-out; }
  .option-btn.wrong { background: #2e0d0d; border-color: #e74c3c; color: #f87171; animation: wrongShake 0.4s ease-out; }
  .option-btn.dimmed { color: #3a3f5e; }
  .explain-card { margin-top: 16px; background: #1a1f35; border-radius: 12px; padding: 14px; border: 1px solid #252a42; }
  .result-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 24px; text-align: center; }
  .json-view { background: #080c14; border-radius: 10px; padding: 16px; font-size: 11px; color: #a8b4d8; overflow-x: auto; border: 1px solid #252a42; line-height: 1.6; white-space: pre; }

  /* Firebase sync */
  #sync-indicator { display: none; align-items: center; gap: 6px; font-size: 11px; color: #27ae60; background: #0d2e1a; border: 1px solid #27ae6044; padding: 3px 10px; border-radius: 20px; }
  #sync-indicator.syncing { color: #f39c12; background: #2e1f0d; border-color: #f39c1244; }
  #sync-indicator.error { color: #e74c3c; background: #2e0d0d; border-color: #e74c3c44; }
  .firebase-setup { background: #0d1a2e; border: 1.5px solid #1e3a5f; border-radius: 12px; padding: 16px; margin-top: 14px; }
  .firebase-toggle { font-size: 12px; color: #7c83fd; cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 700; background: none; border: none; padding: 0; }
  .firebase-fields { display: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
  .firebase-input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1.5px solid #252a42; background: #0d1018; color: #e2e4f0; font-size: 12px; font-family: monospace; }

  /* ── Theme System ─────────────────────────────────────────── */
  :root {
    --bg-primary: #0d1018; --bg-secondary: #111520; --bg-card: #141824;
    --bg-elevated: #1a1f35; --bg-input: #0d1018;
    --border: #252a42; --border-hover: #7c83fd;
    --text-primary: #e2e4f0; --text-secondary: #9398b8; --text-muted: #6b6f8e; --text-dim: #3a3f5e;
    --accent: #7c83fd; --accent-soft: #a78bfa; --accent-bg: #7c83fd22;
    --success: #27ae60; --warning: #f39c12; --danger: #e74c3c;
  }
  body.light-theme {
    --bg-primary: #f8f9fc; --bg-secondary: #ffffff; --bg-card: #ffffff;
    --bg-elevated: #f2f3f8; --bg-input: #ffffff;
    --border: #e2e5ee; --border-hover: #6366f1;
    --text-primary: #1e1f2e; --text-secondary: #3d4060; --text-muted: #6b6f8e; --text-dim: #a0a4be;
    --accent: #6366f1; --accent-soft: #818cf8; --accent-bg: rgba(99,102,241,0.08);
    --success: #059669; --warning: #d97706; --danger: #dc2626;
  }
  body.light-theme #header { background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,0.06); border-bottom: none; }
  body.light-theme #tabs { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.04); border-bottom: none; }
  body.light-theme .explore-card { box-shadow: 0 1px 6px rgba(0,0,0,0.05); }
  body.light-theme .term-card { box-shadow: 0 1px 6px rgba(0,0,0,0.05); }
  body.light-theme .db-row { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
  body.light-theme .modal-sheet { background: #fff; box-shadow: 0 -4px 24px rgba(0,0,0,0.1); }
  body.light-theme .edit-card { background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
  body { background: var(--bg-primary); color: var(--text-primary); }
  #header { background: var(--bg-secondary); border-bottom-color: var(--border); }
  #tabs { background: var(--bg-secondary); border-bottom-color: var(--border); }
  .tab-btn { color: var(--text-muted); }
  .tab-btn.active { color: var(--accent-soft); border-bottom-color: var(--accent); }
  .controls-bar, .search-bar, .quiz-bar, .db-header { background: var(--bg-secondary); border-bottom-color: var(--border); }
  .pill, .count-btn { border-color: var(--border); color: var(--text-muted); }
  .count-btn.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-soft); }
  .filter-input, .search-input, .count-input, .roots-search { border-color: var(--border); background: var(--bg-input); color: var(--text-primary); }
  .term-card, .question-card, .db-row, .root-card, .local-result { background: var(--bg-card); border-color: var(--border); }
  .term-card:hover, .db-row:hover, .root-card:hover, .local-result:hover { border-color: var(--border-hover); }
  .term-card-title { color: var(--text-primary); }
  .term-card-def { color: var(--text-muted); }
  .modal-sheet { background: var(--bg-elevated); border-color: var(--border); }
  .modal-term { color: var(--text-primary); }
  .modal-def { background: var(--bg-elevated); color: var(--text-secondary); }
  .modal-close, .modal-act-btn { border-color: var(--border); color: var(--text-muted); }
  .edit-card { background: var(--bg-elevated); border-color: var(--border); }
  .edit-input, .edit-textarea { border-color: var(--border); background: var(--bg-input); color: var(--text-primary); }
  .option-btn { border-color: var(--border); background: var(--bg-card); color: var(--text-secondary); }
  .json-view { background: var(--bg-primary); border-color: var(--border); color: var(--text-secondary); }
  .data-table th { color: var(--accent); border-bottom-color: var(--border); }
  .data-table tr:hover { background: var(--bg-elevated); }
  .data-table td { border-bottom-color: var(--border); }
  .result-card { background: var(--bg-card); }
  .explain-card { background: var(--bg-elevated); border-color: var(--border); }
  .alert-info { background: var(--bg-elevated); border-color: var(--accent-bg); }
  .roots-stat-card { background: var(--bg-card); border-color: var(--border); }
  .etym-root { background: var(--bg-elevated); }
  .tag { background: var(--border); color: var(--text-muted); }
  #change-key-btn { border-color: var(--border); color: var(--text-muted); }

  /* Theme toggle btn */
  #theme-toggle { padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 14px; cursor: pointer; margin-left: 6px; transition: all 0.2s; flex-shrink: 0; }
  #theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

  /* ── Stats Dashboard ──────────────────────────────────────── */
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
  .stat-card { background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated)); border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; transition: all 0.25s ease; }
  .stat-card:hover { border-color: rgba(124,131,253,0.3); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
  .stat-number { font-size: 28px; font-weight: 800; }
  .stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 4px; }
  .chart-container { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
  .chart-title { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
  .chart-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .chart-bar-label { font-size: 12px; color: var(--text-secondary); min-width: 90px; font-weight: 600; }
  .chart-bar-track { flex: 1; height: 20px; background: var(--border); border-radius: 6px; overflow: hidden; position: relative; }
  .chart-bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; display: flex; align-items: center; padding-left: 8px; }
  .chart-bar-value { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
  .diff-pie { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
  .diff-pie-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
  .diff-pie-dot { width: 12px; height: 12px; border-radius: 50%; }
  .quiz-history-row { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
  .quiz-history-bar { flex: 1; min-width: 8px; max-width: 20px; border-radius: 4px 4px 0 0; transition: height 0.3s; cursor: pointer; position: relative; }
  .quiz-history-bar:hover::after { content: attr(data-tooltip); position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%); background: var(--bg-elevated); color: var(--text-primary); padding: 4px 8px; border-radius: 6px; font-size: 10px; white-space: nowrap; border: 1px solid var(--border); z-index: 10; }

  /* ── Home Dashboard ─────────────────────────────────────────── */
  .home-greeting { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
  .home-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
  .home-section { margin-bottom: 18px; }
  .home-section-title { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
  .streak-card { background: linear-gradient(135deg, rgba(26,16,53,0.8), rgba(13,26,46,0.8)); border: 1.5px solid rgba(124,131,253,0.2); border-radius: 16px; padding: 18px; display: flex; align-items: center; gap: 16px; margin-bottom: 14px; backdrop-filter: blur(12px); position: relative; overflow: hidden; }
  .streak-card::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(ellipse, rgba(243,156,18,0.06) 0%, transparent 60%); pointer-events: none; }
  .streak-fire { font-size: 36px; filter: drop-shadow(0 0 8px rgba(243,156,18,0.3)); }
  .streak-num { font-size: 32px; font-weight: 800; color: #f39c12; }
  .streak-label { font-size: 12px; color: var(--text-muted); }
  .daily-progress { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
  .daily-bar-track { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin-top: 8px; }
  .daily-bar-fill { height: 100%; background: linear-gradient(90deg, #27ae60, #2ecc71); border-radius: 5px; transition: width 0.5s ease; }
  .heatmap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .heatmap-cell { width: 100%; aspect-ratio: 1; border-radius: 3px; background: var(--border); transition: background 0.2s; }
  .heatmap-label { font-size: 9px; color: var(--text-dim); text-align: center; margin-bottom: 2px; }
  .review-card { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .review-card:hover { border-color: var(--accent); }
  .mastery-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .mastery-bar { display: flex; gap: 2px; align-items: center; }
  .mastery-seg { width: 8px; height: 8px; border-radius: 2px; background: var(--border); }
  .mastery-seg.filled { background: #27ae60; }
  .mastery-seg.half { background: #f39c12; }
  .home-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-action-btn { padding: 16px; border-radius: 14px; border: 1.5px solid var(--border); background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated)); color: var(--text-primary); font-size: 13px; font-weight: 700; text-align: center; transition: all 0.25s ease; }
  .home-action-btn:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(124,131,253,0.15); }

  /* Onboarding overlay */
  .onboard-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); z-index: 8600; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.3s ease-out; }
  .onboard-card { background: linear-gradient(145deg, var(--bg-elevated), var(--bg-card)); border-radius: 24px; max-width: 400px; width: 100%; padding: 32px; text-align: center; border: 1px solid rgba(124,131,253,0.2); box-shadow: 0 20px 60px rgba(0,0,0,0.4); animation: scaleIn 0.35s ease-out; }
  .onboard-icon { font-size: 56px; margin-bottom: 12px; }
  .onboard-title { font-size: 20px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
  .onboard-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 20px; }
  .onboard-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
  .onboard-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
  .onboard-dot.active { background: var(--accent); }
  .onboard-step-num { font-size: 11px; color: var(--text-dim); margin-bottom: 14px; }

  /* Mastery badge in cards/list */
  .mastery-badge { padding: 2px 7px; border-radius: 20px; font-size: 9px; font-weight: 700; }
  .mastery-0 { background: #3a3f5e33; color: #6b6f8e; }
  .mastery-1 { background: #e74c3c22; color: #e74c3c; }
  .mastery-2 { background: #f39c1222; color: #f39c12; }
  .mastery-3 { background: #27ae6022; color: #27ae60; }
  .mastery-4 { background: #7c83fd22; color: #7c83fd; }
  .mastery-5 { background: #ffd70033; color: #ffd700; }

  /* ── Import ────────────────────────────────────────────────── */
  .import-hidden { display: none; }

  /* ── Confetti Container ────────────────────────────────────── */
  #confetti-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9700; overflow: hidden; }
  .confetti-piece { position: absolute; top: -10px; width: 8px; height: 8px; border-radius: 2px; animation: confettiFall 1.5s ease-in forwards; }

  /* ── Responsive: Desktop ───────────────────────────────────── */
  @media (min-width: 768px) {
    #header { padding: 14px 24px; }
    .tab-btn { padding: 10px 10px 8px; }
    .tab-icon { font-size: 20px; }
    .tab-label { font-size: 10px; }
    .controls-bar, .search-bar, .db-header { padding: 20px 24px; }
    .results { padding: 20px 24px; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
    .term-card { padding: 18px; }
    .modal-sheet { max-width: 600px; margin: 0 auto; border-radius: 24px 24px 0 0; max-height: 85vh; }
    .modal-overlay { align-items: center; }
    .modal-sheet { border-radius: 24px; max-height: 85vh; margin-bottom: 0; }
    .edit-card { max-width: 560px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .home-quick-actions { grid-template-columns: repeat(4, 1fr); }
    .quiz-setup { max-width: 520px; margin: 0 auto; }
    .onboard-card { max-width: 440px; padding: 36px; }
    .question-card { max-width: 520px; margin-left: auto; margin-right: auto; }
    #options-wrap { max-width: 520px; margin: 0 auto; }
  }

  /* ── Responsive: Large Desktop ─────────────────────────────── */
  @media (min-width: 1200px) {
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .home-greeting { font-size: 26px; }
    .streak-card { padding: 20px; }
  }

  /* ── Responsive: Small Mobile ──────────────────────────────── */
  @media (max-width: 380px) {
    .tab-btn { padding: 6px 3px 5px; }
    .tab-icon { font-size: 15px; }
    .tab-label { font-size: 8px; }
    .cards-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .home-quick-actions { grid-template-columns: 1fr 1fr; gap: 6px; }
    .home-action-btn { padding: 12px; font-size: 12px; }
    .streak-card { padding: 12px; gap: 12px; }
    .streak-num { font-size: 26px; }
    .streak-fire { font-size: 28px; }
  }
  /* ── NEW: Micro-animations & Card Interactions ─────────────── */
  .term-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .term-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 32px rgba(124,131,253,0.18);
  }
  .term-card:active {
    transform: translateY(-1px) scale(0.99);
    transition-duration: 0.1s;
  }
  .term-card .term-card-hint {
    transition: all 0.3s ease;
    opacity: 0.5;
  }
  .term-card:hover .term-card-hint {
    opacity: 1;
    transform: translateX(4px);
  }
  @keyframes cardEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  .card-animate {
    animation: cardEntrance 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
  }

  /* ── NEW: Quiz Feedback Animations ─────────────────────────── */
  @keyframes quizCorrectPulse {
    0% { box-shadow: 0 0 0 0 rgba(39,174,96,0.4); }
    70% { box-shadow: 0 0 0 12px rgba(39,174,96,0); }
    100% { box-shadow: 0 0 0 0 rgba(39,174,96,0); }
  }
  @keyframes quizWrongShake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-6px); }
    30%, 60%, 90% { transform: translateX(6px); }
  }
  .quiz-correct-pulse { animation: quizCorrectPulse 0.6s ease-out; }
  .quiz-wrong-shake { animation: quizWrongShake 0.5s ease-out; }

  /* ── NEW: Enhanced Splash Animation ────────────────────────── */
  @keyframes splashLogoReveal {
    0% { opacity: 0; transform: scale(0.6) rotate(-10deg); filter: blur(8px); }
    60% { opacity: 1; transform: scale(1.05) rotate(1deg); filter: blur(0); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0); }
  }
  @keyframes splashTitleSlide {
    0% { opacity: 0; transform: translateY(16px); letter-spacing: 8px; }
    100% { opacity: 1; transform: translateY(0); letter-spacing: normal; }
  }
  @keyframes splashCreatorFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
  #splash-screen .splash-icon {
    animation: splashLogoReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
  #splash-screen .splash-title {
    animation: splashTitleSlide 0.6s ease-out 0.3s both;
  }
  #splash-screen .splash-creator {
    animation: splashCreatorFade 0.4s ease 0.6s both;
  }
  #splash-screen .splash-loader {
    animation: splashCreatorFade 0.4s ease 0.8s both;
  }

  /* ── NEW: Lesson Pack Cards ────────────────────────────────── */
  .lesson-pack {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }
  .lesson-pack::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
    transition: opacity 0.3s;
    opacity: 0;
  }
  .lesson-pack:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124,131,253,0.12);
  }
  .lesson-pack:hover::after { opacity: 1; }
  .lesson-pack-icon { font-size: 28px; margin-bottom: 8px; }
  .lesson-pack-title { font-size: 14px; font-weight: 800; color: var(--text-primary); font-family: 'Sora', sans-serif; }
  .lesson-pack-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
  .lesson-pack-count { font-size: 10px; font-weight: 700; margin-top: 8px; padding: 3px 8px; border-radius: 20px; display: inline-block; }
  .lesson-packs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

  /* ── NEW: Share Card ───────────────────────────────────────── */
  .share-card-preview {
    background: linear-gradient(135deg, #111520, #1a1f35);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin: 16px 0;
  }
  .share-card-term { font-size: 22px; font-weight: 800; color: #e2e4f0; font-family: 'Sora', sans-serif; }
  .share-card-turkish { font-size: 15px; color: #a78bfa; font-weight: 600; margin-top: 4px; }
  .share-card-def { font-size: 12px; color: #9398b8; margin-top: 10px; line-height: 1.6; }
  .share-card-footer { font-size: 10px; color: #3a3f5e; margin-top: 14px; font-weight: 600; }

  /* ── NEW: Relation Suggestions ─────────────────────────────── */
  .relation-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
  }
  .relation-chip:hover {
    border-color: var(--accent);
    color: var(--accent-soft);
    background: var(--accent-bg);
  }

  /* ── NEW: Toast Notifications ──────────────────────────────── */
  .toast-container {
    position: fixed;
    top: env(safe-area-inset-top, 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    padding-top: 12px;
  }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
  }
  .toast {
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(12px);
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .toast.toast-exit { animation: toastOut 0.25s ease-in forwards; }
  .toast-success { background: rgba(39,174,96,0.9); color: #fff; }
  .toast-error { background: rgba(231,76,60,0.9); color: #fff; }
  .toast-info { background: rgba(124,131,253,0.9); color: #fff; }
  .toast-warning { background: rgba(243,156,18,0.9); color: #fff; }

  /* ── NEW: Skeleton Loading ─────────────────────────────────── */
  @keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
  .skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-elevated) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
  }
  .skeleton-text { height: 14px; margin-bottom: 8px; }
  .skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
  .skeleton-card { height: 120px; border-radius: 14px; margin-bottom: 14px; }

  /* ── NEW: Accessibility Focus Styles ───────────────────────── */
  *:focus-visible {
    outline: 2px solid var(--accent, #7c83fd);
    outline-offset: 2px;
    border-radius: 4px;
  }
  .tab-btn:focus-visible,
  .pill:focus-visible,
  .btn-primary:focus-visible,
  .option-btn:focus-visible {
    outline-offset: 3px;
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* ── Skip to content link (a11y) ──────────────────────────── */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    z-index: 10000;
    font-weight: 700;
    border-radius: 0 0 8px 0;
    transition: top 0.2s;
  }
  .skip-link:focus { top: 0; }

  /* ── Folder System ─────────────────────────────────────────── */
  .cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
  }
  .cat-chip.clickable:hover { opacity: 0.85; transform: scale(1.03); }
  .cat-chip.active-filter { outline: 2px solid; outline-offset: 1px; }
  .folder-icon-opt.active {
    border-color: var(--accent) !important;
    background: var(--accent-bg) !important;
    box-shadow: 0 0 0 2px var(--accent);
  }
  .folder-color-opt.active {
    border-color: #fff !important;
    box-shadow: 0 0 0 3px var(--accent);
    transform: scale(1.15);
  }

  /* ── DB Row — category left border ─────────────────────────── */
  .db-row {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
  }
  .db-row .folder-assign-btn:hover { color: var(--accent-soft); transform: scale(1.15); }

  /* ── Explore Cards ─────────────────────────────────────────── */
  .explore-card {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1.5px solid var(--border);
    padding: 16px;
    margin-bottom: 10px;
    border-left: 4px solid var(--card-cat-color, var(--accent));
    transition: all 0.2s ease;
  }
  .explore-card:hover { border-color: var(--card-cat-color, var(--accent)); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
  .explore-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-elevated); border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0; transition: transform 0.15s;
  }
  .explore-avatar:hover { transform: scale(1.1); border-color: var(--accent); }
  .explore-action-btn {
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-dim); font-weight: 500;
    padding: 4px 8px; border-radius: 8px; transition: all 0.15s;
  }
  .explore-action-btn:hover { background: var(--bg-elevated); }
  .explore-action-btn.liked { color: #e74c3c; font-weight: 700; }

  /* ── UI Polish — mikro animasyonlar ────────────────────────── */
  .tab-btn { transition: all 0.2s cubic-bezier(0.4,0,0.2,1); }
  .tab-btn:active { transform: scale(0.95); }
  .pill { transition: all 0.15s ease; }
  .pill:active { transform: scale(0.96); }
  .btn-primary { transition: all 0.2s ease; }
  .btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,131,253,0.3); }
  .btn-primary:active { transform: translateY(0) scale(0.98); }
  .btn-secondary { transition: all 0.15s ease; }
  .btn-secondary:hover { background: var(--bg-elevated); }
  .modal-act-btn { transition: all 0.15s ease; }
  .modal-act-btn:active { transform: scale(0.95); }
  .edit-input { transition: border-color 0.2s, box-shadow 0.2s; }
  .edit-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,131,253,0.15); }
  @keyframes gentlePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
  .spin { display: inline-block; animation: spin 1s linear infinite; }


  /* ── Group Tabs ──────────────────────────────────────────── */
  .group-tab-btn { flex:1; padding:10px 8px; border:none; background:transparent; color:var(--text-muted); font-size:11px; font-weight:700; cursor:pointer; border-bottom:2px solid transparent; transition:all 0.2s; }
  .group-tab-btn.active { color:var(--accent-soft); border-bottom-color:var(--accent); background:var(--accent-bg); }

  /* ── Chrome Autofill Prevention ──────────────────────────── */
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-elevated) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 9999s ease-in-out 0s;
  }
  input::-webkit-credentials-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
  }
