/* ==========================================================================
   Русский Квест — visual refresh layer (loaded last, overrides the base theme)
   Vazirmatn for Persian UI, Segoe/Arial kept for Russian text.
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Variable.woff2') format('woff2-variations'),
       url('fonts/Vazirmatn-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  --font-fa: 'Vazirmatn', Tahoma, 'Segoe UI', Arial, sans-serif;
  --font-ru: 'Segoe UI', Arial, sans-serif;

  --bg: #f5f7fc;
  --bg-deep: #eef2fa;
  --surface: #ffffff;
  --ink: #101a2e;
  --ink-soft: #2b3a55;
  --muted: #66738c;
  --line: #e5eaf4;
  --line-strong: #d5ddec;

  --primary: #5b4bf0;
  --primary-2: #7c5cff;
  --primary-soft: #eeecff;
  --secondary: #0fa58e;
  --amber: #e79a2a;
  --red: #dc5573;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(21, 35, 60, .06), 0 2px 6px rgba(21, 35, 60, .04);
  --shadow-md: 0 18px 44px rgba(21, 35, 60, .09);
  --shadow-lg: 0 30px 70px rgba(21, 35, 60, .14);
  --ring: 0 0 0 4px rgba(91, 75, 240, .14);
}

/* ---------- typography ---------- */
html { -webkit-text-size-adjust: 100%; }
body,
button,
input,
textarea,
select,
.btn,
.nav-btn,
.f-link,
.stat,
.pill,
.tagline,
.feedback,
.modal,
.card,
h1, h2, h3, h4, p, li, small, strong, b, label {
  font-family: var(--font-fa);
}
body {
  background:
    radial-gradient(1200px 600px at 100% -10%, #e8e6ff 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 10%, #e4f6f4 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.95;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { letter-spacing: 0; line-height: 1.55; color: var(--ink); }
h1 { font-size: clamp(24px, 2.1vw, 31px); font-weight: 800; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 16.5px; font-weight: 700; }
h4 { font-size: 13px; font-weight: 700; }
p { line-height: 1.95; }
strong, b { font-weight: 700; }

/* Russian content keeps a Cyrillic-friendly stack */
.ru, [lang="ru"], .sentence-ru, .conversation-choice, .studio-scene .ru,
.lingua-russian, .reading-text.ru, .hero:after {
  font-family: var(--font-ru);
}

/* ---------- layout ---------- */
.main { padding: 34px max(26px, 4vw) 80px; }
.top { margin-bottom: 24px; gap: 18px; }
.eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--primary);
  opacity: .9;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: linear-gradient(178deg, #0d1730 0%, #17224a 48%, #241c58 100%);
  box-shadow: 18px 0 50px rgba(13, 23, 48, .16);
  padding: 24px 16px;
}
.brand { padding: 2px 8px 26px; gap: 11px; }
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 15px;
  background: linear-gradient(140deg, #8f7dff, #5b4bf0 60%, #4a2fd0);
  box-shadow: 0 10px 26px rgba(91, 75, 240, .45), inset 0 1px 0 #ffffff30;
  font-family: var(--font-ru);
}
.brand strong { font-size: 18px; font-weight: 800; letter-spacing: .01em; }
.brand small { font-size: 10.5px; color: #9fadd0; }

.nav-label {
  font-size: 9.5px;
  letter-spacing: .14em;
  color: #7f8db2;
  padding: 6px 12px 10px;
  font-weight: 700;
}
.nav-btn {
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 3px;
  font-size: 13.5px;
  font-weight: 600;
  color: #a7b4d0;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-btn:hover { background: #ffffff12; color: #fff; }
.nav-btn.active {
  background: linear-gradient(92deg, #ffffff1f, #ffffff0d);
  color: #fff;
  box-shadow: inset 0 0 0 1px #ffffff1f, 0 8px 20px #0a142e40;
}
.nav-btn.active .glyph { opacity: 1; }
.nav-btn .glyph { font-size: 18px; width: 22px; opacity: .95; }

.side-bottom {
  background: linear-gradient(150deg, #ffffff14, #ffffff08);
  border: 1px solid #ffffff1a;
  border-radius: 16px;
  padding: 15px;
}
.side-bottom .label { color: #9fadd0; font-size: 10.5px; }
.side-bottom strong { font-size: 14.5px; }
.progress { background: #e9edf7; height: 8px; border-radius: 99px; }
.progress > span {
  background: linear-gradient(90deg, #8f7dff, #5b4bf0);
  box-shadow: 0 0 12px #7c5cff80;
}
.side-bottom .progress { background: #ffffff1f; }

/* ---------- cards & surfaces ---------- */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
}
.skill, .lesson, .week-card, .dialogue-card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.skill:hover, .lesson:hover, .week-card:hover, .dialogue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cfc9ff;
}
.skill { border-radius: 20px; }
.skill-icon {
  width: 46px; height: 46px; border-radius: 15px;
  background: var(--primary-soft);
  font-size: 22px;
}
.skill:nth-child(2) .skill-icon { background: #e2f7f3; }
.skill:nth-child(3) .skill-icon { background: #fff4e3; }
.skill:nth-child(4) .skill-icon { background: #ffeef2; }
.skill .arrow { color: var(--primary); font-weight: 700; }

.lesson { border-radius: 18px; padding: 18px; }
.lesson-emoji { background: #f2f4fb; border-radius: 15px; }

/* ---------- hero ---------- */
.hero {
  border-radius: 26px;
  background:
    radial-gradient(120% 130% at 88% 8%, #7c5cff55 0%, transparent 46%),
    radial-gradient(90% 120% at 12% 100%, #0fa58e3d 0%, transparent 52%),
    linear-gradient(118deg, #101a33 0%, #221d5c 58%, #3b2a80 100%);
  box-shadow: 0 26px 60px rgba(23, 28, 74, .28), inset 0 1px 0 #ffffff1f;
  padding: 34px;
}
.hero:after {
  font-family: var(--font-ru);
  color: #ffffff0d;
  left: 34px;
}
.hero h2 { font-size: clamp(22px, 2.1vw, 30px); font-weight: 800; line-height: 1.5; }
.hero p { color: #c6cdf0; }
.hero .eyebrow { color: #b9b1ff; }

/* ---------- stats ---------- */
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 9px 14px;
  box-shadow: 0 4px 14px rgba(21, 35, 60, .04);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat small { font-weight: 500; }
.stat .em { font-size: 16px; }

/* ---------- buttons ---------- */
.btn {
  border-radius: 13px;
  padding: 11px 19px;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, background .18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #5b4bf0, #7c5cff);
  box-shadow: 0 10px 24px rgba(91, 75, 240, .30);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(91, 75, 240, .38); }
.btn-light { background: #fff; color: #2b2168; box-shadow: 0 10px 24px #00000026; }
.btn-ghost { background: var(--primary-soft); color: #4a3ad6; }
.btn-outline { border: 1px solid var(--line-strong); color: var(--ink-soft); background: #fff; }
.btn-outline:hover:not(:disabled) { border-color: #b9afff; background: #fbfaff; }
.btn-red { background: #ffeef2; color: #b63a5e; }

/* ---------- forms ---------- */
.answer, .filter, input[type="text"], input[type="email"], input[type="password"], select, textarea {
  border-radius: 13px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  padding: 12px 15px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.answer:focus, .filter:focus, select:focus, textarea:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: #9a8bf7;
  box-shadow: var(--ring);
}
.answer.ru, textarea.ru, input.ru { font-family: var(--font-ru); }

/* ---------- bits ---------- */
.pill { border-radius: 999px; padding: 4px 11px; font-weight: 700; }
.tagline { border-radius: 999px; background: #eef3fb; color: #34506e; }
.choice { border-radius: 15px; border: 1.5px solid var(--line-strong); font-weight: 600; }
.choice:hover { border-color: #a99cf8; background: #faf9ff; }
.choice.selected { background: #efecff; border-color: var(--primary); box-shadow: 0 0 0 3px #5b4bf014; }
.feedback { border-radius: 15px; background: #f3f6fc; }
.reading-text { border-radius: 18px; border-right: 4px solid #a79bfa; background: #f7f9fd; }
.empty { border-radius: 18px; }
.milestone { border-radius: 15px; background: #f5f7fc; }
.day i { border-radius: 10px; }

/* ---------- account / cloud panel ---------- */
#cloudIdentity { font-weight: 600; }

/* ---------- studio overview metrics ---------- */
.studio-overview { gap: 14px; }
.studio-overview .metric {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
.studio-overview .metric::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #8b7bff, #5b4bf0);
}
.studio-overview .metric:nth-child(2)::before { background: linear-gradient(180deg, #4dd6bb, #0fa58e); }
.studio-overview .metric:nth-child(3)::before { background: linear-gradient(180deg, #f8c76b, #e79a2a); }
.studio-overview .metric:nth-child(4)::before { background: linear-gradient(180deg, #ff9bb2, #dc5573); }
.studio-overview .metric strong {
  font-size: 29px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: 0;
  unicode-bidi: isolate;
}
.studio-overview .metric span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- mobile tab bar ---------- */
body.has-mtabs .sidebar { display: none; }
body.has-mtabs .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.mtabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 48;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #101a33f5, #1a2150fa);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid #ffffff14;
  box-shadow: 0 -12px 34px rgba(13, 23, 48, .30);
}
body.has-mtabs .mtabs { display: grid; }
.mtab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: 0;
  color: #93a2c4;
  padding: 6px 2px;
  border-radius: 13px;
  min-height: 54px;
  min-width: 0;
  transition: background .18s ease, color .18s ease;
}
.mtab-ico { font-size: 19px; line-height: 1; }
.mtab-lbl {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-fa);
}
.mtab.on { color: #fff; background: #ffffff17; }
.mtab.on .mtab-lbl { font-weight: 700; }

/* ---------- "more" sheet ---------- */
.msheet {
  position: fixed;
  inset: 0;
  z-index: 66;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: #0b1838b3;
}
.msheet.open { display: flex; }
.msheet-box {
  width: 100%;
  max-width: 560px;
  max-height: 78vh;
  overflow: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(11, 24, 56, .35);
}
.msheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.msheet-head strong { font-size: 15px; font-weight: 800; }
.msheet-x { width: 32px; height: 32px; border: 0; border-radius: 10px; background: #f1f4fa; color: #5a6780; font-size: 14px; }
.msheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mrow {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: right;
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 12px;
  color: var(--ink-soft);
  font: 600 12.5px var(--font-fa);
}
.mrow-ico { font-size: 16px; line-height: 1; }
.mrow.on { background: #eeecff; border-color: #c9c1ff; color: #4a3ad6; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer h4 { color: var(--ink); letter-spacing: .01em; }
.f-link { color: var(--muted); font-weight: 500; font-size: 13px; }
.f-link:hover, .f-link:focus-visible { color: var(--primary); }
.f-brand b { font-size: 17px; letter-spacing: .01em; }
.f-brand p { color: var(--muted); }
.f-dot { box-shadow: 0 0 0 3px #0fa58e22; }
#fToTop { border-radius: 11px; font-weight: 700; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .main { padding: 18px 14px 104px; }
  .mobile-header { font-weight: 800; color: var(--primary); letter-spacing: .01em; }
  .sidebar {
    height: auto;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #101a33f2, #1b2154f2);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 -14px 40px rgba(13, 23, 48, .28);
    overflow: hidden;
  }
  .sidebar nav {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    gap: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    padding-inline-end: 20px;
    -webkit-mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    min-width: 74px;
    scroll-snap-align: center;
    padding: 7px 9px;
    font-size: 10.5px;
    border-radius: 11px;
  }
  .nav-btn .glyph { font-size: 18px; }
  .nav-btn.active { background: #ffffff1f; }
  .card { padding: 18px; border-radius: 20px; }
  .hero { padding: 24px; border-radius: 22px; }
  .btn { padding: 10px 16px; }
  .site-footer { border-top-color: var(--line); }
}

/* ---------- motion & a11y ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
:focus-visible { outline: 2px solid #8f7dff; outline-offset: 2px; border-radius: 8px; }
::selection { background: #cfc7ff; color: #1b1440; }

/* subtle scrollbars on desktop */
@media (min-width: 721px) {
  .sidebar::-webkit-scrollbar { width: 8px; }
  .sidebar::-webkit-scrollbar-thumb { background: #ffffff20; border-radius: 99px; }
  body::-webkit-scrollbar { width: 10px; }
  body::-webkit-scrollbar-thumb { background: #cfd7e8; border-radius: 99px; }
  body::-webkit-scrollbar-track { background: transparent; }
}
