/* =========================================================================
   ExamPro IQ · اختباري
   Premium Arabic RTL mobile-first exam preparation app
   ========================================================================= */

/* -------- 1. Design tokens ----------------------------------------------- */
:root {
  /* Brand palette - deep blue */
  --primary:        #1D4ED8;
  --primary-dark:   #1E3A8A;
  --primary-light:  #3B82F6;
  --primary-50:     #EFF6FF;
  --primary-100:    #DBEAFE;
  --primary-200:    #BFDBFE;

  /* Surfaces */
  --background:     #F5F8FF;
  --surface:        #FFFFFF;
  --surface-2:      #EFF4FF;
  --surface-3:      #E2EBFD;

  /* Text */
  --text:           #0F172A;
  --text-2:         #1E293B;
  --muted:          #64748B;
  --muted-2:        #94A3B8;
  --border:         #E4ECFC;
  --border-strong:  #CBD5E1;

  /* Semantic */
  --success:        #059669;
  --success-bg:     #ECFDF5;
  --success-border: #A7F3D0;
  --danger:         #DC2626;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FECACA;
  --warning:        #D97706;
  --warning-bg:     #FFFBEB;
  --warning-border: #FDE68A;
  --gold:           #B45309;
  --gold-bg:        #FEF3C7;

  /* Radii */
  --radius-sm:      10px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      26px;
  --radius-2xl:     32px;
  --radius-full:    9999px;

  /* Shadows (blue-tinted, premium) */
  --shadow-soft:    0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(30, 64, 175, .06);
  --shadow-md:      0 4px 6px rgba(15, 23, 42, .04), 0 12px 28px rgba(30, 64, 175, .10);
  --shadow-lg:      0 8px 16px rgba(15, 23, 42, .06), 0 24px 48px rgba(30, 64, 175, .14);
  --shadow-press:   0 1px 2px rgba(30, 64, 175, .08), inset 0 1px 0 rgba(255,255,255,.6);

  /* Typography */
  --font-display:   'Noto Naskh Arabic', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-body:      'Noto Sans Arabic', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-num:       'Inter', system-ui, sans-serif;

  /* Layout */
  --safe-top:       env(safe-area-inset-top, 0px);
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --nav-height:     76px;
  --header-height:  60px;
  --container-pad:  20px;
  --max-width:      480px;

  /* Motion */
  --ease:           cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:        cubic-bezier(0.4, 0, 1, 1);
  --transition:     180ms var(--ease);
  --transition-md:  240ms var(--ease);
  --transition-lg:  340ms var(--ease);
}

/* -------- 1b. Inline icon defaults --------------------------------------- */
/* Bare SVGs (no explicit width/height) inside text contexts must be sized,
   otherwise they expand to fill the container. */
.category-sub svg,
.recommend-text svg,
.profile-status svg,
.material-action svg,
.material-title svg,
.section-title .link svg,
.daily-banner-cta svg,
.list-row-title svg,
.list-row-sub svg,
.benefit-text svg,
.option-text svg,
.toast svg,
.btn svg,
.start-cat svg,
.start-desc svg,
.welcome-eyebrow svg,
.welcome-name svg,
.empty-sub svg,
.modal-title svg,
.modal-sub svg,
.field-label svg,
.field-helper svg,
.welcome-name-line svg {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}

.btn svg { width: 18px; height: 18px; }
.badge svg { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; }
.modal-title svg { width: 18px; height: 18px; vertical-align: -3px; }

/* Catch-all: any inline svg that didn't get sized still gets a sane default */
svg:not([width]) { max-width: 100%; }

/* -------- 2. Reset & base ------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--background);
  margin: 0;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 80% -10%, #DBEAFE 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 20%, #EFF6FF 0%, transparent 60%),
    var(--background);
  background-attachment: fixed;
  min-height: 100vh;        /* fallback for older browsers */
  min-height: 100dvh;       /* modern dynamic viewport */
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Focus accessibility */
:focus-visible {
  outline: 3px solid rgba(59, 130, 246, .55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Tabular numerics for stats and timers */
.num,
.timer,
.score,
.stat-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* -------- 3. App shell --------------------------------------------------- */
.app {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;        /* fallback */
  min-height: 100dvh;
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  background: transparent;
}

.app-view {
  /* Subtle breathing space so content never sticks to the fixed header */
  padding: 14px var(--container-pad) 28px;
  animation: viewIn 320ms var(--ease) both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------- 4. Header ------------------------------------------------------ */
.app-header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 30;
  height: calc(var(--header-height) + var(--safe-top));
  padding: calc(var(--safe-top) + 4px) var(--container-pad) 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  background: rgba(245, 248, 255, .82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(228, 236, 252, .8);
  max-width: var(--max-width);
  margin: 0 auto;
  inset-inline: 0;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.header-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.header-title .back-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: var(--transition);
  flex-shrink: 0;
}

.header-title .back-btn:hover { background: var(--surface-2); }
.header-title .back-btn:active { transform: scale(.94); }

.header-title .back-btn svg {
  width: 18px;
  height: 18px;
  transform: scaleX(-1); /* RTL chevron flip */
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: var(--transition);
}

.icon-btn:hover { background: var(--surface-2); border-color: var(--primary-200); color: var(--primary); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* -------- 5. Bottom navigation ------------------------------------------ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 30;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 12px calc(var(--safe-bottom) + 8px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(228, 236, 252, .8);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  transition: var(--transition);
  min-height: 60px;
  position: relative;
}

.nav-item svg { width: 22px; height: 22px; stroke-width: 1.7; }
.nav-item:hover { color: var(--text-2); background: rgba(239, 246, 255, .6); }

.nav-item.active {
  color: var(--primary);
  background: var(--primary-50);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.nav-item.active svg { stroke-width: 2.2; }

/* -------- 6. Section primitives ------------------------------------------ */
.section { margin-top: 24px; }
.section:first-child { margin-top: 4px; }
.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-title .link {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}

/* -------- 7. Cards ------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card.tappable {
  cursor: pointer;
}
.card.tappable:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
}
.card.tappable:active {
  transform: scale(.985);
  box-shadow: var(--shadow-press);
}

/* Welcome / hero card */
.welcome-card {
  padding: 22px 22px 24px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(255,255,255,.18) 0%, transparent 60%),
    linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 110%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(29, 78, 216, .28);
}

.welcome-card::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
  top: -60px;
  left: -40px;
}

.welcome-eyebrow {
  font-size: 12px;
  font-weight: 500;
  opacity: .85;
  letter-spacing: .01em;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.welcome-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

.welcome-sub {
  font-size: 14px;
  opacity: .9;
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
}

.readiness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.18);
}

.readiness-label {
  font-size: 12px;
  opacity: .85;
  margin-bottom: 4px;
}
.readiness-value {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.readiness-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,.18);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.readiness-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #fff, #DBEAFE);
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease);
}

/* Stats card (progress summary) */
.stats-card {
  margin-top: 14px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  padding: 6px 4px;
}

.stat + .stat {
  border-inline-start: 1px solid var(--border);
}

.stat-value {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 25px;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stat.success .stat-value { color: var(--success); }
.stat.danger  .stat-value { color: var(--danger); }
.stat.primary .stat-value { color: var(--primary); }

/* Action grid (2x2) */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  text-align: start;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  min-height: 116px;
  transition: var(--transition);
}

.action-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }
.action-card:active { transform: scale(.98); }

.action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary);
}
.action-icon svg { width: 20px; height: 20px; stroke-width: 1.9; }

.action-card.tone-success .action-icon { background: var(--success-bg); color: var(--success); }
.action-card.tone-warning .action-icon { background: var(--warning-bg); color: var(--warning); }
.action-card.tone-gold    .action-icon { background: var(--gold-bg); color: var(--gold); }

.action-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.35;
}

.action-sub {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Category card (single column big card) */
.category-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  text-align: start;
  width: 100%;
}

.category-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }
.category-card:active { transform: scale(.99); }

.category-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
  color: var(--primary);
  flex-shrink: 0;
}
.category-thumb.alt {
  background: linear-gradient(135deg, #E0F2FE, #F0F9FF);
  color: #0369A1;
}
.category-thumb svg { width: 26px; height: 26px; stroke-width: 1.8; }

.category-body {
  flex: 1;
  min-width: 0;
}
.category-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}
.category-sub {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.category-chev {
  color: var(--muted-2);
  flex-shrink: 0;
}
.category-chev svg { width: 18px; height: 18px; transform: scaleX(-1); }

/* Daily challenge banner */
.daily-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(255,255,255,.18) 0%, transparent 60%),
    linear-gradient(135deg, #047857 0%, #059669 70%, #10B981 110%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(5, 150, 105, .28);
}

.daily-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.18);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.daily-banner-icon svg { width: 24px; height: 24px; color: #fff; }
.daily-banner-body { flex: 1; min-width: 0; }
.daily-banner-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.daily-banner-sub { font-size: 12px; opacity: .9; }
.daily-banner-cta {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.2);
  color: #fff;
  transition: var(--transition);
  flex-shrink: 0;
}
.daily-banner-cta:hover { background: rgba(255,255,255,.3); }

/* Recommendation banner */
.recommend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-lg);
  color: #78350F;
}
.recommend-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: #FDE68A;
  color: #92400E;
  flex-shrink: 0;
}
.recommend-icon svg { width: 18px; height: 18px; }
.recommend-text { font-size: 13px; font-weight: 500; line-height: 1.5; flex: 1; }

/* Subject card */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.subject-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  text-align: start;
  transition: var(--transition);
}
.subject-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }
.subject-card:active { transform: scale(.98); }

.subject-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
}
.subject-thumb svg { width: 22px; height: 22px; }

.subject-thumb.s-english { background: #EFF6FF; color: #1D4ED8; }
.subject-thumb.s-arabic  { background: #FEF3C7; color: #B45309; }
.subject-thumb.s-computer{ background: #ECFDF5; color: #059669; }
.subject-thumb.s-passage { background: #FCE7F3; color: #BE185D; }

.subject-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}

.subject-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  transition: width 600ms var(--ease);
}

.subject-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}
.subject-footer .last {
  font-family: var(--font-num);
  font-weight: 600;
  color: var(--text-2);
}
.subject-footer .last.success { color: var(--success); }
.subject-footer .last.danger  { color: var(--danger); }

/* -------- 8. Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15.5px;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), color var(--transition), border-color var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 70%, var(--primary-dark) 130%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(29, 78, 216, .32), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(29, 78, 216, .36); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--primary-200); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
}
.btn-ghost:hover { background: var(--primary-50); }

.btn-success {
  background: linear-gradient(180deg, #10B981 0%, var(--success) 70%, #047857 130%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(5, 150, 105, .32), inset 0 1px 0 rgba(255,255,255,.18);
}

.btn-danger {
  background: linear-gradient(180deg, #EF4444 0%, var(--danger) 70%, #991B1B 130%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, .26), inset 0 1px 0 rgba(255,255,255,.18);
}

.btn-gold {
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(180, 83, 9, .28), inset 0 1px 0 rgba(255,255,255,.2);
}

.btn-sm { min-height: 40px; padding: 0 14px; font-size: 13px; }
.btn-lg { min-height: 58px; font-size: 16.5px; }

.btn-group { display: flex; flex-direction: column; gap: 10px; }

/* -------- 9. Badges ----------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-50);
  color: var(--primary);
  border: 1px solid var(--primary-100);
}
.badge.success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge.danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border);  }
.badge.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge.muted   { background: var(--surface-2);  color: var(--muted);    border-color: var(--border); }
.badge.gold    { background: var(--gold-bg);    color: var(--gold);     border-color: #FDE68A;  }
.badge svg { width: 12px; height: 12px; }

/* -------- 10. Quiz screen ------------------------------------------------ */
.quiz-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.quiz-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quiz-progress-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quiz-progress-label .now { color: var(--text); font-weight: 600; }

.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-2);
  font-family: var(--font-num);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.quiz-timer.warn { color: var(--warning); border-color: var(--warning-border); background: var(--warning-bg); }
.quiz-timer svg { width: 14px; height: 14px; }

.question-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.question-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: start;
  transition: var(--transition);
  min-height: 56px;
}

.option:hover { border-color: var(--primary-200); background: var(--primary-50); }
.option:active { transform: scale(.99); }

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-text { flex: 1; line-height: 1.5; }

.option-mark {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0;
  transition: var(--transition);
}
.option-mark svg { width: 14px; height: 14px; color: #fff; }

.option.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}
.option.selected .option-letter {
  background: var(--primary);
  color: #fff;
}

.option.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}
.option.correct .option-letter { background: var(--success); color: #fff; }
.option.correct .option-mark { background: var(--success); opacity: 1; }

.option.wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}
.option.wrong .option-letter { background: var(--danger); color: #fff; }
.option.wrong .option-mark { background: var(--danger); opacity: 1; }

.option:disabled { cursor: default; }
.option.disabled { pointer-events: none; }

/* Explanation box */
.explanation {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  animation: explIn 280ms var(--ease) both;
}
@keyframes explIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.explanation-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 8px;
}
.explanation-head.correct { color: var(--success); }
.explanation-head.wrong   { color: var(--danger); }
.explanation-head svg { width: 18px; height: 18px; }
.explanation-body { font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* Quiz exit confirm sheet uses default modal */

/* -------- 11. Result screen --------------------------------------------- */
.result-hero {
  padding: 28px 22px;
  border-radius: var(--radius-xl);
  text-align: center;
  background:
    radial-gradient(140% 100% at 50% 0%, rgba(255,255,255,.2) 0%, transparent 60%),
    linear-gradient(160deg, var(--primary-dark), var(--primary) 60%, var(--primary-light));
  color: #fff;
  box-shadow: 0 12px 28px rgba(29, 78, 216, .28);
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}

.result-emoji {
  font-size: 38px;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.2));
}

.score-ring {
  width: 156px;
  height: 156px;
  margin: 10px auto 12px;
  position: relative;
}
.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-ring .ring-bg { stroke: rgba(255,255,255,.2); fill: none; stroke-width: 10; }
.score-ring .ring-fg { stroke: #fff; fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease); }
.score-ring .center {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.score-ring .center .pct {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 38px;
  line-height: 1;
}
.score-ring .center .pct sup { font-size: 18px; font-weight: 500; vertical-align: top; margin-inline-start: 2px; }
.score-ring .center .lbl { font-size: 11.5px; opacity: .85; margin-top: 4px; }

.result-level {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}
.result-sub { font-size: 13px; opacity: .9; }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.result-stat {
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.result-stat .v { font-family: var(--font-num); font-weight: 700; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.result-stat .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.result-stat.success .v { color: var(--success); }
.result-stat.danger .v { color: var(--danger); }

/* -------- 12. Mistake list & materials ---------------------------------- */
.mistake-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
}
.mistake-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.mistake-q {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--text);
}
.mistake-answer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  line-height: 1.5;
}
.mistake-answer.user { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.mistake-answer.correct { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.mistake-answer .lbl { font-weight: 600; }

.mistake-explain {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 12px;
  padding-inline-start: 12px;
  border-inline-start: 3px solid var(--primary-200);
}

.material-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
  transition: var(--transition);
}
.material-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }

.material-thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary);
  flex-shrink: 0;
}
.material-thumb svg { width: 26px; height: 26px; stroke-width: 1.7; }
.material-thumb.warn { background: var(--warning-bg); color: var(--warning); }
.material-thumb.success { background: var(--success-bg); color: var(--success); }

.material-body { flex: 1; min-width: 0; }
.material-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.material-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.material-action { font-size: 13px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }
.material-action.locked { color: var(--muted); }
.material-action svg { width: 14px; height: 14px; transform: scaleX(-1); }

/* -------- 13. Premium screen --------------------------------------------- */
.premium-hero {
  padding: 26px 22px 24px;
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.22) 0%, transparent 60%),
    linear-gradient(160deg, #1E3A8A, #1D4ED8 60%, #6366F1);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(29, 78, 216, .32);
  margin-bottom: 16px;
}

.premium-crown {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.18);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}
.premium-crown svg { width: 30px; height: 30px; color: #FDE68A; }

.premium-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.premium-desc {
  font-size: 14px;
  opacity: .9;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.premium-price-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255,255,255,.22);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  position: relative;
  z-index: 1;
}
.premium-price-pill .currency { font-size: 12px; font-weight: 500; opacity: .85; }

.benefit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.benefit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.benefit-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--success-bg);
  color: var(--success);
  flex-shrink: 0;
}
.benefit-icon svg { width: 18px; height: 18px; stroke-width: 2.2; }
.benefit-text { font-size: 14px; font-weight: 500; color: var(--text); }

/* -------- 14. Profile + Settings ---------------------------------------- */
.profile-hero {
  padding: 18px 18px 18px 16px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  min-height: 116px;
}
.avatar {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(29, 78, 216, .3);
}
.profile-name { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1.3; margin-bottom: 5px; }
.profile-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.profile-status svg { flex-shrink: 0; }
/* Edit button inside the profile hero sized consistently */
.profile-hero .icon-btn { width: 52px; height: 52px; flex-shrink: 0; }
.profile-status svg { width: 12px; height: 12px; }

/* List groups (a.k.a. .list-card) — consistent rounded container */
.list-card,
.list-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* Grid rows: [icon | content | trailing]. RTL-aware (icon at start = right).
   The 3-column grid guarantees the title and subtitle NEVER collide with
   each other or with the trailing chevron/switch/badge. */
.list-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  background: transparent;
  text-align: start;
  width: 100%;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  min-height: 72px;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row:active { background: var(--surface-3); }

.list-row-icon,
.list-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary);
}
.list-row-icon svg, .list-icon svg { width: 20px; height: 20px; }
.list-row-icon.warning, .list-icon.warning { background: var(--warning-bg); color: var(--warning); }
.list-row-icon.danger,  .list-icon.danger  { background: var(--danger-bg);  color: var(--danger); }
.list-row-icon.gold,    .list-icon.gold    { background: var(--gold-bg);    color: var(--gold); }
.list-row-icon.success, .list-icon.success { background: var(--success-bg); color: var(--success); }

/* Content column — must allow wrapping; min-width:0 prevents grid overflow */
.list-row-body,
.list-content { min-width: 0; }

.list-row-title,
.list-title {
  display: block;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.list-row-sub,
.list-subtitle {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.list-row-chev,
.list-chevron { color: var(--muted-2); display: grid; place-items: center; }
.list-row-chev svg, .list-chevron svg { width: 18px; height: 18px; transform: scaleX(-1); }

/* Small muted badge for the device id (last 4 chars only — never the UUID) */
.device-id-badge {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 9px;
  white-space: nowrap;
}

/* Generic status badge utility */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  padding: 3px 9px;
  background: var(--primary-50);
  color: var(--primary);
  border: 1px solid var(--primary-100);
}

/* Toggle switch */
.switch {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  /* RTL: knob starts on the right */
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
  transition: var(--transition);
}
.switch.on {
  background: var(--primary);
}
.switch.on::after {
  right: calc(100% - 25px);
}

/* -------- 15. Quiz start screen ----------------------------------------- */
.start-hero {
  padding: 22px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
  text-align: center;
}
.start-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: #fff;
  box-shadow: 0 8px 22px rgba(29, 78, 216, .3);
}
.start-thumb svg { width: 40px; height: 40px; }
.start-cat {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.start-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-bottom: 6px; }
.start-desc { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

.start-facts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.start-fact {
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.start-fact .v { font-family: var(--font-num); font-weight: 700; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.start-fact .l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* -------- 16. Empty state ------------------------------------------------ */
.empty {
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--primary);
  box-shadow: var(--shadow-soft);
}
.empty-thumb svg { width: 38px; height: 38px; stroke-width: 1.6; }
.empty-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text); }
.empty-sub { font-size: 13.5px; color: var(--muted); max-width: 280px; line-height: 1.6; }

/* -------- 17. Modal ------------------------------------------------------ */
.modal-root {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.modal-root.open { pointer-events: auto; }

.modal-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--transition-md);
}
.modal-root.open .modal-backdrop { opacity: 1; }

.modal-sheet {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--surface);
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  padding: 12px 22px calc(var(--safe-bottom) + 24px);
  box-shadow: 0 -16px 48px rgba(15, 23, 42, .22);
  transform: translateY(100%);
  transition: transform var(--transition-lg);
}
.modal-root.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 44px;
  height: 5px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 6px;
  text-align: center;
}
.modal-sub {
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.6;
}

.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.field-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  font-family: var(--font-body);
  transition: var(--transition);
  color: var(--text);
}
.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .15);
}
.field-input.code {
  font-family: var(--font-num);
  letter-spacing: .25em;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
}

.field-helper { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field-helper.error { color: var(--danger); }

/* -------- 18. Toast ------------------------------------------------------ */
.toast-root {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: calc(100% - 32px);
  max-width: calc(var(--max-width) - 32px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  animation: toastIn 240ms var(--ease) both;
}
.toast.out { animation: toastOut 200ms var(--ease) forwards; }

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary);
  flex-shrink: 0;
}
.toast-icon svg { width: 16px; height: 16px; }
.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.danger  .toast-icon { background: var(--danger-bg);  color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(.96); }
}

/* -------- 19. Splash ----------------------------------------------------- */
.splash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;                /* modern alias */
  width: 100%;
  height: 100%;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #1E3A8A;     /* solid fallback */
  background:
    radial-gradient(140% 100% at 50% 100%, #1D4ED8 0%, #1E3A8A 60%, #0F172A 110%);
  color: #fff;
  transition: opacity 320ms var(--ease), visibility 320ms var(--ease);
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-logo {
  animation: pop 700ms var(--ease) both;
}
.splash-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin-top: 10px;
  animation: pop 800ms 80ms var(--ease) both;
}
.splash-subtitle {
  font-size: 14px;
  opacity: .8;
  animation: pop 800ms 160ms var(--ease) both;
}
.splash-dots {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.splash-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  animation: dotPulse 1.2s var(--ease) infinite;
}
.splash-dots span:nth-child(2) { animation-delay: .15s; }
.splash-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dotPulse {
  0%, 100% { opacity: .4; transform: scale(.85); }
  50%      { opacity: 1;  transform: scale(1.15); }
}

/* -------- 20. Misc utility ---------------------------------------------- */
.flex { display: flex; }
.between { justify-content: space-between; align-items: center; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.spacer { height: 16px; }
.spacer-lg { height: 28px; }

/* Hidden helper for screen-reader-only labels */
.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;
}

/* -------- 21. Larger screen presentation (>= 540px) --------------------- */
@media (min-width: 540px) {
  body {
    padding: 24px;
  }
  .app {
    border-radius: 28px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, .14), 0 8px 24px rgba(29, 78, 216, .08);
    overflow: hidden;
    min-height: calc(100dvh - 48px);
    background: var(--background);
  }
  .app-header { border-top-left-radius: 28px; border-top-right-radius: 28px; }
  .bottom-nav { border-bottom-left-radius: 28px; border-bottom-right-radius: 28px; }
}

/* -------- 22. Reduced motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* =========================================================================
   23. SaaS refactor additions
   Plan chip · resume card · activation form · WhatsApp · skeleton/spinner ·
   offline banner · paywall helpers
   ========================================================================= */

/* ---- Subscription plan chip (home) ---- */
.plan-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.plan-chip.premium { background: linear-gradient(180deg, #FFFBEB, #FFFFFF); border-color: #FDE68A; }
.plan-chip-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-50); color: var(--primary);
}
.plan-chip.premium .plan-chip-icon { background: var(--gold-bg); color: var(--gold); }
.plan-chip-icon svg { width: 18px; height: 18px; }
.plan-chip-body { flex: 1; min-width: 0; }
.plan-chip-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text); }
.plan-chip-sub { font-size: 12px; color: var(--muted); }

/* ---- Resume last attempt card ---- */
.resume-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; width: 100%; text-align: start;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-50), #FFFFFF);
  border: 1px solid var(--primary-100);
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  cursor: pointer;
}
.resume-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-200); }
.resume-card:active { transform: scale(.99); }
.resume-icon {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary); color: #fff;
}
.resume-icon svg { width: 20px; height: 20px; }
.resume-body { flex: 1; min-width: 0; }
.resume-title { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: var(--text); }
.resume-sub { font-size: 12px; color: var(--muted); }

/* ---- Activation card + form ---- */
.activation-card {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
}
.activation-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--text); margin-bottom: 14px;
}
.activation-title svg { width: 18px; height: 18px; color: var(--primary); }

/* input with leading icon */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon svg { position: absolute; inset-inline-start: 14px; width: 18px; height: 18px; color: var(--muted-2); pointer-events: none; }
.input-icon .field-input { padding-inline-start: 42px; }

/* "or" divider */
.or-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 2px; color: var(--muted-2); font-size: 12.5px; font-weight: 600;
}
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* WhatsApp button */
.btn-whatsapp {
  background: linear-gradient(180deg, #25D366 0%, #1EBE5A 70%, #128C7E 130%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 211, 102, .28), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-whatsapp:hover { box-shadow: 0 10px 22px rgba(37, 211, 102, .34); }
.btn-whatsapp svg { width: 20px; height: 20px; }

/* ---- Spinner + skeleton (loading states) ---- */
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid var(--primary-100);
  border-top-color: var(--primary);
  margin: 6px auto 0;
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; margin: 0; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { animation: viewIn 320ms var(--ease) both; }
.skeleton-card { height: 120px; border-radius: var(--radius-xl); margin: 14px 0; }
.skeleton-line { height: 56px; border-radius: var(--radius-md); margin-bottom: 10px; }
.skeleton-line.short { width: 60%; }
.skeleton-card, .skeleton-line {
  background: linear-gradient(100deg, var(--surface-2) 30%, #F8FBFF 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Offline banner ---- */
.net-banner {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  inset-inline: 0;
  z-index: 25;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 9px var(--container-pad);
  background: #78350F; color: #FFFBEB;
  font-size: 12.5px; font-weight: 500;
  animation: viewIn 240ms var(--ease) both;
}
.net-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Push the view down so the fixed offline banner never hides content. */
.app.has-net-banner .app-view { padding-top: 44px; }

@media (min-width: 540px) {
  .net-banner { border-radius: 0; }
}

/* ---- Small screens (≤380px): tighten without hurting readability ---- */
@media (max-width: 380px) {
  :root { --container-pad: 16px; }
  .list-row { grid-template-columns: 42px 1fr auto; gap: 10px; padding: 14px; min-height: 68px; }
  .list-row-icon, .list-icon { width: 42px; height: 42px; }
  .list-row-title, .list-title { font-size: 15px; }        /* still ≥13px */
  .list-row-sub, .list-subtitle { font-size: 13px; }
  .stat-value { font-size: 22px; }
  .header-title { font-size: 18px; }
  .avatar { width: 68px; height: 68px; font-size: 26px; }
  .action-card { min-height: 108px; }
  .welcome-name { font-size: 22px; }
}
