/* =========================================================================
   English Mastery — Light Premium Design System v12
   -------------------------------------------------------------------------
   - Light mode only: #F4F6FB pearl background, aurora mesh
   - Glassmorphism cards (rgba(255,255,255,0.72) + backdrop-blur)
   - Lucide icons (stroke 1.75) — no emojis in functional UI
   - Rubik display + Assistant body + Space Grotesk (English)
   - Spring physics (Motion One)
   ========================================================================= */

:root {
  /* ---- Base surfaces ---- */
  --bg: #F4F6FB;
  --bg-2: #EDF0F7;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-heavy: rgba(255, 255, 255, 0.95);

  /* ---- Borders (slate) ---- */
  --border: rgba(203, 213, 225, 0.6);
  --border-light: rgba(226, 232, 240, 0.5);
  --border-strong: rgba(148, 163, 184, 0.3);

  /* ---- Text ---- */
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --text-inv: #FFFFFF;

  /* ---- Brand palette ---- */
  --p-ink: #7C3AED;
  --p-ink-2: #6D28D9;
  --p-soft: #F3E8FF;
  --p-soft-2: #EDE9FE;
  --p-glow: rgba(124, 58, 237, 0.15);
  --p-glow-strong: rgba(124, 58, 237, 0.28);

  --c-ink: #06B6D4;
  --c-soft: #CFFAFE;
  --c-glow: rgba(6, 182, 212, 0.18);

  --a-ink: #F59E0B;
  --a-soft: #FEF3C7;

  --pink-ink: #EC4899;
  --pink-soft: #FCE7F3;

  --ok: #10B981;
  --ok-soft: #D1FAE5;
  --ok-text: #047857;
  --ok-glow: rgba(16, 185, 129, 0.18);

  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  --danger-text: #B91C1C;
  --danger-glow: rgba(239, 68, 68, 0.18);

  /* ---- Shadows ---- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 30px 80px rgba(15, 23, 42, 0.1);
  --shadow-glow-p: 0 0 30px rgba(124, 58, 237, 0.15);
  --shadow-glow-c: 0 0 30px rgba(6, 182, 212, 0.15);
  --shadow-glow-ok: 0 0 30px rgba(16, 185, 129, 0.15);
  --shadow-glow-amber: 0 0 30px rgba(245, 158, 11, 0.15);

  /* ---- Typography ---- */
  --font-he: 'Assistant', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Rubik', system-ui, sans-serif;
  --font-en: 'Space Grotesk', 'Inter', sans-serif;

  /* ---- Motion ---- */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Responsive safe area */
  --sat: env(safe-area-inset-top, 0);
  --sab: env(safe-area-inset-bottom, 0);
}

/* ========== RESET ========== */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-he);
  font-weight: 400;
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; background: none; border: none; outline: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.en { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }

/* ========== PAGE-LEVEL AURORA (fixed, behind everything) ========== */
.page-aurora {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.page-aurora::before, .page-aurora::after, .page-aurora span {
  content: ''; position: absolute; border-radius: 50%; filter: blur(80px);
}
.page-aurora::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.35), transparent 70%);
  top: -150px; right: -120px;
  animation: auroraFloat1 20s ease-in-out infinite;
}
.page-aurora::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(165, 243, 252, 0.3), transparent 70%);
  top: 40%; left: -150px;
  animation: auroraFloat2 24s ease-in-out infinite;
}
.page-aurora span {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(252, 211, 170, 0.22), transparent 70%);
  bottom: -100px; right: 20%;
  animation: auroraFloat3 28s ease-in-out infinite;
}
@keyframes auroraFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 30px) scale(1.1); }
}
@keyframes auroraFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -20px) scale(1.08); }
}
@keyframes auroraFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-25px, -30px) scale(1.12); }
}

/* ========== SPLASH SCREEN ========== */
#splash {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: opacity 0.5s var(--ease-out);
}
#splash.fade-out { opacity: 0; pointer-events: none; }
.splash-aurora {
  position: absolute; border-radius: 50%; filter: blur(80px);
  opacity: 0.7;
  animation: splashFloat 8s ease-in-out infinite;
}
.splash-a1 { width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(196,181,253,0.6), transparent 65%);
  top: -80px; right: -100px; }
.splash-a2 { width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(165,243,252,0.5), transparent 65%);
  bottom: -80px; left: -80px; animation-delay: -3s; }
.splash-a3 { width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(252,211,170,0.4), transparent 65%);
  top: 45%; left: 40%; animation-delay: -5s; }
@keyframes splashFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(20px,-20px) scale(1.1); }
}
.splash-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: splashPop 0.7s var(--spring) backwards;
}
@keyframes splashPop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.splash-logo svg {
  filter: drop-shadow(0 20px 40px rgba(124,58,237,0.25));
  animation: splashLogo 3s ease-in-out infinite;
}
@keyframes splashLogo {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%     { transform: translateY(-8px) rotate(2deg); }
}
.splash-title {
  font-family: var(--font-display); font-size: 30px; font-weight: 800;
  background: linear-gradient(135deg, #7C3AED, #6D28D9, #06B6D4);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}
.splash-sub {
  font-size: 13px; color: var(--text-2); font-weight: 500;
}
.splash-dots { display: flex; gap: 8px; margin-top: 8px; }
.splash-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--p-ink);
  animation: dot 1.4s ease-in-out infinite;
  filter: drop-shadow(0 0 10px currentColor);
}
.splash-dot:nth-child(2) { background: var(--p-ink-2); animation-delay: 0.2s; }
.splash-dot:nth-child(3) { background: var(--c-ink); animation-delay: 0.4s; }
@keyframes dot { 0%,80%,100% { transform: scale(0); opacity: 0.3; } 40% { transform: scale(1); opacity: 1; } }

/* ========== TOASTS ========== */
#toast {
  position: fixed; top: calc(var(--sat) + 16px); left: 50%; transform: translateX(-50%) translateY(-100px);
  padding: 12px 20px;
  background: var(--glass-heavy); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 998;
  transition: all 0.4s var(--spring);
  opacity: 0; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.error { border-color: rgba(239, 68, 68, 0.3); color: var(--danger-text); }
#toast.success { border-color: rgba(16, 185, 129, 0.3); color: var(--ok-text); }

/* ========== AUTH SCREEN ========== */
#screen-auth {
  min-height: 100vh;
  padding: calc(var(--sat) + 40px) 24px calc(var(--sab) + 32px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.auth-aurora {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6;
  animation: splashFloat 15s ease-in-out infinite;
}
.auth-aurora-1 { width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(196,181,253,0.55), transparent 65%);
  top: -120px; right: -100px; }
.auth-aurora-2 { width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(165,243,252,0.45), transparent 65%);
  bottom: -120px; left: -100px; animation-delay: -5s; }

.auth-wrap { width: 100%; max-width: 380px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 24px; }
.auth-brand { text-align: center; }
.auth-logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-en); font-weight: 800; font-size: 28px;
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.3);
}
.auth-brand h1 {
  font-family: var(--font-display); font-size: 32px; font-weight: 800;
  letter-spacing: -0.03em; color: var(--text);
}
.auth-brand p { color: var(--text-2); font-size: 15px; margin-top: 6px; font-weight: 500; }

.auth-card {
  padding: 24px; background: var(--glass-heavy); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px;
  background: rgba(241, 245, 249, 0.6); border-radius: 12px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; border-radius: 8px;
  font-weight: 700; font-size: 14px; color: var(--text-3);
  transition: all 0.2s var(--ease-out); }
.auth-tab.active { background: #fff; color: var(--p-ink); box-shadow: var(--shadow-sm); }

.auth-field { margin-bottom: 14px; }
.auth-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.auth-input {
  width: 100%; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px; color: var(--text);
  transition: all 0.2s var(--ease-out);
}
.auth-input:focus { border-color: var(--p-ink); box-shadow: 0 0 0 4px var(--p-glow); background: #fff; }

/* ========== BUTTONS (GLASS iOS STYLE) ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px;
  font-family: var(--font-he); font-weight: 600; font-size: 14px;
  color: var(--text);
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
  cursor: pointer; user-select: none; position: relative; overflow: hidden;
}
.btn svg { width: 16px; height: 16px; stroke-width: 1.75; flex-shrink: 0; }
.btn:hover { background: var(--glass-heavy); box-shadow: var(--shadow); }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--p-ink), var(--p-ink-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover { box-shadow: 0 14px 30px rgba(124, 58, 237, 0.4); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.4); border-color: var(--border-light);
}
.btn-ghost:hover { background: var(--glass-strong); }

.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 14px; }
.btn-lg svg { width: 18px; height: 18px; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-danger-outline {
  background: rgba(254, 226, 226, 0.4); border-color: rgba(239, 68, 68, 0.3); color: var(--danger-text);
}
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }

/* ========== APP SHELL ========== */
#screen-app {
  min-height: 100vh;
  padding-top: var(--sat);
  padding-bottom: calc(var(--sab) + 100px); /* room for bottom nav */
  display: flex; flex-direction: column;
  position: relative;
}

/* ========== TOP BAR ========== */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 10px;
  background: rgba(244, 246, 251, 0.78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 60px; }
.tb-right { justify-content: flex-end; }
#page-title {
  flex: 1; text-align: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  letter-spacing: -0.005em; color: var(--text);
}
.tb-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s var(--ease-out);
}
.tb-btn:hover { background: var(--glass-heavy); color: var(--text); }
.tb-btn:active { transform: scale(0.95); }
.tb-btn svg { width: 20px; height: 20px; stroke-width: 1.75; }

.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--text);
  box-shadow: var(--shadow-xs);
}
.streak-chip svg { width: 14px; height: 14px; color: var(--a-ink); }

/* ========== SIDE DRAWER ========== */
#drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
#drawer-backdrop.open { opacity: 1; pointer-events: auto; }

#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: 300px; max-width: 86vw;
  background: var(--glass-heavy); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(15, 23, 42, 0.1);
  transform: translateX(100%);
  transition: transform 0.4s var(--spring);
  display: flex; flex-direction: column;
  padding-top: var(--sat);
}
#drawer.open { transform: translateX(0); }

.dr-head { padding: 20px 20px 16px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 12px; }
.dr-avatar {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px; font-family: var(--font-en);
  box-shadow: var(--shadow-glow-p);
}
.dr-user { flex: 1; min-width: 0; }
.dr-user-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -0.005em; }
.dr-user-email { font-size: 12px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-en); }

.dr-nav { flex: 1; overflow-y: auto; padding: 12px; }
.dr-section {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 16px 12px 8px; font-family: var(--font-en);
}
.dr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: all 0.2s var(--ease-out);
  margin-bottom: 2px;
  position: relative;
}
.dr-item:hover { background: rgba(243, 232, 255, 0.4); color: var(--text); }
.dr-item.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.06));
  color: var(--p-ink);
}
.dr-item.active::before {
  content: ''; position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--p-ink); border-radius: 2px 0 0 2px;
}
.dr-icon { width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s var(--ease-out); }
.dr-icon svg { width: 18px; height: 18px; stroke-width: 1.75; }
.dr-item.active .dr-icon { background: linear-gradient(135deg, var(--p-ink), var(--c-ink)); color: #fff; border-color: transparent; }

.dr-foot { padding: 16px; border-top: 1px solid var(--border-light); }

/* ========== BOTTOM NAV (GLASS PILL) ========== */
#bottomnav {
  position: fixed; bottom: calc(var(--sab) + 12px); left: 14px; right: 14px; z-index: 50;
  padding: 7px; gap: 2px;
  background: var(--glass-heavy); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  display: flex;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
}
.bn {
  flex: 1; padding: 10px 6px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px; color: var(--text-3); font-weight: 600;
  transition: all 0.3s var(--spring);
  position: relative;
}
.bn.active { color: var(--p-ink); }
.bn.active::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 16px; z-index: -1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.bn:active { transform: scale(0.95); }
.bn-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.bn-icon svg { width: 20px; height: 20px; stroke-width: 1.75; }

/* ========== MAIN SCROLL AREA ========== */
#main {
  padding: 16px 16px 16px;
  min-height: 60vh;
  position: relative; z-index: 1;
}

/* ========== GLASS CARD BASE ========== */
.glass {
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.glass-strong {
  background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

/* ========== LOADING ========== */
.loading {
  padding: 40px 20px; text-align: center; color: var(--text-3);
  font-size: 14px; font-weight: 500;
}

/* ========== DASHBOARD ========== */
.greeting {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.03em; color: var(--text);
  margin-bottom: 4px;
}
.greeting-sub { color: var(--text-2); font-size: 14px; margin-bottom: 20px; font-weight: 500; }

/* Topic Banner */
.topic-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  position: relative; overflow: hidden;
  transition: transform 0.2s var(--ease-out);
}
.topic-banner::before {
  content: ''; position: absolute; width: 100%; height: 100%; top: 0; left: 0;
  background: linear-gradient(135deg, rgba(243, 232, 255, 0.5) 0%, rgba(207, 250, 254, 0.25) 100%);
  z-index: -1;
}
.topic-banner:active { transform: scale(0.98); }
.topic-ic {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 6px 20px rgba(124, 58, 237, 0.25);
  flex-shrink: 0;
}
.topic-ic svg { width: 22px; height: 22px; stroke-width: 1.75; }
.topic-text { flex: 1; min-width: 0; }
.topic-label { font-family: var(--font-en); font-size: 10px; font-weight: 700; color: var(--p-ink);
  letter-spacing: 0.18em; text-transform: uppercase; }
.topic-name { font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--text); margin-top: 2px; letter-spacing: -0.01em; }
.topic-meta { font-family: var(--font-en); font-size: 11px; color: var(--text-3); margin-top: 2px; font-weight: 500; }
.topic-switch {
  padding: 8px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.6); border: 1px solid var(--border-light);
  color: var(--text-2);
  transition: all 0.2s var(--ease-out);
}
.topic-switch:hover { background: #fff; color: var(--p-ink); }
.topic-switch svg { width: 16px; height: 16px; stroke-width: 1.75; }

/* Week dots */
.week {
  display: flex; justify-content: space-between; gap: 6px;
  padding: 14px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 18px; box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.day-cell { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day-name { font-family: var(--font-en); font-size: 9px; color: var(--text-3); font-weight: 700; letter-spacing: 0.05em; }
.day-dot {
  width: 26px; height: 26px; border-radius: 10px;
  background: rgba(241, 245, 249, 0.8); border: 1px solid var(--border-light);
  font-size: 11px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-en);
}
.day-dot.done {
  background: linear-gradient(135deg, var(--p-ink), var(--p-ink-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.day-dot.done svg { width: 14px; height: 14px; stroke-width: 2.5; }
.day-dot.today {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--p-ink); color: var(--p-ink);
  box-shadow: var(--shadow-glow-p);
}

/* Mega CTA (Journey) */
.mega-cta {
  position: relative; overflow: hidden;
  padding: 24px 22px; margin-bottom: 20px;
  background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 50%, #4338CA 100%);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(124, 58, 237, 0.32);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}
.mega-cta:active { transform: scale(0.98); }
.mega-cta::before {
  content: ''; position: absolute; inset: 0; opacity: 0.35;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(circle at bottom left, rgba(6,182,212,0.4), transparent 50%);
  pointer-events: none;
}
.mega-cta-eyebrow {
  font-family: var(--font-en); font-size: 10px;
  font-weight: 700; letter-spacing: 0.22em; color: rgba(255,255,255,0.75);
  text-transform: uppercase; margin-bottom: 10px; position: relative;
}
.mega-cta-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800; letter-spacing: -0.015em;
  margin-bottom: 6px; position: relative;
}
.mega-cta-sub {
  font-size: 13px; color: rgba(255,255,255,0.85);
  margin-bottom: 16px; position: relative; font-weight: 500;
}
.mega-cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--p-ink);
  padding: 12px 18px; border-radius: 14px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  position: relative;
}
.mega-cta-btn svg { width: 16px; height: 16px; stroke-width: 2; }

/* Hero word */
.hero-wd {
  padding: 22px 22px; margin-bottom: 20px;
  background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero-wd::before {
  content: ''; position: absolute;
  width: 200px; height: 200px; top: -60px; right: -60px;
  background: radial-gradient(circle, rgba(196,181,253,0.4), transparent 70%);
  filter: blur(20px);
}
.hero-eyebrow {
  font-family: var(--font-en); font-size: 10px; font-weight: 700; color: var(--p-ink);
  letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 10px;
  position: relative;
}
.hero-word-en {
  font-family: var(--font-en); font-size: 44px; font-weight: 700; letter-spacing: -0.03em;
  direction: ltr; text-align: left; line-height: 1;
  margin-bottom: 10px; color: var(--text);
  position: relative;
}
.hero-word-pos {
  display: inline-block; padding: 3px 10px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  font-family: var(--font-en); margin-bottom: 10px;
  position: relative;
}
.hero-word-he {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 12px;
  letter-spacing: -0.01em; position: relative;
}
.hero-word-ex {
  font-family: var(--font-en); font-style: italic;
  color: var(--text-2); font-size: 13px;
  direction: ltr; text-align: left; line-height: 1.55;
  padding: 10px 12px; background: rgba(248,250,252,0.8);
  border-right: 2px solid var(--p-ink); border-radius: 0 10px 10px 0;
  position: relative;
}

/* Mini stats */
.ministats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.ministat {
  padding: 16px 12px; text-align: center;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out);
}
.ministat:active { transform: scale(0.96); }
.ministat-n {
  font-family: var(--font-en); font-size: 24px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em; line-height: 1;
}
.ministat-l {
  font-size: 11px; color: var(--text-3); margin-top: 4px; font-weight: 600;
}

/* ========== CATEGORY HEADER ========== */
.cat-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 4px 10px; margin-top: 10px;
}
.cat-header-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.005em; }
.cat-header-count { font-family: var(--font-en); font-size: 11px; color: var(--text-3); font-weight: 600; }

/* ========== LIBRARY / WORD CARDS ========== */
.library-filter { margin-bottom: 14px; }
.library-search {
  width: 100%; padding: 12px 16px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  font-size: 14px; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.library-search:focus { border-color: var(--p-ink); box-shadow: 0 0 0 4px var(--p-glow); }

.pill-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; margin-bottom: 6px; -ms-overflow-style: none; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s var(--ease-out);
}
.pill.active {
  background: linear-gradient(135deg, var(--p-ink), var(--p-ink-2));
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-glow-p);
}

.word-card {
  padding: 16px; margin-bottom: 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
}
.word-card:active { transform: scale(0.98); }
.word-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.word-card-en { font-family: var(--font-en); font-weight: 600; font-size: 17px; color: var(--text); direction: ltr; letter-spacing: -0.01em; }
.word-card-he { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text-2); }
.word-card-badge {
  font-family: var(--font-en); font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.word-card-badge.new { background: var(--p-soft); color: var(--p-ink); }
.word-card-badge.due { background: var(--a-soft); color: #92400E; }
.word-card-badge.mast { background: var(--ok-soft); color: var(--ok-text); }
.word-card-badge.hard { background: var(--danger-soft); color: var(--danger-text); }
.word-card-expanded { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 13px; color: var(--text-2); line-height: 1.6; }

/* ========== EMPTY STATE ========== */
.empty-state { padding: 40px 20px; text-align: center; }
.empty-state svg { width: 48px; height: 48px; color: var(--text-3); margin: 0 auto 12px; stroke-width: 1.5; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.empty-state p { font-size: 14px; color: var(--text-2); margin-bottom: 16px; }

/* ========== FLOATING SCORE (match game) ========== */
.float-score {
  position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-en); font-weight: 700; font-size: 14px;
  pointer-events: none; z-index: 10;
  text-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

/* ========== UTILITIES ========== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.hidden { display: none !important; }

/* ========== JOURNEY ========== */
#main.journey-active { padding: 0; }
.journey-wrap { padding-bottom: 20px; }
.journey-hdr {
  position: sticky; top: 60px; z-index: 20;
  padding: 14px 20px 18px;
  background: rgba(244, 246, 251, 0.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.journey-topic-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 5px 12px;
  background: rgba(243, 232, 255, 0.6); border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--p-ink);
  margin-bottom: 12px;
}
.journey-topic-chip svg { width: 13px; height: 13px; stroke-width: 2; }

.journey-progress {
  height: 6px; background: rgba(226, 232, 240, 0.7);
  border-radius: 3px; overflow: hidden; margin: 6px 0 8px;
}
.journey-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--p-ink), var(--c-ink));
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
  transition: width 0.6s var(--ease-out);
}
.journey-step-label {
  font-family: var(--font-en); font-size: 11px; color: var(--text-3);
  text-align: center; font-weight: 600; letter-spacing: 0.05em;
}

.journey-body { padding: 0 20px 100px; }

/* Journey intro screen */
.journey-intro-body { padding: 36px 20px; text-align: center; }
.journey-intro-icon-wrap {
  width: 92px; height: 92px; margin: 0 auto 22px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.3);
  animation: iconFloat 3s ease-in-out infinite;
}
@keyframes iconFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.journey-intro-icon-wrap svg { width: 44px; height: 44px; stroke-width: 1.5; }
.journey-intro-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800; line-height: 1.2;
  margin-bottom: 8px; letter-spacing: -0.025em; color: var(--text);
}
.journey-intro-topic { color: var(--p-ink); }
.journey-intro-desc {
  color: var(--text-2); font-size: 14px; line-height: 1.5;
  margin-bottom: 24px; font-weight: 500;
}

.roadmap {
  padding: 18px 20px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px; text-align: right;
}
.roadmap-title {
  font-family: var(--font-en); font-size: 10px; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 14px;
}
.roadmap-list { display: flex; flex-direction: column; gap: 10px; }
.roadmap-step { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.roadmap-step-dot {
  width: 24px; height: 24px; border-radius: 999px;
  background: rgba(248, 250, 252, 0.8); border: 1.5px solid var(--border);
  font-size: 10px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-en); color: var(--text-3); font-weight: 700;
  flex-shrink: 0;
}
.roadmap-step.active .roadmap-step-dot {
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-glow-p);
}
.roadmap-step.done .roadmap-step-dot {
  background: var(--ok-soft); color: var(--ok-text); border-color: rgba(16,185,129,0.3);
}
.roadmap-step.done .roadmap-step-dot svg { width: 12px; height: 12px; stroke-width: 2.5; }
.roadmap-step.active { color: var(--text); font-weight: 600; }
.roadmap-step-name { flex: 1; color: var(--text-2); }
.roadmap-step-icon { color: var(--text-3); display: flex; }
.roadmap-step-icon svg { width: 16px; height: 16px; stroke-width: 1.75; }
.roadmap-step.active .roadmap-step-icon { color: var(--p-ink); }

/* Big CTA */
.cta-big {
  width: 100%; max-width: 340px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--p-ink), var(--p-ink-2));
  border-radius: 16px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 16px 40px rgba(124, 58, 237, 0.35);
  letter-spacing: -0.01em;
  transition: all 0.2s var(--ease-out);
}
.cta-big:active { transform: scale(0.97); }
.cta-big svg { width: 18px; height: 18px; stroke-width: 2; }

/* Word Preview */
.wp-count { display: flex; justify-content: center; margin: 14px 0 20px; }
.wp-count-chip {
  padding: 7px 14px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-family: var(--font-en); font-size: 12px; font-weight: 700; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.wp-count-chip strong { color: var(--p-ink); font-weight: 800; }

.wp-card {
  padding: 24px 22px; margin-bottom: 14px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.wp-card::before {
  content: ''; position: absolute; width: 200px; height: 200px;
  top: -80px; right: -80px;
  background: radial-gradient(circle, rgba(196,181,253,0.3), transparent 70%);
  filter: blur(20px);
}
.wp-cat {
  font-family: var(--font-en); font-size: 10px; color: var(--p-ink); font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 10px;
  position: relative;
}
.wp-word {
  font-family: var(--font-en); font-size: 36px; font-weight: 700;
  direction: ltr; text-align: left; letter-spacing: -0.025em; line-height: 1.05;
  color: var(--text); margin-bottom: 8px;
  position: relative;
}
.wp-pos {
  display: inline-block; padding: 2px 10px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 10px; color: var(--text-2);
  font-family: var(--font-en); font-weight: 600;
  margin-bottom: 12px;
  position: relative;
}
.wp-he {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--text); margin-bottom: 16px;
  letter-spacing: -0.01em;
  position: relative;
}
.wp-ex-block {
  padding: 12px 14px; background: rgba(248,250,252,0.8);
  border-right: 2px solid var(--p-ink); border-radius: 0 10px 10px 0;
  position: relative;
}
.wp-ex-en {
  font-family: var(--font-en); font-style: italic; font-size: 13px;
  color: var(--text); direction: ltr; text-align: left;
  line-height: 1.5; margin-bottom: 4px;
}
.wp-ex-he { font-size: 12px; color: var(--text-3); font-weight: 500; }

.wp-controls { display: flex; gap: 10px; }
.wp-prev, .wp-next {
  flex: 1; padding: 13px 14px; border-radius: 14px;
  font-weight: 700; font-size: 14px; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s var(--ease-out);
}
.wp-prev {
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.wp-next {
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  color: #fff;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.28);
}
.wp-prev:active, .wp-next:active { transform: scale(0.96); }
.wp-prev svg, .wp-next svg { width: 16px; height: 16px; stroke-width: 2; }

/* ========== FLASHCARDS 3D ========== */
.flash-stage { padding: 20px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 500px; }
.flash-progress-wrap { width: 100%; max-width: 320px; margin-bottom: 20px; }
.flash-progress {
  height: 6px; background: rgba(226, 232, 240, 0.7);
  border-radius: 3px; overflow: hidden;
}
.flash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--p-ink), var(--c-ink));
  transition: width 0.4s var(--ease-out);
}

.flash-card-wrap {
  perspective: 1200px; width: 100%; max-width: 300px;
  margin-bottom: 20px;
}
.flash-card {
  aspect-ratio: 3/4; position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--spring);
  cursor: pointer;
}
.flash-card.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; padding: 26px 24px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.08), var(--shadow-glow-p);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.flash-face::before {
  content: ''; position: absolute;
  width: 140px; height: 140px; top: -50px; right: -50px;
  background: radial-gradient(circle, rgba(196,181,253,0.45), transparent 70%);
  filter: blur(20px); border-radius: 50%;
}
.flash-face.back { transform: rotateY(180deg); }
.flash-face.back::before {
  background: radial-gradient(circle, rgba(165,243,252,0.5), transparent 70%);
}
.flash-cat {
  font-family: var(--font-en); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--p-ink); font-weight: 700; margin-bottom: 14px;
  position: relative;
}
.flash-word {
  font-family: var(--font-en); font-size: 44px; font-weight: 700;
  direction: ltr; text-align: left; letter-spacing: -0.03em; line-height: 1;
  color: var(--text); margin-bottom: 10px;
  position: relative;
}
.flash-pos {
  display: inline-block; padding: 2px 10px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  border-radius: 999px; font-size: 10px; color: var(--text-2);
  margin-bottom: 14px; font-family: var(--font-en); font-weight: 600;
  position: relative;
}
.flash-he {
  font-family: var(--font-display); font-size: 28px; font-weight: 700;
  margin-bottom: 14px; color: var(--text);
  letter-spacing: -0.015em; position: relative;
}
.flash-ex {
  font-family: var(--font-en); font-style: italic; font-size: 13px;
  color: var(--text-2); direction: ltr; text-align: left; line-height: 1.5;
  padding: 10px 12px; background: rgba(248,250,252,0.8);
  border-right: 2px solid var(--p-ink); border-radius: 0 8px 8px 0;
  position: relative; margin-top: auto;
}
.flash-flip-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-3); font-size: 12px; margin-bottom: 20px; font-weight: 500;
}
.flash-flip-hint svg { width: 14px; height: 14px; stroke-width: 2; }

.flash-btns { display: flex; gap: 10px; width: 100%; max-width: 300px; }
.flash-btn {
  flex: 1; padding: 13px 10px; border-radius: 14px;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
}
.flash-btn.know { background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(16,185,129,0.05));
  border: 1px solid rgba(16,185,129,0.25); color: var(--ok-text); }
.flash-btn.dont { background: rgba(254,226,226,0.4);
  border: 1px solid rgba(239,68,68,0.2); color: var(--danger-text); }
.flash-btn:active { transform: scale(0.95); }
.flash-btn svg { width: 14px; height: 14px; stroke-width: 2; }

/* ========== INTERMISSION ========== */
.inter-body { padding: 36px 20px; text-align: center; min-height: 500px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.inter-badge-wrap { position: relative; width: 108px; height: 108px; margin-bottom: 22px; }
.inter-badge-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--ok), #059669);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 20px 40px rgba(16, 185, 129, 0.3), var(--shadow-glow-ok);
}
.inter-badge-ring svg { width: 56px; height: 56px; stroke-width: 2.5; }
.inter-conf { position: absolute; width: 8px; height: 8px; border-radius: 50%;
  opacity: 0; animation: confBurst 0.9s var(--spring) forwards; }
.conf-1 { top: 0; right: -10px; background: var(--p-ink); animation-delay: 0.1s; }
.conf-2 { top: -8px; left: 8px; background: var(--c-ink); animation-delay: 0.15s; }
.conf-3 { bottom: -4px; right: 10px; background: var(--a-ink); animation-delay: 0.2s; }
.conf-4 { bottom: 8px; left: -8px; background: var(--p-ink); animation-delay: 0.25s; }
.conf-5 { top: 50%; right: -18px; background: var(--c-ink); animation-delay: 0.3s; }
.conf-6 { top: 30%; left: -16px; background: var(--pink-ink); animation-delay: 0.35s; }
@keyframes confBurst {
  0% { opacity: 0; transform: scale(0.3); }
  60% { opacity: 1; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}

.inter-title {
  font-family: var(--font-display); font-size: 28px; font-weight: 800;
  margin-bottom: 8px; letter-spacing: -0.025em; color: var(--text);
}
.inter-summary { color: var(--text-2); font-size: 15px; margin-bottom: 24px; font-weight: 500; }

.inter-stats { display: flex; gap: 10px; margin-bottom: 24px; width: 100%; max-width: 310px; }
.inter-stat {
  flex: 1; padding: 12px 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.inter-stat-n { font-family: var(--font-en); font-size: 22px; font-weight: 700;
  color: var(--p-ink); letter-spacing: -0.02em; line-height: 1; }
.inter-stat-l { font-size: 10px; color: var(--text-3); font-weight: 600; margin-top: 4px; }

.inter-next {
  padding: 16px 18px; width: 100%; max-width: 310px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 14px; text-align: right;
}
.inter-next-ic {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  box-shadow: var(--shadow-glow-p);
}
.inter-next-ic svg { width: 20px; height: 20px; stroke-width: 1.75; }
.inter-next-txt { flex: 1; }
.inter-next-label { font-family: var(--font-en); font-size: 10px; color: var(--text-3);
  font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.inter-next-name { font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--text); margin-top: 2px; letter-spacing: -0.005em; }

/* ========== MATCH GAME ========== */
.match-score { padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; }
.match-timer { display: flex; align-items: center; gap: 6px;
  font-family: var(--font-en); font-size: 12px; font-weight: 700;
  color: var(--text-2); letter-spacing: 0.05em; }
.match-timer svg { width: 14px; height: 14px; stroke-width: 2; color: var(--text-3); }
.match-hearts { display: flex; gap: 4px; }
.heart { color: var(--danger); display: inline-flex; }
.heart svg { width: 16px; height: 16px; }
.heart.empty { color: rgba(203, 213, 225, 0.8); }

.match-grid { padding: 16px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-cell {
  padding: 18px 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  text-align: center; font-weight: 600; font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.25s var(--spring);
  cursor: pointer;
}
.match-cell.en { font-family: var(--font-en); direction: ltr; }
.match-cell:active { transform: scale(0.96); }
.match-cell.selected {
  border-color: var(--p-ink);
  background: rgba(243, 232, 255, 0.5);
  box-shadow: var(--shadow-glow-p);
  transform: translateY(-2px);
}
.match-cell.matched {
  opacity: 0.4;
  background: rgba(209, 250, 229, 0.5);
  border-color: rgba(16,185,129,0.3);
  color: var(--ok-text);
  pointer-events: none;
}
.match-cell.wrong {
  background: rgba(254, 226, 226, 0.6);
  border-color: var(--danger);
  color: var(--danger-text);
  animation: shakeHz 0.4s ease-out;
}
@keyframes shakeHz {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ========== QUIZ ========== */
.quiz-hdr { padding: 20px 20px 12px; }
.quiz-progress { display: flex; gap: 4px; margin-bottom: 16px; }
.quiz-dot { flex: 1; height: 5px; background: rgba(226, 232, 240, 0.6); border-radius: 999px; }
.quiz-dot.done { background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); }
.quiz-dot.current {
  background: linear-gradient(90deg, var(--p-ink), var(--c-ink));
  opacity: 0.6; animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

.quiz-q-num { font-family: var(--font-en); font-size: 11px; color: var(--text-3);
  font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }

.quiz-question-card {
  padding: 22px 20px; margin: 16px 20px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.quiz-ctx {
  display: inline-block; padding: 3px 10px;
  background: rgba(243, 232, 255, 0.5); border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 999px;
  font-family: var(--font-en); font-size: 10px; font-weight: 700;
  color: var(--p-ink); letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 12px;
}
.quiz-question-en {
  font-family: var(--font-en); font-size: 16px; direction: ltr; text-align: left;
  line-height: 1.55; color: var(--text); font-weight: 500;
}

.quiz-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px; }
.quiz-ans {
  padding: 18px 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-weight: 700; font-size: 15px; text-align: center;
  font-family: var(--font-en);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
}
.quiz-ans:active { transform: scale(0.96); }
.quiz-ans svg { width: 16px; height: 16px; stroke-width: 2.5; }
.quiz-ans.true { color: var(--ok-text); border-color: rgba(16, 185, 129, 0.3); }
.quiz-ans.false { color: var(--danger-text); border-color: rgba(239, 68, 68, 0.3); }
.quiz-ans.true:hover { background: var(--ok-soft); }
.quiz-ans.false:hover { background: var(--danger-soft); }

.quiz-feedback {
  padding: 22px 20px; margin: 16px 20px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  position: relative;
}
.quiz-feedback.ok {
  background: linear-gradient(135deg, rgba(209, 250, 229, 0.7), rgba(167, 243, 208, 0.4));
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.quiz-feedback.bad {
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.7), rgba(254, 202, 202, 0.4));
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.quiz-feedback-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 800;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.015em;
}
.quiz-feedback-title.ok { color: var(--ok-text); }
.quiz-feedback-title.bad { color: var(--danger-text); }
.quiz-feedback-title svg { width: 20px; height: 20px; stroke-width: 2.5; }
.quiz-feedback-explain { font-size: 13px; color: var(--text); line-height: 1.6; font-weight: 500; }
.quiz-key { font-family: var(--font-en); font-weight: 700; color: var(--p-ink); }

/* ========== TYPING / TRANSLATE ========== */
.typing-stage { padding: 20px 20px; }
.typing-prompt {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  text-align: center; color: var(--text); margin-bottom: 14px;
  letter-spacing: -0.005em;
}
.typing-target {
  padding: 18px 20px; margin-bottom: 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  font-family: var(--font-display); font-size: 28px; font-weight: 700;
  color: var(--text); letter-spacing: -0.015em;
  box-shadow: var(--shadow-sm);
}
.typing-target.en { font-family: var(--font-en); direction: ltr; letter-spacing: -0.025em; }
.typing-hint {
  text-align: center; font-family: var(--font-en); font-size: 11px;
  color: var(--text-3); font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; margin-bottom: 14px;
}
.typing-input {
  width: 100%; padding: 16px 18px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 18px; color: var(--text);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.typing-input.en { font-family: var(--font-en); direction: ltr; }
.typing-input:focus { border-color: var(--p-ink); box-shadow: 0 0 0 4px var(--p-glow); }
.typing-input.correct { border-color: var(--ok); background: var(--ok-soft); }
.typing-input.wrong { border-color: var(--danger); background: var(--danger-soft); animation: shakeHz 0.4s; }

/* ========== READING ========== */
.reading-top-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: rgba(226, 232, 240, 0.5);
  z-index: 5;
}
.reading-progress-top {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--p-ink), var(--c-ink));
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
  transition: width 0.2s ease-out;
}
.reader-bar {
  position: sticky; top: 56px; z-index: 20;
  padding: 10px 16px;
  background: rgba(244, 246, 251, 0.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-light);
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
}
.reader-back-btn { display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px; font-size: 13px; color: var(--text-2); font-weight: 600; border-radius: 10px; }
.reader-back-btn:hover { background: var(--glass-strong); color: var(--text); }
.reader-back-btn svg { width: 14px; height: 14px; stroke-width: 2; }
.reader-controls { display: flex; gap: 6px; }
.reader-btn {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255,255,255,0.9); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
}
.reader-btn:active { transform: scale(0.95); }
.reader-btn svg { width: 18px; height: 18px; stroke-width: 1.75; }
.reader-btn.active {
  background: rgba(243, 232, 255, 0.6);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--p-ink);
  box-shadow: var(--shadow-glow-p);
}

.reading-title {
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  letter-spacing: -0.025em; padding: 24px 20px 6px; color: var(--text);
}
.reading-meta {
  font-family: var(--font-en); font-size: 11px; color: var(--text-3);
  padding: 0 20px; letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 20px; font-weight: 600;
}
.reading-para { padding: 14px 20px; }
.reading-para-roman, .reading-para-num {
  font-family: var(--font-en); font-size: 11px; font-weight: 700;
  color: var(--p-ink); letter-spacing: 0.15em; margin-bottom: 8px;
}
.reading-para-en {
  font-family: var(--font-en); font-size: 15px; line-height: 1.7;
  direction: ltr; text-align: left; color: var(--text);
}
.reading-para-highlight {
  background: linear-gradient(transparent 55%, rgba(196, 181, 253, 0.45) 55%);
  padding: 0 2px; border-radius: 2px;
}
.reading-para-he, .para-he {
  padding-top: 10px; font-size: 13px; color: var(--text-3); line-height: 1.6; font-weight: 500;
}

/* Text card in library list */
.text-card {
  padding: 16px 20px; margin-bottom: 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out); cursor: pointer;
}
.text-card:active { transform: scale(0.98); }
.text-card.today {
  background: linear-gradient(135deg, rgba(243, 232, 255, 0.7), rgba(207, 250, 254, 0.3));
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: var(--shadow), var(--shadow-glow-p);
}

/* ========== WRITE / AI FEEDBACK ========== */
.write-prompt {
  padding: 20px 18px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px; text-align: center;
  position: relative; overflow: hidden;
}
.write-prompt::before {
  content: ''; position: absolute;
  width: 200px; height: 200px; top: -80px; right: -60px;
  background: radial-gradient(circle, rgba(196,181,253,0.3), transparent 70%);
  filter: blur(20px);
}
.write-prompt-label { font-family: var(--font-en); font-size: 10px; color: var(--text-3);
  font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  margin-bottom: 10px; position: relative; }
.write-prompt-word {
  font-family: var(--font-en); font-size: 34px; font-weight: 700;
  direction: ltr; letter-spacing: -0.03em; line-height: 1;
  color: var(--text); margin-bottom: 6px; position: relative;
}
.write-prompt-he {
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
  color: var(--text-2); position: relative; letter-spacing: -0.005em;
}

.ai-feedback {
  padding: 18px 18px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 20px;
  box-shadow: var(--shadow), var(--shadow-glow-p);
  margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.ai-feedback::before {
  content: ''; position: absolute;
  width: 220px; height: 220px; top: -100px; left: -80px;
  background: radial-gradient(circle, rgba(207, 250, 254, 0.5), transparent 70%);
  filter: blur(30px);
}
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: relative; }
.ai-avatar {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow-glow-p);
}
.ai-avatar svg { width: 16px; height: 16px; stroke-width: 1.75; }
.ai-name { font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: -0.005em; }
.ai-score { margin-right: auto; font-family: var(--font-en); font-weight: 700;
  font-size: 22px; color: var(--p-ink); letter-spacing: -0.02em; }
.ai-praise {
  padding: 10px 12px;
  background: rgba(209, 250, 229, 0.5); border: 1px solid rgba(16,185,129,0.15);
  border-radius: 10px;
  color: var(--ok-text); font-size: 13px; margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 8px; font-weight: 500;
  position: relative;
}
.ai-praise svg { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; margin-top: 1px; }
.ai-corrected {
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.8); border: 1px solid var(--border-light);
  border-radius: 10px;
  font-family: var(--font-en); font-size: 13px; direction: ltr; text-align: left;
  color: var(--text); margin-bottom: 8px; font-weight: 500;
  position: relative;
}
.ai-tip {
  padding: 10px 12px;
  background: rgba(254, 243, 199, 0.5); border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 10px;
  color: #92400E; font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px; font-weight: 500;
  position: relative;
}
.ai-tip svg { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; margin-top: 1px; }

/* ========== DONE CELEBRATION ========== */
.done-body { padding: 36px 20px; text-align: center; min-height: 600px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.done-trophy-wrap { position: relative; width: 120px; height: 120px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center; }
.done-trophy-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(135deg, #FDBA74, #F59E0B);
  box-shadow: 0 20px 50px rgba(245, 158, 11, 0.35);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.done-trophy-ring svg { width: 60px; height: 60px; stroke-width: 2; }
.done-title {
  font-family: var(--font-display); font-size: 32px; font-weight: 800;
  margin-bottom: 8px; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 40%, var(--p-ink) 70%, var(--c-ink) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.done-sub { color: var(--text-2); font-size: 14px; margin-bottom: 24px; max-width: 280px; font-weight: 500; }
.done-xp {
  padding: 16px 18px; width: 100%; max-width: 310px;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.6), rgba(253, 230, 138, 0.3));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 18px;
  box-shadow: var(--shadow), 0 0 30px rgba(245, 158, 11, 0.15);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.done-xp-ic {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}
.done-xp-ic svg { width: 22px; height: 22px; stroke-width: 1.75; }
.done-xp-txt { flex: 1; text-align: right; }
.done-xp-label { font-family: var(--font-en); font-size: 10px; color: #92400E;
  font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.done-xp-val { font-family: var(--font-en); font-size: 22px; font-weight: 700;
  color: var(--text); margin-top: 2px; letter-spacing: -0.02em; }

.done-summary {
  padding: 16px 18px; width: 100%; max-width: 310px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border-light); border-radius: 18px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.done-summary-row { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 14px; }
.done-summary-row + .done-summary-row {
  border-top: 1px solid var(--border-light); padding-top: 10px; margin-top: 4px;
}
.done-summary-k { color: var(--text-2); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.done-summary-k svg { width: 16px; height: 16px; stroke-width: 1.75; color: var(--text-3); }
.done-summary-v { font-family: var(--font-en); font-weight: 700; color: var(--text); font-size: 14px; }
.done-summary-v.good { color: var(--ok); }

/* ========== SETTINGS ========== */
.settings-card {
  padding: 14px 16px; margin-bottom: 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.settings-profile { display: flex; gap: 12px; align-items: center; padding: 16px; }
.avatar {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 20px; font-family: var(--font-en);
  box-shadow: var(--shadow-glow-p);
}
.settings-section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 4px 10px;
}
.settings-section-ic {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--p-soft); color: var(--p-ink);
  display: flex; align-items: center; justify-content: center;
}
.settings-section-ic svg { width: 16px; height: 16px; stroke-width: 1.75; }
.settings-section-ic.warn { background: var(--danger-soft); color: var(--danger-text); }
.settings-section-ic.ok { background: var(--ok-soft); color: var(--ok-text); }
.settings-section-ic.mail { background: var(--c-soft); color: #0E7490; }
.settings-section-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.settings-section-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.settings-row + .settings-row { border-top: 1px solid var(--border-light); }
.settings-row-label { font-size: 14px; color: var(--text); font-weight: 500; }
.settings-input {
  flex: 1; max-width: 220px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-light); border-radius: 10px;
  font-size: 14px; color: var(--text);
}
.settings-row-toggle { padding-top: 10px; }
.settings-switch {
  appearance: none; -webkit-appearance: none;
  width: 48px; height: 28px; border-radius: 999px;
  background: rgba(203, 213, 225, 0.6);
  position: relative; cursor: pointer;
  transition: background 0.2s;
}
.settings-switch:checked { background: linear-gradient(135deg, var(--p-ink), var(--c-ink)); }
.settings-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: left 0.2s var(--spring);
}
.settings-switch:checked::after { left: 22px; }

/* ========== PROGRESS WIDGETS ========== */
.progress-widget {
  padding: 18px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 20px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.widget-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.widget-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.widget-sub { font-family: var(--font-en); font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.05em; }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ========== BACKWARD COMPAT (keep existing renders functional) ========== */
.journey-stage-card {
  padding: 24px 22px; text-align: center;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow);
}
.journey-stage-icon { font-size: 56px; margin-bottom: 12px; }
.journey-next-btn { width: 100%; }
.preview-card {
  padding: 22px 20px; margin-bottom: 14px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow); text-align: center;
}
.preview-pos {
  font-family: var(--font-en); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--p-ink); font-weight: 700; margin-bottom: 10px;
}
.preview-word {
  font-family: var(--font-en); font-size: 36px; font-weight: 700;
  direction: ltr; text-align: center; letter-spacing: -0.03em; line-height: 1;
  color: var(--text); margin-bottom: 6px;
}
.preview-he { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.preview-ex { font-family: var(--font-en); font-style: italic; font-size: 13px;
  color: var(--text-2); direction: ltr; text-align: center; line-height: 1.5; margin-bottom: 4px; }
.preview-ex-he { font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 14px; }

.journey-header { padding: 14px 20px 18px; background: rgba(244, 246, 251, 0.85);
  backdrop-filter: blur(24px); border-bottom: 1px solid var(--border-light); margin-bottom: 16px; }
.journey-topic-tag {
  display: inline-flex; gap: 6px; padding: 4px 10px;
  background: rgba(243, 232, 255, 0.6); border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--p-ink);
  margin-bottom: 10px;
}
.journey-progress-fill { background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); }
.grammar-feedback {
  padding: 16px 18px; border-radius: 16px; margin-top: 14px;
  background: var(--glass-strong); border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.grammar-feedback.ok { background: linear-gradient(135deg, rgba(209,250,229,0.7), rgba(167,243,208,0.4)); border-color: rgba(16,185,129,0.3); }
.grammar-feedback.bad { background: linear-gradient(135deg, rgba(254,226,226,0.7), rgba(254,202,202,0.4)); border-color: rgba(239,68,68,0.3); }

/* Dashboard mission compat */
.next-mission {
  padding: 18px 20px; margin-bottom: 14px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 18px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform 0.2s var(--ease-out);
}
.next-mission:active { transform: scale(0.98); }
.next-mission-tag { font-family: var(--font-en); font-size: 10px; color: var(--p-ink);
  font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 6px; }
.next-mission-title { font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 10px; letter-spacing: -0.005em; }
.next-mission-bar { height: 5px; background: rgba(226, 232, 240, 0.7); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.next-mission-fill { height: 100%; background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); }
.next-mission-row { display: flex; justify-content: space-between; align-items: center; }
.next-mission-count { font-size: 13px; color: var(--text-2); }
.next-mission-count strong { color: var(--text); font-size: 15px; font-family: var(--font-en); }
.next-mission-btn { display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px; background: var(--p-soft); color: var(--p-ink);
  border-radius: 10px; font-weight: 700; font-size: 13px; }

.mission-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.mission-mini.done { opacity: 0.6; }
.mini-check { width: 24px; height: 24px; border-radius: 8px; background: rgba(241,245,249,0.8);
  display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.mission-mini.done .mini-check { background: var(--ok-soft); color: var(--ok-text); }
.mini-title { flex: 1; font-size: 14px; color: var(--text); font-weight: 500; }
.mini-count { font-family: var(--font-en); font-size: 12px; color: var(--text-3); font-weight: 600; }
.mini-arrow { color: var(--text-3); }

.sect-head { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 10px; padding: 0 4px; }
.sect-head h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.sect-head .meta { font-family: var(--font-en); font-size: 11px; color: var(--text-3); font-weight: 600; }

.collapsible { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; margin-top: 16px;
  background: var(--glass-strong); border: 1px solid var(--border-light);
  border-radius: 12px; cursor: pointer; }
.collapsible-title { font-weight: 600; color: var(--text); }
.collapsible-right { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; font-family: var(--font-en); }

.stats-row, .stat { /* legacy fallbacks */ }

/* Legacy auth bg (use new auth structure but keep if still referenced) */
.aurora, .float-chip { display: none; }

/* ========== MATCH GAME (fix for games.js class names) ========== */
.match-stage { padding: 0 4px; }
.match-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.match-stat {
  padding: 14px 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 14px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.match-stat-val {
  font-family: var(--font-en); font-size: 24px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em; line-height: 1;
}
.match-stat-lbl {
  font-size: 11px; color: var(--text-3); margin-top: 4px; font-weight: 600;
}
.match-hint {
  padding: 12px 14px; margin-bottom: 14px;
  background: rgba(243, 232, 255, 0.4);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 12px;
  font-size: 13px; color: var(--text-2); line-height: 1.45;
}
.match-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 0; margin-bottom: 16px;
}
.match-tile {
  padding: 18px 10px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  text-align: center;
  font-family: var(--font-he); font-weight: 600; font-size: 15px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.25s var(--spring);
  cursor: pointer;
  min-height: 56px;
}
.match-tile.en { font-family: var(--font-en); direction: ltr; letter-spacing: -0.01em; }
.match-tile:active { transform: scale(0.96); }
.match-tile.selected {
  border-color: var(--p-ink);
  background: linear-gradient(135deg, rgba(243, 232, 255, 0.7), rgba(255,255,255,0.8));
  box-shadow: var(--shadow-glow-p);
  transform: translateY(-2px);
  color: var(--p-ink-2);
}
.match-tile.matched {
  opacity: 0.45;
  background: rgba(209, 250, 229, 0.5);
  border-color: rgba(16,185,129,0.3);
  color: var(--ok-text);
  pointer-events: none;
}
.match-tile.wrong {
  background: rgba(254, 226, 226, 0.6);
  border-color: var(--danger);
  color: var(--danger-text);
  animation: shakeHz 0.4s ease-out;
}
.match-tile .floating-text {
  position: absolute; top: -18px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-en); font-weight: 700; font-size: 14px;
  color: var(--ok);
  pointer-events: none; z-index: 10;
}

/* ========== FLASHCARD (existing games.js structure) ========== */
.flash-stage { padding: 12px 4px; display: flex; flex-direction: column; align-items: center; }
.flash-progress {
  width: 100%; max-width: 320px; height: 6px;
  background: rgba(226, 232, 240, 0.7);
  border-radius: 3px; overflow: hidden; margin-bottom: 20px;
}
.flash-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--p-ink), var(--c-ink));
  transition: width 0.4s var(--ease-out);
}
.flashcard {
  perspective: 1200px;
  width: 100%; max-width: 320px; aspect-ratio: 3/4;
  margin-bottom: 20px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--spring);
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; padding: 26px 24px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.08), var(--shadow-glow-p);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.flashcard-face::before {
  content: ''; position: absolute;
  width: 140px; height: 140px; top: -50px; right: -50px;
  background: radial-gradient(circle, rgba(196,181,253,0.4), transparent 70%);
  filter: blur(20px); border-radius: 50%;
}
.flashcard-back { transform: rotateY(180deg); }
.flashcard-back::before {
  background: radial-gradient(circle, rgba(165,243,252,0.5), transparent 70%);
}
.flash-word {
  font-family: var(--font-he); font-size: 32px; font-weight: 700;
  color: var(--text); letter-spacing: -0.015em; margin-bottom: 8px;
  position: relative;
}
.flash-word.en { font-family: var(--font-en); direction: ltr; text-align: left; font-size: 44px; letter-spacing: -0.03em; }
.flash-pos {
  display: inline-block; padding: 3px 10px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  border-radius: 999px; font-size: 10px; color: var(--text-2);
  margin-bottom: 14px; font-family: var(--font-en); font-weight: 600;
  position: relative;
}
.flash-example {
  margin-top: auto; padding: 10px 12px;
  background: rgba(248,250,252,0.8);
  border-right: 2px solid var(--p-ink); border-radius: 0 8px 8px 0;
  position: relative;
}
.flash-example-en {
  font-family: var(--font-en); font-style: italic; font-size: 13px;
  color: var(--text); direction: ltr; text-align: left; line-height: 1.5; margin-bottom: 4px;
}
.flash-example-he { font-size: 12px; color: var(--text-3); font-weight: 500; }
.flash-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-3); font-size: 12px; margin-bottom: 20px; font-weight: 500;
}
.flash-controls { display: flex; gap: 10px; width: 100%; max-width: 320px; }
.flash-controls button {
  flex: 1; padding: 13px 10px; border-radius: 14px;
  font-family: var(--font-he); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
  background: var(--glass-strong); border: 1px solid var(--border-light);
  color: var(--text);
}
.flash-controls button:active { transform: scale(0.96); }
.flash-controls .flash-know { background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.06));
  border-color: rgba(16,185,129,0.3); color: var(--ok-text); }
.flash-controls .flash-dont { background: rgba(254,226,226,0.5); border-color: rgba(239,68,68,0.25); color: var(--danger-text); }

/* ========== MULTIPLE CHOICE ========== */
.choice-stage { padding: 12px 4px; }
.choice-q {
  padding: 24px 22px; margin-bottom: 16px;
  background: var(--glass-strong); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative; overflow: hidden;
}
.choice-q::before {
  content: ''; position: absolute; width: 180px; height: 180px; top: -60px; right: -60px;
  background: radial-gradient(circle, rgba(196,181,253,0.35), transparent 70%);
  filter: blur(20px);
}
.choice-q-sub {
  font-family: var(--font-en); font-size: 10px; color: var(--p-ink); font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 8px;
  position: relative;
}
.choice-q-word {
  font-family: var(--font-he); font-size: 28px; font-weight: 700;
  color: var(--text); letter-spacing: -0.015em; line-height: 1.1;
  position: relative; margin-bottom: 8px;
}
.choice-q-word.he-dir { direction: rtl; }
.choice-q-word:not(.he-dir) { font-family: var(--font-en); direction: ltr; font-size: 36px; letter-spacing: -0.025em; }
.choice-q-pos {
  display: inline-block; padding: 3px 10px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  border-radius: 999px; font-size: 11px; color: var(--text-2); font-family: var(--font-en);
  font-weight: 600; position: relative;
}
.choice-opts { display: flex; flex-direction: column; gap: 10px; }
.choice-opt {
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  font-size: 15px; color: var(--text); font-weight: 500;
  text-align: right;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
}
.choice-opt:active { transform: scale(0.98); }
.choice-opt:hover { background: var(--glass-heavy); border-color: var(--border); }
.choice-opt.correct {
  background: linear-gradient(135deg, rgba(209,250,229,0.7), rgba(167,243,208,0.4));
  border-color: var(--ok); color: var(--ok-text);
  box-shadow: var(--shadow-glow-ok);
}
.choice-opt.wrong {
  background: linear-gradient(135deg, rgba(254,226,226,0.7), rgba(254,202,202,0.4));
  border-color: var(--danger); color: var(--danger-text);
  animation: shakeHz 0.4s;
}
.choice-opt-num {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(241,245,249,0.8); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-en); font-weight: 700; font-size: 12px;
  color: var(--text-3); flex-shrink: 0;
}
.choice-opt.correct .choice-opt-num { background: var(--ok); color: #fff; border-color: transparent; }
.choice-opt.wrong .choice-opt-num { background: var(--danger); color: #fff; border-color: transparent; }

/* ========== TYPING (works for existing games.js structure too) ========== */
.typing-stage { padding: 12px 4px; }

/* ========== TIMER ========== */
.timer {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-family: var(--font-en); font-size: 12px; font-weight: 700;
  color: var(--text-2);
}

/* ========== GRAMMAR ========== */
.grammar-topics { display: flex; flex-direction: column; gap: 10px; }
.grammar-topic {
  padding: 16px 18px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
}
.grammar-topic:active { transform: scale(0.98); }
.grammar-topic-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.grammar-topic-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 8px; }
.grammar-topic-meta { font-family: var(--font-en); font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.05em; }

.grammar-prompt {
  padding: 18px 20px; margin-bottom: 14px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); color: var(--text); font-size: 15px; line-height: 1.6;
}
.grammar-input {
  width: 100%; padding: 14px 16px;
  background: var(--glass-strong); backdrop-filter: blur(20px);
  border: 1.5px solid var(--border); border-radius: 14px;
  font-family: var(--font-he); font-size: 15px; color: var(--text);
  min-height: 80px; resize: vertical;
  box-shadow: var(--shadow-sm);
}
.grammar-input.en { font-family: var(--font-en); direction: ltr; text-align: left; }
.grammar-input:focus { border-color: var(--p-ink); box-shadow: 0 0 0 4px var(--p-glow); outline: none; }

/* ========== SPEECH ========== */
.speech-convo { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.speech-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  font-size: 14px; line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.speech-bubble-role {
  font-family: var(--font-en); font-size: 10px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 4px;
}
.speech-bubble.ai {
  background: var(--glass-strong); border: 1px solid var(--border-light);
  align-self: flex-start;
}
.speech-bubble.user {
  background: linear-gradient(135deg, var(--p-ink), var(--p-ink-2));
  color: #fff; border: none; align-self: flex-end;
}
.speech-bubble-text, .speech-question-text { color: inherit; }
.speech-question-text { font-family: var(--font-en); direction: ltr; text-align: left; }

.speech-mic-btn {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--p-ink), var(--c-ink));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.35);
  margin: 0 auto;
  transition: all 0.2s var(--ease-out);
}
.speech-mic-btn:active { transform: scale(0.95); }
.speech-mic-btn.recording { animation: pulseMic 1.2s ease-in-out infinite; }
@keyframes pulseMic {
  0%, 100% { box-shadow: 0 20px 40px rgba(124, 58, 237, 0.35); }
  50%      { box-shadow: 0 20px 40px rgba(124, 58, 237, 0.6), 0 0 0 10px rgba(124, 58, 237, 0.1); }
}
.speech-mic-btn svg { width: 32px; height: 32px; }

.speech-hint { text-align: center; color: var(--text-3); font-size: 13px; margin: 14px 0; font-weight: 500; }
.speech-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.speech-chip {
  padding: 6px 12px;
  background: rgba(243, 232, 255, 0.5); border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 999px;
  font-family: var(--font-en); font-size: 13px; color: var(--p-ink); font-weight: 600;
}
.speech-note {
  padding: 14px 16px; margin-top: 14px;
  background: rgba(254, 243, 199, 0.5); border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  color: #92400E; font-size: 13px; line-height: 1.55;
}
.speech-play {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border-light);
  color: var(--text-2); font-size: 12px; font-weight: 600;
}
.speech-feedback {
  padding: 16px 18px; margin-top: 14px;
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(6,182,212,0.04));
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 16px;
  box-shadow: var(--shadow-glow-p);
}

/* Floating text (shared) */
.floating-text {
  position: absolute; pointer-events: none;
  font-family: var(--font-en); font-weight: 700; font-size: 14px;
  z-index: 10;
  animation: floatUp 1s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* ========== HE DIR UTIL ========== */
.he-dir { direction: rtl; }

/* ============ PREMIUM LIQUID GLASS v2 (real recipe) ============ */
/* Override the old frosted-glass with proper liquid glass values */
:root {
  --lg-bg: rgba(255, 255, 255, 0.14);
  --lg-bg-heavy: rgba(255, 255, 255, 0.22);
  --lg-border: rgba(255, 255, 255, 0.28);
  --lg-border-top: rgba(255, 255, 255, 0.55);
  --lg-highlight: rgba(255, 255, 255, 0.85);
  --lg-blur: blur(20px) saturate(180%);
  --lg-blur-heavy: blur(28px) saturate(200%);
}


/* ============================================================
   v16 — Components that lost (or never had) styles in v15.
   Light palette only; reuses existing tokens. No layout/palette change.
   ============================================================ */
:root {
  /* aliases used by older inline styles but never defined */
  --success: var(--ok);
  --warn: var(--a-ink);
  --p1: var(--p-ink);
  --surface: var(--glass);
  --surface-2: var(--bg-2);
  --read-scale: 1;
}

/* ---------- Bottom sheet (topic picker) ---------- */
#sheet-backdrop {
  position: fixed; inset: 0; z-index: 180;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
#sheet-backdrop.open { opacity: 1; pointer-events: auto; }
#sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 181;
  max-width: 640px; margin: 0 auto;
  max-height: 82vh; max-height: 82dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass-heavy);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.12);
  padding-bottom: calc(var(--sab) + 12px);
  transform: translateY(100%);
  visibility: hidden;
  /* close: shorter than open (exit is softer); Vaul/iOS sheet curve */
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.32s;
}
#sheet.open { transform: translateY(0); visibility: visible; transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s; }
#sheet-backdrop.open { transition-duration: 0.5s; }
.sheet-grabber, .sheet-head { touch-action: none; }
.sheet-item:focus-visible, .sheet-reset:focus-visible, #sheet .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--p-glow-strong); }
.sheet-grabber { width: 36px; height: 5px; border-radius: 999px; background: var(--border-strong); margin: 8px auto 4px; flex-shrink: 0; }
.sheet-head { padding: 10px 22px 14px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; text-wrap: balance; }
.sheet-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; font-weight: 500; text-wrap: pretty; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 14px 8px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 12px 14px; margin-bottom: 8px; border-radius: 16px;
  background: var(--glass-strong); border: 1px solid var(--border-light);
  cursor: pointer; transition: transform 0.15s var(--ease-out), background 0.2s, border-color 0.2s;
}
.sheet-item:active { transform: scale(0.98); }
.sheet-item.active { background: var(--p-soft); border-color: rgba(124, 58, 237, 0.35); }
.sheet-item-ic {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  box-shadow: 0 6px 16px var(--p-glow-strong);
}
.sheet-item-ic svg { width: 22px; height: 22px; stroke-width: 1.75; }
.sheet-item-txt { flex: 1; min-width: 0; }
.sheet-item-name { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); }
.sheet-item-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* contextual icon cross-fade (ui-motion): scale .25->1, opacity, blur 4px->0, 300ms, no overshoot */
.sheet-item-check { color: var(--p-ink); display: flex; opacity: 0; transform: scale(0.25); filter: blur(4px);
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1), transform 0.3s cubic-bezier(0.2, 0, 0, 1), filter 0.3s cubic-bezier(0.2, 0, 0, 1); }
.sheet-item.active .sheet-item-check { opacity: 1; transform: scale(1); filter: blur(0); }
.sheet-foot { padding: 12px 18px 0; border-top: 1px solid var(--border-light); display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-shrink: 0; }
.sheet-reset { min-height: 44px; padding: 10px 12px; border-radius: 10px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.sheet-reset svg { width: 15px; height: 15px; stroke-width: 1.75; }
.sheet-reset:hover { color: var(--p-ink); }
body.sheet-lock { overflow: hidden; }

@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.enter-up { animation: slideUp 0.45s var(--ease-out) backwards; }

/* ---------- Word tour (סיור מילים) ---------- */
.review-progress {
  position: sticky; top: calc(var(--sat) + 64px); z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--glass-heavy); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.review-progress-bar { flex: 1; height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.review-progress-fill { height: 100%; width: 1%; background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); border-radius: 999px; transition: width 0.5s var(--ease-out); }
.review-progress-count { font-family: var(--font-en); font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 56px; text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }

.rv-card {
  position: relative; overflow: hidden;
  padding: 20px; margin-bottom: 14px;
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light); border-radius: 22px; box-shadow: var(--shadow);
}
.rv-eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.rv-eyebrow-cat { color: var(--p-ink); }
.rv-eyebrow-dot { color: var(--text-3); font-weight: 400; }
.rv-word-en { display: block; font-family: var(--font-en); font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); direction: ltr; text-align: left; margin-bottom: 6px; overflow-wrap: anywhere; }
.rv-word-he { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--p-ink-2); line-height: 1.3; margin-bottom: 16px; }
.rv-example { padding: 12px 14px; background: var(--p-soft-2); border-radius: 12px; }
.rv-example-en { font-family: var(--font-en); font-style: italic; font-size: 15px; direction: ltr; text-align: left; color: var(--text); font-weight: 500; line-height: 1.55; margin-bottom: 6px; text-wrap: pretty; }
.rv-example-he { font-size: 13.5px; color: var(--text-2); line-height: 1.55; font-weight: 500; text-wrap: pretty; }
.rv-forms-title { margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--border-light); font-size: 12px; font-weight: 700; color: var(--text-3); }
.rv-forms-wrap { display: flex; flex-direction: column; gap: 8px; }
.rv-form { padding: 12px 14px; background: var(--glass-heavy); border: 1px solid var(--border-light); border-radius: 14px; }
.rv-form-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.rv-form-en { font-family: var(--font-en); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); direction: ltr; overflow-wrap: anywhere; }
.rv-form-pos { padding: 3px 10px; background: var(--p-soft); border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--p-ink-2); flex-shrink: 0; white-space: nowrap; }
.rv-form-he { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.rv-form-example { padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.rv-form-ex-en { font-family: var(--font-en); font-style: italic; font-size: 13.5px; color: var(--text); direction: ltr; text-align: left; line-height: 1.5; margin-bottom: 3px; text-wrap: pretty; }
.rv-form-ex-he { font-size: 12.5px; color: var(--text-2); line-height: 1.5; text-wrap: pretty; }

/* ---------- Library word cards ---------- */
.word-card.en-top-layout { padding: 14px 16px; cursor: pointer; }
.wc2-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.wc2-word-en { font-family: var(--font-en); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; direction: ltr; color: var(--text); overflow-wrap: anywhere; }
.wc2-badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; flex-shrink: 0; white-space: nowrap; }
.wc2-badge.new  { background: var(--p-soft); color: var(--p-ink-2); }
.wc2-badge.mast { background: var(--ok-soft); color: var(--ok-text); }
.wc2-badge.due  { background: var(--a-soft); color: #B45309; }
.wc2-badge.hard { background: var(--danger-soft); color: var(--danger-text); }
.wc2-he { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.wc2-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.wc2-chev { margin-inline-start: auto; display: inline-flex; transition: transform 0.25s var(--ease-out); }
.wc2-chev svg { width: 16px; height: 16px; stroke-width: 1.75; }
.word-card.open .wc2-chev { transform: rotate(180deg); }
.wc2-forms { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 8px; }
.wc2-forms[hidden] { display: none; }

/* ---------- Add words ---------- */
.add-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--bg-2); border-radius: 14px; }
.add-tabs button { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 11px; font-size: 14px; font-weight: 600; color: var(--text-2); background: transparent; transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.add-tabs button svg { width: 16px; height: 16px; stroke-width: 1.75; }
.add-tabs button.active { background: var(--glass-heavy); color: var(--text); box-shadow: var(--shadow-sm); }
.form-add { display: flex; flex-direction: column; gap: 14px; }
.form-card { padding: 16px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.form-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea, .write-input {
  width: 100%; min-height: 46px; padding: 11px 14px;
  background: var(--glass-heavy); border: 1.5px solid var(--border); border-radius: 12px;
  font-family: var(--font-he); font-size: 16px; color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input[dir="ltr"] { font-family: var(--font-en); text-align: left; }
.field input:focus, .field select:focus, .field textarea:focus, .write-input:focus { outline: none; border-color: var(--p-ink); box-shadow: 0 0 0 4px var(--p-glow); }
.field input::placeholder, .write-input::placeholder { color: var(--text-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .field-row { grid-template-columns: 1fr; } }
.row-forms { padding: 14px; background: var(--glass-heavy); border: 1px solid var(--border-light); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-actions .btn-primary { flex: 1; }
.btn-xl { min-height: 52px; padding: 14px 22px; font-size: 16px; border-radius: 14px; }
.btn-outline { background: var(--glass-heavy); border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--p-ink); color: var(--p-ink); }
.btn-icon-only { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; }

/* Scan from camera */
.scan-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 28px 20px; border: 2px dashed var(--border-strong); border-radius: 18px; background: var(--glass-strong); color: var(--text-2); }
.scan-drop .scan-ic { width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, #7C3AED, #06B6D4); box-shadow: 0 8px 20px var(--p-glow-strong); }
.scan-drop .scan-ic svg { width: 26px; height: 26px; stroke-width: 1.75; }
.scan-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 14px; background: var(--bg-2); }
.scan-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 14px; cursor: pointer; }
.scan-item input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--p-ink); flex-shrink: 0; }
.scan-item-en { font-family: var(--font-en); font-weight: 700; font-size: 16px; direction: ltr; text-align: left; color: var(--text); }
.scan-item-he { font-size: 14px; color: var(--text-2); font-weight: 600; }
.scan-item-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.scan-item.dup { opacity: 0.55; }

/* ---------- Write sentence ---------- */
.write-wrap { display: flex; flex-direction: column; gap: 12px; }
.write-word-card { padding: 20px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 20px; box-shadow: var(--shadow-sm); }
.write-word-card .en { display: block; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); text-align: left; line-height: 1.15; }
.write-word-card .he { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--p-ink-2); margin-top: 4px; }
.write-word-card .write-ex { margin-top: 14px; padding: 10px 12px; background: var(--p-soft-2); border-radius: 12px; font-family: var(--font-en); font-style: italic; font-size: 14px; color: var(--text); direction: ltr; text-align: left; line-height: 1.5; }
textarea.write-input { min-height: 120px; resize: vertical; font-family: var(--font-en); direction: ltr; text-align: left; line-height: 1.55; }
select.write-input { font-family: var(--font-he); direction: rtl; }
.write-actions { display: flex; gap: 10px; }
.write-actions .btn { flex: 1; min-height: 48px; }
.sentence-list-title { margin: 20px 0 10px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.sentence-row { padding: 12px 14px; margin-bottom: 8px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 14px; }
.sentence-row-en { font-size: 15px; color: var(--text); line-height: 1.5; text-align: left; }
.sentence-row-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- Missions (progress page) ---------- */
.mission { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 14px; cursor: pointer; min-height: 56px; }
.mission-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.mission.done .mission-check { background: var(--ok); border-color: var(--ok); }
.mission-check svg { width: 16px; height: 16px; stroke-width: 2; }
.mission-body { flex: 1; min-width: 0; }
.mission-title { font-weight: 700; font-size: 14px; color: var(--text); }
.mission-sub { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mission-arrow { color: var(--text-3); display: flex; }
.mission-arrow svg { width: 16px; height: 16px; }
.mission-bar { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.mission-bar-fill { height: 100%; background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); border-radius: 999px; }
.stat-val { font-family: var(--font-en); font-weight: 800; font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 12px; color: var(--text-3); font-weight: 600; }
.gauge-wrap { display: flex; justify-content: center; }
.gauge-sub { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- Settings controls ---------- */
.settings-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.settings-section-icon { width: 28px; height: 28px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--p-soft); color: var(--p-ink); flex-shrink: 0; }
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: background 0.25s var(--ease-out); }
.switch-slider::before { content: ''; position: absolute; width: 24px; height: 24px; top: 3px; right: 3px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(15,23,42,0.2); transition: transform 0.3s var(--ease-out); }
.switch input:checked + .switch-slider { background: var(--p-ink); }
.switch input:checked + .switch-slider::before { transform: translateX(-20px); }
.switch input:focus-visible + .switch-slider { box-shadow: 0 0 0 4px var(--p-glow); }
.theme-opt { flex: 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-radius: 14px; background: var(--glass-heavy); border: 1.5px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text-2); }
.theme-opt.active { border-color: var(--p-ink); color: var(--p-ink); background: var(--p-soft); }
.theme-opt-icon { display: flex; }

/* ---------- Speech practice ---------- */
.speech-question { padding: 18px; background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 18px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.speech-transcript { min-height: 80px; padding: 14px; background: var(--glass-heavy); border: 1.5px dashed var(--border); border-radius: 14px; font-family: var(--font-en); direction: ltr; text-align: left; color: var(--text); line-height: 1.55; }
.speech-rating { display: inline-flex; flex-direction: column; align-items: center; padding: 10px 16px; background: var(--p-soft); border-radius: 14px; }
.speech-rating-val { font-family: var(--font-en); font-weight: 800; font-size: 22px; color: var(--p-ink-2); font-variant-numeric: tabular-nums; }
.speech-rating-lbl { font-size: 11px; color: var(--text-2); font-weight: 600; }
.listening { box-shadow: 0 0 0 6px var(--p-glow); }

/* ---------- Misc ---------- */
.auth-err { color: var(--danger-text); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; }
.quiz-next-btn { width: 100%; min-height: 52px; margin-top: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--p-ink), #4F46E5); color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.timer.warn { color: var(--a-ink); }
.timer.critical, .critical { color: var(--danger); }
.confetti-piece { position: fixed; top: -10px; width: 8px; height: 14px; border-radius: 2px; pointer-events: none; z-index: 400; }

/* ---------- Reading: adjustable text size ---------- */
.reading-para-en { font-size: calc(15px * var(--read-scale)); line-height: 1.7; overflow-wrap: break-word; }
.reading-para-he, .para-he { font-size: calc(13px * var(--read-scale)); }
.reading-toolbar { position: sticky; top: calc(var(--sat) + 64px); z-index: 5; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 16px; background: var(--glass-heavy); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--border-light); border-radius: 16px; box-shadow: var(--shadow-sm); }
.font-stepper { display: inline-flex; align-items: center; background: var(--bg-2); border-radius: 12px; padding: 2px; }
.font-stepper button { min-width: 44px; min-height: 40px; border-radius: 10px; font-family: var(--font-en); font-weight: 700; color: var(--text); background: transparent; }
.font-stepper button:disabled { color: var(--text-3); }
.font-stepper button:not(:disabled):active { background: var(--glass-heavy); }
.font-stepper .fs-small { font-size: 13px; }
.font-stepper .fs-big { font-size: 18px; }
#main > div > .reading-toolbar, #main.journey-active > .btn { margin-left: 12px; margin-right: 12px; }

/* ---------- Journey resume prompt ---------- */
.resume-card { padding: 18px; margin-bottom: 16px; background: var(--p-soft); border: 1px solid rgba(124,58,237,0.25); border-radius: 18px; }
.resume-card-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); margin-bottom: 4px; }
.resume-card-sub { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.resume-card .form-actions .btn { flex: 1; min-height: 46px; }

@media (prefers-reduced-motion: reduce) {
  #sheet, #sheet-backdrop, .review-progress-fill, .switch-slider, .switch-slider::before, .wc2-chev { transition-duration: 0.01ms !important; }
  .enter-up { animation: none; }
}

/* Daily mission: start-over link in the sticky header */
.journey-restart { display: block; margin: 6px auto 0; min-height: 32px; padding: 4px 10px; border-radius: 8px; background: transparent; color: var(--text-3); font-size: 12px; font-weight: 600; align-self: center; }
.journey-restart:hover { color: var(--p-ink); }

/* ---- C3: press feedback for tappable surfaces (scale .96-.985, 160ms, no overshoot) ---- */
.sheet-item, .word-card, .pill, .add-tabs button, .tb-btn, .text-card, .scan-item, .mission, .theme-opt, .font-stepper button {
  transition-property: transform, background-color, border-color, box-shadow, color, opacity;
  transition-duration: 0.16s; transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.pill:active, .add-tabs button:active, .tb-btn:active, .theme-opt:active, .font-stepper button:not(:disabled):active { transform: scale(0.96); }
.word-card:active, .text-card:active, .scan-item:active, .mission:active { transform: scale(0.985); }
/* search field: Lucide "search" icon instead of the emoji in the placeholder */
.library-filter { position: relative; }
.library-filter::before { content: ''; position: absolute; z-index: 1; right: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none;
  background: var(--text-3); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat; }
.library-search { padding-right: 42px; }
.library-search::-webkit-search-cancel-button { -webkit-appearance: none; }
@media (prefers-reduced-motion: reduce) {
  .sheet-item-check { transition: none; }
  .pill:active, .add-tabs button:active, .tb-btn:active, .theme-opt:active, .word-card:active, .text-card:active, .scan-item:active, .mission:active { transform: none; }
}

/* ---- C4: numbers — fixed-width digits so counters never jump; streak bump on increase ---- */
#streak-count, .ministat-n, .stat-val, .match-stat-val, .mini-count, .cat-header-count, .review-progress-count,
.sheet-item-meta, .wp-count-chip, .journey-step-label, .inter-stat, .done-xp, .gauge-wrap text { font-variant-numeric: tabular-nums; }
@keyframes streakBump { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
.streak-chip.bump { animation: streakBump 0.45s cubic-bezier(0.2, 0, 0, 1); }
.streak-chip.bump #flame-ic { animation: streakBump 0.45s cubic-bezier(0.2, 0, 0, 1) 0.08s; display: inline-flex; }
@media (prefers-reduced-motion: reduce) { .streak-chip.bump, .streak-chip.bump #flame-ic { animation: none; } }

/* ---- C5: typography polish (ui-typography) — no font/size/color changes ---- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* short headings: even line lengths, no lone word on the last line */
h1, h2, h3, .greeting, .topic-name, .reading-title, .journey-intro-title, .sheet-title, .mega-cta-title,
.resume-card-title, .form-card-title, .inter-title, .empty-state h3 { text-wrap: balance; }
/* short-to-medium body text: avoid a dangling last word */
p, li, .topic-meta, .greeting-sub, .m1-greet-sub, .journey-intro-desc, .mega-cta-sub, .wc2-he, .rv-word-he,
.reading-meta, .resume-card-sub, .settings-row-sub, .sheet-sub, .text-card div { text-wrap: pretty; }
/* long reading paragraphs stay default (balance/pretty cost on 10+ lines) */
.reading-para-en, .reading-para-he { text-wrap: wrap; }

/* ===== Offline status bar ===== */
#offline-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 94px);
  z-index: 900; max-width: calc(100% - 32px);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--glass-heavy); color: var(--text-2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font-size: 12px; font-weight: 600; text-align: center;
  pointer-events: none;
}
#offline-bar[hidden] { display: none; }

/* =========================================================================
   Exam Focus (מיקוד מבחן) — v23
   One hero + one primary action; numbers tabular; 4px spacing rhythm;
   violet→cyan gradient reserved for mastery (ring, fills) only.
   ========================================================================= */
.xf { max-width: 640px; margin: 0 auto; }
.xf .en { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }
.xf-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--p-ink); text-transform: uppercase; }
.xf-hero {
  position: relative; padding: 20px; border-radius: 24px;
  background: linear-gradient(var(--glass-heavy), var(--glass-heavy)) padding-box,
              linear-gradient(135deg, rgba(124,58,237,.45), rgba(6,182,212,.35)) border-box;
  border: 1.5px solid transparent; box-shadow: 0 20px 50px rgba(124,58,237,.10);
}
.xf-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.xf-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin-top: 4px; text-align: right; }
.xf-count { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--p-soft); color: var(--p-ink-2); white-space: nowrap; }
.xf-count.hot { background: var(--a-soft); color: #B45309; }
.xf-count svg { width: 14px; height: 14px; }
.xf-hero-mid { display: flex; align-items: center; gap: 20px; margin: 20px 0 16px; }
.xf-ring { position: relative; flex-shrink: 0; }
.xf-ring-arc { transition: stroke-dashoffset 1.1s var(--ease-out); }
.xf-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.xf-ring-label b { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.xf-ring-label span { font-size: 11px; color: var(--text-3); font-weight: 600; }
.xf-big b { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.xf-big span { font-size: 16px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.xf-sub { font-size: 14px; color: var(--text-2); font-weight: 600; }
.xf-sub2 { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.xf-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--bg-2); }
.xf-seg { min-width: 4px; transition: flex-grow .6s var(--ease-out); }
.xf-seg.m { background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); }
.xf-seg.l { background: var(--a-ink); opacity: .75; }
.xf-seg.n { background: var(--border-strong); }
.xf-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.xf-legend span { display: inline-flex; align-items: center; gap: 4px; }
.xf-legend b { font-variant-numeric: tabular-nums; color: var(--text); }
.xf-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.xf-legend i.m { background: var(--p-ink); } .xf-legend i.l { background: var(--a-ink); } .xf-legend i.n { background: var(--text-3); }
.xf-hero-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.xf-cta { width: 100%; justify-content: center; min-height: 52px; }
.xf-weak { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 14px; font-size: 14px; font-weight: 600;
  color: var(--danger-text); background: var(--danger-soft); border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.xf-weak b { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.xf-weak svg { width: 16px; height: 16px; }
.xf-weak.empty { color: var(--ok-text); background: var(--ok-soft); cursor: default; }
.xf-section { margin-top: 28px; }
.xf-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.xf-h h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.xf-h span { font-size: 12px; color: var(--text-3); }
.xf-card { background: var(--glass-strong); border: 1px solid var(--border-light); border-radius: 18px; padding: 16px; box-shadow: var(--shadow-sm); }
.xf-paras { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; direction: ltr; }
.xf-para { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; padding: 4px 0; min-height: 44px; font-family: inherit; }
.xf-para-track { width: 22px; height: 64px; border-radius: 8px; background: var(--bg-2); display: flex; align-items: flex-end; overflow: hidden; }
.xf-para-fill { width: 100%; border-radius: 8px; background: linear-gradient(0deg, var(--p-ink), var(--c-ink)); transition: height .8s var(--ease-out); }
.xf-para-lbl { font-size: 13px; font-weight: 700; color: var(--text); }
.xf-para-n { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.xf-segctl { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-2); margin-bottom: 12px; overflow-x: auto; }
.xf-segbtn { flex: 1; white-space: nowrap; min-height: 36px; padding: 6px 10px; border-radius: 10px; border: 0; background: transparent; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background-color .15s, color .15s; }
.xf-segbtn small { margin-inline-start: 4px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.xf-segbtn.on { background: #fff; color: var(--p-ink-2); box-shadow: var(--shadow-xs); }
.xf-segbtn:focus-visible, .xf-tile:focus-visible, .xf-opt:focus-visible, .xf-text:focus-visible { outline: 2px solid var(--p-ink); outline-offset: 2px; }
.xf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.xf-tile { position: relative; text-align: right; padding: 16px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm); cursor: pointer; font-family: inherit; min-height: 104px; transition: box-shadow .15s, border-color .15s; }
.xf-tile:hover { box-shadow: var(--shadow); border-color: var(--border); }
.xf-tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; }
.xf-tile-icon svg { width: 20px; height: 20px; }
.t-p { background: var(--p-soft); color: var(--p-ink); } .t-c { background: var(--c-soft); color: #0E7490; }
.t-a { background: var(--a-soft); color: #B45309; } .t-pink { background: var(--pink-soft); color: var(--pink-ink); } .t-ok { background: var(--ok-soft); color: var(--ok-text); }
.xf-tile-label { font-size: 15px; font-weight: 700; color: var(--text); }
.xf-tile-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.xf-tag { position: absolute; top: 12px; left: 12px; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--a-soft); color: #B45309; }
.xf-texts { display: flex; flex-direction: column; gap: 8px; }
.xf-subh { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; margin: 12px 4px 4px; }
.xf-text { display: flex; align-items: center; gap: 12px; text-align: right; padding: 12px 16px; border-radius: 16px; background: var(--glass-strong);
  border: 1px solid var(--border-light); cursor: pointer; font-family: inherit; min-height: 64px; transition: box-shadow .15s; }
.xf-text:hover { box-shadow: var(--shadow-sm); }
.xf-text-num { width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--p-soft); color: var(--p-ink-2); }
.xf-text-num.done { background: var(--ok-soft); color: var(--ok-text); }
.xf-text-num svg { width: 16px; height: 16px; }
.xf-text-body { flex: 1; min-width: 0; }
.xf-text-title { font-size: 15px; font-weight: 700; color: var(--text); text-align: right; }
.xf-text-intro { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.xf-text-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.xf-text-go { color: var(--text-3); } .xf-text-go svg { width: 18px; height: 18px; }
/* dashboard banner */
.xf-banner { width: 100%; display: flex; align-items: center; gap: 12px; text-align: right; padding: 14px 16px; margin: 12px 0 4px; border-radius: 20px; cursor: pointer; font-family: inherit;
  background: linear-gradient(var(--glass-heavy), var(--glass-heavy)) padding-box, linear-gradient(135deg, rgba(124,58,237,.5), rgba(6,182,212,.4)) border-box;
  border: 1.5px solid transparent; box-shadow: 0 10px 30px rgba(124,58,237,.10); }
.xf-banner-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--p-soft); color: var(--p-ink); flex-shrink: 0; }
.xf-banner-icon svg { width: 22px; height: 22px; }
.xf-banner-body { flex: 1; min-width: 0; }
.xf-banner-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.xf-mini-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.xf-mini-bar div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--p-ink), var(--c-ink)); }
.xf-banner-go { color: var(--text-3); }
/* play shell */
.xf-playbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 12px; }
.xf-back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px; border-radius: 12px; border: 0; background: var(--glass-strong);
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.xf-back svg { width: 16px; height: 16px; }
.xf-playtitle { text-align: center; font-weight: 700; font-size: 14px; color: var(--text); }
.xf-playn { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.xf-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
.xf-step { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); }
.xf-step span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); transition: background-color .2s, color .2s; }
.xf-step span svg { width: 12px; height: 12px; }
.xf-step em { font-style: normal; white-space: nowrap; }
.xf-step.on span { background: var(--p-ink); color: #fff; box-shadow: 0 0 0 4px var(--p-glow); }
.xf-step.on { color: var(--p-ink-2); font-weight: 700; }
.xf-step.done span { background: var(--ok-soft); color: var(--ok-text); }
/* cloze + quiz */
.xf-cloze-card { padding: 20px; border-radius: 20px; background: var(--glass-heavy); border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); margin: 12px 0; }
.xf-cloze-top { display: flex; justify-content: space-between; margin-bottom: 12px; }
.xf-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--p-soft); color: var(--p-ink-2); }
.xf-chip.soft { background: var(--bg-2); color: var(--text-2); font-variant-numeric: tabular-nums; }
.xf-chip.exam { background: var(--a-soft); color: #B45309; }
.xf-cloze-en { font-size: 18px; line-height: 1.7; color: var(--text); text-align: left; }
.xf-gap { display: inline-block; min-width: 72px; border-bottom: 2px dashed var(--p-ink); color: var(--p-ink-2); font-weight: 700; transition: color .15s; }
.xf-gap.ok { border-bottom-style: solid; border-color: var(--ok); color: var(--ok-text); }
.xf-gap.bad { border-bottom-style: solid; border-color: var(--danger); color: var(--danger-text); }
.xf-cloze-he { font-size: 14px; color: var(--text-2); margin-top: 10px; line-height: 1.6; }
.xf-hint { margin-top: 10px; background: none; border: 0; color: var(--p-ink); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; min-height: 36px; }
.xf-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xf-tf { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xf-opt { min-height: 52px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--glass-heavy); font-size: 15px; font-weight: 600;
  color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background-color .15s, border-color .15s, color .15s; }
.xf-opt svg { width: 18px; height: 18px; }
.xf-opt.t { color: var(--ok-text); } .xf-opt.f { color: var(--danger-text); }
.xf-opt.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-text); }
.xf-opt.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-text); animation: shakeHz .3s; }
.xf-opt:disabled { cursor: default; }
.xf-opt:disabled:not(.ok):not(.bad) { opacity: .5; }
.xf-feedback { margin-top: 12px; padding: 14px 16px; border-radius: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; }
.xf-feedback.ok { background: var(--ok-soft); color: var(--ok-text); }
.xf-feedback.bad { background: var(--danger-soft); color: var(--danger-text); }
.xf-feedback .btn { align-self: stretch; justify-content: center; }
.xf-q { font-size: 17px; line-height: 1.6; color: var(--text); text-align: left; }
.xf-qhe { font-size: 13px; color: var(--text-2); margin: 6px 0 10px; }
.xf-qdone { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 20px; }
.xf-qdone b { font-family: var(--font-display); font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.xf-qdone span { color: var(--text-2); }
.xf-open { padding: 16px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--border-light); margin-bottom: 12px; }
.xf-open .xf-q { margin-top: 8px; font-size: 16px; }
.xf-ta { width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid var(--border); padding: 10px 12px; font-size: 15px; background: #fff; margin-bottom: 8px; resize: vertical; }
.xf-ans { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--p-soft); line-height: 1.6; }
.xf-ans p.en { text-align: left; color: var(--text); font-size: 15px; }
.xf-ans-he { margin-top: 6px; color: var(--text-2); font-size: 14px; }
/* reader */
.xf-reader { position: relative; }
.xf-rtitle { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; text-align: left; margin-top: 4px; }
.xf-rintro { font-size: 13px; color: var(--text-2); margin: 6px 0 16px; }
.xf-rpara { padding: 16px; border-radius: 18px; background: var(--glass-heavy); border: 1px solid var(--border-light); margin-bottom: 12px; }
.xf-roman { font-size: 12px; font-weight: 700; color: var(--p-ink); margin-bottom: 6px; }
.xf-para-en { font-size: 18px; line-height: 1.8; color: var(--text); text-align: left; }
.xf-para-he { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 15px; line-height: 1.7; color: var(--text-2); }
.xf-w { cursor: pointer; border-radius: 4px; transition: background-color .12s; }
.xf-w:hover { background: var(--p-soft); }
.xf-w.star { background: linear-gradient(transparent 62%, rgba(245,158,11,.30) 62%); font-weight: 600; }
.xf-tip { position: absolute; z-index: 20; width: 220px; padding: 10px 12px; border-radius: 14px; background: var(--text); color: #fff; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; font-size: 14px; }
.xf-tip[hidden] { display: none; }
.xf-tip b { font-family: var(--font-en); }
.xf-tip span { flex: 1; color: rgba(255,255,255,.85); }
.xf-tip-say { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.xf-rtools { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; padding: 8px; border-radius: 18px; background: var(--glass-heavy);
  backdrop-filter: blur(12px); box-shadow: var(--shadow-lg); margin-top: 12px; }
.xf-rtools .btn { flex: 1; justify-content: center; padding-inline: 8px; }
/* result */
.xf-result { text-align: center; padding-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.xf-result h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.xf-result p { color: var(--text-2); font-size: 14px; }
.xf-result > div:not(.xf-ring) { width: 100%; }
.xf-result-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 16px; }
.xf-result-actions .btn { justify-content: center; }
/* browse */
.xf-search { width: 100%; box-sizing: border-box; min-height: 44px; border-radius: 14px; border: 1px solid var(--border); padding: 10px 14px; font-size: 15px; font-family: inherit; background: #fff; margin-bottom: 12px; }
.xf-list { display: flex; flex-direction: column; gap: 4px; }
.xf-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 0; background: var(--glass-strong); cursor: pointer; font-family: inherit; text-align: right; }
.xf-item.open { background: #fff; box-shadow: var(--shadow-xs); }
.xf-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.xf-dot.m { background: var(--p-ink); } .xf-dot.l { background: var(--a-ink); }
.xf-item-en { font-weight: 700; color: var(--text); font-size: 15px; }
.xf-star { color: var(--a-ink); margin-inline-start: 4px; font-size: 12px; }
.xf-item-he { flex: 1; color: var(--text-2); font-size: 14px; text-align: left; }
.xf-say { color: var(--text-3); display: grid; place-items: center; width: 32px; height: 32px; }
.xf-say svg { width: 16px; height: 16px; }
.xf-item-det { padding: 8px 12px 12px; }
.xf-form { padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.xf-form:last-child { border-bottom: 0; }
.xf-ex { margin-top: 4px; color: var(--text); text-align: left; line-height: 1.6; }
.xf-exhe { color: var(--text-2); font-size: 13px; margin-top: 2px; }
/* loading skeleton */
.xf-skel { background: linear-gradient(90deg, var(--bg-2) 0%, #fff 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: xfShimmer 1.2s linear infinite; }
@keyframes xfShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .xf-skel { animation: none; } .xf-ring-arc, .xf-para-fill, .xf-seg { transition: none; } }
@media (max-width: 380px) { .xf-hero-mid { gap: 14px; } .xf-big b { font-size: 28px; } .xf-opts { grid-template-columns: 1fr; } }
