/* ================================================================
   RAWDAT AT-TULLAB — style.css
   Dark glass redesign: deep black + emerald glow + glassmorphism
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

/* ============================================================
   DESIGN TOKENS — DARK GLASS DEFAULT
   ============================================================ */
:root {
  /* Brand — emerald */
  --brand-900: #042B1C;
  --brand-800: #064A2F;
  --brand-700: #0A6642;
  --brand-600: #0F8556;
  --brand-500: #16A96E;
  --brand-400: #2EC98A;
  --brand-300: #5EDBA8;
  --brand-200: #A8EDCE;
  --brand-100: #0D2A1E;
  --brand-050: #081A12;

  /* Gold accent */
  --gold-500: #C9973A;
  --gold-400: #E0AF52;
  --gold-300: #F0C96A;
  --gold-100: #2A2015;

  /* Semantic */
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --warn: #FBBF24;
  --warn-bg: rgba(251, 191, 36, 0.10);
  --success: #2EC98A;

  /* Dark glass neutrals */
  --bg: #060608;
  --bg-warm: #0A0A0C;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-3: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.08);
  --border-med: rgba(255, 255, 255, 0.13);
  --text: #F0F0EE;
  --text-2: #C0C0B8;
  --text-3: #70706A;
  --muted: #444440;
  --overlay: rgba(0, 0, 0, 0.75);

  /* Shadows */
  --s-xs: 0 1px 3px rgba(0, 0, 0, 0.5);
  --s-sm: 0 2px 8px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
  --s-md: 0 6px 20px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.5);
  --s-lg: 0 16px 40px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.6);
  --s-xl: 0 28px 60px rgba(0, 0, 0, 0.85), 0 8px 20px rgba(0, 0, 0, 0.7);
  --s-brand: 0 0 40px rgba(15, 133, 86, 0.35), 0 0 80px rgba(15, 133, 86, 0.15);
  --s-gold: 0 6px 20px rgba(201, 151, 58, 0.20);
  --s-card: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 4px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
}
  /* ================================================================
   RAWDAT AT-TULLAB — style.css
   Dark glass redesign: deep black + emerald glow + glassmorphism
   ================================================================ */

  /* ============================================================
   DESIGN TOKENS — DARK GLASS DEFAULT
   ============================================================ */
  :root {
    /* Brand — emerald */
    --brand-900: #042B1C;
    --brand-800: #064A2F;
    --brand-700: #0A6642;
    --brand-600: #0F8556;
    --brand-500: #16A96E;
    --brand-400: #2EC98A;
    --brand-300: #5EDBA8;
    --brand-200: #A8EDCE;
    --brand-100: #0D2A1E;
    --brand-050: #081A12;

    /* Gold accent */
    --gold-500: #C9973A;
    --gold-400: #E0AF52;
    --gold-300: #F0C96A;
    --gold-100: #2A2015;

    /* Semantic */
    --danger: #F87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --warn: #FBBF24;
    --warn-bg: rgba(251, 191, 36, 0.10);
    --success: #2EC98A;

    /* Dark glass neutrals */
    --bg: #060608;
    --bg-warm: #0A0A0C;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --surface-3: rgba(255, 255, 255, 0.10);
    --border: rgba(255, 255, 255, 0.08);
    --border-med: rgba(255, 255, 255, 0.13);
    --text: #F0F0EE;
    --text-2: #C0C0B8;
    --text-3: #70706A;
    --muted: #444440;
    --overlay: rgba(0, 0, 0, 0.75);

    /* Shadows */
    --s-xs: 0 1px 3px rgba(0, 0, 0, 0.5);
    --s-sm: 0 2px 8px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
    --s-md: 0 6px 20px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.5);
    --s-lg: 0 16px 40px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.6);
    --s-xl: 0 28px 60px rgba(0, 0, 0, 0.85), 0 8px 20px rgba(0, 0, 0, 0.7);
    --s-brand: 0 0 40px rgba(15, 133, 86, 0.35), 0 0 80px rgba(15, 133, 86, 0.15);
    --s-gold: 0 6px 20px rgba(201, 151, 58, 0.20);
    --s-card: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 4px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);

    /* Radii */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 20px;
    --r-xl: 24px;
    --r-2xl: 32px;
    --r-pill: 999px;

    /* Motion */
    --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-1: 110ms;
    --dur-2: 200ms;
    --dur-3: 340ms;
    --dur-4: 520ms;

    /* Typography — SF Pro everywhere for Cyrillic/Latin, weight/tracking carry the hierarchy */
    --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
    --font-ar: "Tajawal", "SF Arabic", "Noto Naskh Arabic", "Amiri", serif;
    --font-ar-classic: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", "Fira Code", monospace;

    /* Safe areas */
    --sa-top: env(safe-area-inset-top, 0px);
    --sa-bot: env(safe-area-inset-bottom, 0px);
    --sa-left: env(safe-area-inset-left, 0px);
    --sa-right: env(safe-area-inset-right, 0px);
    --nav-h: 80px;
  }

  /* Light theme */
  html[data-theme="light"] {
    --bg: #F5F5F0;
    --bg-warm: #EFEDE8;
    --surface: #FFFFFF;
    --surface-2: #F5F5F0;
    --surface-3: #ECEAE5;
    --border: rgba(0, 0, 0, 0.07);
    --border-med: rgba(0, 0, 0, 0.11);
    --text: #1A1A18;
    --text-2: #3D3D38;
    --text-3: #888880;
    --muted: #B0AFA8;
    --overlay: rgba(10, 10, 8, 0.45);
    --brand-100: #E4F7EF;
    --brand-050: #F2FBF7;
    --danger: #C0392B;
    --danger-bg: #FEF0EE;
    --warn: #C07A1E;
    --warn-bg: #FEF5E8;
    --s-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --s-sm: 0 2px 8px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    --s-md: 0 6px 20px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
    --s-lg: 0 16px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.05);
    --s-xl: 0 28px 60px rgba(0, 0, 0, 0.14), 0 8px 20px rgba(0, 0, 0, 0.07);
    --s-brand: 0 8px 28px rgba(15, 133, 86, 0.30), 0 2px 8px rgba(15, 133, 86, 0.15);
    --s-card: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --gold-100: #FBF0D9;
  }
  /* ============================================================
   RESET
   ============================================================ */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    height: 100%;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
  }

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

  button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  input,
  select,
  textarea {
    background: none;
    border: 0;
    outline: 0;
  }

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

  ::selection {
    background: rgba(15, 133, 86, 0.25);
    color: var(--brand-400);
  }

  ::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  /* ============================================================
   ГЛОБАЛЬНЫЕ ДЕКОРАТИВНЫЕ ОРЕОЛЫ (только в тёмной теме)
   ============================================================ */

  body::before {
    content: "";
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 500px;
    background: radial-gradient(ellipse at center,
        rgba(15, 133, 86, 0.18) 0%,
        rgba(15, 133, 86, 0.06) 40%,
        transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  body::after {
    content: "";
    position: fixed;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse at center,
        rgba(15, 133, 86, 0.10) 0%,
        transparent 65%);
    pointer-events: none;
    z-index: 0;
  }

  html[data-theme="light"] body::before,
  html[data-theme="light"] body::after {
    display: none;
  }

  /* ============================================================
   LAYOUT SHELL
   ============================================================ */
  .app {
    min-height: 100dvh;
    min-height: 100vh;
    padding-bottom: var(--nav-h);
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    background: var(--bg);
  }

  .screen {
    padding: 0 0 24px;
    opacity: 0;
    transform: translateY(10px);
    animation: screenIn var(--dur-3) var(--ease-out) forwards;
  }

  #s-lesson {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  #s-pdf {
    padding-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }

  .pdf-frame-wrap {
    flex: 1;
    min-height: 0;
    padding: 0 16px calc(16px + var(--nav-h));
  }

  #pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--s-card);
  }

  @media (min-width: 768px) {
    .pdf-frame-wrap {
      padding: 0 20px 20px;
    }
  }

  .screen.hidden {
    display: none !important;
  }

  @keyframes screenIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* ============================================================
   TOP BAR
   ============================================================ */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--sa-top) + 16px) 16px 12px;
    gap: 10px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }

  .topbar-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    text-align: center;
    flex: 1;
  }

  .topbar-large {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 34px;
    letter-spacing: -0.03em;
    padding: calc(var(--sa-top) + 10px) 20px 6px;
    line-height: 1.15;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-2);
    transition: transform var(--dur-1) var(--ease-spring), background var(--dur-1), box-shadow var(--dur-1);
    flex-shrink: 0;
  }

  .icon-btn:active {
    transform: scale(0.90);
    background: var(--surface-3);
  }

  .icon-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ============================================================
   TYPOGRAPHY
   ============================================================ */
  .h1 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
  }

  .h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
  }

  .h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .h4 {
    font-size: 15px;
    font-weight: 600;
  }

  .muted {
    color: var(--text-3);
    font-size: 13px;
  }

  .tiny {
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.02em;
  }

  .eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
  }

  /* ============================================================
   SECTIONS
   ============================================================ */
  .section {
    margin: 8px 0;
  }

  .section-pad {
    padding: 0 16px;
  }

  .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 10px;
  }

  .section-head .eyebrow {
    font-size: 11.5px;
  }

  .section-head .link {
    color: var(--brand-400);
    font-size: 13.5px;
    font-weight: 600;
  }

  /* GLASS LIST GROUP */
  .list-group {
    background: var(--surface);
    border-radius: var(--r-xl);
    margin: 0 16px;
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .list-group+.list-group {
    margin-top: 10px;
  }

  .list-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    min-height: 56px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
    cursor: pointer;
    transition: background var(--dur-1);
  }

  .list-item:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 58px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .list-item:active {
    background: var(--surface-2);
  }

  .list-item .li-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 14px;
    border: 1px solid var(--border);
  }

  .list-item .li-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .list-item .li-body {
    flex: 1;
    min-width: 0;
  }

  .list-item .li-title {
    font-size: 15.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .list-item .li-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 1px;
  }

  .list-item .li-trail {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    flex-shrink: 0;
  }

  .list-item .li-trail svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .list-item.danger .li-title {
    color: var(--danger);
  }

  .list-item.locked {
    opacity: 0.35;
    pointer-events: none;
  }

  /* ============================================================
   GLASS CARD — базовый компонент
   ============================================================ */
  .card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    margin: 0 16px;
  }

  .card+.card {
    margin-top: 10px;
  }

  /* ============================================================
   HERO CARD — зелёный ореол + стекло
   ============================================================ */
  .hero-card {
    border-radius: var(--r-2xl);
    background: linear-gradient(135deg,
        rgba(15, 133, 86, 0.85) 0%,
        rgba(6, 74, 47, 0.90) 50%,
        rgba(4, 43, 28, 0.95) 100%);
    color: #fff;
    padding: 22px 20px 20px;
    margin: 10px 16px 0;
    position: relative;
    overflow: hidden;
    box-shadow:
      0 0 60px rgba(15, 133, 86, 0.25),
      0 0 120px rgba(15, 133, 86, 0.10),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
    isolation: isolate;
    border: 1px solid rgba(46, 201, 138, 0.25);
  }

  .hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 70% 60% at 100% -10%, rgba(46, 201, 138, 0.25) 0%, transparent 55%),
      radial-gradient(ellipse 50% 70% at -10% 110%, rgba(4, 43, 28, 0.60) 0%, transparent 50%);
    pointer-events: none;
  }

  .hero-card::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 40px solid rgba(46, 201, 138, 0.08);
    pointer-events: none;
  }

  .hero-card .hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    position: relative;
  }

  .hero-card .hero-greeting {
    font-size: 12.5px;
    opacity: 0.70;
    font-weight: 500;
    margin-bottom: 3px;
    letter-spacing: 0.02em;
  }

  .hero-card .hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.02em;
    line-height: 1.2;
  }

  .hero-card .hero-subtitle {
    font-size: 13px;
    opacity: 0.70;
    margin-top: 3px;
    font-weight: 400;
  }

  .hero-brand-ar {
    font-family: var(--font-ar);
    font-size: 28px;
    font-weight: 700;
    opacity: 0.18;
    direction: rtl;
    line-height: 1;
    user-select: none;
  }

  /* Статистика чипы */
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
  }

  .stat-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 11px 8px;
    text-align: center;
    transition: background var(--dur-1);
  }

  .stat-chip:active {
    background: rgba(255, 255, 255, 0.15);
  }

  .stat-chip .stat-n {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.02em;
  }

  .stat-chip .stat-l {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 3px;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  /* Hero buttons */
  .hero-actions {
    display: flex;
    gap: 10px;
    position: relative;
  }

  .btn-hero {
    flex: 1;
    min-height: 46px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    letter-spacing: -0.01em;
    transition: transform var(--dur-1) var(--ease-spring), opacity var(--dur-1);
  }

  .btn-hero:active {
    transform: scale(0.96);
    opacity: 0.88;
  }

  .btn-hero.primary {
    background: rgba(255, 255, 255, 0.95);
    color: #064A2F;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 0 22px rgba(94, 219, 168, 0.45);
  }

  .btn-hero.ghost {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .btn-hero svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ============================================================
   LIBRARY TILES — glass cards
   ============================================================ */
  .tile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px;
  }

  .tile {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 130px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2), border-color var(--dur-2);
    text-align: left;
    width: 100%;
    position: relative;
    overflow: hidden;
  }

  .tile:active {
    transform: scale(0.96);
    border-color: rgba(15, 133, 86, 0.3);
  }

  .tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  }

  .tile .tile-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    border: 1px solid var(--border);
  }

  .tile .tile-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .tile .tile-title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
  }

  .tile .tile-sub {
    font-size: 11.5px;
    color: var(--text-3);
  }

  .tile-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
    margin: -16px -15px 12px -15px;
    border: 0;
    display: block;
  }

  /* ============================================================
   PROGRESS
   ============================================================ */
  .progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    overflow: hidden;
  }

  .progress>i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
    border-radius: inherit;
    transition: width var(--dur-4) var(--ease-out);
  }

  .progress.thin {
    height: 3px;
  }

  .progress.thick {
    height: 7px;
  }

  .ring {
    --size: 48px;
    --val: 0;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--brand-500) calc(var(--val) * 1%), var(--surface-2) 0);
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
  }

  .ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--bg);
  }

  .ring>span {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
  }

  /* ============================================================
   BUTTONS
   ============================================================ */
  .btn {
    min-height: 50px;
    padding: 0 20px;
    border-radius: var(--r-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    transition: transform var(--dur-1) var(--ease-spring), opacity var(--dur-1), box-shadow var(--dur-1);
    width: 100%;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .btn:active {
    transform: scale(0.97);
    opacity: 0.88;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff;
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.30), 0 4px 14px rgba(15, 133, 86, 0.25);
    border: 1px solid rgba(46, 201, 138, 0.20);
  }

  .btn-primary:active {
    box-shadow: none;
  }

  .btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-med);
  }

  .btn-ghost {
    background: transparent;
    color: var(--text);
  }

  .btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.15);
  }

  .btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .btn-row {
    display: flex;
    gap: 10px;
  }

  .btn-row .btn {
    flex: 1;
  }

  /* ============================================================
   CHIP
   ============================================================ */
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border-med);
    transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1) var(--ease-spring);
    white-space: nowrap;
  }

  .chip:active {
    transform: scale(0.95);
  }

  .chip.on {
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    border-color: rgba(15, 133, 86, 0.30);
  }

  .segmented {
    display: flex;
    gap: 0;
    padding: 3px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    margin: 0 16px;
    border: 1px solid var(--border);
  }

  .seg {
    flex: 1;
    min-height: 34px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-2), color var(--dur-2), box-shadow var(--dur-2);
  }

  .seg.on {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: var(--s-sm);
  }

  /* ============================================================
   INPUTS
   ============================================================ */
  .field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
  }

  .field label {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 700;
    padding-left: 2px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    font-size: 16px;
    transition: border-color var(--dur-2), background var(--dur-2), box-shadow var(--dur-2);
  }

  .textarea {
    min-height: 100px;
    padding: 12px 16px;
    resize: vertical;
    line-height: 1.5;
  }

  .input:focus,
  .select:focus,
  .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px rgba(15, 133, 86, 0.15);
  }

  .input.ar,
  .textarea.ar {
    direction: rtl;
    text-align: right;
    font-family: var(--font-ar-classic);
    font-size: 22px;
  }

  .search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 0 16px;
    min-height: 44px;
    margin: 8px 16px 0;
    border: 1px solid var(--border-med);
  }

  .search-wrap:focus-within {
    border-color: rgba(15, 133, 86, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 133, 86, 0.10);
  }

  .search-wrap svg {
    width: 16px;
    height: 16px;
    color: var(--text-3);
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
  }

  .search-wrap input {
    flex: 1;
    background: none;
    border: 0;
    outline: 0;
    min-height: 44px;
    font-size: 15px;
    color: var(--text);
  }

  .search-wrap input::placeholder {
    color: var(--muted);
  }

  /* ============================================================
   WORD ROW
   ============================================================ */
  .word-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: transparent;
    position: relative;
  }

  .word-row:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 54px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .word-row .wr-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
  }

  .word-row .wr-ru {
    color: var(--text-3);
    font-size: 13.5px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .word-row .wr-fav {
    color: var(--muted);
    padding: 6px;
    flex-shrink: 0;
    transition: color var(--dur-1), transform var(--dur-1) var(--ease-spring);
  }

  .word-row .wr-fav.on {
    color: var(--gold-400);
  }

  .word-row .wr-fav:active {
    transform: scale(1.3);
  }

  .word-row .wr-fav svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .word-row .wr-fav.on svg {
    fill: currentColor;
  }

  /* ============================================================
   FLASHCARD (STUDY)
   ============================================================ */
  .study-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px 14px;
  }

  .study-header .progress {
    flex: 1;
  }

  .study-header .count {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .flashcard-wrap {
    padding: 0 16px;
  }

  .flashcard {
    background: var(--surface);
    border-radius: var(--r-2xl);
    padding: 36px 26px 28px;
    min-height: 290px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--s-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    gap: 0;
    isolation: isolate;
  }

  .flashcard::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 100% 50% at 50% -5%, rgba(15, 133, 86, 0.12), transparent 65%);
  }

  .flashcard::after {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    pointer-events: none;
  }

  .fc-type-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid rgba(15, 133, 86, 0.25);
  }

  .fc-arabic {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: clamp(40px, 11vw, 60px);
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    word-break: break-word;
    width: 100%;
    color: var(--text);
    position: relative;
    z-index: 1;
  }

  .fc-divider {
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: var(--border-med);
    margin: 14px 0;
    opacity: 0;
    transition: opacity var(--dur-2) var(--ease);
  }

  .fc-translation {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-2);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
    min-height: 26px;
    position: relative;
    z-index: 1;
  }

  .fc-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity var(--dur-2);
    position: relative;
    z-index: 1;
  }

  .fc-hint svg {
    opacity: 0.6;
  }

  .flashcard.revealed .fc-divider {
    opacity: 1;
  }

  .flashcard.revealed .fc-translation {
    opacity: 1;
    transform: translateY(0);
  }

  .flashcard.revealed .fc-hint {
    opacity: 0;
    pointer-events: none;
  }

  .flashcard.swipe-left {
    transform: translateX(-48%) rotate(-9deg);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.swipe-right {
    transform: translateX(48%) rotate(9deg);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.swipe-up {
    transform: translateY(-30%) scale(0.95);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.enter {
    animation: fcEnter var(--dur-4) var(--ease-out);
  }

  @keyframes fcEnter {
    from {
      opacity: 0;
      transform: translateY(20px) scale(0.95);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  .rate-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 12px 16px 0;
  }

  .rate-btn {
    min-height: 62px;
    border-radius: var(--r-md);
    font-weight: 700;
    font-size: 13.5px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: transform var(--dur-1) var(--ease-spring), filter var(--dur-1), box-shadow var(--dur-1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
  }

  .rate-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.20);
  }

  .rate-btn:active {
    transform: scale(0.95);
    filter: brightness(0.85);
    box-shadow: none;
  }

  .rate-btn .rb-label {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .rate-btn .rb-interval {
    font-size: 10px;
    opacity: 0.80;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .rate-btn.hard {
    background: linear-gradient(160deg, rgba(224, 80, 96, 0.90), rgba(192, 57, 43, 0.90));
    box-shadow: 0 4px 20px rgba(192, 57, 43, 0.30);
  }

  .rate-btn.ok {
    background: linear-gradient(160deg, rgba(232, 168, 64, 0.90), rgba(192, 122, 30, 0.90));
    box-shadow: 0 4px 20px rgba(192, 122, 30, 0.30);
  }

  .rate-btn.easy {
    background: linear-gradient(160deg, rgba(46, 201, 138, 0.90), rgba(15, 133, 86, 0.90));
    box-shadow: 0 4px 20px rgba(15, 133, 86, 0.35);
  }

  /* Summary */
  .summary-card {
    background: var(--surface);
    border-radius: var(--r-2xl);
    padding: 32px 22px;
    margin: 0 16px;
    text-align: center;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .summary-emoji {
    font-size: 44px;
    margin-bottom: 14px;
  }

  .summary-accuracy {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-300));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .summary-label {
    font-size: 14px;
    color: var(--text-3);
    margin-top: 5px;
  }

  .summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
  }

  .summary-stat {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 14px 8px;
    border: 1px solid var(--border);
  }

  .summary-stat .ss-n {
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.02em;
  }

  .summary-stat .ss-l {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
    font-weight: 500;
  }

  /* ============================================================
   STATS SCREEN
   ============================================================ */
  .kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px;
  }

  .kpi {
    padding: 18px 16px;
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .kpi .kpi-label {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .kpi .kpi-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 30px;
    margin-top: 6px;
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .kpi .kpi-detail {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
  }

  .kpi.accent {
    background: rgba(15, 133, 86, 0.10);
    border-color: rgba(15, 133, 86, 0.25);
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.08);
  }

  .kpi.accent .kpi-value {
    color: var(--brand-400);
  }

  .heatmap-card {
    margin: 0 16px;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .heatmap {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 3px;
    margin-top: 12px;
  }

  .heatmap .hm-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--surface-3);
  }

  .heatmap .hm-cell[data-l="1"] {
    background: rgba(15, 133, 86, 0.22);
  }

  .heatmap .hm-cell[data-l="2"] {
    background: rgba(15, 133, 86, 0.44);
  }

  .heatmap .hm-cell[data-l="3"] {
    background: rgba(15, 133, 86, 0.68);
  }

  .heatmap .hm-cell[data-l="4"] {
    background: var(--brand-500);
    box-shadow: 0 0 6px rgba(15, 133, 86, 0.5);
  }

  .heatmap-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
    font-size: 10.5px;
    color: var(--text-3);
    margin-top: 10px;
    font-weight: 500;
  }

  .heatmap-legend .lsq {
    width: 10px;
    height: 10px;
    border-radius: 2px;
  }

  /* ============================================================
   BOTTOM NAV — glass
   ============================================================ */
  /* BOTTOM NAV — iOS style */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 430px;
    margin: 0 auto;
    padding: 8px 0 calc(8px + var(--sa-bot));
    background: rgba(6, 6, 8, 0.80);
    backdrop-filter: saturate(180%) blur(30px);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    border-top: 0.5px solid rgba(255, 255, 255, 0.10);
    z-index: 40;
  }

  html[data-theme="light"] .bottom-nav {
    background: rgba(249, 249, 249, 0.85);
    border-top: 0.5px solid rgba(0, 0, 0, 0.12);
  }

  .bottom-nav .nav-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-btn {
    padding: 4px 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-3);
    transition: color var(--dur-2);
    position: relative;
    border-radius: 0;
  }

  .nav-btn svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--dur-2) var(--ease-spring), fill var(--dur-2), stroke var(--dur-2);
  }

  .nav-btn .nav-lbl {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    transition: color var(--dur-2);
    font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
  }

  .nav-btn.active {
    color: var(--brand-400);
  }

  html[data-theme="light"] .nav-btn.active {
    color: var(--brand-600);
  }

  .nav-btn.active svg {
    transform: scale(1.0);
    stroke-width: 2;
    fill: none;
    filter: drop-shadow(0 0 6px rgba(46, 201, 138, 0.55));
  }

  html[data-theme="light"] .nav-btn.active svg {
    filter: drop-shadow(0 0 5px rgba(15, 133, 86, 0.35));
  }

  .nav-btn:active svg {
    transform: scale(0.88);
  }

  /* убираем точку — iOS не использует dot индикатор */
  .nav-btn.active::after {
    display: none;
  }

  html[data-theme="light"] .bottom-nav {
    background: rgba(245, 245, 240, 0.85);
  }

  .bottom-nav .nav-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-btn {
    padding: 6px 4px 3px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-3);
    transition: color var(--dur-2);
    position: relative;
  }

  .nav-btn svg {
    width: 23px;
    height: 23px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--dur-2) var(--ease-spring);
  }

  .nav-btn .nav-lbl {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color var(--dur-2);
  }

  .nav-btn.active {
    color: var(--brand-400);
  }

  .nav-btn.active svg {
    transform: scale(1.1);
    stroke-width: 2;
  }

  .nav-btn.active::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brand-400);
    box-shadow: 0 0 6px var(--brand-400);
    animation: navDot var(--dur-3) var(--ease-spring);
  }

  @keyframes navDot {
    from {
      transform: translateX(-50%) scale(0);
      opacity: 0;
    }

    to {
      transform: translateX(-50%) scale(1);
      opacity: 1;
    }
  }

  /* ============================================================
   SHEET — glass
   ============================================================ */
  .sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-3) var(--ease);
  }

  .sheet-backdrop.on {
    opacity: 1;
    pointer-events: auto;
  }

  .sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 430px;
    margin: 0 auto;
    background: rgba(14, 14, 12, 0.90);
    border-radius: 26px 26px 0 0;
    z-index: 51;
    transform: translateY(100%);
    transition: transform var(--dur-4) var(--ease-out);
    padding: 0 18px calc(22px + var(--sa-bot));
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
  }

  html[data-theme="light"] .sheet {
    background: rgba(255, 255, 255, 0.95);
  }

  .sheet.on {
    transform: translateY(0);
  }

  .sheet .sheet-handle {
    width: 32px;
    height: 4px;
    border-radius: 3px;
    background: var(--border-med);
    margin: 12px auto 18px;
  }

  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .sheet-head .sheet-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  body.sheet-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ============================================================
   TOAST
   ============================================================ */
  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 14px);
    transform: translate(-50%, 14px);
    background: rgba(14, 14, 12, 0.90);
    color: var(--text);
    padding: 11px 20px;
    border-radius: var(--r-pill);
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--s-xl), 0 0 0 1px var(--border);
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring);
    white-space: nowrap;
    letter-spacing: 0.01em;
  }

  html[data-theme="light"] .toast {
    background: rgba(26, 26, 24, 0.90);
    color: #F0F0EE;
  }

  .toast.on {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  /* ============================================================
   MISC UTILITIES
   ============================================================ */
  .divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
  }

  .spacer {
    height: 16px;
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 20px;
    color: var(--text-3);
    text-align: center;
  }

  .empty-state .es-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    font-size: 26px;
  }

  .empty-state .es-icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .empty-state .es-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 6px;
  }

  .empty-state .es-text {
    font-size: 14px;
    line-height: 1.55;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--r-pill);
    letter-spacing: 0.02em;
  }

  .badge.green {
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    border: 1px solid rgba(15, 133, 86, 0.25);
  }

  .badge.red {
    background: var(--danger-bg);
    color: var(--danger);
  }

  .badge.yellow {
    background: var(--warn-bg);
    color: var(--warn);
  }

  .badge.gray {
    background: var(--surface-2);
    color: var(--text-3);
  }

  .lock-badge {
    position: absolute;
    top: 11px;
    right: 11px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    display: grid;
    place-items: center;
  }

  .lock-badge svg {
    width: 11px;
    height: 11px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .words-group {
    background: var(--surface);
    border-radius: var(--r-xl);
    margin: 0 16px;
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: transparent;
    position: relative;
  }

  .settings-toggle:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .toggle-track {
    width: 50px;
    height: 30px;
    border-radius: 15px;
    background: var(--surface-3);
    border: 1px solid var(--border-med);
    position: relative;
    transition: background var(--dur-2), border-color var(--dur-2);
    cursor: pointer;
    flex-shrink: 0;
  }

  .toggle-track.on {
    background: var(--brand-500);
    border-color: var(--brand-500);
    box-shadow: 0 0 12px rgba(15, 133, 86, 0.40);
  }

  .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform var(--dur-2) var(--ease-spring);
  }

  .toggle-track.on .toggle-thumb {
    transform: translateX(20px);
  }

  .chips-scroll {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chips-scroll::-webkit-scrollbar {
    display: none;
  }

  .unit-info-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    margin: 0 16px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .unit-info-card .ui-row {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .ico-green {
    background: rgba(15, 133, 86, 0.12);
    color: var(--brand-400);
  }

  .ico-blue {
    background: rgba(26, 108, 214, 0.12);
    color: #60A5FA;
  }

  .ico-orange {
    background: rgba(192, 122, 30, 0.12);
    color: var(--gold-400);
  }

  .ico-red {
    background: rgba(248, 113, 113, 0.12);
    color: #F87171;
  }

  .ico-purple {
    background: rgba(124, 58, 237, 0.12);
    color: #C084FC;
  }

  .ico-pink {
    background: rgba(190, 24, 93, 0.12);
    color: #F472B6;
  }

  .ico-brand {
    background: rgba(15, 133, 86, 0.12);
    color: var(--brand-400);
  }

  /* ============================================================
   ANIMATION UTILITIES
   ============================================================ */
  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: 0.5;
    }
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(14px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .animate-in {
    animation: slideUp var(--dur-3) var(--ease-out) both;
  }

  .btn,
  .nav-btn,
  .tile,
  .list-item,
  .chip,
  .seg,
  .rate-btn,
  .icon-btn {
    -webkit-user-select: none;
    user-select: none;
  }

  :focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
  }

  /* ============================================================
   LESSON SCREEN
   ============================================================ */
  .lesson-arabic-text {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 600;
    line-height: 2.1;
    text-align: center;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    color: var(--text);
  }

  .lesson-explain {
    background: rgba(15, 133, 86, 0.08);
    border: 1px solid rgba(15, 133, 86, 0.20);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 14px;
  }

  .lesson-explain-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-400);
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .lesson-explain-text {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.65;
  }

  .lesson-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .lesson-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .lesson-card-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    margin: 0 auto 10px;
    color: #fff;
  }

  .lesson-card-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
  }

  .lesson-card-label {
    font-size: 10.5px;
    color: var(--text-3);
    font-weight: 600;
    line-height: 1.4;
  }

  .lesson-section {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .lesson-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-400);
    margin-bottom: 10px;
  }

  .lesson-bullet {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    color: var(--text-2);
    margin-bottom: 7px;
    line-height: 1.55;
  }

  .lesson-bullet::before {
    content: "•";
    color: var(--brand-400);
    font-size: 16px;
    flex-shrink: 0;
    margin-top: -1px;
  }

  .lesson-example {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin-top: 10px;
    border: 1px solid var(--border);
  }

  .lesson-example .ex-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 18px;
    font-weight: 600;
    color: var(--brand-400);
  }

  .lesson-tip {
    background: rgba(192, 122, 30, 0.08);
    border: 1px solid rgba(192, 122, 30, 0.18);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .lesson-tip-icon {
    font-size: 20px;
    flex-shrink: 0;
  }

  .lesson-tip-text {
    font-size: 13.5px;
    color: var(--text-2);
    line-height: 1.55;
  }

  .lesson-tip-text b {
    color: var(--text);
  }

  /* Таблица урока */
  .lesson-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    background: var(--surface);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    font-size: 13px;
  }

  .lesson-table th {
    background: rgba(15, 133, 86, 0.20);
    color: var(--brand-300);
    font-weight: 700;
    font-size: 12px;
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .lesson-table td {
    padding: 9px 10px;
    border-top: 1px solid var(--border);
    color: var(--text-2);
    line-height: 1.45;
    vertical-align: top;
  }

  .lesson-table td:first-child {
    font-family: var(--font-ar-classic);
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-400);
    direction: rtl;
    white-space: nowrap;
  }

  .lesson-table td:nth-child(2) {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
  }

  /* Практика */
  .pr-q {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--s-card);
  }

  .pr-q-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  .pr-q-text {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 12px;
  }

  .pr-q-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    padding: 10px 0 14px;
  }

  .pr-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .pr-opt {
    padding: 11px 14px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    font-size: 14.5px;
    color: var(--text);
    text-align: left;
    transition: all var(--dur-1);
    cursor: pointer;
    width: 100%;
  }

  .pr-opt.sel {
    background: rgba(15, 133, 86, 0.12);
    border-color: rgba(15, 133, 86, 0.40);
    color: var(--brand-400);
    font-weight: 600;
  }

  .pr-opt.ok {
    background: rgba(15, 133, 86, 0.18);
    border-color: var(--brand-500);
    color: var(--brand-300);
    font-weight: 700;
  }

  .pr-opt.bad {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.40);
    color: var(--danger);
    font-weight: 600;
  }

  .pr-open {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-3);
    line-height: 1.5;
    border: 1px dashed var(--border-med);
  }

  .pr-result {
    background: rgba(15, 133, 86, 0.12);
    border: 1px solid rgba(15, 133, 86, 0.25);
    border-radius: var(--r-xl);
    padding: 18px;
    text-align: center;
    margin-bottom: 14px;
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.10);
  }

  .pr-result-n {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 800;
    color: var(--brand-400);
    line-height: 1;
  }

  .pr-result-l {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 5px;
  }

  /* ============================================================
   VIEWPORT
   ============================================================ */
@media (max-width: 375px) {
  .flashcard { padding: 28px 18px 22px; }
  .rate-btn { min-height: 56px; }
  .fc-arabic { font-size: 36px; }
}

/* ============================================================
   ПЛАНШЕТ И НОУТБУК
   ============================================================ */
@media (min-width: 768px) {
  .app { max-width: 720px; padding-bottom: 24px; padding-left: 88px; }
  .bottom-nav { left: 0; right: auto; top: 0; bottom: 0; width: 88px; max-width: 88px; margin: 0; border-top: 0; border-right: 1px solid var(--border); padding: calc(var(--sa-top) + 20px) 0 20px; display: flex; align-items: flex-start; }
  .bottom-nav .nav-inner { grid-template-columns: 1fr; gap: 8px; width: 100%; }
  .nav-btn { padding: 12px 4px; }
  .nav-btn.active::after { display: none; }
  .tile-grid { grid-template-columns: 1fr 1fr 1fr; }
  .sheet, .toast { max-width: 720px; margin-left: auto; margin-right: auto; }
  .sheet { left: 88px; }
}

@media (min-width: 1100px) {
  .app { max-width: 960px; }
  .tile-grid { grid-template-columns: repeat(4, 1fr); }
  .sheet { max-width: 960px; }
}


  /* Light theme */
  html[data-theme="light"] {
    --bg: #F5F5F0;
    --bg-warm: #EFEDE8;
    --surface: #FFFFFF;
    --surface-2: #F5F5F0;
    --surface-3: #ECEAE5;
    --border: rgba(0, 0, 0, 0.07);
    --border-med: rgba(0, 0, 0, 0.11);
    --text: #1A1A18;
    --text-2: #3D3D38;
    --text-3: #888880;
    --muted: #B0AFA8;
    --overlay: rgba(10, 10, 8, 0.45);
    --brand-100: #E4F7EF;
    --brand-050: #F2FBF7;
    --danger: #C0392B;
    --danger-bg: #FEF0EE;
    --warn: #C07A1E;
    --warn-bg: #FEF5E8;
    --s-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --s-sm: 0 2px 8px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    --s-md: 0 6px 20px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.04);
    --s-lg: 0 16px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.05);
    --s-xl: 0 28px 60px rgba(0, 0, 0, 0.14), 0 8px 20px rgba(0, 0, 0, 0.07);
    --s-brand: 0 8px 28px rgba(15, 133, 86, 0.30), 0 2px 8px rgba(15, 133, 86, 0.15);
    --s-card: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --gold-100: #FBF0D9;
  }

  /* ============================================================
   RESET
   ============================================================ */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    height: 100%;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
  }

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

  button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  input,
  select,
  textarea {
    background: none;
    border: 0;
    outline: 0;
  }

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

  ::selection {
    background: rgba(15, 133, 86, 0.25);
    color: var(--brand-400);
  }

  ::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  /* ============================================================
   ГЛОБАЛЬНЫЕ ДЕКОРАТИВНЫЕ ОРЕОЛЫ (только в тёмной теме)
   ============================================================ */
  body::before {
    content: "";
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 500px;
    background: radial-gradient(ellipse at center,
        rgba(15, 133, 86, 0.18) 0%,
        rgba(15, 133, 86, 0.06) 40%,
        transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  body::after {
    content: "";
    position: fixed;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse at center,
        rgba(15, 133, 86, 0.10) 0%,
        transparent 65%);
    pointer-events: none;
    z-index: 0;
  }

  html[data-theme="light"] body::before,
  html[data-theme="light"] body::after {
    display: none;
  }

  /* ============================================================
   LAYOUT SHELL
   ============================================================ */
  .app {
    min-height: 100dvh;
    min-height: 100vh;
    padding-bottom: var(--nav-h);
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  .screen {
    padding: 0 0 24px;
    opacity: 0;
    transform: translateY(10px);
    animation: screenIn var(--dur-3) var(--ease-out) forwards;
  }

  #s-lesson {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .screen.hidden {
    display: none !important;
  }

  @keyframes screenIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* ============================================================
   TOP BAR
   ============================================================ */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--sa-top) + 16px) 16px 12px;
    gap: 10px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }

  .topbar-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    text-align: center;
    flex: 1;
  }

  .topbar-large {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 34px;
    letter-spacing: -0.03em;
    padding: calc(var(--sa-top) + 10px) 20px 6px;
    line-height: 1.15;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-2);
    transition: transform var(--dur-1) var(--ease-spring), background var(--dur-1), box-shadow var(--dur-1);
    flex-shrink: 0;
  }

  .icon-btn:active {
    transform: scale(0.90);
    background: var(--surface-3);
  }

  .icon-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ============================================================
   TYPOGRAPHY
   ============================================================ */
  .h1 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
  }

  .h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
  }

  .h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .h4 {
    font-size: 15px;
    font-weight: 600;
  }

  .muted {
    color: var(--text-3);
    font-size: 13px;
  }

  .tiny {
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.02em;
  }

  .eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
  }

  /* ============================================================
   SECTIONS
   ============================================================ */
  .section {
    margin: 8px 0;
  }

  .section-pad {
    padding: 0 16px;
  }

  .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 10px;
  }

  .section-head .eyebrow {
    font-size: 11.5px;
  }

  .section-head .link {
    color: var(--brand-400);
    font-size: 13.5px;
    font-weight: 600;
  }

  /* GLASS LIST GROUP */
  .list-group {
    background: var(--surface);
    border-radius: var(--r-xl);
    margin: 0 16px;
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .list-group+.list-group {
    margin-top: 10px;
  }

  .list-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    min-height: 56px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
    cursor: pointer;
    transition: background var(--dur-1);
  }

  .list-item:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 58px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .list-item:active {
    background: var(--surface-2);
  }

  .list-item .li-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 14px;
    border: 1px solid var(--border);
  }

  .list-item .li-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .list-item .li-body {
    flex: 1;
    min-width: 0;
  }

  .list-item .li-title {
    font-size: 15.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .list-item .li-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 1px;
  }

  .list-item .li-trail {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    flex-shrink: 0;
  }

  .list-item .li-trail svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .list-item.danger .li-title {
    color: var(--danger);
  }

  .list-item.locked {
    opacity: 0.35;
    pointer-events: none;
  }

  /* ============================================================
   GLASS CARD — базовый компонент
   ============================================================ */
  .card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    margin: 0 16px;
  }

  .card+.card {
    margin-top: 10px;
  }

  /* ============================================================
   HERO CARD — зелёный ореол + стекло
   ============================================================ */
  .hero-card {
    border-radius: var(--r-2xl);
    background: linear-gradient(135deg,
        rgba(15, 133, 86, 0.85) 0%,
        rgba(6, 74, 47, 0.90) 50%,
        rgba(4, 43, 28, 0.95) 100%);
    color: #fff;
    padding: 22px 20px 20px;
    margin: 10px 16px 0;
    position: relative;
    overflow: hidden;
    box-shadow:
      0 0 60px rgba(15, 133, 86, 0.25),
      0 0 120px rgba(15, 133, 86, 0.10),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
    isolation: isolate;
    border: 1px solid rgba(46, 201, 138, 0.25);
  }

  .hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 70% 60% at 100% -10%, rgba(46, 201, 138, 0.25) 0%, transparent 55%),
      radial-gradient(ellipse 50% 70% at -10% 110%, rgba(4, 43, 28, 0.60) 0%, transparent 50%);
    pointer-events: none;
  }

  .hero-card::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 40px solid rgba(46, 201, 138, 0.08);
    pointer-events: none;
  }

  .hero-card .hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    position: relative;
  }

  .hero-card .hero-greeting {
    font-size: 12.5px;
    opacity: 0.70;
    font-weight: 500;
    margin-bottom: 3px;
    letter-spacing: 0.02em;
  }

  .hero-card .hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.02em;
    line-height: 1.2;
  }

  .hero-card .hero-subtitle {
    font-size: 13px;
    opacity: 0.70;
    margin-top: 3px;
    font-weight: 400;
  }

  .hero-brand-ar {
    font-family: var(--font-ar);
    font-size: 28px;
    font-weight: 700;
    opacity: 0.18;
    direction: rtl;
    line-height: 1;
    user-select: none;
  }

  /* Статистика чипы */
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
  }

  .stat-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 11px 8px;
    text-align: center;
    transition: background var(--dur-1);
  }

  .stat-chip:active {
    background: rgba(255, 255, 255, 0.15);
  }

  .stat-chip .stat-n {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.02em;
  }

  .stat-chip .stat-l {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 3px;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  /* Hero buttons */
  .hero-actions {
    display: flex;
    gap: 10px;
    position: relative;
  }

  .btn-hero {
    flex: 1;
    min-height: 46px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    letter-spacing: -0.01em;
    transition: transform var(--dur-1) var(--ease-spring), opacity var(--dur-1);
  }

  .btn-hero:active {
    transform: scale(0.96);
    opacity: 0.88;
  }

  .btn-hero.primary {
    background: rgba(255, 255, 255, 0.95);
    color: #064A2F;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 0 22px rgba(94, 219, 168, 0.45);
  }

  .btn-hero.ghost {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .btn-hero svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ============================================================
   LIBRARY TILES — glass cards
   ============================================================ */
  .tile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px;
  }

  .tile {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 130px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2), border-color var(--dur-2);
    text-align: left;
    width: 100%;
    position: relative;
    overflow: hidden;
  }

  .tile:active {
    transform: scale(0.96);
    border-color: rgba(15, 133, 86, 0.3);
  }

  .tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  }

  .tile .tile-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    border: 1px solid var(--border);
  }

  .tile .tile-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .tile .tile-title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
  }

  .tile .tile-sub {
    font-size: 11.5px;
    color: var(--text-3);
  }

  .tile-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
    margin: -16px -15px 12px -15px;
    border: 0;
    display: block;
  }

  /* ============================================================
   PROGRESS
   ============================================================ */
  .progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    overflow: hidden;
  }

  .progress>i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
    border-radius: inherit;
    transition: width var(--dur-4) var(--ease-out);
  }

  .progress.thin {
    height: 3px;
  }

  .progress.thick {
    height: 7px;
  }

  .ring {
    --size: 48px;
    --val: 0;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--brand-500) calc(var(--val) * 1%), var(--surface-2) 0);
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
  }

  .ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--bg);
  }

  .ring>span {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
  }

  /* ============================================================
   BUTTONS
   ============================================================ */
  .btn {
    min-height: 50px;
    padding: 0 20px;
    border-radius: var(--r-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    transition: transform var(--dur-1) var(--ease-spring), opacity var(--dur-1), box-shadow var(--dur-1);
    width: 100%;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .btn:active {
    transform: scale(0.97);
    opacity: 0.88;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff;
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.30), 0 4px 14px rgba(15, 133, 86, 0.25);
    border: 1px solid rgba(46, 201, 138, 0.20);
  }

  .btn-primary:active {
    box-shadow: none;
  }

  .btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-med);
  }

  .btn-ghost {
    background: transparent;
    color: var(--text);
  }

  .btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.15);
  }

  .btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .btn-row {
    display: flex;
    gap: 10px;
  }

  .btn-row .btn {
    flex: 1;
  }

  /* ============================================================
   CHIP
   ============================================================ */
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border-med);
    transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1) var(--ease-spring);
    white-space: nowrap;
  }

  .chip:active {
    transform: scale(0.95);
  }

  .chip.on {
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    border-color: rgba(15, 133, 86, 0.30);
  }

  .segmented {
    display: flex;
    gap: 0;
    padding: 3px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    margin: 0 16px;
    border: 1px solid var(--border);
  }

  .seg {
    flex: 1;
    min-height: 34px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-2), color var(--dur-2), box-shadow var(--dur-2);
  }

  .seg.on {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: var(--s-sm);
  }

  /* ============================================================
   INPUTS
   ============================================================ */
  .field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
  }

  .field label {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 700;
    padding-left: 2px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text);
    font-size: 16px;
    transition: border-color var(--dur-2), background var(--dur-2), box-shadow var(--dur-2);
  }

  .textarea {
    min-height: 100px;
    padding: 12px 16px;
    resize: vertical;
    line-height: 1.5;
  }

  .input:focus,
  .select:focus,
  .textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px rgba(15, 133, 86, 0.15);
  }

  .input.ar,
  .textarea.ar {
    direction: rtl;
    text-align: right;
    font-family: var(--font-ar-classic);
    font-size: 22px;
  }

  .search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 0 16px;
    min-height: 44px;
    margin: 8px 16px 0;
    border: 1px solid var(--border-med);
  }

  .search-wrap:focus-within {
    border-color: rgba(15, 133, 86, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 133, 86, 0.10);
  }

  .search-wrap svg {
    width: 16px;
    height: 16px;
    color: var(--text-3);
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
  }

  .search-wrap input {
    flex: 1;
    background: none;
    border: 0;
    outline: 0;
    min-height: 44px;
    font-size: 15px;
    color: var(--text);
  }

  .search-wrap input::placeholder {
    color: var(--muted);
  }

  /* ============================================================
   WORD ROW
   ============================================================ */
  .word-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: transparent;
    position: relative;
  }

  .word-row:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 54px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .word-row .wr-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
  }

  .word-row .wr-ru {
    color: var(--text-3);
    font-size: 13.5px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .word-row .wr-fav {
    color: var(--muted);
    padding: 6px;
    flex-shrink: 0;
    transition: color var(--dur-1), transform var(--dur-1) var(--ease-spring);
  }

  .word-row .wr-fav.on {
    color: var(--gold-400);
  }

  .word-row .wr-fav:active {
    transform: scale(1.3);
  }

  .word-row .wr-fav svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .word-row .wr-fav.on svg {
    fill: currentColor;
  }

  /* ============================================================
   FLASHCARD (STUDY)
   ============================================================ */
  .study-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px 14px;
  }

  .study-header .progress {
    flex: 1;
  }

  .study-header .count {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .flashcard-wrap {
    padding: 0 16px;
  }

  .flashcard {
    background: var(--surface);
    border-radius: var(--r-2xl);
    padding: 36px 26px 28px;
    min-height: 290px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--s-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    gap: 0;
    isolation: isolate;
  }

  .flashcard::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 100% 50% at 50% -5%, rgba(15, 133, 86, 0.12), transparent 65%);
  }

  .flashcard::after {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    pointer-events: none;
  }

  .fc-type-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid rgba(15, 133, 86, 0.25);
  }

  .fc-arabic {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: clamp(40px, 11vw, 60px);
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    word-break: break-word;
    width: 100%;
    color: var(--text);
    position: relative;
    z-index: 1;
  }

  .fc-divider {
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: var(--border-med);
    margin: 14px 0;
    opacity: 0;
    transition: opacity var(--dur-2) var(--ease);
  }

  .fc-translation {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-2);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
    min-height: 26px;
    position: relative;
    z-index: 1;
  }

  .fc-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity var(--dur-2);
    position: relative;
    z-index: 1;
  }

  .fc-hint svg {
    opacity: 0.6;
  }

  .flashcard.revealed .fc-divider {
    opacity: 1;
  }

  .flashcard.revealed .fc-translation {
    opacity: 1;
    transform: translateY(0);
  }

  .flashcard.revealed .fc-hint {
    opacity: 0;
    pointer-events: none;
  }

  .flashcard.swipe-left {
    transform: translateX(-48%) rotate(-9deg);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.swipe-right {
    transform: translateX(48%) rotate(9deg);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.swipe-up {
    transform: translateY(-30%) scale(0.95);
    opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
  }

  .flashcard.enter {
    animation: fcEnter var(--dur-4) var(--ease-out);
  }

  @keyframes fcEnter {
    from {
      opacity: 0;
      transform: translateY(20px) scale(0.95);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  .rate-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 12px 16px 0;
  }

  .rate-btn {
    min-height: 62px;
    border-radius: var(--r-md);
    font-weight: 700;
    font-size: 13.5px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: transform var(--dur-1) var(--ease-spring), filter var(--dur-1), box-shadow var(--dur-1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
  }

  .rate-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.20);
  }

  .rate-btn:active {
    transform: scale(0.95);
    filter: brightness(0.85);
    box-shadow: none;
  }

  .rate-btn .rb-label {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .rate-btn .rb-interval {
    font-size: 10px;
    opacity: 0.80;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .rate-btn.hard {
    background: linear-gradient(160deg, rgba(224, 80, 96, 0.90), rgba(192, 57, 43, 0.90));
    box-shadow: 0 4px 20px rgba(192, 57, 43, 0.30);
  }

  .rate-btn.ok {
    background: linear-gradient(160deg, rgba(232, 168, 64, 0.90), rgba(192, 122, 30, 0.90));
    box-shadow: 0 4px 20px rgba(192, 122, 30, 0.30);
  }

  .rate-btn.easy {
    background: linear-gradient(160deg, rgba(46, 201, 138, 0.90), rgba(15, 133, 86, 0.90));
    box-shadow: 0 4px 20px rgba(15, 133, 86, 0.35);
  }

  /* Summary */
  .summary-card {
    background: var(--surface);
    border-radius: var(--r-2xl);
    padding: 32px 22px;
    margin: 0 16px;
    text-align: center;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .summary-emoji {
    font-size: 44px;
    margin-bottom: 14px;
  }

  .summary-accuracy {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-300));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .summary-label {
    font-size: 14px;
    color: var(--text-3);
    margin-top: 5px;
  }

  .summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
  }

  .summary-stat {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 14px 8px;
    border: 1px solid var(--border);
  }

  .summary-stat .ss-n {
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.02em;
  }

  .summary-stat .ss-l {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
    font-weight: 500;
  }

  /* ============================================================
   STATS SCREEN
   ============================================================ */
  .kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px;
  }

  .kpi {
    padding: 18px 16px;
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .kpi .kpi-label {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .kpi .kpi-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 30px;
    margin-top: 6px;
    line-height: 1;
    letter-spacing: -0.03em;
  }

  .kpi .kpi-detail {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
  }

  .kpi.accent {
    background: rgba(15, 133, 86, 0.10);
    border-color: rgba(15, 133, 86, 0.25);
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.08);
  }

  .kpi.accent .kpi-value {
    color: var(--brand-400);
  }

  .heatmap-card {
    margin: 0 16px;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .heatmap {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 3px;
    margin-top: 12px;
  }

  .heatmap .hm-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--surface-3);
  }

  .heatmap .hm-cell[data-l="1"] {
    background: rgba(15, 133, 86, 0.22);
  }

  .heatmap .hm-cell[data-l="2"] {
    background: rgba(15, 133, 86, 0.44);
  }

  .heatmap .hm-cell[data-l="3"] {
    background: rgba(15, 133, 86, 0.68);
  }

  .heatmap .hm-cell[data-l="4"] {
    background: var(--brand-500);
    box-shadow: 0 0 6px rgba(15, 133, 86, 0.5);
  }

  .heatmap-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
    font-size: 10.5px;
    color: var(--text-3);
    margin-top: 10px;
    font-weight: 500;
  }

  .heatmap-legend .lsq {
    width: 10px;
    height: 10px;
    border-radius: 2px;
  }

  /* ============================================================
   BOTTOM NAV — glass
   ============================================================ */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 430px;
    margin: 0 auto;
    padding: 6px 4px calc(6px + var(--sa-bot));
    background: rgba(6, 6, 8, 0.75);
    backdrop-filter: saturate(2) blur(30px);
    -webkit-backdrop-filter: saturate(2) blur(30px);
    border-top: 1px solid var(--border);
    z-index: 40;
  }

  html[data-theme="light"] .bottom-nav {
    background: rgba(245, 245, 240, 0.85);
  }

  .bottom-nav .nav-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-btn {
    padding: 6px 4px 3px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-3);
    transition: color var(--dur-2);
    position: relative;
  }

  .nav-btn svg {
    width: 23px;
    height: 23px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--dur-2) var(--ease-spring);
  }

  .nav-btn .nav-lbl {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color var(--dur-2);
  }

  .nav-btn.active {
    color: var(--brand-400);
  }

  .nav-btn.active svg {
    transform: scale(1.1);
    stroke-width: 2;
  }

  .nav-btn.active::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brand-400);
    box-shadow: 0 0 6px var(--brand-400);
    animation: navDot var(--dur-3) var(--ease-spring);
  }

  @keyframes navDot {
    from {
      transform: translateX(-50%) scale(0);
      opacity: 0;
    }

    to {
      transform: translateX(-50%) scale(1);
      opacity: 1;
    }
  }

  /* ============================================================
   SHEET — glass
   ============================================================ */
  .sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-3) var(--ease);
  }

  .sheet-backdrop.on {
    opacity: 1;
    pointer-events: auto;
  }

  .sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 430px;
    margin: 0 auto;
    background: rgba(14, 14, 12, 0.90);
    border-radius: 26px 26px 0 0;
    z-index: 51;
    transform: translateY(100%);
    transition: transform var(--dur-4) var(--ease-out);
    padding: 0 18px calc(22px + var(--sa-bot));
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
  }

  html[data-theme="light"] .sheet {
    background: rgba(255, 255, 255, 0.95);
  }

  .sheet.on {
    transform: translateY(0);
  }

  .sheet .sheet-handle {
    width: 32px;
    height: 4px;
    border-radius: 3px;
    background: var(--border-med);
    margin: 12px auto 18px;
  }

  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .sheet-head .sheet-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  body.sheet-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ============================================================
   TOAST
   ============================================================ */
  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 14px);
    transform: translate(-50%, 14px);
    background: rgba(14, 14, 12, 0.90);
    color: var(--text);
    padding: 11px 20px;
    border-radius: var(--r-pill);
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--s-xl), 0 0 0 1px var(--border);
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring);
    white-space: nowrap;
    letter-spacing: 0.01em;
  }

  html[data-theme="light"] .toast {
    background: rgba(26, 26, 24, 0.90);
    color: #F0F0EE;
  }

  .toast.on {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  /* ============================================================
   MISC UTILITIES
   ============================================================ */
  .divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
  }

  .spacer {
    height: 16px;
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 20px;
    color: var(--text-3);
    text-align: center;
  }

  .empty-state .es-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    font-size: 26px;
  }

  .empty-state .es-icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .empty-state .es-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 6px;
  }

  .empty-state .es-text {
    font-size: 14px;
    line-height: 1.55;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--r-pill);
    letter-spacing: 0.02em;
  }

  .badge.green {
    background: rgba(15, 133, 86, 0.15);
    color: var(--brand-400);
    border: 1px solid rgba(15, 133, 86, 0.25);
  }

  .badge.red {
    background: var(--danger-bg);
    color: var(--danger);
  }

  .badge.yellow {
    background: var(--warn-bg);
    color: var(--warn);
  }

  .badge.gray {
    background: var(--surface-2);
    color: var(--text-3);
  }

  .lock-badge {
    position: absolute;
    top: 11px;
    right: 11px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    display: grid;
    place-items: center;
  }

  .lock-badge svg {
    width: 11px;
    height: 11px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .words-group {
    background: var(--surface);
    border-radius: var(--r-xl);
    margin: 0 16px;
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: transparent;
    position: relative;
  }

  .settings-toggle:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 0;
    height: 1px;
    background: var(--border);
  }

  .toggle-track {
    width: 50px;
    height: 30px;
    border-radius: 15px;
    background: var(--surface-3);
    border: 1px solid var(--border-med);
    position: relative;
    transition: background var(--dur-2), border-color var(--dur-2);
    cursor: pointer;
    flex-shrink: 0;
  }

  .toggle-track.on {
    background: var(--brand-500);
    border-color: var(--brand-500);
    box-shadow: 0 0 12px rgba(15, 133, 86, 0.40);
  }

  .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform var(--dur-2) var(--ease-spring);
  }

  .toggle-track.on .toggle-thumb {
    transform: translateX(20px);
  }

  .chips-scroll {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chips-scroll::-webkit-scrollbar {
    display: none;
  }

  .unit-info-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 18px;
    margin: 0 16px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .unit-info-card .ui-row {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .ico-green {
    background: rgba(15, 133, 86, 0.12);
    color: var(--brand-400);
  }

  .ico-blue {
    background: rgba(26, 108, 214, 0.12);
    color: #60A5FA;
  }

  .ico-orange {
    background: rgba(192, 122, 30, 0.12);
    color: var(--gold-400);
  }

  .ico-red {
    background: rgba(248, 113, 113, 0.12);
    color: #F87171;
  }

  .ico-purple {
    background: rgba(124, 58, 237, 0.12);
    color: #C084FC;
  }

  .ico-pink {
    background: rgba(190, 24, 93, 0.12);
    color: #F472B6;
  }

  .ico-brand {
    background: rgba(15, 133, 86, 0.12);
    color: var(--brand-400);
  }

  /* ============================================================
   ANIMATION UTILITIES
   ============================================================ */
  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: 0.5;
    }
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(14px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .animate-in {
    animation: slideUp var(--dur-3) var(--ease-out) both;
  }

  .btn,
  .nav-btn,
  .tile,
  .list-item,
  .chip,
  .seg,
  .rate-btn,
  .icon-btn {
    -webkit-user-select: none;
    user-select: none;
  }

  :focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
  }

  /* ============================================================
   LESSON SCREEN
   ============================================================ */
  .lesson-arabic-text {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 600;
    line-height: 2.1;
    text-align: center;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    color: var(--text);
  }

  .lesson-explain {
    background: rgba(15, 133, 86, 0.08);
    border: 1px solid rgba(15, 133, 86, 0.20);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 14px;
  }

  .lesson-explain-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-400);
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .lesson-explain-text {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.65;
  }

  .lesson-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .lesson-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .lesson-card-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    margin: 0 auto 10px;
    color: #fff;
  }

  .lesson-card-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
  }

  .lesson-card-label {
    font-size: 10.5px;
    color: var(--text-3);
    font-weight: 600;
    line-height: 1.4;
  }

  .lesson-section {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
  }

  .lesson-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-400);
    margin-bottom: 10px;
  }

  .lesson-bullet {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    color: var(--text-2);
    margin-bottom: 7px;
    line-height: 1.55;
  }

  .lesson-bullet::before {
    content: "•";
    color: var(--brand-400);
    font-size: 16px;
    flex-shrink: 0;
    margin-top: -1px;
  }

  .lesson-example {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin-top: 10px;
    border: 1px solid var(--border);
  }

  .lesson-example .ex-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 18px;
    font-weight: 600;
    color: var(--brand-400);
  }

  .lesson-tip {
    background: rgba(192, 122, 30, 0.08);
    border: 1px solid rgba(192, 122, 30, 0.18);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .lesson-tip-icon {
    font-size: 20px;
    flex-shrink: 0;
  }

  .lesson-tip-text {
    font-size: 13.5px;
    color: var(--text-2);
    line-height: 1.55;
  }

  .lesson-tip-text b {
    color: var(--text);
  }

  /* Таблица урока */
  .lesson-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    background: var(--surface);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--s-card);
    border: 1px solid var(--border);
    font-size: 13px;
  }

  .lesson-table th {
    background: rgba(15, 133, 86, 0.20);
    color: var(--brand-300);
    font-weight: 700;
    font-size: 12px;
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .lesson-table td {
    padding: 9px 10px;
    border-top: 1px solid var(--border);
    color: var(--text-2);
    line-height: 1.45;
    vertical-align: top;
  }

  .lesson-table td:first-child {
    font-family: var(--font-ar-classic);
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-400);
    direction: rtl;
    white-space: nowrap;
  }

  .lesson-table td:nth-child(2) {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
  }

  /* Практика */
  .pr-q {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--s-card);
  }

  .pr-q-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  .pr-q-text {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 12px;
  }

  .pr-q-ar {
    font-family: var(--font-ar-classic);
    direction: rtl;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    padding: 10px 0 14px;
  }

  .pr-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .pr-opt {
    padding: 11px 14px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    font-size: 14.5px;
    color: var(--text);
    text-align: left;
    transition: all var(--dur-1);
    cursor: pointer;
    width: 100%;
  }

  .pr-opt.sel {
    background: rgba(15, 133, 86, 0.12);
    border-color: rgba(15, 133, 86, 0.40);
    color: var(--brand-400);
    font-weight: 600;
  }

  .pr-opt.ok {
    background: rgba(15, 133, 86, 0.18);
    border-color: var(--brand-500);
    color: var(--brand-300);
    font-weight: 700;
  }

  .pr-opt.bad {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.40);
    color: var(--danger);
    font-weight: 600;
  }

  .pr-open {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-3);
    line-height: 1.5;
    border: 1px dashed var(--border-med);
  }

  .pr-result {
    background: rgba(15, 133, 86, 0.12);
    border: 1px solid rgba(15, 133, 86, 0.25);
    border-radius: var(--r-xl);
    padding: 18px;
    text-align: center;
    margin-bottom: 14px;
    box-shadow: 0 0 30px rgba(15, 133, 86, 0.10);
  }

  .pr-result-n {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 800;
    color: var(--brand-400);
    line-height: 1;
  }

  .pr-result-l {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 5px;
  }

  /* ============================================================
   VIEWPORT
   ============================================================ */
  @media (max-width: 375px) {
    .flashcard {
      padding: 28px 18px 22px;
    }

    .rate-btn {
      min-height: 56px;
    }

    .fc-arabic {
      font-size: 36px;
    }
  }

  /* ============================================================
   ПЛАНШЕТ И НОУТБУК
   ============================================================ */
  @media (min-width: 768px) {
    .app {
      max-width: 720px;
      padding-bottom: 24px;
      padding-left: 88px;
    }

    .bottom-nav {
      left: 0;
      right: auto;
      top: 0;
      bottom: 0;
      width: 88px;
      max-width: 88px;
      margin: 0;
      border-top: 0;
      border-right: 1px solid var(--border);
      padding: calc(var(--sa-top) + 20px) 0 20px;
      display: flex;
      align-items: flex-start;
    }

    .bottom-nav .nav-inner {
      grid-template-columns: 1fr;
      gap: 8px;
      width: 100%;
    }

    .nav-btn {
      padding: 12px 4px;
    }

    .nav-btn.active::after {
      display: none;
    }

    .tile-grid {
      grid-template-columns: 1fr 1fr 1fr;
    }

    .sheet,
    .toast {
      max-width: 720px;
      margin-left: auto;
      margin-right: auto;
    }

    .sheet {
      left: 88px;
    }
  }

  @media (min-width: 1100px) {
    .app {
      max-width: 960px;
    }

    .tile-grid {
      grid-template-columns: repeat(4, 1fr);
    }

    .sheet {
      max-width: 960px;
    }
  }

  .tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--s-lg), 0 0 30px rgba(15, 133, 86, 0.12);
    border-color: rgba(15, 133, 86, 0.25)
  }

