/* =========================================================
   free.thefinbaba.com — page styles (on top of finbaba-shell.css)
   Layout follows free.crazygktrick.com: numbered course grid on home,
   chapters sidebar + sticky player on the course page.
   ========================================================= */

:root { --fs-side-w: 340px; }
body { background: var(--fb-bg); overflow-x: hidden; }
.fs-container { max-width: 1480px; padding-left: 24px; padding-right: 24px; }
[hidden] { display: none !important; }
button:disabled { cursor: not-allowed; opacity: .5; transform: none !important; box-shadow: none !important; }

/* ---------- Breadcrumbs (slim) ---------- */
.fs-breadcrumbs { padding: 9px 0; font-size: .8rem; }
.fs-breadcrumbs li { min-width: 0; }
.fs-breadcrumbs li span { display: inline-block; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* =========================================================
   HOME
   ========================================================= */
.fs-home-wrap { padding-top: 28px; padding-bottom: 10px; }

/* Banner slider */
.fs-slider { position: relative; border-radius: var(--fb-radius); overflow: hidden; margin-bottom: 26px; background: var(--fb-primary-tint); box-shadow: var(--fb-shadow-md); }
.fs-slider-track { display: flex; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.fs-slide { flex: 0 0 100%; }
.fs-slide a, .fs-slide picture { display: block; }
.fs-slide img { display: block; width: 100%; aspect-ratio: 8 / 1; object-fit: cover; }
.fs-slider-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }
.fs-slider-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; padding: 0; background: rgba(255,255,255,.6); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: width .25s, background .25s; }
.fs-slider-dots button.active { width: 22px; background: #fff; }

/* Title + search row (same arrangement as the reference) */
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.page-title { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.search-form { display: flex; align-items: center; background: #fff; border: 1.5px solid var(--fb-border); border-radius: 999px; padding: 4px 4px 4px 14px; width: 100%; max-width: 320px; transition: border-color .2s, box-shadow .2s; }
.search-form:focus-within { border-color: var(--fb-primary); box-shadow: var(--fb-ring); }
.search-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .9rem; padding: 6px 4px; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-form button, .search-form .search-clear { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; }
.search-form button { background: var(--fb-grad-primary); color: #fff; }
.search-form .search-clear { color: var(--fb-muted); margin-right: 2px; }
.search-form .search-clear:hover { background: var(--fb-bg); color: var(--fb-danger); }
.fs-result-note { color: var(--fb-muted); margin: -8px 0 18px; font-size: .9rem; }

/* Course card */
.module-card { position: relative; display: flex; flex-direction: column; height: 100%; background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid var(--fb-border); box-shadow: var(--fb-shadow-sm); color: var(--fb-text); text-decoration: none; transition: transform .25s, box-shadow .25s, border-color .25s; }
.module-card:hover { transform: translateY(-5px); box-shadow: var(--fb-shadow-lg); border-color: transparent; color: var(--fb-text); }
.module-number { position: absolute; top: 12px; left: 12px; z-index: 2; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; background: #fff; color: var(--module-color); font-size: 1.15rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(15,23,42,.18); }
.module-image-container { position: relative; aspect-ratio: 16 / 9; background: var(--fb-primary-tint); overflow: hidden; }
.module-image-container::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--module-color); z-index: 1; }
.module-image { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.module-card:hover .module-image { transform: scale(1.05); }
.module-play { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.94); color: var(--module-color); display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; box-shadow: 0 4px 12px rgba(0,0,0,.25); transition: transform .25s; }
.module-play i { margin-left: 3px; }
.module-card:hover .module-play { transform: scale(1.12); }
.module-count { position: absolute; left: 12px; bottom: 12px; background: rgba(15,23,42,.78); color: #fff; font-size: .72rem; font-weight: 600; padding: 5px 9px; border-radius: 999px; backdrop-filter: blur(4px); }
.module-content { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.module-title { font-size: 1.05rem; font-weight: 700; line-height: 1.4; margin: 0 0 6px; color: var(--fb-ink); }
.module-description { font-size: .86rem; color: var(--fb-muted); margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.module-cta { margin-top: auto; font-size: .85rem; font-weight: 700; color: var(--fb-primary); display: inline-flex; align-items: center; gap: 6px; }
.module-card:hover .module-cta i { transform: translateX(3px); }
.module-cta i { transition: transform .2s; }

/* Empty + pagination */
.fs-empty { text-align: center; background: #fff; border: 1px dashed var(--fb-border); border-radius: var(--fb-radius-lg); padding: 50px 20px; }
.fs-empty i { font-size: 2.4rem; color: var(--fb-primary); opacity: .6; }
.fs-empty h2 { margin: 14px 0 6px; font-size: 1.3rem; }
.fs-empty p { color: var(--fb-muted); }
.fs-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 40px 0 10px; }
.fs-pagination a, .fs-pagination .pg-gap { min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: .9rem; }
.fs-pagination a { background: #fff; border: 1px solid var(--fb-border); color: var(--fb-text); }
.fs-pagination a:hover { border-color: var(--fb-primary); color: var(--fb-primary); }
.fs-pagination a.active { background: var(--fb-grad-primary); border-color: transparent; color: #fff; }
.fs-pagination a.disabled { pointer-events: none; opacity: .45; }
.fs-pagination .pg-gap { color: var(--fb-muted); min-width: 20px; padding: 0; }

/* =========================================================
   DEMAT PROMOTION
   ========================================================= */
.fs-demat-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; margin-bottom: 26px; border-radius: var(--fb-radius-lg); color: #fff; background: radial-gradient(circle at 90% 20%, rgba(245,158,11,.35), transparent 45%), linear-gradient(135deg, var(--fb-primary-ink), var(--fb-primary)); box-shadow: var(--fb-shadow-md); }
.fs-demat-strip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fs-demat-strip-eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #fde68a; }
.fs-demat-strip strong { font-size: 1.2rem; line-height: 1.3; }
.fs-demat-strip-text > span:last-child { color: rgba(255,255,255,.82); font-size: .9rem; }
.fs-demat-strip .btn-fb-accent { flex-shrink: 0; }

.fs-demat-card { position: relative; display: flex; flex-direction: column; height: 100%; padding: 22px; border-radius: 16px; color: #fff; text-decoration: none; overflow: hidden; background: linear-gradient(160deg, var(--fb-primary-ink) 0%, var(--fb-primary-deep) 60%, var(--fb-primary) 100%); box-shadow: var(--fb-shadow-md); transition: transform .25s, box-shadow .25s; }
.fs-demat-card::after { content: ''; position: absolute; width: 220px; height: 220px; right: -70px; top: -70px; border-radius: 50%; background: radial-gradient(circle, rgba(245,158,11,.4), transparent 70%); }
.fs-demat-card:hover { color: #fff; transform: translateY(-5px); box-shadow: var(--fb-shadow-lg); }
.fs-demat-card > * { position: relative; z-index: 1; }
.fs-demat-badge { align-self: flex-start; font-size: .72rem; font-weight: 700; color: #78350f; background: #fde68a; padding: 4px 10px; border-radius: 999px; }
.fs-demat-card-icon { width: 54px; height: 54px; border-radius: 16px; margin: 16px 0 12px; background: var(--fb-grad-accent); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: 0 8px 20px rgba(245,158,11,.4); }
.fs-demat-card h3 { color: #fff; font-size: 1.2rem; margin-bottom: 6px; }
.fs-demat-card p { color: rgba(255,255,255,.8); font-size: .88rem; margin-bottom: 12px; }
.fs-demat-card ul { list-style: none; padding: 0; margin: 0 0 18px; font-size: .86rem; color: rgba(255,255,255,.9); }
.fs-demat-card li { padding: 3px 0; }
.fs-demat-card li i { color: #fbbf24; margin-right: 8px; }
.fs-demat-card .btn-fb-accent { margin-top: auto; }

.fs-demat-inline { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 16px; border-radius: var(--fb-radius); background: #fff; border: 1px solid var(--fb-accent-tint); border-left: 4px solid var(--fb-accent); box-shadow: var(--fb-shadow-sm); }
.fs-demat-inline-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: var(--fb-accent-tint); color: var(--fb-accent-deep); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.fs-demat-inline-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-demat-inline-text strong { color: var(--fb-ink); font-size: .98rem; }
.fs-demat-inline-text span { color: var(--fb-muted); font-size: .84rem; }
.fs-demat-inline .btn-fb-accent { flex-shrink: 0; padding: 10px 18px; }

.fs-demat-side { display: flex; align-items: center; gap: 12px; margin: 14px 16px 18px; padding: 14px; border-radius: 14px; text-decoration: none; background: linear-gradient(135deg, var(--fb-primary-ink), var(--fb-primary)); color: #fff; transition: transform .2s, box-shadow .2s; }
.fs-demat-side:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--fb-shadow-md); }
.fs-demat-side-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: var(--fb-grad-accent); display: flex; align-items: center; justify-content: center; }
.fs-demat-side strong { display: block; font-size: .88rem; line-height: 1.3; }
.fs-demat-side span { font-size: .78rem; color: #fde68a; font-weight: 600; }

/* Navbar "Free Demat" pill (mobile only) */
.fs-nav-demat { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; background: var(--fb-grad-accent); color: #fff !important; font-weight: 700; font-size: .78rem; white-space: nowrap; box-shadow: 0 4px 12px rgba(245,158,11,.35); animation: fsPulse 2.6s ease-in-out infinite; }
@keyframes fsPulse { 0%, 100% { box-shadow: 0 4px 12px rgba(245,158,11,.35); } 50% { box-shadow: 0 4px 20px rgba(245,158,11,.65); } }

/* =========================================================
   COURSE PAGE
   ========================================================= */
.fs-learn { display: grid; grid-template-columns: var(--fs-side-w) minmax(0, 1fr); grid-template-areas: "side main"; align-items: start; }
.fs-main { grid-area: main; padding: 18px 32px 36px; min-width: 0; }
/* Banner (w/8) + stats + 16:9 player should fit one screen: w * (1/8 + 9/16) ≈ 100vh - chrome */
.fs-media, .fs-info, .fs-extra { width: 100%; max-width: max(560px, min(1080px, calc((100vh - 220px) * 1.45))); margin: 0 auto; }

.ad-banner-video-top { margin-bottom: 10px; }
.ad-banner-video-top a { display: block; border-radius: 12px; overflow: hidden; background: var(--fb-primary-tint); }
.ad-banner-video-top img { display: block; width: 100%; aspect-ratio: 8 / 1; object-fit: cover; }

.stats-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 4px 0 10px; font-size: .88rem; color: var(--fb-muted); }
.stats-data { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stats-data i { color: var(--fb-primary); }
.stats-data .fa-file-pdf { color: var(--fb-success); }
.stats-data b { color: var(--fb-ink); font-weight: 700; }
.stats-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn-icon { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--fb-border); background: #fff; color: var(--fb-muted); display: inline-flex; align-items: center; justify-content: center; transition: all .2s; }
.btn-icon:hover, .btn-icon.copied { color: var(--fb-primary); border-color: var(--fb-primary); }
.btn-icon.copied { color: #fff; background: var(--fb-success); border-color: var(--fb-success); }
.btn-share { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 10px; background: #25D366; color: #fff !important; font-weight: 700; font-size: .85rem; box-shadow: 0 4px 12px rgba(37,211,102,.3); transition: transform .2s, background .2s; }
.btn-share:hover { background: #1ebe57; transform: translateY(-1px); }

.video-wrapper { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(15,23,42,.22); }
.video-wrapper iframe, .video-wrapper video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fs-player-empty { background: var(--fb-grad-hero); display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; }
.fs-player-empty i { font-size: 2.5rem; opacity: .8; }
.fs-player-empty p { margin: 10px 0 0; font-weight: 600; }

.fs-info { padding-top: 18px; }
.fs-now-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; color: var(--fb-primary); background: var(--fb-primary-tint); padding: 3px 10px; border-radius: 999px; }
.fs-now-eyebrow b { font-weight: 800; }
.fs-now h1, .fs-course-h1 { font-size: clamp(1.15rem, .95rem + .8vw, 1.6rem); line-height: 1.3; margin: 8px 0 0; }
.fs-nav-btns { display: flex; gap: 10px; margin-top: 14px; }
.fs-nav-btns button { padding: 9px 18px; }
.fs-desc { margin-top: 16px; background: #fff; border: 1px solid var(--fb-border); border-radius: var(--fb-radius); padding: 14px 16px; }
.fs-desc-text { font-size: .9rem; color: var(--fb-text); white-space: normal; overflow-wrap: anywhere; }
.fs-desc.collapsible .fs-desc-text { max-height: 4.8em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.fs-desc.expanded .fs-desc-text { max-height: none; -webkit-mask-image: none; mask-image: none; }
.fs-desc-toggle { display: none; border: 0; background: none; padding: 6px 0 0; color: var(--fb-primary); font-weight: 700; font-size: .85rem; }
.fs-desc.collapsible .fs-desc-toggle { display: inline-block; }

/* Sidebar / chapters */
.fs-sidebar { grid-area: side; position: sticky; top: var(--fb-nav-h); height: calc(100vh - var(--fb-nav-h)); overflow-y: auto; overscroll-behavior: contain; background: #fff; border-right: 1px solid var(--fb-border); scrollbar-width: thin; }
.fs-side-head { position: sticky; top: 0; z-index: 2; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); padding: 18px 16px 12px; border-bottom: 1px solid var(--fb-border); }
.fs-side-eyebrow { margin: 0; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fb-muted); }
.fs-side-head h2 { font-size: 1.02rem; margin: 4px 0 0; line-height: 1.35; }
.fs-side-search { position: relative; margin-top: 12px; }
.fs-side-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fb-muted); font-size: .8rem; }
.fs-side-search input { width: 100%; border: 1.5px solid var(--fb-border); border-radius: 10px; padding: 8px 12px 8px 32px; font: inherit; font-size: .85rem; outline: 0; }
.fs-side-search input:focus { border-color: var(--fb-primary); box-shadow: var(--fb-ring); }

.fs-chapters { padding: 12px 12px 4px; }
.fs-chapter { margin-bottom: 8px; }
.fs-chapter-btn { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--fb-primary-tint2); background: var(--fb-primary-tint); color: var(--fb-primary-deep); font-weight: 700; font-size: .9rem; transition: background .2s; }
.fs-chapter-btn:hover { background: var(--fb-primary-tint2); }
.fs-chapter-title { flex: 1; min-width: 0; }
.fs-chapter-meta { font-size: .72rem; font-weight: 700; background: #fff; color: var(--fb-primary); border-radius: 999px; padding: 1px 8px; }
.fs-chapter-btn .fa-chevron-down { font-size: .75rem; transition: transform .25s; }
.fs-chapter.open .fs-chapter-btn .fa-chevron-down { transform: rotate(180deg); }
.fs-chapter-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.fs-chapter-body > * { overflow: hidden; }
.fs-chapter.open .fs-chapter-body { grid-template-rows: 1fr; }
.fs-chapter-body-inner { min-height: 0; padding-top: 4px; }

.sub-video-link { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px 9px 12px; margin: 2px 0 2px 8px; border-radius: 9px; color: var(--fb-text); font-size: .9rem; line-height: 1.4; border-left: 3px solid transparent; transition: background .15s, color .15s; }
.sub-video-link:hover { background: var(--fb-bg); color: var(--fb-ink); border-left-color: var(--fb-border); }
.svl-num { flex-shrink: 0; min-width: 24px; height: 22px; border-radius: 6px; background: var(--fb-bg); color: var(--fb-muted); font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.svl-title { flex: 1; min-width: 0; }
.svl-done { display: none; color: var(--fb-success); margin-top: 3px; font-size: .85rem; }
.sub-video-link.watched .svl-done { display: inline-block; }
.sub-video-link.active { background: var(--fb-grad-primary); color: #fff; border-left-color: var(--fb-accent); box-shadow: 0 6px 14px rgba(79,70,229,.28); }
.sub-video-link.active .svl-num { background: rgba(255,255,255,.2); color: #fff; }
.sub-video-link.active .svl-done { color: #bbf7d0; }
.fs-chapter-empty, .fs-filter-empty { color: var(--fb-muted); font-size: .85rem; padding: 8px 14px; margin: 0; }

/* More courses */
.fs-more { padding-top: 30px; padding-bottom: 10px; }
.fs-more-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.fs-more-head h2 { font-size: 1.25rem; margin: 0; }
.fs-more-head a { font-weight: 700; font-size: .88rem; }
.fs-more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fs-more-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--fb-border); border-radius: 14px; overflow: hidden; color: var(--fb-ink); font-weight: 700; font-size: .92rem; transition: transform .2s, box-shadow .2s; }
.fs-more-card:hover { transform: translateY(-3px); box-shadow: var(--fb-shadow-md); color: var(--fb-ink); }
.fs-more-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.fs-more-card span { padding: 12px 14px; }
.fs-course-page .fb-footer { margin-top: 40px; }

/* =========================================================
   POPUP (admin managed)
   ========================================================= */
.fs-popup { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.fs-popup-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.fs-popup-card { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: 20px; box-shadow: var(--fb-shadow-xl); transform: translateY(24px) scale(.96); opacity: 0; transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .3s; }
.fs-popup.show .fs-popup-backdrop { opacity: 1; }
.fs-popup.show .fs-popup-card { transform: none; opacity: 1; }
.fs-popup-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(15,23,42,.55); color: #fff; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.fs-popup-close:hover { background: rgba(15,23,42,.85); }
.fs-popup-img { display: block; }
.fs-popup-img img { display: block; width: 100%; height: auto; }
.fs-popup-body { padding: 20px 22px 22px; text-align: center; }
.fs-popup-body h2 { font-size: 1.35rem; margin-bottom: 8px; }
.fs-popup-body p { color: var(--fb-muted); font-size: .92rem; margin-bottom: 16px; }
.fs-popup-card:not(:has(.fs-popup-img)) .fs-popup-body { padding-top: 40px; }

/* =========================================================
   404
   ========================================================= */
.fs-notfound { text-align: center; padding: 70px 16px 30px; max-width: 640px; }
.fs-notfound-code { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 800; line-height: 1; background: var(--fb-grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fs-notfound h1 { font-size: 1.6rem; margin: 10px 0 8px; }
.fs-notfound p { color: var(--fb-muted); margin-bottom: 22px; }
.fs-notfound-links { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fs-notfound-links p { width: 100%; margin: 0 0 4px; font-weight: 700; color: var(--fb-ink); }
.fs-notfound-links a { background: #fff; border: 1px solid var(--fb-border); padding: 7px 14px; border-radius: 999px; font-size: .85rem; }

/* Toast */
.fs-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--fb-ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .88rem; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 10001; }
.fs-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1199.98px) {
  :root { --fs-side-w: 300px; }
  .fs-main { padding: 16px 22px 30px; }
}

/* Tablet + mobile: stacked like the reference mobile view —
   banner/stats/player stick under the header, chapters scroll below. */
@media (max-width: 991.98px) {
  .fs-container { padding-left: 16px; padding-right: 16px; }
  .fs-learn { display: flex; flex-direction: column; }
  .fs-main { padding: 0; width: 100%; }
  .fs-media, .fs-info, .fs-extra { max-width: none; }
  /* Flatten main so media / title / chapters / extras can be ordered like the reference mobile page */
  .fs-main { display: contents; }
  .fs-media { order: 1; }
  .fs-info { order: 2; }
  .fs-sidebar { order: 3; }
  .fs-extra { order: 4; padding: 4px 16px 0; }
  .fs-media { background: #fff; padding: 8px 12px 10px; box-shadow: 0 4px 14px rgba(15,23,42,.08); }
  .fs-info { padding: 12px 16px 0; }
  .fs-sidebar { position: static; height: auto; overflow: visible; border-right: 0; background: transparent; width: 100%; }
  .fs-side-head { position: static; background: transparent; backdrop-filter: none; border: 0; padding: 20px 16px 4px; }
  .fs-chapters { padding: 8px 12px 0; }
  .fs-chapter-body-inner { background: #fff; border-radius: 10px; }
  /* Phones already get the promo right below the lesson list (.fs-extra) — avoid two stacked promos */
  .fs-extra:has(.fs-demat-inline) ~ .fs-sidebar .fs-demat-side, .fs-learn:has(.fs-demat-inline) .fs-demat-side { display: none; }
  .fs-demat-side { margin: 12px 12px 0; }
  .fs-course-page .fs-breadcrumbs { display: none; }
  .fs-course-page .fb-chat-btn { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%; }
  .fs-course-page .fb-chat-btn .fb-chat-label { display: none; }
  .fs-course-page .fb-chat-btn i { font-size: 1.1rem; }
  .fs-more-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .fs-more-card { scroll-snap-align: start; }
}

/* Sticky player only when the screen is tall enough to still show the lesson list */
@media (max-width: 991.98px) and (min-height: 560px) {
  .fs-media { position: sticky; top: var(--fb-nav-h); z-index: 30; }
}

@media (max-width: 767.98px) {
  .fs-home-wrap { padding-top: 18px; }
  .fs-slide img { aspect-ratio: 4 / 1; }
  .fs-slider { margin-bottom: 18px; border-radius: 12px; }
  .top-bar { margin-bottom: 16px; gap: 10px; }
  .page-title { font-size: 1.15rem; white-space: nowrap; }
  .search-form { max-width: 190px; padding-left: 12px; }
  .search-form input { font-size: .85rem; }
  .search-form button, .search-form .search-clear { width: 30px; height: 30px; }
  .fs-grid { --bs-gutter-y: 1.1rem; }
  .module-number { min-width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; }
  .fs-pagination .pg-btn span { display: none; }

  .fs-demat-strip { flex-direction: column; align-items: stretch; text-align: left; padding: 16px 18px; gap: 12px; margin-bottom: 18px; }
  .fs-demat-strip strong { font-size: 1.05rem; }
  .fs-demat-strip .btn-fb-accent { justify-content: center; }
  .fs-demat-inline { flex-wrap: wrap; padding: 12px 14px; gap: 10px 12px; margin-top: 14px; }
  .fs-demat-inline-icon { width: 38px; height: 38px; }
  .fs-demat-inline .btn-fb-accent { width: 100%; justify-content: center; }

  .ad-banner-video-top { margin-bottom: 6px; }
  .ad-banner-video-top a { border-radius: 8px; }
  .ad-banner-video-top img { aspect-ratio: 4 / 1; }
  .stats-bar { gap: 12px; padding: 2px 0 8px; font-size: .8rem; }
  .stats-label { display: none; }
  .btn-icon { width: 32px; height: 32px; border-radius: 8px; }
  .btn-share { height: 32px; padding: 0 12px; font-size: .8rem; border-radius: 8px; }
  .video-wrapper { border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,.2); }
  .fs-nav-btns { margin-top: 10px; }
  .fs-nav-btns button { flex: 1; justify-content: center; padding: 8px 10px; font-size: .84rem; }
  .fs-now h1 { font-size: 1.02rem; margin-top: 6px; }
  .fs-side-head { padding-top: 16px; }
  .fs-side-head h2 { font-size: .98rem; }
  .fs-desc { padding: 12px 14px; }
  .sub-video-link { margin-left: 0; font-size: .88rem; padding: 10px 10px 10px 10px; }
  .fs-more-grid { grid-template-columns: repeat(3, 72%); }

  .fs-popup { align-items: flex-end; padding: 0; }
  .fs-popup-card { max-width: none; border-radius: 20px 20px 0 0; max-height: 88vh; transform: translateY(100%); }
  .fs-popup-body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

@media (max-width: 575.98px) {
  /* Logo + "Free Demat" pill + menu button must stay on one line */
  .fb-navbar .container { flex-wrap: nowrap; }
  .fb-navbar .navbar-collapse { position: absolute; top: 100%; left: 0; right: 0; margin: 0; }
  .fb-navbar .logo-img { height: 30px; }
  .fb-navbar .navbar-brand { margin-right: 6px; flex-shrink: 1; min-width: 0; }
  .fb-navbar .navbar-toggler { padding: 4px 6px; flex-shrink: 0; }
  .fs-nav-demat { flex-shrink: 0; }
}

@media (max-width: 380px) {
  .page-title { font-size: 1.02rem; }
  .search-form { max-width: 160px; }
  .fs-nav-demat { padding: 6px 9px; font-size: .72rem; }
  .fs-nav-demat i { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
