/* ───────── صفحه‌ی اصلی ───────── */
.hero {
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700)); color: #fff; border-radius: var(--radius-lg);
  padding: 20px 24px; display: flex; align-items: center; gap: 18px; justify-content: space-between; flex-wrap: wrap;
  position: relative; overflow: hidden; margin-bottom: 16px;
}
.hero::after { content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero h1 { color: #fff; margin-bottom: 4px; font-size: 1.4rem; }
.hero p { margin: 0; opacity: .9; max-width: 560px; }
.hero .btn { position: relative; z-index: 1; }
.hero-steps { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; position: relative; z-index: 1; }
.hero-steps li { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; }
.hero-steps b { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: .9rem; flex: none; }
.hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; position: relative; z-index: 1; }
.hero-link { color: #fff; text-decoration: underline; text-underline-offset: 4px; display: inline-flex; align-items: center; min-height: 32px; }
@media (pointer: coarse) { .hero-link { min-height: var(--touch); } }
.continue-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.continue-card .play { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-600); color: #fff; display: grid; place-items: center; flex: none; }

/* استوری‌ها */
.stories { display: flex; gap: 16px; overflow-x: auto; padding: 4px 4px 10px; scrollbar-width: thin; margin-bottom: 6px; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; width: 72px; flex: none; color: var(--text); }
.story-ring {
  width: 66px; height: 66px; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 200deg, var(--ring, #6D3BEA), #FF8A5B, var(--ring, #6D3BEA));
  transition: transform .15s;
}
.story:hover .story-ring { transform: scale(1.05); }
.story.is-seen .story-ring { background: var(--border-strong); }
.story-face {
  width: 100%; height: 100%; border-radius: 50%; background: var(--ring, #6D3BEA); border: 3px solid var(--bg);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.4rem; overflow: hidden;
}
.story-face img { width: 100%; height: 100%; object-fit: cover; }
.story-name { font-size: .86rem; font-weight: 500; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.story-viewer { position: fixed; inset: 0; z-index: 300; background: rgba(15,10,30,.92); display: grid; place-items: center; }
.story-stage { position: relative; width: min(420px, 100vw); height: min(780px, 100dvh); background: #000; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; color: #fff; }
.story-bars { position: absolute; top: 12px; inset-inline: 12px; display: flex; gap: 5px; z-index: 3; direction: rtl; }
.story-bars i { flex: 1; height: 3.5px; background: rgba(255,255,255,.35); border-radius: 3px; overflow: hidden; display: block; }
.story-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.story-bars i.done b { width: 100%; }
.story-top { position: absolute; top: 26px; inset-inline: 14px; display: flex; align-items: center; gap: 10px; z-index: 3; }
.story-top .avatar { width: 36px; height: 36px; background: var(--ring); color: #fff; }
.story-top strong { text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.story-media { flex: 1; display: grid; place-items: center; background: #000; min-height: 0; }
.story-media video { width: 100%; height: 100%; object-fit: contain; }
.story-card { width: 100%; height: 100%; padding: 90px 32px 120px; display: flex; flex-direction: column; justify-content: center; gap: 12px; text-align: center; background: linear-gradient(160deg, var(--ring), #1b1240); }
.story-card .tag { align-self: center; padding: 2px 12px; border-radius: 99px; background: rgba(255,255,255,.2); font-size: .86rem; }
.story-card h2 { color: #fff; font-size: 1.35rem; line-height: 1.7; }
.story-card .meta { opacity: .88; font-size: .9rem; }
.story-course img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.4); margin-bottom: 6px; }
.story-lessons { text-align: start; align-items: stretch; }
.story-lessons .tag, .story-lessons h2 { align-self: center; text-align: center; }
.lesson-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.lesson-list li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.14); line-height: 1.7; font-size: .95rem; }
.lesson-list .no { flex: none; min-width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.28); display: inline-grid; place-items: center; font-size: .86rem; font-weight: 700; }
.story-lessons .meta { text-align: center; }
.story-foot { position: absolute; inset-inline: 0; bottom: 0; padding: 60px 18px 22px; background: linear-gradient(transparent, rgba(0,0,0,.75)); z-index: 3; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.story-foot .title { font-weight: 600; }
.story-close { position: absolute; top: 22px; inset-inline-end: 12px; z-index: 5; color: #fff; }
.story-nav { position: absolute; inset-block: 70px 110px; width: 40%; z-index: 2; background: none; border: 0; }
.story-nav.prev { right: 0; } .story-nav.next { left: 0; }
.story-sound { position: absolute; bottom: 110px; inset-inline-start: 14px; z-index: 4; background: rgba(0,0,0,.5); color: #fff; border: 0; border-radius: 99px; padding: 6px 14px; min-height: 36px; font-size: .86rem; }

/* صفحه‌ی اصلی: دوره‌ها در تمام عرض (دستیار شناور است و جای ثابت نمی‌گیرد) */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; gap: 10px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head h2 .icon { color: var(--brand-600); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.home-main .course-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.course-block + .course-block { margin-top: 24px; }
.empty { padding: 22px; text-align: center; color: var(--muted); background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }

/* کارت دوره */
.course-card { display: flex; flex-direction: column; overflow: hidden; color: inherit; transition: transform .15s, box-shadow .15s; height: 100%; }
@media (hover: hover) { .course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; } }
.course-card:hover { text-decoration: none; }
.cc-cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--tc, #6D3BEA), #1b1240); display: grid; place-items: center; color: #fff; overflow: hidden; }
.cc-cover img { width: 100%; height: 100%; object-fit: cover; }
.cc-cover .ph { font-size: 2.2rem; font-weight: 700; opacity: .9; }
.cc-cover .play { position: absolute; inset-inline-start: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--brand-700); display: grid; place-items: center; box-shadow: var(--shadow); }
.cc-price { position: absolute; top: 8px; inset-inline-end: 8px; }
.cc-tool { position: absolute; top: 8px; inset-inline-start: 8px; background: rgba(0,0,0,.45); color: #fff; padding: 1px 9px; border-radius: 99px; font-size: .86rem; }
.cc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cc-title { font-weight: 700; line-height: 1.65; margin: 0; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-summary { color: var(--muted); font-size: .9rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-meta { margin-top: auto; display: flex; gap: 12px; color: var(--muted); font-size: .86rem; flex-wrap: wrap; }
.cc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.course-card.is-entry { border-color: var(--brand-400, var(--brand-300)); }
.cc-flag { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; background: var(--brand-50); color: var(--brand-700); padding: 1px 9px; border-radius: 8px; font-size: .86rem; font-weight: 600; }
.cc-price-inline, .cc-tool-inline { display: none; }

/* ───────── دستیار شناور ───────── */
.cw { --cw-gap: 18px; --cw-w: 380px; }
.cw-fab {
  position: fixed; z-index: 90; left: var(--cw-gap); bottom: var(--cw-gap); width: 54px; height: 54px; border-radius: 50%;
  border: 0; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-lg); transition: transform .18s ease, box-shadow .18s ease;
}
.cw-fab:hover { transform: translateY(-2px); box-shadow: 0 22px 48px rgba(42,31,92,.28); }
.cw-fab:active { transform: scale(.95); }
.cw-fab:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 3px; }
.cw-fab::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand-500); opacity: 0; animation: cw-ring 2.6s ease-out 1.2s 2; pointer-events: none; }
.cw-dot { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FF4D6D; border: 3px solid #fff; }
.cw-tip {
  position: fixed; z-index: 89; left: calc(var(--cw-gap) + 66px); bottom: calc(var(--cw-gap) + 10px); background: var(--text); color: #fff;
  padding: 6px 12px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); animation: cw-pop .25s ease-out;
}
.cw-tip::before { content: ""; position: absolute; top: 50%; right: 100%; margin-top: -6px; border: 6px solid transparent; border-left-color: transparent; border-right-color: var(--text); }

.cw-panel {
  position: fixed; z-index: 95; left: var(--cw-gap); bottom: var(--cw-gap); width: var(--cw-w); max-width: calc(100vw - 2 * var(--cw-gap));
  height: min(600px, calc(100dvh - var(--header-h) - 28px)); display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  transform-origin: bottom left; animation: cw-in .2s ease-out;
}
.cw-panel:focus { outline: none; }
.cw-head { display: flex; align-items: center; gap: 2px; padding: 6px 8px 6px 4px; background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); color: #fff; flex: none; }
.cw-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; margin-inline: 4px; }
.cw-title { flex: 1; min-width: 0; line-height: 1.4; }
.cw-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.cw-sub { font-size: .86rem; opacity: .92; display: inline-flex; align-items: center; gap: 6px; }
.cw-online { width: 8px; height: 8px; border-radius: 50%; background: #5CF29B; box-shadow: 0 0 0 3px rgba(92,242,155,.25); }
.cw-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.cw-btn:hover { background: rgba(255,255,255,.16); }
.cw-btn:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.cw-page { flex: none; padding: 6px 12px; background: var(--brand-50); color: var(--brand-800); font-size: .86rem; border-bottom: 1px solid var(--border); line-height: 1.65; }
.cw-page.is-muted { background: var(--surface-2); color: var(--muted); }

.cw-view { flex: 1; min-height: 0; background: var(--surface-2); }
.cw-chat { position: relative; display: flex; flex-direction: column; }
.cw-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cw-log:focus-visible { outline: 3px solid var(--brand-300); outline-offset: -3px; }

/* نوار پیمایش: باریک و شفاف، فقط هنگام پیمایش یا رفتن موس روی فهرست پیدا می‌شود. پیمایش با چرخ، لمس و صفحه‌کلید مثل قبل است. */
.cw-log, .cw-hist, .cw-settings { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.cw-log:hover, .cw-log.is-scrolling, .cw-log:focus-visible, .cw-hist:hover, .cw-settings:hover { scrollbar-color: color-mix(in srgb, var(--brand-600) 38%, transparent) transparent; }
.cw-form textarea { scrollbar-width: none; }
.cw-form textarea::-webkit-scrollbar { display: none; }
@supports not (scrollbar-width: thin) {
  .cw-log::-webkit-scrollbar, .cw-hist::-webkit-scrollbar, .cw-settings::-webkit-scrollbar { width: 6px; }
  .cw-log::-webkit-scrollbar-track, .cw-hist::-webkit-scrollbar-track, .cw-settings::-webkit-scrollbar-track { background: transparent; }
  .cw-log::-webkit-scrollbar-thumb, .cw-hist::-webkit-scrollbar-thumb, .cw-settings::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; }
  .cw-log:hover::-webkit-scrollbar-thumb, .cw-log.is-scrolling::-webkit-scrollbar-thumb, .cw-hist:hover::-webkit-scrollbar-thumb, .cw-settings:hover::-webkit-scrollbar-thumb { background: rgba(109, 59, 234, .38); }
}
.cw-msg { max-width: 90%; padding: 8px 12px; border-radius: 14px; line-height: 1.7; font-size: 1rem; overflow-wrap: anywhere; box-shadow: var(--shadow-sm); }
.cw-msg p { margin: 0 0 .5em; } .cw-msg p:last-child { margin: 0; }
.cw-msg ol, .cw-msg ul { margin: .3em 0 .6em; padding-inline-start: 1.3em; }
.cw-msg-user { align-self: flex-start; background: var(--brand-600); color: #fff; border-end-start-radius: 4px; white-space: pre-wrap; }
.cw-msg-bot { align-self: flex-end; background: #fff; border: 1px solid var(--border); border-end-end-radius: 4px; }
.cw-msg-bot.is-typing:empty::before { content: "…"; color: var(--muted); }
.cw-msg-bot.is-status { color: var(--muted); font-size: .9rem; }
.cw-msg-bot.is-working { padding: 7px 12px; }
/* گام‌های آماده‌سازی: کوچک، کم‌رنگ و موقت؛ با رسیدن اولین کلمه‌ی جواب برداشته می‌شوند */
.cw-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: .86rem; line-height: 1.65; color: var(--muted); }
.cw-steps li { display: flex; align-items: center; gap: 8px; }
.cw-steps li::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.cw-steps li.is-run { color: var(--text-2); }
.cw-steps li.is-run::before { border: 2px solid var(--brand-100); border-top-color: var(--brand-600); animation: cw-spin .8s linear infinite; }
.cw-steps li.is-done::before { background: var(--brand-600) center / 8px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); opacity: .55; }
.cw-steps li.is-done { opacity: .75; }
@keyframes cw-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cw-steps li.is-run::before { animation: none; border-top-color: var(--brand-300); } }

/* کارت سبد خرید زیر پیام */
.cw-cart { margin-top: 8px; padding: 9px 11px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); display: flex; flex-direction: column; gap: 5px; font-size: .92rem; }
.cw-cart-line { margin: 0; line-height: 1.65; }
.cw-cart-line.is-ok { color: var(--ok, #12805c); }
.cw-cart-line.is-bad { color: var(--bad); }
.cw-act-title { margin: 0; font-weight: 700; color: var(--brand-800); }
.cw-cart-line.is-plan { color: var(--text); }
.cw-act[data-status="rejected"] .cw-cart-line.is-plan, .cw-act[data-status="expired"] .cw-cart-line.is-plan { color: var(--text-2); text-decoration: line-through; }
.cw-act-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cw-act-yes, .cw-act-no { min-height: 44px; min-width: 92px; padding: 6px 20px; border-radius: 99px; font: inherit; font-weight: 700; cursor: pointer; border: 1.5px solid var(--brand-600); }
.cw-act-yes { background: var(--brand-600); color: #fff; }
.cw-act-yes:hover:not(:disabled) { background: var(--brand-700); }
.cw-act-no { background: transparent; color: var(--brand-700); }
.cw-act-no:hover:not(:disabled) { background: var(--brand-50); }
.cw-act-yes:disabled, .cw-act-no:disabled { opacity: .6; cursor: default; }
.cw-act-yes:focus-visible, .cw-act-no:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; }
.cw-act-hint { margin: 0; font-size: .86rem; color: var(--text-2); }
.cw-cart-sum { margin: 0; color: var(--text-2); font-weight: 600; }
.cw-cart-choices { display: flex; flex-direction: column; gap: 6px; }
.cw-chip { min-height: 44px; text-align: start; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--brand-300); background: #fff; color: var(--brand-800); font: inherit; cursor: pointer; }
.cw-chip:hover { background: var(--brand-100); }
.cw-chip:focus-visible, .cw-cart-btn:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; }
.cw-cart-btn { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; padding: 6px 18px; border-radius: 99px; background: var(--brand-600); color: #fff; font-weight: 700; text-decoration: none; }
.cw-cart-btn:hover { background: var(--brand-700); }
.cw-file-all { margin-inline-start: 12px; font-size: .86rem; }
.cw-files-link { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; padding: 6px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); color: var(--brand-700); text-decoration: none; font-size: .9rem; }
.cw-files-link:hover { background: var(--brand-50); }
.cw-msg-bot.is-status::after, .cw-msg-bot.is-working::after { content: none !important; }
.cw-msg-bot.is-typing:not(:empty)::after { content: "▍"; animation: cw-blink 1s steps(2) infinite; color: var(--brand-600); }
.cw-msg-error { align-self: center; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--bad-bg); color: var(--bad); font-size: .9rem; }
.cw-retry { min-height: 40px; padding: 4px 14px; border-radius: 99px; border: 1.5px solid var(--bad); background: #fff; color: var(--bad); font: inherit; font-weight: 600; cursor: pointer; }
.cw-file { margin-top: 8px; font-size: .9rem; color: var(--muted); }
.cw-file.is-error { color: var(--bad); }
.cw-file-link { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border-radius: 99px; border: 1.5px solid var(--brand-600); background: #fff; color: var(--brand-700); font-weight: 600; text-decoration: none; }
.cw-file-link:hover { background: var(--brand-100); }
.cw-file-link:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; }

.cw-empty, .cw-locked { margin: auto; padding: 16px 14px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cw-big { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; }
.cw-empty p { margin: 0; color: var(--text-2); }
.cw-suggest { display: flex; flex-direction: column; gap: 6px; align-self: stretch; margin-top: 4px; }
.cw-suggest button { min-height: 44px; text-align: start; background: #fff; border: 1.5px solid var(--brand-100); color: var(--brand-800); padding: 7px 12px; border-radius: 12px; font: inherit; font-size: .93rem; line-height: 1.65; cursor: pointer; }
.cw-suggest button:hover { background: var(--brand-50); border-color: var(--brand-300); }
.cw-locked strong { color: var(--text); }
.cw-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface-2); }
.cw-loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-300); animation: cw-bounce 1s infinite ease-in-out; }
.cw-loading span:nth-child(2) { animation-delay: .15s; } .cw-loading span:nth-child(3) { animation-delay: .3s; }

.cw-form { flex: none; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 8px 10px 4px; border-top: 1px solid var(--border); background: #fff; }
.cw-form textarea { border: 1.5px solid var(--border-strong); border-radius: 22px; padding: 9px 14px; font: inherit; line-height: 1.65; max-height: 120px; min-height: 44px; resize: none; background: var(--surface-2); }
.cw-form textarea:focus { outline: 3px solid var(--brand-100); border-color: var(--brand-500); }
.cw-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand-600); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cw-send:hover { background: var(--brand-700); }
.cw-send:disabled { opacity: .5; cursor: not-allowed; }
.cw-send:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; }
.cw-send .icon { transform: scaleX(-1); }
.cw-hint { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; color: var(--muted); padding-bottom: 4px; }

.cw-settings { overflow-y: auto; overscroll-behavior: contain; }
.cw-agent { display: flex; flex-direction: column; gap: 8px; padding: 14px 12px 18px; }
.cw-label { font-weight: 700; font-size: .93rem; color: var(--text); padding: 0; }
.cw-help { margin: -4px 0 4px; font-size: .86rem; color: var(--muted); line-height: 1.65; }
.cw-faces { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cw-face-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cw-face { position: relative; display: block; cursor: pointer; }
.cw-face input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.cw-face span { display: grid; place-items: center; min-height: 52px; border-radius: 12px; border: 2px solid var(--border); background: #fff; color: var(--brand-700); transition: border-color .15s, background-color .15s; }
.cw-face input:checked + span { border-color: var(--brand-600); background: var(--brand-50); }
.cw-face input:focus-visible + span { outline: 3px solid var(--brand-300); outline-offset: 2px; }
.cw-agent-msg { min-height: 1.4em; margin: 0; font-size: .9rem; }
.cw-agent-msg.is-bad { color: var(--bad); } .cw-agent-msg.is-ok { color: var(--ok, #12805c); }
.cw-agent-actions { display: flex; gap: 8px; }
.cw-agent input[aria-invalid="true"] { border-color: var(--bad); }

.cw-hist { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.cw-hist-tools { padding: 10px 12px 0; }
.cw-search { width: 100%; min-height: 44px; border: 1.5px solid var(--border-strong); border-radius: 12px; padding: 8px 14px; font: inherit; background: #fff; }
.cw-hist-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cw-hist-row { display: flex; align-items: stretch; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.cw-hist-row.is-current { border-color: var(--brand-300); background: var(--brand-50); }
.cw-hist-item { flex: 1; min-width: 0; min-height: 52px; text-align: start; background: transparent; border: 0; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-radius: 12px; }
.cw-hist-item:hover { background: var(--brand-50); }
.cw-hist-item .t { font-weight: 600; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cw-hist-item .d { font-size: .86rem; color: var(--muted); }
.cw-del { width: 44px; flex: none; border: 0; background: transparent; color: var(--muted); border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.cw-del:hover { color: var(--bad); background: var(--bad-bg); }
.cw-hist-row.is-confirming { align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; background: var(--bad-bg); border-color: transparent; }
.cw-hist-row .ask { flex: 1 1 100%; color: var(--bad); font-weight: 600; }
.cw-yes, .cw-no { min-height: 44px; padding: 6px 16px; border-radius: 99px; font: inherit; font-weight: 600; cursor: pointer; }
.cw-yes { background: var(--bad); color: #fff; border: 0; }
.cw-no { background: #fff; color: var(--text-2); border: 1.5px solid var(--border-strong); }
.cw-hist-empty { margin: auto; padding: 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }

.cw-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(20,12,45,.5); animation: cw-fade .2s ease-out; }
html.cw-lock { overflow: hidden; }

@keyframes cw-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cw-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes cw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cw-pop { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes cw-ring { 0% { opacity: .55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes cw-blink { 50% { opacity: 0; } }
@keyframes cw-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

@media (max-width: 900px) {
  .cw-fab { left: max(16px, env(safe-area-inset-left)); bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  .cw-tip { display: none; }
  .cw-panel {
    left: 0; right: 0; bottom: 0; width: 100%; max-width: none; z-index: 130; height: min(88dvh, calc(100dvh - 12px));
    border-radius: 22px 22px 0 0; border-bottom: 0; transform-origin: bottom center; animation: cw-up .26s ease-out; padding-bottom: env(safe-area-inset-bottom); background: #fff;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cw *, .cw-backdrop, .cw-fab::before { animation: none !important; transition: none !important; }
}

/* ───────── فهرست دوره‌ها ───────── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 160px; }
.filters-search { flex: 1 1 280px; display: flex; gap: 8px; min-width: 0; }
.filters-search .search { flex: 1; min-width: 0; width: 100%; }
.results-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 10px; color: var(--muted); font-size: .92rem; }
.results-line a { display: inline-flex; align-items: center; min-height: 32px; }
@media (pointer: coarse) { .results-line a { min-height: var(--touch); } }
.empty-find { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 18px; }
.empty-find strong { color: var(--text); font-size: 1.05rem; }
.empty-find p { margin: 0 0 6px; }
.pill-tabs { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pill-tabs a { padding: 5px 14px; border-radius: 9px; color: var(--text-2); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; min-height: 32px; }
@media (pointer: coarse) { .pill-tabs { padding: 2px; } .pill-tabs a { min-height: var(--touch); } }.pill-tabs a.active { background: var(--brand-600); color: #fff; }
.pill-tabs a:hover { text-decoration: none; }

/* ───────── جزئیات دوره ───────── */
.crumbs { display: flex; align-items: center; gap: 6px; margin: 2px 0 10px; font-size: .92rem; color: var(--muted); min-width: 0; }
.crumbs a { display: inline-flex; align-items: center; min-height: 32px; flex: none; }
.crumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.crumbs .sep { opacity: .6; flex: none; }
@media (pointer: coarse) { .crumbs a { min-height: var(--touch); padding-inline: 6px; margin-inline: -6px; } }
/* three parts in this order: the intro, the start box, then the description and syllabus. On a phone that is the reading order, so the
   start button sits right under the title; on a desktop the box stands beside both. */
.detail-head { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "intro box" "body box"; gap: 20px; align-items: start; }
.detail-intro { grid-area: intro; min-width: 0; }
.detail-body { grid-area: body; min-width: 0; }
.detail-cover { aspect-ratio: 5 / 2; border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, var(--tc, #6D3BEA), #1b1240); display: grid; place-items: center; color: #fff; font-size: 2.8rem; font-weight: 700; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.buy-box { grid-area: box; position: sticky; top: calc(var(--header-h) + 14px); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.path-hint { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: .92rem; }
.path-hint b { display: block; margin-bottom: 4px; }
.path-hint ol { margin: 0; padding-inline-start: 1.6em; color: var(--text-2); list-style-type: persian; }
.path-hint li + li { margin-top: 3px; }
.path-note { margin: 0; text-align: center; }
.price-big { font-size: 1.45rem; font-weight: 700; color: var(--brand-800); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.fact { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; text-align: center; }
.fact b { display: block; font-size: 1rem; } .fact span { color: var(--muted); font-size: .86rem; }
.syllabus details { border: 1px solid var(--border); border-radius: 12px; background: #fff; margin-bottom: 8px; overflow: hidden; }
.syllabus summary { padding: 10px 14px; min-height: var(--touch); cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: space-between; list-style: none; background: var(--surface-2); }
.syllabus summary::-webkit-details-marker { display: none; }
.syllabus li { list-style: none; border-top: 1px solid var(--border); }
.syl-row { display: flex; gap: 10px; align-items: center; padding: 8px 14px; min-height: var(--touch); color: inherit; }
a.syl-row:hover { background: var(--surface-2); text-decoration: none; }
a.syl-row:focus-visible { outline: 3px solid var(--brand-300); outline-offset: -3px; }
.syl-row.is-locked { color: var(--muted); }
.syllabus ul { padding: 0; }
.syllabus-head { margin-bottom: 8px; }
.syllabus-head h2 { margin: 0; }
.sec-files { border-top: 1px solid var(--border); padding: 10px 14px 12px; background: var(--surface-2); }
.sec-files h3 { font-size: .95rem; margin: 0 0 6px; }
/* فایل‌های zip: یک ردیف برای هر فایل، هم در صفحه‌ی دوره و هم در فهرست کنار پخش‌کننده */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: var(--touch); border: 1px solid var(--border); border-radius: 12px; background: #fff; color: inherit; }
a.file-row:hover { border-color: var(--brand-300); background: var(--brand-50); text-decoration: none; }
a.file-row:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; }
.file-row.is-locked { color: var(--muted); background: var(--surface-2); }
.file-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); }
.file-row.is-locked .file-ico { background: var(--border); color: var(--muted); }
.file-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.file-text b { font-weight: 600; overflow-wrap: anywhere; }
.file-size { flex: none; }
.file-get { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--brand-700); font-weight: 600; font-size: .9rem; }
.panel-files { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.panel-files-title { font-size: .86rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.panel-files .file-row { padding: 6px 10px; }
.panel-files .file-ico { width: 32px; height: 32px; }
.panel-files .file-size, .panel-files .file-get span { display: none; }
.prose { line-height: 1.9; }
.prose h2, .prose h3 { margin-top: 1.2em; }
.prose ul, .prose ol { padding-inline-start: 1.5em; margin-bottom: 1em; }

/* ───────── صفحه‌ی پخش (سه ستون طبق طرح) ───────── */
.watch-grid { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 16px; direction: ltr; align-items: start; }
.watch-grid > * { direction: rtl; }
.lessons-panel { padding: 0; overflow: hidden; position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100dvh - var(--header-h) - 28px); display: flex; flex-direction: column; }
.lessons-head { padding: 14px; border-bottom: 1px solid var(--border); }
.lessons-scroll { overflow-y: auto; }
.sec-title { padding: 8px 14px; background: var(--surface-2); font-weight: 600; font-size: .92rem; border-bottom: 1px solid var(--border); color: var(--text-2); }
/* هر سرفصل (فصل) در فهرست درس‌ها قابل جمع‌شدن است؛ فقط وقتی دوره بیش از یک سرفصل دارد دکمه می‌شود */
button.sec-title { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--touch); border: 0; border-bottom: 1px solid var(--border); text-align: start; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; }
button.sec-title:hover { background: var(--brand-50); }
button.sec-title:focus-visible { outline: 3px solid var(--brand-300); outline-offset: -3px; }
.sec-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: .86rem; flex: none; }
.sec-chev { transition: transform .2s; }
.sec.is-collapsed .sec-chev { transform: rotate(90deg); }
.sec.is-collapsed .sec-body { display: none; }
@media (prefers-reduced-motion: reduce) { .sec-chev { transition: none; } }
.lesson-row { display: flex; gap: 10px; align-items: center; padding: 10px 14px; min-height: var(--touch); border-bottom: 1px solid var(--border); color: var(--text); font-size: .95rem; line-height: 1.65; }
.lesson-row:hover { background: var(--brand-50); text-decoration: none; }
.lesson-row.is-current { background: var(--brand-50); box-shadow: inset -4px 0 0 var(--brand-600); font-weight: 600; }
.lesson-row.is-locked { color: var(--muted); }
.lesson-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-50); color: var(--brand-800); display: grid; place-items: center; font-size: .86rem; flex: none; font-weight: 600; }
.lesson-row.is-done .lesson-no { background: var(--ok); color: #fff; }
.lesson-time { margin-inline-start: auto; color: var(--muted); font-size: .86rem; flex: none; }
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; position: relative; box-shadow: var(--shadow); }
.player-wrap video { width: 100%; height: 100%; background: #000; }
.player-end { position: absolute; inset: 0; background: rgba(20,12,45,.88); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; }
/* پیام‌های جای پخش‌کننده (پخش نشدن، دستگاه دیگر در حال پخش) */
/* سرعت پخش و تمام‌صفحه‌ی پخش‌کننده‌ی خودمان (درس‌هایی که فایلشان روی همین سایت است) */
.player-tools { position: absolute; z-index: 3; top: 10px; inset-inline-end: 10px; display: flex; gap: 8px; align-items: flex-start; transition: opacity .25s; }
.player-tools[hidden] { display: none; }
.player-wrap.tools-idle .player-tools:not(:focus-within) { opacity: 0; pointer-events: none; }
.player-btn {
  min-width: 44px; height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; background: rgba(0,0,0,.6); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.player-btn:hover, .player-btn:focus-visible, .player-btn[aria-pressed="true"], .player-btn[aria-expanded="true"] { background: rgba(0,0,0,.85); }
.player-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.speed { position: relative; }
.speed-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 150px; padding: 6px; border-radius: 12px;
  background: rgba(15,10,30,.96); box-shadow: 0 8px 24px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 2px;
}
.speed-menu[hidden] { display: none; }
.speed-item { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: #fff; font: inherit; text-align: start; cursor: pointer; }
.speed-item:hover, .speed-item:focus-visible { background: rgba(255,255,255,.14); }
.speed-item:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.speed-item[aria-checked="true"] { background: var(--brand-600); font-weight: 700; }
.player-wrap:fullscreen { aspect-ratio: auto; border-radius: 0; box-shadow: none; }
.player-wrap.is-theater { position: fixed; inset: 0; z-index: 1000; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
html.no-scroll { overflow: hidden; }
.player-notice {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px;
  color: #fff; background: linear-gradient(160deg, #1b1038, #2a1a5e);
}
.player-notice strong { font-size: 1.05rem; line-height: 1.8; }
.player-notice .small { opacity: .85; }
.player-notice[hidden] { display: none; }
.player-denied { position: absolute; inset: 0; z-index: 5; }
.lesson-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 12px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 8px 16px; min-height: var(--touch); font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border: 0; }
.comment .meta { font-size: .86rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment p { margin: 3px 0 0; }
.comment-pending { background: var(--warn-bg); border-radius: var(--radius-sm, 10px); padding-inline: 10px; margin-block: 4px; border-bottom-color: transparent; }
.cert-banner { background: linear-gradient(135deg, #12894A, #0C6334); color: #fff; border-radius: var(--radius); padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cert-banner strong { font-size: 1rem; }
.mobile-only { display: none; }

/* پروفایل شرکت‌کننده: static/css/profile.css (بارگذاری‌شده فقط در صفحه‌ی پروفایل) */

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 30px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); min-height: 3px; }
.bar.is-zero i { background: var(--brand-100); }
.bar.is-today i { background: linear-gradient(180deg, #FF9A62, #F2682A); }
.bar span { font-size: .86rem; color: var(--muted); line-height: 1.2; text-align: center; }
.bar em { font-style: normal; font-size: .86rem; color: var(--text-2); font-weight: 600; min-height: 1em; }

/* ───────── صفحه‌ی دوره‌های من ───────── */
.mc-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mc-stats { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.mc-stat { padding: 4px 12px; border-radius: 99px; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800); font-size: .92rem; }
.mc-stat b { font-weight: 700; }
.mc-group + .mc-group { margin-top: 26px; }
.mc-group h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 12px; }
.mc-group h2 .icon { color: var(--brand-600); }
.mc-watch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mc-watch-item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
.mc-watch-title { flex: 1 1 220px; font-weight: 700; color: var(--text); text-decoration: none; }
.mc-watch-title:hover { color: var(--brand-700); }
.mc-watch-item form { margin: 0; }
.mc-watch-item .btn { min-height: 44px; }
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mc-card { display: flex; flex-direction: column; overflow: hidden; }
.mc-card:hover { box-shadow: var(--shadow); }
.mc-cover { position: relative; aspect-ratio: 16 / 6; background: linear-gradient(135deg, var(--tc, #6D3BEA), #1b1240); display: grid; place-items: center; color: #fff; overflow: hidden; }
.mc-cover img { width: 100%; height: 100%; object-fit: cover; }
.mc-cover .ph { font-size: 1.9rem; font-weight: 700; opacity: .9; }
.mc-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; flex: 1; }
.mc-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mc-title { font-size: 1rem; line-height: 1.65; margin: 0; }
.mc-title a { color: inherit; }
.mc-title a:hover { color: var(--brand-700); }
.mc-title-row .badge { flex: none; }
.mc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.mc-card.is-off .mc-cover { filter: grayscale(.8); opacity: .75; }
.mc-empty .btn { margin-top: 4px; }
.share-box { display: flex; gap: 8px; align-items: center; }
.share-box input { direction: ltr; text-align: left; font-size: .9rem; }

/* ───────── ورود / ثبت‌نام ───────── */
.auth-wrap { max-width: 420px; margin: 12px auto; }
.auth-card { padding: 24px 22px; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: 4px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--brand-100); }
.steps i.on { background: var(--brand-600); }
.choice-card { display: flex; gap: 10px; align-items: center; padding: 9px 14px; min-height: var(--touch); border: 1.5px solid var(--border-strong); border-radius: 12px; cursor: pointer; margin-bottom: 8px; background: #fff; }
.choice-card:hover { border-color: var(--brand-300); background: var(--brand-50); }
.choice-card input { width: 18px; height: 18px; accent-color: var(--brand-600); flex: none; }
.choice-card:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-100); }
.q-block { margin-bottom: 20px; }
.q-block h3 { margin-bottom: 10px; }

/* ───────── آزمون ───────── */
.exam-head { position: sticky; top: var(--header-h); z-index: 20; background: var(--bg); padding: 8px 0 10px; }
.exam-meta { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 600; gap: 10px; flex-wrap: wrap; }
.q-card { padding: 18px; margin-bottom: 12px; }
.q-card h2 { font-size: 1.08rem; line-height: 1.85; margin-bottom: 12px; }
.q-card .qno { color: var(--brand-700); }
.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.q-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.q-dots button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: #fff; font-size: .86rem; color: var(--muted); }
@media (pointer: coarse) { .q-dots button { width: var(--touch); height: var(--touch); } }
@media (max-width: 560px) { .q-dots { display: grid; grid-template-columns: repeat(5, 1fr); } .q-dots button { width: 100%; } }
.q-dots button.answered { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-800); }
.q-dots button.current { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.exam-right { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-dots button:disabled { opacity: .45; cursor: not-allowed; }
.q-dots button:focus-visible, .choice-card:has(input:focus-visible) { outline: 3px solid var(--brand-300); outline-offset: 2px; }

/* هر گزینه بعد از انتخاب قفل می‌شود: سبز = درست، قرمز = انتخاب نادرست شما. رنگ تنها نیست؛ علامت و برچسب هم دارد. */
.choice-card { position: relative; transition: border-color .15s, background-color .15s, box-shadow .15s, opacity .15s; }
.choice-text { flex: 1; min-width: 0; line-height: 1.8; }
.choice-mark, .choice-tag { display: none; flex: none; }
.choice-mark svg { display: block; }
.choice-tag { font-size: .85rem; font-weight: 700; padding: 1px 9px; border-radius: 99px; line-height: 1.7; white-space: nowrap; }
.q-card.is-sending .choice-card { opacity: .7; }
.choice-card.is-locked { cursor: default; }
.choice-card.is-locked:not(.is-right):not(.is-wrong) { opacity: .62; }
.choice-card.is-locked:not(.is-right):not(.is-wrong):hover { border-color: var(--border-strong); background: #fff; }
.choice-card.is-locked.is-right { border-color: var(--ok); background: var(--ok-bg); color: #0C6334; box-shadow: 0 0 0 3px rgba(18, 137, 74, .14); }
.choice-card.is-locked.is-wrong { border-color: var(--bad); background: var(--bad-bg); color: #8A1730; box-shadow: 0 0 0 3px rgba(196, 35, 66, .12); }
.choice-card.is-locked.is-right .choice-mark, .choice-card.is-locked.is-wrong .choice-mark { display: inline-grid; place-items: center; }
.choice-card .mk-bad, .choice-card.is-right .mk-bad { display: none; }
.choice-card.is-wrong .mk-bad { display: block; }
.choice-card.is-wrong .mk-ok { display: none; }
.choice-card.is-right .tag-right { display: inline-block; background: var(--ok); color: #fff; }
.choice-card.is-wrong .tag-wrong { display: inline-block; background: var(--bad); color: #fff; }
.choice-card.is-locked input { opacity: 0; width: 0; margin: 0; position: absolute; pointer-events: none; }

.q-feedback { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; animation: fb-in .25s ease-out; }
.q-feedback.fb-ok { background: var(--ok-bg); border-color: #B7E3C9; color: #0C6334; }
.q-feedback.fb-bad { background: var(--bad-bg); border-color: #F3C0CB; color: #8A1730; }
.fb-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.fb-ok .fb-icon { background: var(--ok); } .fb-bad .fb-icon { background: var(--bad); }
.fb-icon .fi-bad { display: none; } .fb-bad .fb-icon .fi-ok { display: none; } .fb-bad .fb-icon .fi-bad { display: block; }
.fb-body { flex: 1; min-width: 0; }
.fb-title { display: block; font-size: 1.02rem; line-height: 1.9; }
.fb-line { margin: 2px 0 0; line-height: 1.85; }
.fb-why { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed currentColor; color: var(--text-2); font-size: .94rem; line-height: 1.95; }
@keyframes fb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .q-feedback { animation: none; } .choice-card { transition: none; } }

.score-big { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; margin: 4px 0 2px; }
.score-big b { font-size: 2.1rem; line-height: 1.2; }
.score-big span { color: var(--muted); font-weight: 500; }
.score-ring circle.sr-fill { animation: sr-fill .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sr-fill { from { stroke-dasharray: 0 100; } to { stroke-dasharray: var(--v) 100; } }
@media (prefers-reduced-motion: reduce) { .score-ring circle.sr-fill { animation: none; } }
.score-ring { width: 136px; height: 136px; margin: 0 auto 8px; position: relative; }
.score-ring svg { transform: rotate(90deg) scaleX(-1); }
.score-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.review { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: #fff; overflow: hidden; }
.review summary { padding: 10px 14px; min-height: var(--touch); cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review .body { padding: 4px 14px 12px; border-top: 1px solid var(--border); }
.ans { padding: 6px 12px; border-radius: 8px; margin-top: 6px; }
.ans-ok { background: var(--ok-bg); color: #0C6334; } .ans-bad { background: var(--bad-bg); color: #8A1730; }
.step-card { padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.step-card .no { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-600); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.step-card.is-done .no { background: var(--ok); }
.step-card.is-locked { opacity: .75; }

/* ───────── اشتراک ───────── */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; max-width: 860px; margin: 0 auto; }
.plan { padding: 22px 18px; text-align: center; position: relative; display: flex; flex-direction: column; gap: 8px; }
.plan.is-best { border: 2px solid var(--brand-600); box-shadow: var(--shadow); }
.plan .badge-top { position: absolute; top: -13px; inset-inline: 0; margin-inline: auto; width: fit-content; background: var(--brand-600); color: #fff; padding: 1px 14px; border-radius: 99px; font-size: .86rem; font-weight: 600; }
.plan .price { font-size: 1.5rem; font-weight: 700; color: var(--brand-800); }
.plan .old { color: var(--muted); text-decoration: line-through; font-size: .93rem; }
.features { text-align: start; list-style: none; padding: 0; margin: 6px 0; }
.features li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.features .icon { color: var(--ok); margin-top: 6px; }

/* ───────── پنل مدرس ───────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: .92rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpi { padding: 12px 10px; text-align: center; } }
.kpi { padding: 13px 16px; }
.kpi b { display: block; font-size: 1.45rem; color: var(--brand-800); line-height: 1.4; }
.kpi span { color: var(--muted); font-size: .9rem; }

/* ───────── گواهی ───────── */
.cert-stage { display: flex; justify-content: center; padding: 10px 0; }
/* the certificate is one SVG on an A4 landscape sheet (297 x 210), drawn by apps/certificates/design.py; it scales with the page and prints as it is */
.cert-svg { display: block; width: 100%; max-width: 1000px; height: auto; background: #fff; box-shadow: var(--shadow-lg); border-radius: 4px; }
.verify-badge { display: inline-flex; gap: 8px; align-items: center; background: var(--ok-bg); color: #0C6334; padding: 8px 18px; border-radius: 99px; font-weight: 600; }

/* ───────── بنرهای تبلیغاتی ───────── */
.promo { margin: 0 0 16px; }
.promo-link { position: relative; display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); background: var(--surface); }
.promo-link:hover { box-shadow: var(--shadow); text-decoration: none; }
.promo-link:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }
/* the box is reserved from the stored picture sizes, so the page does not jump when the picture arrives (desktop and phone pictures can differ in shape) */
.promo img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar-d); object-fit: cover; }
@media (max-width: 700px) { .promo img { aspect-ratio: var(--ar-m, var(--ar-d)); } }
.promo-tag { position: absolute; top: 8px; inset-inline-end: 8px; padding: 1px 9px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-size: .86rem; line-height: 1.6; }
.promo-course_page { margin: 26px 0 0; }
.promo { position: relative; }
/* video and the owner's own code: height from the admin (a different one for phones); code frames then fit their content */
.promo-video { display: block; width: 100%; height: var(--h-d); object-fit: cover; background: var(--brand-900); }
.promo-box { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); background: var(--surface); }
.promo-frame { display: block; width: 100%; height: var(--h-d); border: 0; background: transparent; }
@media (max-width: 700px) { .promo-video, .promo-frame { height: var(--h-m, var(--h-d)); } }
/* ready-made text card */
.promo-text { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding: 20px 24px; min-height: 96px; }
.promo-text-copy { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; }
.promo-text-copy strong { font-size: 1.14rem; line-height: 1.5; }
.promo-text-copy span { font-size: .96rem; opacity: .92; }
.promo-btn { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 20px; border-radius: 999px; font-weight: 700; transition: transform .15s ease; }
.promo-link:hover .promo-btn { transform: translateX(-3px); }
.promo-text-brand { color: #fff; background: radial-gradient(120% 160% at 0% 0%, var(--brand-500), var(--brand-800)); }
.promo-text-brand .promo-btn { background: #fff; color: var(--brand-800); }
.promo-text-dark { color: #fff; background: linear-gradient(135deg, #2A1F5C, #1F1B2E); }
.promo-text-dark .promo-btn { background: var(--brand-500); color: #fff; }
.promo-text-light { color: var(--text); background: linear-gradient(135deg, var(--brand-50), #fff); }
.promo-text-light .promo-btn { background: var(--brand-600); color: #fff; }
.promo-close {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; padding: 0;
}
.promo-close:hover { background: rgba(0,0,0,.75); }
/* the text card leaves room for the close button so it never covers the headline */
.promo[data-promo-close] .promo-text { padding-inline-start: 56px; }
.promo-close:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; }
@media (pointer: coarse) { .promo-close { width: 36px; height: 36px; } .promo-close::before { content: ""; position: absolute; inset: -4px; } }
.promo[hidden] { display: none; }
@media (hover: none) { .cw-hint span:last-child { display: none; } }  /* راهنمای صفحه‌کلید روی لمسی بی‌معناست */

/* ── staff agent console ───────────────────────────────────────────────── */
.cs-head { align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.cs-kill { margin-bottom: 20px; align-items: center; }
.cs-kill form { flex-shrink: 0; }
.cs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; margin-bottom: 8px; }
.cs-grid > * { min-width: 0; }
.cs .section-head { margin-top: 28px; }
.cs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cs-list li { display: flex; gap: 10px; align-items: flex-start; }
.cs-list .badge { flex-shrink: 0; min-width: 52px; justify-content: center; }
.cs-table th, .cs-table td { padding: 8px 6px; white-space: normal; }
.cs-table th { background: none; font-weight: 500; }
.cs-table td { font-weight: 600; text-align: end; }
.table td.cs-wrap { white-space: normal; max-width: 42ch; overflow-wrap: anywhere; }

/* ── سبد خرید، سفارش‌ها و رسید ── */
.cart-link { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: inherit; }
.cart-link:hover, .cart-link.active { background: rgba(127,127,160,.16); }
.cart-badge {
  position: absolute; top: -3px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  /* white on the purple header so the count is seen as a badge, not as a loose digit */
  background: #fff; color: var(--brand-800, #3b1d8f); box-shadow: 0 0 0 2px var(--brand-600); font-size: .86rem; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.cart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.cart-row + .cart-row { border-top: 1px solid var(--border); }
.cart-thumb {
  flex: none; width: 88px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-600), #1b1240); color: #fff; font-weight: 700; font-size: 1.3rem;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cart-price { flex: none; min-width: 104px; display: flex; flex-direction: column; text-align: end; }
.cart-price .old { color: var(--muted); font-size: .86rem; }
.cart-remove { color: var(--muted); }
.cart-remove:hover { color: var(--bad); }
.cart-summary { position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column; gap: 12px; }
.cart-summary .card-title { margin-bottom: 0; }
.cart-coupon label { display: block; margin-bottom: 6px; }
.cart-coupon .input { flex: 1; min-width: 0; }
.cart-coupon-on { align-items: center; }
.cart-coupon-on form { margin: 0; }
.sum { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sum > div { display: flex; justify-content: space-between; gap: 12px; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; font-weight: 600; }
.sum-discount dd { color: var(--ok); }
.sum-total { padding-top: 8px; border-top: 1px solid var(--border); font-size: 1.05rem; }
.sum-total dt { color: var(--text); font-weight: 700; }
.sum-total dd { color: var(--brand-800); font-weight: 700; }
.order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.order-row { padding: 13px 16px; display: flex; }
.order-no { font-weight: 700; color: var(--text); }
.order-items { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-scroll { overflow-x: auto; margin: 14px 0; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 440px; }
.receipt-table th, .receipt-table td { padding: 8px 8px; text-align: start; border-bottom: 1px solid var(--border); }
.receipt-table thead th { color: var(--muted); font-weight: 600; font-size: .86rem; }
.receipt-table tbody th { font-weight: 600; }
.receipt-table td { white-space: nowrap; }


/* فایل‌های دستیار من */
.files-list { list-style: none; margin: 0; padding: 0; }
.files-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.files-row:last-child { border-bottom: 0; }
.files-kind { flex: none; min-width: 52px; text-align: center; padding: 4px 9px; border-radius: 10px; background: var(--brand-100); color: var(--brand-800); font-weight: 700; font-size: .86rem; }
.files-row .grow { flex: 1 1 13rem; min-width: 0; }  /* on a narrow screen the buttons drop under the text instead of squeezing it */
.files-title { display: block; line-height: 1.7; overflow-wrap: anywhere; }
.files-bad { color: var(--bad); }
.files-empty { text-align: center; }
.files-del { position: relative; }
.files-del > summary { list-style: none; cursor: pointer; }
.files-del > summary::-webkit-details-marker { display: none; }
.files-del[open] > summary { background: var(--bad-bg); color: var(--bad); }
.files-del-form { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.files-yes { background: var(--bad); color: #fff; border: 0; }


/* ── امتیاز ستاره‌ای دوره: کوچک و بی‌اسکریپت (هر ستاره یک دکمه‌ی همان فرم است) ───────────────────────────── */
.icon.on { fill: currentColor; }
.rating-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.rating-sum, .cc-rating { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; color: var(--star, #B87300); }
.rating-sum b, .cc-rating { font-weight: 700; }
.rate-form { display: inline-flex; align-items: center; gap: 6px; }
.rate-stars { display: inline-flex; gap: 0; }
.rate-star { background: none; border: 0; padding: 4px 3px; cursor: pointer; color: var(--muted); line-height: 0; border-radius: 8px; }
.rate-star.on { color: var(--star, #B87300); }
.rate-star:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.rate-stars:hover .rate-star { color: var(--star, #B87300); }
.rate-stars:hover .rate-star:hover ~ .rate-star { color: var(--muted); }
.rate-stars:hover .rate-star .icon, .rate-star.on .icon { fill: currentColor; }
.rate-stars:hover .rate-star:hover ~ .rate-star .icon { fill: none; }

/* ── choosing the payment gateway (cart and pricing) ── */
.gateway-pick { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.gateway-pick legend { font-weight: 700; font-size: .95rem; padding: 0; margin-bottom: 8px; color: var(--text); }
.gateway-pick .choice-card:last-child { margin-bottom: 0; }
