/* ============================================================
   کوییزنت — سیستم طراحی
   ============================================================ */

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

:root {
  --brand: #58cc02;
  --brand-d: #3f9402;
  --brand-l: #e8ffd6;
  --brand-soft: #f5ffed;
  --brand-1: #6bdd12;
  --brand-2: #4eb902;
  --brand-3: #3a8a02;
  --brand-glow: rgba(88, 204, 2, 0.9);
  --violet: #7c5cfc;
  --violet-d: #6142e6;
  --sky: #38bdf8;
  --sky-d: #0e94cf;
  --orange: #ff9600;
  --orange-d: #d97a00;
  --rose: #fb7185;
  --rose-d: #e04a60;
  --amber: #ffc800;
  --ink: #1a2330;
  --ink-2: #46535f;
  --muted: #7c8894;
  --line: #e6ece4;
  --line-2: #f0f4ee;
  --surface: #ffffff;
  --surface-2: #f6faf3;
  --surface-3: #fbfdf9;
  --bg: #f7faf4;
  --chrome: rgba(255, 255, 255, 0.86);
  --chrome-strong: rgba(255, 255, 255, 0.94);
  --tabs-bg: #eef2ec;
  --body-glow-1: #e9ffd8;
  --body-glow-2: #e8f4ff;
  --body-glow-3: #f2ecff;
  --landing-blob-1: #dcffc0;
  --landing-blob-2: #e3dcff;
  --highlight-1: #d8ffb6;
  --highlight-2: #b6f48a;
  --me-a: #f7ffee;
  --me-b: #f2ffe2;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow-xs: 0 1px 2px rgba(26, 35, 48, 0.05);
  --shadow-sm: 0 6px 18px -10px rgba(26, 35, 48, 0.22);
  --shadow-md: 0 16px 38px -22px rgba(26, 35, 48, 0.34);
  --shadow-lg: 0 30px 70px -34px rgba(26, 35, 48, 0.45);
  --tabbar-h: 62px;
  --topbar-h: 69px;
  --bg-soft: var(--surface-2);
}

/* ---------------- تم‌های انتخابی ---------------- */

html[data-theme='ocean'] {
  --brand: #0ea5a4;
  --brand-d: #0b7f7e;
  --brand-l: #c9fbf7;
  --brand-soft: #effdfb;
  --brand-1: #2ccfc7;
  --brand-2: #0a9d9a;
  --brand-3: #077a78;
  --brand-glow: rgba(14, 165, 164, 0.85);
  --bg: #eefaf9;
  --surface-2: #f0fbfa;
  --surface-3: #f8fffe;
  --line: #dcefec;
  --line-2: #ecf7f5;
  --tabs-bg: #e2f4f2;
  --body-glow-1: #d7fbf6;
  --body-glow-2: #dcf2ff;
  --body-glow-3: #e6fffb;
  --landing-blob-1: #c8f7f0;
  --landing-blob-2: #d5e9ff;
  --highlight-1: #bff5ee;
  --highlight-2: #93ecdf;
  --me-a: #effcfa;
  --me-b: #e2fbf6;
}

html[data-theme='sunset'] {
  --brand: #f97316;
  --brand-d: #c2410c;
  --brand-l: #ffedd5;
  --brand-soft: #fff7ed;
  --brand-1: #fb923c;
  --brand-2: #f0640a;
  --brand-3: #c2410c;
  --brand-glow: rgba(249, 115, 22, 0.85);
  --bg: #fff8f1;
  --surface-2: #fff5eb;
  --surface-3: #fffaf4;
  --line: #f3e2d1;
  --line-2: #fbf0e6;
  --tabs-bg: #f8e9db;
  --body-glow-1: #ffe7cf;
  --body-glow-2: #ffe3e8;
  --body-glow-3: #fff0d6;
  --landing-blob-1: #ffd9b8;
  --landing-blob-2: #ffd9df;
  --highlight-1: #ffe0b8;
  --highlight-2: #ffc98f;
  --me-a: #fff7ee;
  --me-b: #ffefdf;
}

html[data-theme='rose'] {
  --brand: #ec4899;
  --brand-d: #be185d;
  --brand-l: #fce7f3;
  --brand-soft: #fdf2f8;
  --brand-1: #f472b6;
  --brand-2: #db2777;
  --brand-3: #be185d;
  --brand-glow: rgba(236, 72, 153, 0.85);
  --bg: #fff5fa;
  --surface-2: #fdf1f7;
  --surface-3: #fff9fc;
  --line: #f3dfea;
  --line-2: #fbebf3;
  --tabs-bg: #f8e4ef;
  --body-glow-1: #ffe0ef;
  --body-glow-2: #ffe8f5;
  --body-glow-3: #f4e6ff;
  --landing-blob-1: #ffd6e9;
  --landing-blob-2: #f0dcff;
  --highlight-1: #ffd3e7;
  --highlight-2: #ffb8d6;
  --me-a: #fff5fa;
  --me-b: #ffe9f4;
}

html[data-theme='violet'] {
  --brand: #8b5cf6;
  --brand-d: #6d28d9;
  --brand-l: #ede9fe;
  --brand-soft: #f5f3ff;
  --brand-1: #a78bfa;
  --brand-2: #7c3aed;
  --brand-3: #6d28d9;
  --brand-glow: rgba(139, 92, 246, 0.85);
  --bg: #faf7ff;
  --surface-2: #f6f2ff;
  --surface-3: #fcfaff;
  --line: #e8e0f8;
  --line-2: #f2ecfc;
  --tabs-bg: #ece4fb;
  --body-glow-1: #eee3ff;
  --body-glow-2: #e6eafd;
  --body-glow-3: #f8e2ff;
  --landing-blob-1: #e3d8ff;
  --landing-blob-2: #d9e5ff;
  --highlight-1: #e4d8ff;
  --highlight-2: #cdb6ff;
  --me-a: #f8f4ff;
  --me-b: #efe7ff;
}

html[data-theme='midnight'] {
  color-scheme: dark;
  --brand: #6ee62f;
  --brand-d: #8df05a;
  --brand-l: rgba(110, 230, 47, 0.16);
  --brand-soft: rgba(110, 230, 47, 0.08);
  --brand-1: #7ceb3c;
  --brand-2: #52c40e;
  --brand-3: #3b8f07;
  --brand-glow: rgba(110, 230, 47, 0.5);
  --violet: #a78bfa;
  --violet-d: #c4b5fd;
  --sky: #5cc8ff;
  --sky-d: #7dd8ff;
  --orange: #ffb020;
  --orange-d: #ffca5c;
  --rose: #ff8098;
  --rose-d: #ff9fae;
  --amber: #ffd24d;
  --ink: #e9f0f6;
  --ink-2: #bac8d4;
  --muted: #8597a6;
  --line: #26333f;
  --line-2: #1e2933;
  --surface: #151d26;
  --surface-2: #1a2430;
  --surface-3: #1d2833;
  --bg: #0c1218;
  --chrome: rgba(18, 26, 35, 0.88);
  --chrome-strong: rgba(18, 26, 35, 0.95);
  --tabs-bg: #1b2733;
  --body-glow-1: rgba(80, 200, 40, 0.16);
  --body-glow-2: rgba(40, 140, 220, 0.14);
  --body-glow-3: rgba(130, 80, 220, 0.15);
  --landing-blob-1: rgba(70, 180, 40, 0.25);
  --landing-blob-2: rgba(110, 70, 200, 0.25);
  --highlight-1: #2d5c13;
  --highlight-2: #3f7a1a;
  --me-a: #16251a;
  --me-b: #1a2e1c;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 8px 22px -12px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 18px 42px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 32px 74px -36px rgba(0, 0, 0, 0.95);
}

html[data-theme='midnight'] .hero-art::before {
  background:
    radial-gradient(circle at 38% 34%, rgba(120, 200, 255, 0.18) 0%, transparent 58%),
    conic-gradient(from 200deg, #173420, #152b3a, #251a3f, #3a2f16, #173420);
}

html[data-theme='midnight'] .hero-art::after {
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.95);
}

html[data-theme='midnight'] .podium .p.first .ring {
  box-shadow: 0 0 0 4px rgba(255, 200, 0, 0.18), var(--shadow-sm);
}

html[data-theme='midnight'] .pin-card,
html[data-theme='midnight'] .news-card.pinned {
  background: linear-gradient(120deg, #262110, #171c20);
  border-color: #4a3d14;
}
html[data-theme='midnight'] .pin-card p,
html[data-theme='midnight'] .announce-ribbon p {
  color: #d9c68a;
}
html[data-theme='midnight'] .pin-card .pin-meta {
  color: #a99a6d;
}
html[data-theme='midnight'] .msg.me .bubble {
  background: linear-gradient(120deg, #1d3320, #203a16);
}
html[data-theme='midnight'] .composer-preview,
html[data-theme='midnight'] .msg-avatar,
html[data-theme='midnight'] .quiz-ic {
  background: var(--surface-2);
}
html[data-theme='midnight'] .fox-bubble {
  background: linear-gradient(135deg, #1d2833, #182a1c);
}
html[data-theme='midnight'] .msg.me .bubble,
html[data-theme='midnight'] .bubble {
  color: var(--ink);
}
html[data-theme='midnight'] .badge {
  background: #223040;
  color: var(--ink-2);
}
html[data-theme='midnight'] .badge-green {
  background: rgba(110, 230, 47, 0.16);
  color: #9cf06a;
}
html[data-theme='midnight'] .badge-blue {
  background: rgba(56, 189, 248, 0.16);
  color: #8fd8ff;
}
html[data-theme='midnight'] .badge-orange {
  background: rgba(255, 150, 0, 0.16);
  color: #ffc270;
}
html[data-theme='midnight'] .badge-red {
  background: rgba(251, 113, 133, 0.16);
  color: #ff9dab;
}
html[data-theme='midnight'] .badge-violet {
  background: rgba(139, 92, 246, 0.2);
  color: #cbb8ff;
}
html[data-theme='midnight'] .tbl th {
  background: var(--surface-2);
}

/* انتخاب تم در پروفایل */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 9px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  color: var(--ink);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.theme-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-l);
}
.theme-swatch {
  display: flex;
  height: 42px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.theme-swatch i {
  flex: 1;
}
.theme-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 900;
}
.theme-check {
  color: var(--brand);
  font-size: 14px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.theme-card.active .theme-check {
  opacity: 1;
  transform: scale(1);
}
.badge-soft {
  background: var(--brand-l);
  color: var(--brand-d);
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 620px at 92% -8%, var(--body-glow-1) 0%, transparent 62%),
    radial-gradient(720px 520px at -4% 16%, var(--body-glow-2) 0%, transparent 58%),
    radial-gradient(860px 620px at 52% 118%, var(--body-glow-3) 0%, transparent 62%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: var(--sky-d);
  text-decoration: none;
}

button {
  font-family: inherit;
}

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

:focus-visible {
  outline: 3px solid #9ad8ff;
  outline-offset: 2px;
}

::selection {
  background: var(--brand-l);
  color: var(--brand-d);
}

/* ---------------- ابزارها ---------------- */

.muted {
  color: var(--muted);
}
.tiny {
  font-size: 12px;
}
.center {
  text-align: center;
}
.bold {
  font-weight: 800;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grow {
  flex: 1;
  min-width: 0;
}
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-24 {
  margin-top: 24px;
}
.mb-8 {
  margin-bottom: 8px;
}
.mb-16 {
  margin-bottom: 16px;
}
.hidden {
  display: none !important;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- دکمه‌ها ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 20px;
  min-height: 44px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 3px 0 rgba(26, 35, 48, 0.08);
}

.btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(26, 35, 48, 0.1);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-green {
  background: linear-gradient(180deg, var(--brand-1), var(--brand-2));
  border-color: var(--brand-3);
  color: #fff;
  box-shadow: 0 4px 0 var(--brand-3), 0 12px 24px -14px var(--brand-glow);
}
.btn-green:hover {
  filter: brightness(1.04);
}
.btn-green:active {
  box-shadow: 0 1px 0 var(--brand-3);
}

.btn-blue {
  background: linear-gradient(180deg, #4ec8ff, #1ea9e8);
  border-color: var(--sky-d);
  color: #fff;
  box-shadow: 0 4px 0 #1187b9;
}
.btn-violet {
  background: linear-gradient(180deg, #9075ff, #6c4df4);
  border-color: var(--violet-d);
  color: #fff;
  box-shadow: 0 4px 0 #5538cc;
}
.btn-orange {
  background: linear-gradient(180deg, #ffb02e, #f28b00);
  border-color: var(--orange-d);
  color: #fff;
  box-shadow: 0 4px 0 #c47500;
}
.btn-red {
  background: linear-gradient(180deg, #ff8a9a, #f2556b);
  border-color: var(--rose-d);
  color: #fff;
  box-shadow: 0 4px 0 #c73b50;
}
.btn-soft {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
  box-shadow: 0 2px 0 rgba(26, 35, 48, 0.06);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-sm {
  padding: 7px 13px;
  min-height: 36px;
  font-size: 12.5px;
  border-radius: 11px;
  box-shadow: 0 2px 0 rgba(26, 35, 48, 0.07);
}
.btn-lg {
  padding: 15px 34px;
  min-height: 56px;
  font-size: 17px;
  border-radius: 18px;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  padding: 8px;
  min-width: 38px;
}

/* ---------------- فرم‌ها ---------------- */

.input,
select.input,
textarea.input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(88, 204, 2, 0.12);
}

textarea.input {
  resize: vertical;
  min-height: 84px;
  line-height: 1.9;
}
select.input {
  cursor: pointer;
}

.input[dir='ltr'] {
  text-align: left;
}

.field {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
}

.field .input {
  margin-top: 5px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 12px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 12px;
}

/* ---------------- کارت ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-soft {
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 38px 16px;
  font-weight: 600;
}
.empty .big {
  font-size: 44px;
  display: block;
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.08));
}
.empty-title {
  font-weight: 800;
  color: var(--ink-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--ink-2);
  line-height: 1.7;
  white-space: nowrap;
}
.badge-green {
  background: var(--brand-l);
  color: #3f7d00;
}
.badge-blue {
  background: #ddf4ff;
  color: #0b6c99;
}
.badge-orange {
  background: #fff0d9;
  color: #a35d00;
}
.badge-red {
  background: #ffe4e7;
  color: #b0293b;
}
.badge-violet {
  background: #efe9ff;
  color: #5b3fd6;
}

/* ============================================================
   نوار بالا و ناوبری
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--chrome);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--brand-l), 0 4px 10px rgba(26, 35, 48, 0.12);
  transition: transform 0.25s ease;
}

.brand-link:hover .brand-logo {
  transform: rotate(-6deg) scale(1.05);
}

.brand-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}

.brand-fa {
  font-size: 23px;
  font-weight: 900;
  color: var(--brand-d);
  letter-spacing: -0.6px;
  line-height: 1;
}

.brand-en {
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 2.4px;
  color: var(--brand);
  opacity: 0.72;
  text-transform: lowercase;
}

.topnav {
  display: flex;
  gap: 2px;
  margin-inline-start: 6px;
}

.topnav-link {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.topnav-link:hover {
  background: var(--brand-soft);
  color: var(--brand-d);
}
.topnav-link.active {
  background: var(--brand-l);
  color: #3f7a00;
}

.topbar-side {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.xp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff7e6;
  color: #a96400;
  font-weight: 900;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #ffe6b8;
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  transition: box-shadow 0.18s, transform 0.18s;
}
.user-chip:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.user-chip-name {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* نوار پایین (موبایل) */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  background: var(--chrome-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-inner {
  display: flex;
  width: 100%;
  max-width: 560px;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 4px 9px;
  min-height: var(--tabbar-h);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.tab .ic {
  font-size: 21px;
  line-height: 1.2;
  filter: grayscale(0.45);
  transition: transform 0.2s ease, filter 0.2s ease;
}
.tab.active {
  color: var(--brand-d);
}
.tab.active .ic {
  filter: none;
  transform: translateY(-2px) scale(1.08);
}

/* ============================================================
   لندینگ
   ============================================================ */

.landing {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.landing::before,
.landing::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.7;
  animation: blob 16s ease-in-out infinite alternate;
}

.landing::before {
  width: 460px;
  height: 460px;
  top: -140px;
  inset-inline-start: -120px;
  background: radial-gradient(circle at 35% 35%, var(--landing-blob-1), transparent 65%);
}

.landing::after {
  width: 520px;
  height: 520px;
  bottom: -180px;
  inset-inline-end: -140px;
  background: radial-gradient(circle at 60% 60%, var(--landing-blob-2), transparent 66%);
  animation-delay: -6s;
}

.landing-top {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.landing .brand-logo {
  width: 44px;
  height: 44px;
}
.landing .brand-fa {
  font-size: 27px;
}
.landing .brand-en {
  font-size: 10px;
  letter-spacing: 2.8px;
}

.hero {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 28px 34px;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 18px;
  align-items: center;
}

.hero-copy {
  max-width: 560px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
  animation: rise 0.6s ease both;
  background: var(--surface);
}

.hero h1 {
  font-size: clamp(32px, 4.4vw, 55px);
  line-height: 1.5;
  font-weight: 900;
  letter-spacing: -1.4px;
  margin-bottom: 14px;
  animation: rise 0.6s 0.05s ease both;
}

.hero h1 .hl {
  color: var(--brand);
  position: relative;
  white-space: nowrap;
}

.hero h1 .hl::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 2px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--highlight-1), var(--highlight-2));
  z-index: -1;
}

.lead {
  font-size: clamp(14px, 1.35vw, 16.5px);
  color: var(--muted);
  font-weight: 500;
  line-height: 2.05;
  margin-bottom: 20px;
  max-width: 460px;
  animation: rise 0.6s 0.1s ease both;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  animation: rise 0.6s 0.16s ease both;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  animation: rise 0.6s 0.22s ease both;
}

.hero-cta .btn {
  min-width: 180px;
}

.hero-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 380px;
}

.hero-art::before {
  content: '';
  position: absolute;
  width: min(420px, 92%);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, #ffffff 0%, rgba(255, 255, 255, 0.4) 45%, transparent 62%),
    conic-gradient(from 200deg, #eaffd8, #e3f3ff, #f0e8ff, #fff6df, #eaffd8);
  opacity: 0.95;
  animation: spin-slow 30s linear infinite;
}

.hero-art::after {
  content: '';
  position: absolute;
  inset: 14% 20%;
  border-radius: 50%;
  box-shadow: 0 40px 80px -40px rgba(26, 35, 48, 0.4);
  z-index: 0;
}

.hero-art img {
  position: relative;
  z-index: 1;
  width: min(430px, 82%);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  animation: float 5.5s ease-in-out infinite;
  filter: drop-shadow(0 26px 32px rgba(26, 35, 48, 0.14));
}

.float-emoji {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 24px;
  animation: float 4.6s ease-in-out infinite;
}
.float-emoji.e1 {
  top: 8%;
  inset-inline-start: 4%;
  animation-delay: -0.8s;
  color: var(--sky-d);
}
.float-emoji.e2 {
  top: 24%;
  inset-inline-end: 1%;
  animation-delay: -2.1s;
}
.float-emoji.e3 {
  bottom: 12%;
  inset-inline-start: 12%;
  animation-delay: -3s;
}

.features {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 42px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 17px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature .ic {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 23px;
  background: var(--brand-soft);
  flex: none;
}

.feature:nth-child(2) .ic {
  background: #eef7ff;
}
.feature:nth-child(3) .ic {
  background: #fff8e3;
}

.feature h3 {
  font-size: 14.5px;
  font-weight: 900;
  margin-bottom: 2px;
}
.feature p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}

.landing-foot {
  text-align: center;
  padding: 0 20px 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   ساختار صفحه اپ
   ============================================================ */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 22px 44px;
}

.page-narrow {
  max-width: 760px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-title {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.4px;
  line-height: 1.5;
}

.page-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.section-title {
  font-size: 17px;
  font-weight: 900;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-inline-start: auto;
}

.page-loader {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.loader-fox {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  animation: bob 1.5s ease-in-out infinite;
}

.loader-bar {
  width: 150px;
  height: 8px;
  border-radius: 99px;
  background: #e9eee4;
  overflow: hidden;
}
.loader-bar i {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #7ade28, var(--brand));
  animation: loader 1.1s ease-in-out infinite;
}

/* ============================================================
   خانه
   ============================================================ */

.welcome {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, #eef9e5 0%, transparent 55%),
    linear-gradient(120deg, #f3ffea 0%, #eef7ff 52%, #f4edff 100%);
  border: 1px solid #e2f1d6;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.welcome::after {
  content: '';
  position: absolute;
  inset-inline-start: -30px;
  bottom: -70px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 138, 0.5), transparent 68%);
}

.welcome-copy {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.welcome h1 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.welcome-sub {
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 600;
}

.welcome-tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.welcome-art {
  position: relative;
  z-index: 1;
  flex: none;
}
.welcome-art img {
  width: 116px;
  height: 116px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(26, 35, 48, 0.16));
  animation: float 5s ease-in-out infinite;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 26px;
  background: linear-gradient(180deg, #f4ffec, #e8f9d8);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e3f3d4;
  flex: none;
  line-height: 1;
}
.avatar.sm {
  width: 36px;
  height: 36px;
  font-size: 18px;
}
.avatar.lg {
  width: 88px;
  height: 88px;
  font-size: 44px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.45s ease both;
}
.stat-card:nth-child(2) {
  animation-delay: 0.05s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.1s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.15s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}
.stat-card .ic {
  font-size: 18px;
  line-height: 1.4;
}
.stat-card .v {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.45;
}
.stat-card .l {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 800;
}
.stat-card.green .ic {
  color: var(--brand-d);
}
.stat-card.amber .ic {
  color: var(--orange-d);
}
.stat-card.sky .ic {
  color: var(--sky-d);
}
.stat-card.violet .ic {
  color: var(--violet-d);
}

.goal-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.goal-strip .goal-text {
  flex: 1;
  min-width: 0;
}
.goal-strip b {
  font-size: 13px;
}
.goal-strip .tiny {
  display: block;
}

.goal-percent {
  font-size: 18px;
  font-weight: 900;
  color: var(--brand-d);
  flex: none;
}

.progress {
  height: 14px;
  background: #e9ede6;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(180deg, #84e63a, var(--brand));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.progress > i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: translateX(-100%);
  animation: shimmer 2.6s ease-in-out infinite;
}

.goal-strip .progress {
  flex: 1.4;
  min-width: 120px;
}

/* روبان اطلاعیه */

.announce-ribbon {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(120deg, #fff8e6, #fffdf6 60%);
  border: 1px solid #ffe7b0;
  border-radius: 18px;
  padding: 13px 15px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px -18px rgba(179, 120, 0, 0.7);
  overflow: hidden;
}
.announce-ribbon::after {
  content: '';
  position: absolute;
  inset-inline-start: -20px;
  top: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 0, 0.22), transparent 70%);
}
.announce-ribbon .pin-ic {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #fff3d1;
  font-size: 19px;
  flex: none;
}
.announce-ribbon .ann-body {
  flex: 1;
  min-width: 0;
}
.announce-ribbon b {
  font-size: 13.5px;
  display: block;
  line-height: 1.7;
}
.announce-ribbon p {
  font-size: 12px;
  color: #7d6633;
  line-height: 1.8;
}
.announce-ribbon .go-link {
  flex: none;
  font-size: 12px;
  font-weight: 800;
  color: var(--orange-d);
}

/* درس‌ها و فصل‌ها */

.subject-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.subject-top {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 2px 12px;
}

.subject-ic {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  flex: none;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14);
}

.subject-top h2 {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.5;
}

.subject-top .page-sub {
  font-size: 11.5px;
}

.subject-top .subject-progress {
  margin-inline-start: auto;
  text-align: center;
  flex: none;
}

.subject-top .subject-progress b {
  font-size: 15px;
  color: var(--brand-d);
}
.subject-top .subject-progress span {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
  font-weight: 700;
}

.chapter {
  border-top: 1px dashed var(--line);
  padding: 12px 2px 4px;
}
.chapter:first-of-type {
  border-top: none;
  padding-top: 2px;
}

.chapter-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chapter-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  background: #f1f5ee;
  color: var(--ink-2);
}

.chapter-head h3 {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink-2);
  line-height: 1.6;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.quiz-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  min-height: 64px;
  border-radius: 15px;
  border: 1px solid #f1f5ec;
  background: #fbfdf9;
  cursor: pointer;
  text-align: right;
  width: 100%;
  font-family: inherit;
  color: inherit;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.quiz-row:hover {
  background: var(--brand-soft);
  border-color: #e4f5d4;
}
.quiz-row:active {
  transform: scale(0.995);
}

.quiz-ic {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #f7faf4;
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}

.quiz-info {
  flex: 1;
  min-width: 0;
}

.quiz-info .t {
  font-weight: 800;
  font-size: 14px;
  display: block;
  line-height: 1.65;
}

.quiz-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-weight: 700;
}

.mini-pbar {
  height: 6px;
  border-radius: 99px;
  background: #edf1ea;
  overflow: hidden;
  margin-top: 5px;
  max-width: 220px;
}
.mini-pbar > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.quiz-side {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  flex: none;
}

.quiz-xp {
  font-size: 11px;
  font-weight: 900;
  color: var(--brand-d);
  background: var(--brand-l);
  border-radius: 999px;
  padding: 2px 9px;
}

.quiz-go {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-l);
  color: var(--brand-d);
  font-size: 13px;
  flex: none;
  transition: transform 0.18s ease, background 0.18s ease;
}
.quiz-row:hover .quiz-go {
  transform: translateX(-3px);
  background: var(--brand);
  color: #fff;
}

/* صدر جدول خانه */

.top3 {
  display: grid;
  gap: 8px;
}

.top3-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 8px 12px;
  box-shadow: var(--shadow-xs);
}

.lb-rank {
  width: 26px;
  text-align: center;
  font-weight: 900;
  color: var(--muted);
  font-size: 14px;
  flex: none;
}

.lb-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-name .cls {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 700;
}

.lb-xp {
  font-weight: 900;
  font-size: 13px;
  color: var(--orange-d);
  white-space: nowrap;
}

/* ============================================================
   آزمون
   ============================================================ */

.play {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 70% -10%, #eef9e5, transparent 60%),
    radial-gradient(700px 420px at 10% 110%, #eef4ff, transparent 60%),
    #fff;
}

.play-top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-radius: 0 0 18px 18px;
}

.play-close {
  border: none;
  background: #f2f5ef;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  flex: none;
  transition: background 0.15s, color 0.15s;
}
.play-close:hover {
  background: #ffe4e7;
  color: var(--rose-d);
}

.play-progress {
  flex: 1;
  height: 12px;
  border-radius: 99px;
  background: #edf1ea;
  overflow: hidden;
}
.play-progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(180deg, #84e63a, var(--brand));
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hearts {
  display: flex;
  gap: 1px;
  font-size: 15px;
  white-space: nowrap;
  flex: none;
}
.heart {
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.heart.lost {
  filter: grayscale(1);
  opacity: 0.35;
  transform: scale(0.85);
}
.heart.pop {
  animation: heart-pop 0.45s ease;
}

.timer-ring {
  position: relative;
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
}
.timer-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.timer-ring .tr-bg {
  stroke: #edf1ea;
}
.timer-ring .tr-fill {
  stroke: var(--brand);
  transition: stroke-dashoffset 0.25s linear, stroke 0.25s ease;
}
.timer-ring b {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--ink-2);
}
.timer-ring.warn .tr-fill {
  stroke: var(--amber);
}
.timer-ring.warn b {
  color: #a97a00;
}
.timer-ring.danger .tr-fill {
  stroke: var(--rose);
}
.timer-ring.danger b {
  color: var(--rose-d);
}
.timer-ring.danger {
  animation: pulse 1s ease-in-out infinite;
}

.xp-chip {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--orange-d);
  background: #fff7e6;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
  flex: none;
  border: 1px solid #ffe6b8;
}

.practice-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: #6b4bd8;
  background: #f1ecff;
  border-radius: 999px;
  padding: 3px 9px;
  flex: none;
}

.play-body {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 20px 180px;
}

.q-tag {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.q-prompt {
  font-size: clamp(19px, 2.6vw, 26px);
  font-weight: 900;
  line-height: 1.85;
  margin: 10px 0 20px;
  animation: rise 0.35s ease both;
}

.options {
  display: grid;
  gap: 11px;
}

.option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: right;
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 13px 15px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
  line-height: 1.7;
  min-height: 58px;
  animation: rise 0.35s ease both;
}
.option:nth-child(2) {
  animation-delay: 0.04s;
}
.option:nth-child(3) {
  animation-delay: 0.08s;
}
.option:nth-child(4) {
  animation-delay: 0.12s;
}

.option:hover:not(:disabled) {
  background: #fbfdf9;
  border-color: #cfe8bb;
  transform: translateY(-1px);
}
.option:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}
.option:disabled {
  cursor: default;
}

.option .key {
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 900;
  color: var(--muted);
  flex: none;
  background: var(--surface);
  transition: 0.15s;
}

.option.picked {
  border-color: var(--sky);
  background: #e8f7ff;
  color: #0b6c99;
}
.option.picked .key {
  border-color: var(--sky);
  color: var(--sky-d);
}

.option.correct {
  border-color: var(--brand);
  background: var(--brand-l);
  color: #3f7d00;
  animation: pop-soft 0.32s ease;
}
.option.correct .key {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.option.wrong {
  border-color: var(--rose);
  background: #ffe9ec;
  color: #b52b3d;
  animation: shake 0.35s ease;
}
.option.wrong .key {
  border-color: var(--rose);
  background: var(--rose);
  color: #fff;
}

.feedback {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: linear-gradient(180deg, #f4ffec, #ecffe0);
  border-top: 1px solid #ccebb4;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(130%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -14px 40px -24px rgba(26, 35, 48, 0.35);
}
.feedback.show {
  transform: none;
}
.feedback.no {
  background: linear-gradient(180deg, #fff5f6, #ffe9ec);
  border-top-color: #ffd0d6;
}
.feedback.timeout {
  background: linear-gradient(180deg, #fffaf0, #fff2d9);
  border-top-color: #ffe3a8;
}

.feedback-in {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.feedback .ic {
  font-size: 30px;
  line-height: 1;
  flex: none;
}
.feedback .msg {
  flex: 1;
  min-width: 190px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.8;
}
.feedback .msg .t {
  display: block;
  font-size: 16px;
  font-weight: 900;
}
.feedback .msg .d {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 12.5px;
}

/* نتیجه */

.result {
  max-width: 540px;
  margin: 0 auto;
  padding: 26px 20px 40px;
  text-align: center;
  animation: rise 0.5s ease both;
}

.result-trophy {
  width: 108px;
  height: 108px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 54px;
  background: radial-gradient(circle at 35% 30%, #fffdf0, #fff2c8);
  border: 1px solid #ffe9a6;
  box-shadow: 0 18px 40px -22px rgba(255, 200, 0, 0.9);
  animation: pop 0.5s ease;
}

.result h1 {
  font-size: 27px;
  font-weight: 900;
  margin: 8px 0 2px;
}

.accuracy-ring {
  --p: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  margin: 18px auto;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e9eee6 0);
  position: relative;
}
.accuracy-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.accuracy-ring > div {
  position: relative;
  font-size: 25px;
  font-weight: 900;
  color: var(--brand-d);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 16px 0 18px;
}
.result-stats .card-soft {
  padding: 10px 6px;
  text-align: center;
}
.result-stats .v {
  font-size: 19px;
  font-weight: 900;
}
.result-stats .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

.result-note {
  background: #f3f0ff;
  border: 1px solid #e2d9ff;
  color: #5b41c4;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.9;
  margin-bottom: 16px;
}
.result-note.warn {
  background: #fff8ea;
  border-color: #ffe3b3;
  color: #93600a;
}

/* ============================================================
   جدول رتبه‌ها
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--tabs-bg);
  padding: 4px;
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs button {
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 8px 15px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.16s;
  min-height: 38px;
}
.tabs button:hover {
  color: var(--ink);
}
.tabs button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(26, 35, 48, 0.1);
}

.me-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #f1ffe4, #f7ffef);
  border: 1px solid #dbf3c5;
  border-radius: 16px;
  padding: 10px 15px;
  margin-bottom: 16px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 20px;
}

.podium .p {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 31%;
  max-width: 132px;
}

.podium .ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 27px;
  background: var(--surface);
  border: 3px solid var(--line);
  box-shadow: var(--shadow-sm);
  animation: rise 0.45s ease both;
}

.podium .p.first .ring {
  width: 76px;
  height: 76px;
  font-size: 36px;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px #fff6d6, var(--shadow-sm);
  animation: pop 0.55s ease both;
}

.podium .name {
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  line-height: 1.5;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium .xp {
  font-size: 11px;
  color: var(--orange-d);
  font-weight: 900;
}

.podium .base {
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: #f2f5ef;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-bottom: none;
}
.podium .p.first .base {
  background: linear-gradient(180deg, #fff8dd, #fff1bb);
  border-color: #f0dfa2;
  color: #a97f00;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 7px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.lb-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.lb-row.me {
  border-color: var(--brand);
  background: linear-gradient(90deg, var(--me-a), var(--me-b));
}
.lb-row.me .lb-rank {
  color: var(--brand-d);
}

/* ============================================================
   گفتگوی درسی
   ============================================================ */

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}

.chat-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-pins {
  display: grid;
  gap: 8px;
}

.pin-card {
  position: relative;
  background: linear-gradient(120deg, #fffaee, #fffdf8);
  border: 1px solid #ffe7b5;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
}

.pin-card .pin-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.pin-card .pin-ic {
  font-size: 15px;
}
.pin-card h4 {
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.7;
}
.pin-card p {
  font-size: 12px;
  color: #7d6633;
  line-height: 1.9;
  white-space: pre-wrap;
}
.pin-card .pin-meta {
  font-size: 10.5px;
  color: #a4905f;
  font-weight: 700;
  margin-top: 4px;
}
.pin-card .pin-actions {
  display: flex;
  gap: 5px;
  margin-inline-start: auto;
}

.chat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fbfdf9, #fff);
}
.chat-head .t {
  font-weight: 900;
  font-size: 15px;
}
.chat-head .s {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.chat-feed {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
  max-height: min(58vh, 540px);
  overflow-y: auto;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  background:
    radial-gradient(600px 240px at 100% 0%, #f7fff1, transparent 70%),
    #fff;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 86%;
  align-self: flex-start;
  animation: msg-in 0.28s ease both;
}

.msg.me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: #f4f8f0;
  border: 1px solid var(--line);
}

.msg-body {
  min-width: 0;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 3px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.msg.me .msg-head {
  justify-content: flex-end;
}
.msg-head b {
  font-size: 11.5px;
  color: var(--ink-2);
}

.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 6px;
  padding: 9px 12px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.msg.me .bubble {
  background: linear-gradient(120deg, #f2ffe5, #ebffd8);
  border-color: #d8f0be;
  border-radius: 16px 16px 6px 16px;
}

.msg-text {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-subject {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 8px;
  margin-bottom: 5px;
  background: #f1f5ee;
  color: var(--ink-2);
}

.msg-img {
  margin-top: 8px;
  border-radius: 12px;
  max-width: 260px;
  max-height: 260px;
  object-fit: cover;
  cursor: zoom-in;
  border: 1px solid var(--line);
  transition: transform 0.2s ease;
}
.msg-img:hover {
  transform: scale(1.01);
}

.msg-del {
  border: none;
  background: none;
  color: #b9c2bb;
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
}
.msg-del:hover {
  color: var(--rose-d);
}

.chat-composer {
  border-top: 1px solid var(--line-2);
  padding: 10px 12px;
  background: var(--surface);
  position: sticky;
  bottom: 10px;
  z-index: 5;
}

.composer-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7faf4;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px;
  margin-bottom: 8px;
}
.composer-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}
.composer-preview .tiny {
  flex: 1;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.attach-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex: none;
  transition: border-color 0.15s, background 0.15s;
}
.attach-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.composer-row textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.7;
  font-weight: 500;
  outline: none;
}
.composer-row textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(88, 204, 2, 0.1);
}

.composer-subject {
  width: 130px;
  flex: none;
  font-size: 11.5px;
  padding: 6px 8px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  font-family: inherit;
  background: var(--surface);
  min-height: 40px;
}

.composer-send {
  flex: none;
  min-height: 42px;
  padding: 0 18px;
}

.chat-hint {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* صفحهٔ گفتگو ارتفاع نمایشگر را پر می‌کند تا کادر ارسال همیشه در دید بماند */
.page.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--topbar-h));
  padding-bottom: 22px;
}

.chat-page .page-head {
  flex: none;
}

.chat-page .chat-layout {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.chat-page .chat-main {
  min-height: 0;
}

.chat-page .chat-pins {
  flex: none;
  max-height: min(210px, 24vh);
  overflow-y: auto;
  scrollbar-width: thin;
}

.chat-page .chat-card {
  flex: 1;
  min-height: 0;
}

.chat-page .chat-feed {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.chat-page .chat-composer {
  position: static;
}

.chat-page .chat-side {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px;
  font-weight: 700;
}
.member-row:first-of-type {
  border-top: none;
}
.member-row .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-row .cls {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.chat-members-toggle {
  display: none;
}

/* ============================================================
   اطلاعیه‌ها
   ============================================================ */

.news-list {
  display: grid;
  gap: 12px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: rise 0.4s ease both;
}
.news-card.pinned {
  border-color: #f0d99a;
  background: linear-gradient(120deg, #fffdf5, #fff);
}
.news-card.pinned::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--amber), #ffe49a);
}

.news-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.news-head h3 {
  font-size: 15.5px;
  font-weight: 900;
  line-height: 1.7;
  flex: 1;
  min-width: 0;
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  flex-wrap: wrap;
  margin-top: 8px;
}
.news-body {
  font-size: 13px;
  line-height: 2;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.news-actions {
  display: flex;
  gap: 5px;
  flex: none;
}

.pin-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #a97f00;
  background: #fff3cd;
  border-radius: 999px;
  padding: 2px 8px;
}

/* ============================================================
   پروفایل
   ============================================================ */

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  background: linear-gradient(120deg, #f3ffe9, #eef7ff 60%, #f5efff);
  border: 1px solid #e2f1d6;
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}
.profile-head h1 {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.5;
}
.profile-head .page-sub {
  font-size: 12px;
}

.level-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.level-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(160deg, #8ce93d, var(--brand));
  font-size: 15px;
  flex: none;
  box-shadow: 0 4px 0 var(--brand-d);
}

/* ============================================================
   پنل‌ها و جدول‌ها
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
}
.kpi .v {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.4;
}
.kpi .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hint {
  background: #eef8ff;
  border: 1px solid #d4ecfb;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 12.5px;
  color: #23678c;
  font-weight: 600;
  line-height: 1.9;
}
.hint.warn {
  background: #fff8e8;
  border-color: #ffe3b0;
  color: #8a5f0a;
}
.hint.ok {
  background: #f2ffe6;
  border-color: #d8f2c2;
  color: #3f7d00;
}

.tbl-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
.tbl th {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding: 9px 12px;
  background: #fafcf8;
  font-weight: 800;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.tbl td {
  padding: 9px 12px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px;
  vertical-align: middle;
}
.tbl .name {
  font-weight: 800;
  font-size: 13px;
}
.tbl tr:hover td {
  background: #fcfdfa;
}
.tbl .actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0 5px;
  color: var(--ink-2);
  transition: 0.15s;
}
.icon-btn:hover {
  background: var(--bg-soft, #f8faf5);
  border-color: #cfd9cb;
}
.icon-btn.danger:hover {
  background: #fff0f2;
  border-color: #ffc9d0;
  color: var(--rose-d);
}

.teacher-class {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 15px;
  background: var(--surface);
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
}

.student-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line-2);
  font-size: 13px;
}
.student-row:first-of-type {
  border-top: none;
}
.student-row .n {
  flex: 1;
  min-width: 0;
  font-weight: 800;
}
.student-row .n small {
  display: block;
  color: var(--muted);
  font-weight: 600;
  font-size: 10.5px;
}

.subject-edit-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 8px;
}
.subject-edit-card .sq {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 21px;
  color: #fff;
  flex: none;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.13);
}

.chapter-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: #f9fbf6;
  border: 1px solid var(--line-2);
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
}
.chapter-edit .ci {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 900;
  color: var(--muted);
  flex: none;
}
.chapter-edit .cn {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  margin-bottom: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.question-card .qp {
  font-weight: 800;
  font-size: 13.5px;
  line-height: 1.9;
  margin-bottom: 6px;
}
.question-card .qo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.question-card .qo .ok {
  color: var(--brand-d);
  font-weight: 800;
}

.backup-zone {
  border: 2px dashed #cfe3c2;
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(180deg, #fafff6, #f5ffed);
}
.backup-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   مودال، توست، کاغذرنگی
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(22, 30, 40, 0.48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade 0.18s ease;
}
.modal-backdrop.closing {
  animation: fade-out 0.16s ease forwards;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 24px;
  padding: 22px;
  width: 100%;
  max-width: 410px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 92dvh;
  overflow: auto;
}
.modal-wide {
  max-width: 620px;
}
.modal h2 {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 4px;
}
.modal .sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
}
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  border: none;
  background: #f3f6f1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
  background: #ffe9ec;
  color: var(--rose-d);
}

.toast-wrap {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 92vw;
}

/* وقتی نوار بالایی هست، پیام‌ها زیر آن ظاهر شوند تا منو را نپوشانند */
body.has-chrome .toast-wrap {
  top: 78px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f2a36;
  color: #fff;
  padding: 10px 16px;
  border-radius: 13px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.26s ease;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.out {
  opacity: 0;
  transform: translateY(-8px);
}
.toast.ok {
  background: #2f7d0a;
}
.toast.error {
  background: #b3273c;
}
.toast-ic {
  font-size: 14px;
}

.confetti-piece {
  position: fixed;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  z-index: 110;
  pointer-events: none;
  animation: fall linear forwards;
}

/* ============================================================
   انیمیشن‌ها
   ============================================================ */

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: none;
  }
}

@keyframes logo-glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--brand-l), 0 4px 10px rgba(26, 35, 48, 0.12);
  }
  50% {
    box-shadow: 0 0 0 4px #dcffc4, 0 8px 18px rgba(63, 148, 2, 0.2);
  }
}

@keyframes sheen {
  0%,
  55% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes underline-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes mascot-pop {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes topbar-in {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: none;
  }
}

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

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pop-soft {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-12px) rotate(-1deg);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blob {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, 24px) scale(1.08);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  55%,
  100% {
    transform: translateX(100%);
  }
}

@keyframes loader {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(260%);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.07);
  }
}

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(560deg);
    opacity: 0;
  }
}

.page-enter > .page,
.page-enter > .chat-page,
.page-enter > .play {
  animation: rise 0.4s ease both;
}

/* ============================================================
   جلوه‌های تازه، لوگو و ریزجزئیات
   ============================================================ */

.btn-login-pill {
  border-radius: 999px;
  padding: 9px 26px;
  min-height: 42px;
  font-size: 13.5px;
  font-weight: 900;
  color: var(--brand-d);
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #c9eab0;
  box-shadow: 0 4px 0 #dbefcc, 0 10px 24px -16px rgba(63, 148, 2, 0.8);
  backdrop-filter: blur(8px);
}
.btn-login-pill:hover {
  background: var(--brand-l);
  border-color: var(--brand);
  color: #2f7000;
}

.btn-green {
  position: relative;
  overflow: hidden;
}
.btn-green::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.4) 45%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.btn-green:hover::after {
  transform: translateX(120%);
}

.btn-bounce {
  animation: bounce-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.btn-bounce:hover {
  animation: none;
}

.brand-logo {
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  animation: logo-glow 4.5s ease-in-out infinite;
}

.hero-eyebrow {
  position: relative;
  overflow: hidden;
}
.hero-eyebrow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(88, 204, 2, 0.16), transparent 70%);
  transform: translateX(-100%);
  animation: sheen 5s ease-in-out infinite;
}

.hero h1 .hl::after {
  transform-origin: right center;
  animation: underline-grow 0.9s 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-art img {
  animation: float 6s ease-in-out infinite, mascot-pop 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.float-emoji {
  animation: float 4.6s ease-in-out infinite, pop 0.5s ease both;
}

.subject-block {
  animation: rise 0.45s ease both;
}
.subject-block:nth-of-type(2) {
  animation-delay: 0.05s;
}
.subject-block:nth-of-type(3) {
  animation-delay: 0.1s;
}
.subject-block:nth-of-type(4) {
  animation-delay: 0.15s;
}

.subject-block:hover .subject-ic {
  transform: rotate(-6deg) scale(1.06);
}
.subject-ic {
  transition: transform 0.25s ease;
}

.quiz-row:hover .quiz-ic {
  transform: scale(1.08) rotate(-4deg);
}
.quiz-ic {
  transition: transform 0.2s ease;
}
.quiz-row:hover .quiz-go {
  transform: translateX(-4px) scale(1.06);
}

.chapter-head h3 {
  position: relative;
}

.stat-card:hover .ic {
  animation: bob 0.6s ease;
}
.stat-card .ic {
  transition: transform 0.2s ease;
}

.chat-feed .msg {
  animation: msg-in 0.3s ease both;
}

.news-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pin-card {
  animation: rise 0.4s ease both;
}

.modal {
  animation: pop 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.option {
  overflow: hidden;
  position: relative;
}
.option.correct::after,
.option.wrong::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12% 50%, rgba(255, 255, 255, 0.65), transparent 55%);
  pointer-events: none;
}

.timer-ring {
  filter: drop-shadow(0 2px 4px rgba(26, 35, 48, 0.08));
}

.result-trophy {
  animation: pop 0.55s cubic-bezier(0.22, 1, 0.36, 1), bob 3.2s 0.6s ease-in-out infinite;
}

.progress > i {
  min-width: 2px;
}

.topbar {
  animation: topbar-in 0.4s ease both;
}

.chat-card {
  animation: rise 0.45s ease both;
}

.backup-zone {
  transition: border-color 0.2s ease, background 0.2s ease;
}
.backup-zone:hover {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f7ffee, #efffe0);
}

.avatar {
  transition: transform 0.2s ease;
}
.avatar:hover {
  transform: scale(1.06);
}

/* ============================================================
   واکنش‌گرا
   ============================================================ */

@media (min-width: 901px) {
  .tabbar {
    display: none !important;
  }
  .page {
    padding-bottom: 50px;
  }
}

@media (max-width: 1080px) {
  .topnav-link {
    padding: 8px 9px;
    font-size: 12.5px;
  }
  .chat-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}

@media (max-width: 900px) {
  :root {
    --topbar-h: 61px;
  }
  .topnav {
    display: none;
  }
  .quiz-grid {
    grid-template-columns: 1fr;
  }
  .topbar-inner {
    height: 60px;
    padding: 0 14px;
    gap: 10px;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
  }
  .brand-fa {
    font-size: 20px;
  }
  .brand-en {
    font-size: 8px;
    letter-spacing: 2px;
  }
  .user-chip-name {
    display: none;
  }
  .user-chip {
    padding: 3px;
  }
  .page {
    padding: 18px 14px calc(var(--tabbar-h) + 26px);
  }
  .page-narrow {
    max-width: 100%;
  }
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 4px 18px 26px;
    gap: 8px;
  }
  .hero-copy {
    max-width: 100%;
  }
  .hero-art {
    order: -1;
    min-height: 280px;
  }
  .hero-art img {
    width: min(300px, 74%);
  }
  .hero-art::before {
    width: min(300px, 82%);
  }
  .lead {
    margin-inline: auto;
  }
  .chips,
  .hero-cta {
    justify-content: center;
  }
  .float-emoji {
    width: 44px;
    height: 44px;
    font-size: 20px;
    border-radius: 14px;
  }
  .features {
    grid-template-columns: 1fr;
    padding: 0 18px 30px;
  }
  .landing-top {
    padding: 16px 18px;
  }
  .stat-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .chat-side {
    display: none;
  }
  .chat-members-toggle {
    display: inline-flex;
  }
  .chat-feed {
    max-height: none;
    min-height: calc(100dvh - 380px);
  }
  .chat-composer {
    bottom: calc(var(--tabbar-h) + 8px);
  }
  /* گفتگو در موبایل: پیام‌ها اسکرول می‌شوند و کادر ارسال همیشه پایین صفحه می‌ماند */
  .page.chat-page {
    height: calc(100dvh - var(--topbar-h) - var(--tabbar-h));
    padding: 10px 12px 8px;
    overflow: hidden;
  }
  .chat-page .page-head {
    margin-bottom: 10px;
    align-items: center;
  }
  .chat-page .page-title {
    font-size: 18px;
  }
  .chat-page .page-sub {
    font-size: 11px;
  }
  .chat-page .chat-main {
    height: 100%;
  }
  .chat-page .chat-pins {
    display: flex;
    gap: 8px;
    padding-bottom: 2px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .chat-page .chat-pins::-webkit-scrollbar {
    display: none;
  }
  .chat-page .chat-pins > .pin-card {
    flex: 0 0 auto;
    width: min(72vw, 290px);
    scroll-snap-align: start;
  }
  .chat-page .chat-feed {
    overscroll-behavior: contain;
  }
  .chat-page .chat-composer {
    border-radius: 0 0 22px 22px;
  }
  .chat-page .chat-hint {
    display: none;
  }
  .top3-row .lb-name {
    max-width: none;
  }
  .welcome-art img {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14.5px;
  }
  .page-title {
    font-size: 20px;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .welcome {
    padding: 16px;
    gap: 10px;
  }
  .welcome h1 {
    font-size: 20px;
  }
  .welcome-art img {
    width: 78px;
    height: 78px;
  }
  .subject-top {
    gap: 9px;
  }
  .subject-ic {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  .play-top {
    padding: 10px 12px;
    gap: 8px;
  }
  .play-body {
    padding: 12px 14px 190px;
  }
  .xp-chip {
    display: none;
  }
  .feedback {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }
  .feedback-in {
    gap: 10px;
  }
  .feedback .ic {
    font-size: 25px;
  }
  .feedback .msg {
    min-width: 150px;
    font-size: 13px;
  }
  .feedback .msg .t {
    font-size: 14.5px;
  }
  .feedback .btn {
    width: 100%;
  }
  .result {
    padding-top: 18px;
  }
  .result h1 {
    font-size: 23px;
  }
  .podium .ring {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
  .podium .p.first .ring {
    width: 66px;
    height: 66px;
    font-size: 30px;
  }
  .podium .name {
    font-size: 11px;
  }
  .chat-feed {
    padding: 12px;
    min-height: calc(100dvh - 360px);
  }
  .msg {
    max-width: 92%;
  }
  .composer-row {
    flex-wrap: wrap;
  }
  .composer-row textarea {
    flex-basis: calc(100% - 138px);
  }
  .composer-subject {
    width: 100%;
    order: 3;
  }
  .profile-head {
    padding: 14px;
    gap: 11px;
  }
  .avatar.lg {
    width: 68px;
    height: 68px;
    font-size: 34px;
  }
  .profile-head h1 {
    font-size: 18px;
  }
  .goal-strip {
    flex-wrap: wrap;
    gap: 8px;
  }
  .goal-strip .progress {
    order: 3;
    flex-basis: 100%;
  }
  .modal {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .landing-top {
    padding: 12px 14px;
  }
  .landing .brand-fa {
    font-size: 23px;
  }
  .landing .brand-logo {
    width: 38px;
    height: 38px;
  }
  .hero {
    padding: 0 14px 20px;
  }
  .hero h1 {
    font-size: clamp(27px, 8.6vw, 36px);
    letter-spacing: -1px;
  }
  .hero-art {
    min-height: 240px;
  }
  .hero-art img {
    width: min(245px, 70%);
  }
  .hero-art::before {
    width: min(240px, 76%);
  }
  .float-emoji {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-radius: 12px;
  }
  .features {
    padding: 0 14px 24px;
  }
  .feature {
    padding: 14px;
  }
  .page {
    padding: 14px 12px calc(var(--tabbar-h) + 22px);
  }
  .page-title {
    font-size: 18.5px;
  }
  .welcome {
    padding: 14px;
    border-radius: 20px;
  }
  .welcome-art {
    display: none;
  }
  .stat-cards {
    gap: 8px;
  }
  .stat-card {
    padding: 10px 8px;
    border-radius: 15px;
  }
  .stat-card .v {
    font-size: 17px;
  }
  .subject-block {
    padding: 12px;
    border-radius: 20px;
  }
  .quiz-row {
    padding: 8px;
    gap: 9px;
  }
  .quiz-ic {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  .quiz-info .t {
    font-size: 13px;
  }
  .quiz-meta {
    font-size: 10.5px;
  }
  .quiz-go {
    width: 30px;
    height: 30px;
  }
  .q-prompt {
    font-size: 18.5px;
    margin-bottom: 16px;
  }
  .option {
    padding: 11px 12px;
    font-size: 14px;
    gap: 10px;
    border-radius: 14px;
  }
  .option .key {
    width: 27px;
    height: 27px;
    font-size: 11.5px;
  }
  .result-stats {
    gap: 6px;
  }
  .result-stats .v {
    font-size: 16.5px;
  }
  .result-stats .l {
    font-size: 10px;
  }
  .podium {
    gap: 6px;
  }
  .podium .ring {
    width: 46px;
    height: 46px;
    font-size: 21px;
  }
  .podium .p.first .ring {
    width: 58px;
    height: 58px;
    font-size: 26px;
  }
  .podium .xp {
    font-size: 10px;
  }
  .chat-feed {
    min-height: calc(100dvh - 340px);
    padding: 10px;
  }
  .chat-composer {
    padding: 8px;
  }
  .composer-send {
    padding: 0 14px;
    font-size: 12.5px;
  }
  .msg-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .msg-text {
    font-size: 13px;
  }
  .bubble {
    padding: 8px 10px;
  }
  .news-card {
    padding: 13px;
  }
  .kpi .v {
    font-size: 19px;
  }
  .question-card .qo {
    grid-template-columns: 1fr;
  }
  .subject-edit-card {
    flex-wrap: wrap;
  }
  .subject-edit-card .grow {
    flex-basis: 60%;
  }
  .backup-zone {
    padding: 14px;
  }
  .topbar-inner {
    gap: 8px;
  }
  .xp-pill {
    font-size: 11.5px;
    padding: 5px 9px;
  }
  .toast {
    font-size: 12px;
    padding: 9px 13px;
  }
  body.has-chrome .toast-wrap {
    top: 70px;
  }
}

@media (max-width: 380px) {
  .brand-fa {
    font-size: 18px;
  }
  .brand-en {
    font-size: 7.5px;
    letter-spacing: 1.8px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .chips {
    gap: 6px;
  }
  .chip {
    padding: 6px 11px;
    font-size: 12.5px;
  }
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
  .quiz-side .quiz-xp {
    display: none;
  }
  .podium .name {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .play-progress {
    min-width: 36px;
  }
  .timer-ring {
    width: 42px;
    height: 42px;
  }
  .timer-ring b {
    font-size: 11.5px;
  }
  .practice-badge {
    display: none;
  }
  .hearts {
    font-size: 13px;
  }
  .play-top {
    padding: 8px 10px;
    gap: 7px;
  }
  .composer-subject {
    order: 3;
    width: 100%;
  }
  .composer-send {
    min-height: 42px;
  }
  .stats-row + .card,
  .stat-cards {
    gap: 7px;
  }
  .btn-login-pill {
    padding: 8px 20px;
    min-height: 40px;
  }
  .landing .brand-fa {
    font-size: 22px;
  }
  .hero-cta {
    gap: 10px;
  }
  .hero-cta .btn {
    width: 100%;
  }
  .hero-note {
    width: 100%;
  }
  .timer-ring.warn,
  .timer-ring.danger {
    animation: none;
  }
}

@media (max-width: 360px) {
  .tab {
    font-size: 9.5px;
    padding: 7px 2px 8px;
  }
  .tab .ic {
    font-size: 19px;
  }
  .hero h1 {
    font-size: 24px;
  }
  .page {
    padding-inline: 10px;
  }
  .option {
    font-size: 13.5px;
  }
  .chat-composer {
    padding: 6px;
  }
  .composer-row textarea {
    flex-basis: calc(100% - 132px);
    font-size: 12.5px;
  }
}

/* ============================================================
   کاراکتر روباه، دکمه صدا و جلوه‌های تازه
   ============================================================ */

/* ---------- دکمه صدا ---------- */

.sound-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(26, 35, 48, 0.06);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.sound-btn:hover {
  background: var(--brand-soft);
  transform: translateY(-1px);
}
.sound-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}
.sound-btn.is-off {
  opacity: 0.62;
  filter: grayscale(1);
}
.sound-btn--light {
  background: var(--chrome);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sound-btn--play {
  width: 36px;
  height: 36px;
  border-color: transparent;
  background: #f2f5ef;
  box-shadow: none;
  font-size: 15px;
}

.landing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* ---------- روباه ---------- */

.fox {
  overflow: visible;
  display: block;
  max-width: 100%;
  height: auto;
  flex: none;
  transform-origin: 50% 100%;
}
.fox g {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.fox-sparkles,
.fox-happy-eyes,
.fox-sleep-eyes,
.fox-brows,
.fox-sad-brows,
.fox-mouth-sad,
.fox-mouth-oh,
.fox-tongue,
.fox-arm-wave,
.fox-zzz {
  opacity: 0;
}

.fox-tail {
  transform-box: view-box;
  transform-origin: 78px 176px;
  animation: fox-tail 3.1s ease-in-out infinite;
}
.fox-body {
  transform-box: view-box;
  transform-origin: 110px 203px;
  animation: fox-breathe 3.6s ease-in-out infinite;
}
.fox-head {
  transform-box: view-box;
  transform-origin: 110px 158px;
  animation: fox-head-bob 3.6s ease-in-out infinite;
}
.fox-eyes {
  transform-box: view-box;
  transform-origin: 110px 94px;
  animation: fox-blink 4.6s infinite;
}
.fox-ears {
  transform-box: view-box;
  transform-origin: 110px 82px;
  animation: fox-ears 6.4s ease-in-out infinite;
}
.fox-ear {
  transform-box: view-box;
  transition: transform 0.35s ease;
}
.fox-ear-l {
  transform-origin: 68px 84px;
}
.fox-ear-r {
  transform-origin: 152px 84px;
}

/* حالت شاد و جشن */
.fox--happy .fox-eyes,
.fox--celebrate .fox-eyes,
.fox--sleep .fox-eyes {
  opacity: 0;
}
.fox--happy .fox-happy-eyes,
.fox--celebrate .fox-happy-eyes {
  opacity: 1;
}
.fox--sleep .fox-sleep-eyes {
  opacity: 1;
}
.fox--happy .fox-tongue,
.fox--celebrate .fox-tongue {
  opacity: 1;
}
.fox--happy .fox-sparkles,
.fox--celebrate .fox-sparkles {
  opacity: 1;
}
.fox--happy .fox-arm-wave,
.fox--celebrate .fox-arm-wave,
.fox--wave .fox-arm-wave {
  opacity: 1;
}
.fox--wave .fox-arm-rest {
  opacity: 0;
}
.fox--happy .fox-arm-wave,
.fox--celebrate .fox-arm-wave {
  transform-box: view-box;
  transform-origin: 84px 158px;
  transform: rotate(-18deg);
}
.fox--wave .fox-arm-wave {
  transform-box: view-box;
  transform-origin: 84px 158px;
  animation: fox-wave 1.05s ease-in-out infinite;
}

/* حالت خنثی، فکر، ناراحت و خواب */
.fox--think .fox-mouth-smile,
.fox--sleep .fox-mouth-smile,
.fox--sad .fox-mouth-smile {
  opacity: 0;
}
.fox--think .fox-mouth-oh {
  opacity: 1;
}
.fox--think .fox-brows {
  opacity: 1;
}
.fox--think .fox-head {
  transform-box: view-box;
  transform-origin: 110px 158px;
  animation: fox-think 2.9s ease-in-out infinite;
}
.fox--sad .fox-mouth-sad {
  opacity: 1;
}
.fox--sad .fox-sad-brows {
  opacity: 1;
}
.fox--sad {
  animation: fox-sway 3s ease-in-out infinite;
}
.fox--sad .fox-ear-l {
  transform: rotate(-9deg);
}
.fox--sad .fox-ear-r {
  transform: rotate(9deg);
}
.fox--sleep .fox-zzz {
  opacity: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: fox-zzz 2.7s ease-in-out infinite;
}
.fox--sleep .fox-zzz.z2 {
  animation-delay: 1.35s;
}
.fox--sleep .fox-head {
  transform-box: view-box;
  transform-origin: 110px 158px;
  animation: fox-sleep-bob 5s ease-in-out infinite;
}

/* جشن */
.fox--celebrate {
  animation: fox-jump 0.82s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.fox--celebrate .sp,
.fox--happy .sp {
  transform-box: fill-box;
  transform-origin: center;
  animation: fox-spark 1.35s ease-in-out infinite;
}
.fox--celebrate .sp2,
.fox--happy .sp2 {
  animation-delay: 0.22s;
}
.fox--celebrate .sp3,
.fox--happy .sp3 {
  animation-delay: 0.44s;
}

@keyframes fox-tail {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(5deg);
  }
}
@keyframes fox-breathe {
  0%,
  100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.008, 0.986);
  }
}
@keyframes fox-head-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1.6px);
  }
}
@keyframes fox-blink {
  0%,
  90%,
  100% {
    transform: scaleY(1);
  }
  93% {
    transform: scaleY(0.12);
  }
  96% {
    transform: scaleY(1);
  }
}
@keyframes fox-ears {
  0%,
  100% {
    transform: rotate(0deg);
  }
  40% {
    transform: rotate(1.4deg);
  }
  70% {
    transform: rotate(-1.2deg);
  }
}
@keyframes fox-wave {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(-27deg);
  }
}
@keyframes fox-jump {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-12px) scale(1.03, 0.97);
  }
  55% {
    transform: translateY(0) scale(0.99, 1.02);
  }
}
@keyframes fox-spark {
  0%,
  100% {
    transform: scale(0.45) rotate(0deg);
    opacity: 0.2;
  }
  50% {
    transform: scale(1) rotate(40deg);
    opacity: 1;
  }
}
@keyframes fox-zzz {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  30% {
    opacity: 0.9;
  }
  100% {
    transform: translate(9px, -17px);
    opacity: 0;
  }
}
@keyframes fox-sway {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(2.5px);
  }
}
@keyframes fox-think {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-3deg);
  }
}
@keyframes fox-sleep-bob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(1.5px) rotate(1.5deg);
  }
}
@keyframes chip-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

.xp-chip.bump {
  animation: chip-bump 0.45s ease;
}

.msg-del {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
}
.btn-sm {
  min-height: 38px;
}
.icon-btn {
  min-width: 36px;
  height: 36px;
}

/* ---------- حباب گفتار روباه ---------- */

.fox-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fffdf8, #f4ffe9);
  border: 1px solid #e2f0d6;
  border-radius: 20px;
  padding: 10px 14px 10px 8px;
  box-shadow: var(--shadow-sm);
}
.fox-bubble-art {
  flex: none;
  filter: drop-shadow(0 8px 10px rgba(26, 35, 48, 0.1));
}
.fox-bubble-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  line-height: 1.85;
  min-width: 0;
}
.modal .fox-bubble {
  margin-bottom: 14px;
}
.chat-side .fox-bubble {
  margin-top: 10px;
}
.chat-empty .fox {
  margin: 0 auto 10px;
}
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- جای روباه در صفحه‌ها ---------- */

.loader-fox {
  width: 96px;
  height: auto;
  border-radius: 0;
  object-fit: contain;
  animation: bob 1.6s ease-in-out infinite;
}
.welcome-art svg {
  width: 116px;
  height: auto;
  filter: drop-shadow(0 14px 18px rgba(26, 35, 48, 0.16));
  animation: float 5s ease-in-out infinite;
}
.result-fox {
  width: 172px;
  height: 172px;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf0, #f0ffe0);
  border: 1px solid #e6f5d4;
  box-shadow: 0 18px 40px -24px rgba(88, 204, 2, 0.8);
}
.feedback .ic .fox {
  filter: drop-shadow(0 6px 8px rgba(26, 35, 48, 0.12));
}

/* ---------- پرداخت نهایی رابط ---------- */

.topnav-link {
  position: relative;
}
.topnav-link.active::after {
  content: '';
  position: absolute;
  inset-inline: 30%;
  bottom: 1px;
  height: 3px;
  border-radius: 99px;
  background: var(--brand);
}

.stat-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quiz-row {
  transition: background 0.16s ease, transform 0.14s ease, border-color 0.16s ease;
}
.quiz-row:hover {
  transform: translateY(-1px);
  border-color: #d8ecc6;
}
.quiz-row:active {
  transform: translateY(1px) scale(0.996);
}

.chat-feed {
  scrollbar-width: thin;
  scrollbar-color: #d5e0cf transparent;
}
.chat-feed::-webkit-scrollbar {
  width: 8px;
}
.chat-feed::-webkit-scrollbar-thumb {
  background: #d5e0cf;
  border-radius: 99px;
}

.modal-backdrop {
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

/* پیام‌های کوتاه از پایین صفحه ظاهر شوند تا تیتر صفحه را نپوشانند */
.toast-wrap {
  top: auto;
  bottom: calc(18px + env(safe-area-inset-bottom));
}
body.has-chrome .toast-wrap {
  top: auto;
}

@media (max-width: 900px) {
  .btn-sm {
    min-height: 42px;
  }
  .icon-btn {
    min-width: 40px;
    height: 40px;
    font-size: 14px;
  }
  .modal-close {
    width: 38px;
    height: 38px;
  }
  .play-close {
    width: 42px;
    height: 42px;
  }
  .msg-del {
    min-width: 30px;
    height: 30px;
    font-size: 12px;
    border-radius: 9px;
  }
  body.has-chrome .toast-wrap {
    bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  }
  .page {
    padding-bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom));
  }
  .page.chat-page {
    height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom));
  }
  .landing {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .welcome-art svg {
    width: 96px;
  }
}

@media (max-width: 720px) {
  .welcome-art svg {
    width: 78px;
  }
  .chat-page .chat-pins .pin-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .result-fox {
    width: 146px;
    height: 146px;
  }
  .result-fox .fox {
    width: 132px;
    height: auto;
  }
  .tabs {
    scroll-snap-type: x proximity;
    padding: 4px 5px;
    -webkit-mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to left, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .tabs button {
    scroll-snap-align: center;
  }
}

@media (max-width: 620px) {
  .tbl-wrap--cards {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  table.tbl--cards {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .tbl--cards thead {
    display: none;
  }
  .tbl--cards tbody {
    display: grid;
    gap: 10px;
  }
  .tbl--cards tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: var(--shadow-xs);
  }
  .tbl--cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border: 0;
    font-size: 12.5px;
    text-align: left;
  }
  .tbl--cards td::before {
    content: attr(data-label);
    flex: none;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
  }
  .tbl--cards td[data-label='#'] {
    display: none;
  }
  .tbl--cards td[data-label='دانش‌آموز'] {
    background: #fbfdf8;
    border-radius: 11px;
    margin-bottom: 6px;
    padding: 6px 8px;
    justify-content: flex-start;
  }
  .tbl--cards td[data-label='دانش‌آموز']::before {
    display: none;
  }
  .tbl--cards td[colspan] {
    display: block;
    text-align: center;
  }
  .tbl--cards td[colspan]::before {
    display: none;
  }
  .tbl--cards tr:hover td {
    background: transparent;
  }
  .tbl--cards td[data-label='دانش‌آموز']:hover {
    background: #fbfdf8;
  }
}

@media (max-width: 480px) {
  .sound-btn--play {
    width: 38px;
    height: 38px;
  }
  .modal .fox-bubble {
    gap: 9px;
    padding: 8px 10px 8px 6px;
  }
  .modal .fox-bubble .fox {
    width: 76px;
    height: auto;
  }
  .fox-bubble-text {
    font-size: 11.5px;
  }
}

@media (max-width: 560px) {
  .welcome-art {
    display: block;
  }
  .welcome-art svg {
    width: 60px;
  }
  .hero {
    padding: 0 14px 12px;
  }
  .hero-art {
    min-height: 198px;
  }
  .hero-art img {
    width: min(192px, 58%);
  }
  .hero-art::before {
    width: min(196px, 64%);
  }
}

@media (max-width: 400px) {
  .podium {
    gap: 4px;
  }
  .podium .ring {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .podium .p.first .ring {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }
  .podium .name {
    font-size: 9.5px;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .podium .xp {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .fox,
  .fox * {
    animation: none !important;
  }
}



/* ============================================================
   درخواست‌های معلم و سازنده
   ============================================================ */

.req-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.req-stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  background: var(--surface-2);
  text-align: center;
}
.req-stat b {
  display: block;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.5;
}
.req-stat span {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
}

.req-list {
  display: grid;
  gap: 10px;
}

.req-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px 13px 16px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.req-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.req-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: var(--line);
}
.req-card.open::before {
  background: linear-gradient(180deg, var(--orange), var(--amber));
}
.req-card.done::before {
  background: linear-gradient(180deg, var(--brand), var(--brand-d));
}
.req-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.req-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.7;
}
.req-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}
.req-text {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.req-response {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 12px;
  line-height: 1.95;
  overflow-wrap: anywhere;
}
.req-response b {
  color: var(--brand-d);
}
.req-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.req-actions .input {
  flex: 1;
  min-width: 150px;
}
.req-form-head {
  align-items: center;
  margin-bottom: 12px;
}
.req-ico {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--brand-l);
  flex: none;
}
.req-empty {
  text-align: center;
  padding: 26px 14px;
  color: var(--muted);
}
.req-empty .big {
  display: block;
  font-size: 36px;
  margin-bottom: 6px;
}
